/* L.O.S Castle (loscastle.xyz): its own themes, picked separately from L.O.S Farms' (UserProfile::CASTLE_THEMES). */

/* Royal Court: the default. Kingdom purple and crown gold. */
[data-theme="castle-royal"],
[data-site="castle"][data-theme="classic"] {
    --bg: #f6f1fb;
    --surface: #fffdfa;
    --surface-alt: #efe7f7;
    --text: #2b1d3f;
    --muted: #6d5a85;
    --link: #6a3fb0;
    --link-strong: #522d8f;
    --border: #4a2d78;
    --row-border: #e4d9f0;
    --head-from: #5b3592;
    --head-to: #3b2366;
    --head-text: #fff8e7;
    --header-from: #4b2a7d;
    --header-to: #2a1749;
    --nav-text: #f4ecff;
    --nav-active-bg: rgba(246, 195, 67, 0.22);
    --nav-active-text: #f6c343;
    --brand-a: #f6c343;
    --brand-b: #f6c343;
    --gold: #f2c230;
    --gold-dark: #d9a514;
    --gold-text: #3b2366;
    --accent: #6a3fb0;
    --icon-from: #8a5cd0;
    --icon-to: #5b3592;
    --chip-bg: #f1eafa;
    --chip-border: #d8c8ee;
    --footer-from: #2a1749;
    --footer-to: #160b29;
    --footer-text: #e4d9f0;
    color-scheme: light;
}

/* Enchanted Forest: the Fairy Realm. Mossy greens, fairy pink, fireflies. */
[data-theme="castle-enchanted"] {
    --bg: #eef6ef;
    --surface: #fbfffb;
    --surface-alt: #e2f0e4;
    --text: #1f3324;
    --muted: #557060;
    --link: #2e7d5b;
    --link-strong: #1f5e43;
    --border: #2f5a3f;
    --row-border: #d6e8da;
    --head-from: #2f6b4a;
    --head-to: #1c4430;
    --head-text: #f5fff0;
    --header-from: #1f4d36;
    --header-to: #10291d;
    --nav-text: #e9fbe9;
    --nav-active-bg: rgba(255, 182, 222, 0.22);
    --nav-active-text: #ffb6de;
    --brand-a: #ffb6de;
    --brand-b: #ffb6de;
    --gold: #f2c230;
    --gold-dark: #d9a514;
    --gold-text: #1c4430;
    --accent: #2e7d5b;
    --accent-text: #ffffff;
    --icon-from: #e07bb5;
    --icon-to: #a24b85;
    --input-bg: #ffffff;
    --input-border: #c3dccb;
    --chip-bg: #e8f5ea;
    --chip-border: #c8e2cd;
    --footer-from: #10291d;
    --footer-to: #081a11;
    --footer-text: #d6efdb;
    --shadow: 0 4px 14px rgba(16, 41, 29, 0.14);
    --online: #1f9d55;
    --online-bg: #e5f6ec;
    color-scheme: light;
}

/* Gloomwood: a dark theme from the Gloom. Night purples and a sickly green glow. */
[data-theme="castle-gloom"] {
    --bg: #15121c;
    --surface: #1f1a28;
    --surface-alt: #2a2335;
    --text: #e8e1f2;
    --muted: #a597ba;
    --link: #b48cf0;
    --link-strong: #d2b8ff;
    --border: #3d3450;
    --row-border: #2e273b;
    --head-from: #3a2b52;
    --head-to: #241a35;
    --head-text: #f3ecff;
    --header-from: #261a3a;
    --header-to: #120c1c;
    --nav-text: #e6dcf7;
    --nav-active-bg: rgba(126, 224, 129, 0.16);
    --nav-active-text: #8ef09a;
    --brand-a: #8ef09a;
    --brand-b: #8ef09a;
    --gold: #c9a541;
    --gold-dark: #a8862a;
    --gold-text: #15121c;
    --accent: #7b55c7;
    --accent-text: #ffffff;
    --icon-from: #4a3a66;
    --icon-to: #2f2445;
    --input-bg: #15121c;
    --input-border: #3d3450;
    --chip-bg: #2a2335;
    --chip-border: #3d3450;
    --footer-from: #0f0c15;
    --footer-to: #08060c;
    --footer-text: #b7abc9;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    --online: #7ee081;
    --online-bg: rgba(126, 224, 129, 0.14);
    color-scheme: dark;
}

/* Gloomwood gets the dark-theme fixes the L.O.S Farms dark themes have. */
[data-theme="castle-gloom"] .los-badge { filter: saturate(0.9) brightness(0.95); }
[data-theme="castle-gloom"] a.los-leader-name { color: var(--gold); }
[data-theme="castle-gloom"] .los-chat-panel { background: var(--surface); color: var(--text); }
[data-theme="castle-gloom"] .los-chat-messages { background: var(--bg); }
[data-theme="castle-gloom"] .los-chat-msg .bubble { background: var(--surface-alt); }
[data-theme="castle-gloom"] .los-chat-form input { background: var(--input-bg); color: var(--text); border-color: var(--input-border); }
[data-theme="castle-gloom"] .los-field-errors, [data-theme="castle-gloom"] .los-error-text { color: #ff8a80; }

/* Castle Stone: grey keep walls and crimson banners. */
[data-theme="castle-stone"] {
    --bg: #efeeeb;
    --surface: #fbfaf8;
    --surface-alt: #e5e3de;
    --text: #26231f;
    --muted: #6b665e;
    --link: #9b2226;
    --link-strong: #7a1a1d;
    --border: #57534b;
    --row-border: #dcd9d2;
    --head-from: #6b665e;
    --head-to: #45413a;
    --head-text: #fbf6ea;
    --header-from: #5a564f;
    --header-to: #2f2c27;
    --nav-text: #f3efe6;
    --nav-active-bg: rgba(212, 58, 58, 0.28);
    --nav-active-text: #ffcc66;
    --brand-a: #ffcc66;
    --brand-b: #ffcc66;
    --gold: #e0b13b;
    --gold-dark: #c4961f;
    --gold-text: #2f2c27;
    --accent: #9b2226;
    --accent-text: #ffffff;
    --icon-from: #b23a3a;
    --icon-to: #7a1a1d;
    --input-bg: #ffffff;
    --input-border: #cfcac0;
    --chip-bg: #f1efe9;
    --chip-border: #dad6cd;
    --footer-from: #2f2c27;
    --footer-to: #1a1815;
    --footer-text: #ddd7cb;
    --shadow: 0 4px 14px rgba(30, 28, 25, 0.16);
    --online: #1f9d55;
    --online-bg: #e5f6ec;
    color-scheme: light;
}

/* Yulefest Frost: the winter festival. Icy blues, falling snow. */
[data-theme="castle-frost"] {
    --bg: #eef5fb;
    --surface: #fbfdff;
    --surface-alt: #e1edf7;
    --text: #18324a;
    --muted: #56718a;
    --link: #1f6fae;
    --link-strong: #155384;
    --border: #2c5a80;
    --row-border: #d3e3f0;
    --head-from: #2f6fa3;
    --head-to: #1b4a72;
    --head-text: #f4fbff;
    --header-from: #1f5a8a;
    --header-to: #0f3557;
    --nav-text: #eaf6ff;
    --nav-active-bg: rgba(255, 255, 255, 0.18);
    --nav-active-text: #ffe08a;
    --brand-a: #ffe08a;
    --brand-b: #ffe08a;
    --gold: #e9c14a;
    --gold-dark: #cfa52c;
    --gold-text: #0f3557;
    --accent: #1f6fae;
    --accent-text: #ffffff;
    --icon-from: #4aa3df;
    --icon-to: #1f6fae;
    --input-bg: #ffffff;
    --input-border: #c4d8ea;
    --chip-bg: #e8f2fa;
    --chip-border: #c9ddee;
    --footer-from: #0f3557;
    --footer-to: #081f35;
    --footer-text: #d6e6f3;
    --shadow: 0 4px 14px rgba(15, 53, 87, 0.14);
    --online: #1f9d55;
    --online-bg: #e5f6ec;
    color-scheme: light;
}

/* ---------- Every castle theme ---------- */

/* Battlements along the bottom of the header. */
[data-site="castle"] .los-header { position: relative; border-bottom: 3px solid var(--gold); }
[data-site="castle"] .los-header::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -11px; height: 8px; pointer-events: none;
    background: linear-gradient(90deg, var(--header-to) 0 18px, transparent 18px 30px) 0 0 / 30px 8px repeat-x;
    opacity: 0.9;
}
[data-site="castle"] .los-card-head { letter-spacing: 0.01em; }
[data-site="castle"] .los-page-title { font-family: Georgia, "Times New Roman", serif; }

/* Theme effects (los-farms.js renderEffects): fireflies, snow, gloom wisps, royal sparkles. */
.los-mote { position: absolute; border-radius: 50%; will-change: transform, opacity; }
.los-firefly { background: radial-gradient(circle, #fff6a8 0 30%, rgba(255, 220, 90, 0.35) 55%, transparent 70%); animation: los-firefly ease-in-out infinite alternate; }
@keyframes los-firefly {
    0% { transform: translate3d(0, 0, 0); opacity: 0.1; }
    40% { opacity: 0.95; }
    100% { transform: translate3d(60px, -50px, 0); opacity: 0.2; }
}
.los-snow { top: -12px; background: #fff; box-shadow: 0 0 4px rgba(255, 255, 255, 0.8); animation: los-snowfall linear infinite; }
@keyframes los-snowfall {
    0% { transform: translate3d(0, -12px, 0); }
    50% { transform: translate3d(28px, 52vh, 0); }
    100% { transform: translate3d(-12px, 105vh, 0); }
}
.los-wisp { background: radial-gradient(circle, rgba(142, 240, 154, 0.55), transparent 70%); filter: blur(2px); animation: los-wisp ease-in-out infinite alternate; }
@keyframes los-wisp {
    0% { transform: translate3d(0, 0, 0) scale(0.8); opacity: 0; }
    50% { opacity: 0.7; }
    100% { transform: translate3d(-40px, -90px, 0) scale(1.3); opacity: 0; }
}
.los-sparkle { background: #f6c343; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: los-twinkle ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
    .los-firefly, .los-wisp, .los-sparkle { animation: none; opacity: 0.5; }
    .los-snow { display: none; }
}

/* The theme picker's previews on the castle site. */
[data-site="castle"] .los-theme-card .los-swatches i { border-radius: 4px; }

/* A member's kingdom on their profile (members/partials/kingdom). */
.castle-kingdom-title { margin: 0 0 12px; font-size: 1.05rem; }
.castle-worlds { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.castle-worlds li { padding: 4px 12px; border-radius: 999px; background: var(--surface-alt); border: 1px solid var(--row-border); color: var(--muted); font-size: 0.9rem; }
.castle-worlds li.visited { color: var(--text); border-color: var(--gold); }

/* Castle Developer → Studio */
.castle-studio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 0 16px; }
.castle-task { border: 1px solid var(--row-border); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; background: var(--surface-alt); }
.castle-task legend { font-weight: 700; padding: 0 6px; }
.castle-map { width: 100%; max-width: 640px; aspect-ratio: 1; background: #6f9e4b; border-radius: 10px; display: block; }
.castle-map rect { stroke: rgba(0, 0, 0, 0.35); stroke-width: 0.1; }
.castle-map rect:hover { stroke: #fff; stroke-width: 0.35; }
