/* ==========================================================================
   Themes. Every colour, shape and font comes from these tokens; a theme is
   one block. The chosen theme is set on <html data-theme> (see index.html).
   ========================================================================== */
:root, [data-theme="moonwind"] {
  /* Moonwind: an indigo night, periwinkle petals, a silver moon. Its panels are glass:
     see-through, and blurred where they're small (--blur). */
  --bg: #0a0d24;
  --stars:
    radial-gradient(1px 1px at 12% 18%, #ffffffcc 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 72% 12%, #D5D2E3cc 50%, transparent 51%),
    radial-gradient(1px 1px at 38% 64%, #ffffffaa 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 48%, #D5D2E3aa 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 58% 86%, #ffffffbb 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 92%, #D5D2E399 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 82%, #ffffff99 50%, transparent 51%);
  --glow:
    radial-gradient(ellipse 60% 50% at 88% -5%, #7b6cf040, transparent 70%),
    radial-gradient(ellipse 50% 45% at 0% 100%, #b65ad52e, transparent 70%),
    radial-gradient(ellipse 80% 70% at 45% 50%, #26307a40, transparent 75%);
  --page: rgba(30, 35, 82, .58);
  --surface: rgba(19, 24, 60, .66);
  --surface-2: rgba(124, 131, 212, .16);
  --field: rgba(8, 11, 32, .55);
  --border: rgba(172, 178, 240, .17);
  --field-border: rgba(160, 166, 232, .42);
  --text: #e4e3f4;
  --muted: #a9aad2;
  --accent: #c6c7f7;          /* lavender text, readable on the night */
  --accent-soft: #7c83d4;     /* periwinkle: ornaments, borders, glows */
  --accent-bg: #c3c6f4;       /* silver-lavender buttons */
  --accent-ink: #0d1030;
  --player: rgba(124, 131, 212, .24);
  --good: #9fd8b8;
  --bad: #f2a7b0;
  --shadow-soft: 0 18px 44px -18px #02031acc;
  color-scheme: dark;
}

[data-theme="moonwind-day"] {
  --bg: #F1EFF6;
  --stars: none;
  --glow: radial-gradient(ellipse at 80% -10%, #D5D2E3, transparent 65%);
  --page: #FFFFFF;
  --surface: #E9E6F1;
  --surface-2: #D5D2E3;
  --field: #FFFFFF;
  --border: #D5D2E3;
  --field-border: #8a82a0;
  --text: #353a4a;
  --muted: #5b546d;
  --accent: #6E6182;
  --accent-soft: #7E718F;
  --accent-bg: #565E71;
  --accent-ink: #FFFFFF;
  --player: #E4E1EE;
  --good: #276b47;
  --bad: #a8334a;
  --shadow-soft: 0 18px 40px -20px #565E7166;
  color-scheme: light;
}

[data-theme="parchment"] {
  --bg: #EDE3CC;
  --stars: none;
  --glow: radial-gradient(ellipse at 50% 0%, #fbf5e6, transparent 70%);
  --page: #FBF5E6;
  --surface: #F3EADA;
  --surface-2: #E8DCC4;
  --field: #FFFBF2;
  --border: #DCCBA9;
  --field-border: #a48d68;
  --text: #3B2A1E;
  --muted: #6E5843;
  --accent: #9E2A2B;          /* ribbon red */
  --accent-soft: #b9895a;
  --accent-bg: #9E2A2B;
  --accent-ink: #FFF8EC;
  --player: #EADBC0;
  --good: #3d6b35;
  --bad: #9E2A2B;
  --shadow-soft: 0 18px 40px -20px #6e584366;
  color-scheme: light;
}

[data-theme="night"] {
  --bg: #12131b;
  --stars:
    radial-gradient(1px 1px at 15% 25%, #f3e3b955 50%, transparent 51%),
    radial-gradient(1px 1px at 70% 70%, #f3e3b944 50%, transparent 51%),
    radial-gradient(1px 1px at 85% 20%, #f3e3b944 50%, transparent 51%);
  --glow: radial-gradient(ellipse at 20% 110%, #e2b66622, transparent 60%);
  --page: #191b26;
  --surface: #1b1d28;
  --surface-2: #262938;
  --field: #12131b;
  --border: #30344a;
  --field-border: #5a6078;
  --text: #ECE6DA;
  --muted: #A6A4B0;
  --accent: #E2B666;          /* candle gold */
  --accent-soft: #a8874b;
  --accent-bg: #E2B666;
  --accent-ink: #1b1608;
  --player: #2a3350;
  --good: #8fcf8f;
  --bad: #ec8a7c;
  --shadow-soft: 0 18px 40px -18px #000000cc;
  color-scheme: dark;
}

:root {
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --story-font: "Lora", Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --ui-font: "Quicksand", "Segoe UI Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --heading-font: "Cormorant Garamond", "Cormorant", Georgia, serif;
  --title-font: "Cinzel", "Cormorant Garamond", Georgia, serif;   /* the library's names */
}

/* ==========================================================================
   Base
   ========================================================================== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--glow), var(--bg);
  color: var(--text);
  font: 500 15px/1.55 var(--ui-font);
  display: flex;
  flex-direction: column;
  position: relative;
}
/* A faint, slowly twinkling starfield (dark themes only). */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: var(--stars); background-size: 420px 420px;
  animation: twinkle 7s ease-in-out infinite alternate;
}
body > * { position: relative; z-index: 1; }
body > .toast { position: fixed; z-index: 20; }
@keyframes twinkle { from { opacity: .55; } to { opacity: 1; } }

button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- top bar ---------- */
.topbar { z-index: 5;   /* its menus open over the story and panel below */
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px; border-bottom: 1px solid var(--border); background: var(--surface);
  backdrop-filter: blur(var(--blur, 0px));
}
.brand { font: italic 600 22px/1 var(--heading-font); letter-spacing: .02em; color: var(--accent); white-space: nowrap; }
a.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-moon { width: 24px; height: 24px; flex-shrink: 0; fill: var(--accent-soft); }
.brand .tagline { font: italic 500 15px var(--heading-font); color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.tagline-line { margin: -2px 0 14px; font: italic 500 18px var(--heading-font); color: var(--muted); }
a.brand:hover { color: var(--accent-ink); }
/* ---------- the library: a rail down the left, beside every screen ---------- */
.shell { flex: 1; display: flex; min-height: 0; }
.shell > .layout, .shell > .screen { flex: 1; min-width: 0; }
.rail { flex-shrink: 0; width: 184px; display: flex; flex-direction: column; gap: 6px; padding: 16px 10px;
  border-right: 1px solid var(--border); background: var(--surface); overflow-y: auto;
  backdrop-filter: blur(var(--blur, 0px)); }
.rail button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  background: transparent; border: 1px solid transparent; color: var(--muted); font-size: 14px; text-align: left; white-space: nowrap; }
.rail button:hover { color: var(--text); background: var(--surface-2); border-color: transparent; }
.rail button.active { color: var(--accent); border-color: color-mix(in srgb, var(--accent-soft) 55%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent-soft) 30%, transparent), transparent);
  box-shadow: inset 3px 0 0 var(--accent); }
.rail svg { width: 21px; height: 21px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round; }
.rail .label { overflow: hidden; text-overflow: ellipsis; }
.rail-gap { flex: 1; }
/* While playing the story needs the room: icons only (their names are in the tooltips). */
body.in-game .rail { width: 62px; padding: 14px 8px; }
body.in-game .rail .label { display: none; }
body.in-game .rail button { justify-content: center; padding: 10px 0; }

/* ---------- the library's pages: tiles, two to a row ---------- */
.library { max-width: 1000px; margin: 0 auto; }
.library-title, .card h1.library-title { margin: 0; font: 600 34px/1.15 var(--title-font); letter-spacing: .06em; color: var(--accent); }
.library-sub { margin: 4px 0 22px; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; overflow: hidden;
  padding: 22px 24px; border-radius: 20px; text-align: left; font-weight: 500; color: var(--text);
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--accent-soft) 26%, transparent), transparent 55%),
    linear-gradient(160deg, color-mix(in srgb, var(--surface-2) 75%, transparent), color-mix(in srgb, var(--page) 92%, transparent));
  box-shadow: var(--shadow-soft), var(--edge, 0 0 #0000);
  backdrop-filter: blur(var(--blur, 0px)); transition: transform .15s, border-color .15s, box-shadow .15s; }
.tile.wide { grid-column: 1 / -1; }
button.tile, .tile.open { cursor: pointer; }
button.tile:hover, .tile.open:hover { transform: translateY(-2px); border-color: var(--accent-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-soft) 60%, transparent), 0 22px 44px -22px var(--accent-soft); }
.tile-name { margin: 0; font: 600 21px/1.25 var(--title-font); letter-spacing: .04em; color: var(--accent);
  overflow-wrap: anywhere; }
.tile .facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 0; font-size: 14px; }
.tile .facts dt { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding-top: 2px; }
.tile .facts dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .when { color: var(--muted); font-size: 12px; margin-top: auto; }
.tile .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.tile .badge { position: absolute; top: 14px; right: 16px; padding: 2px 10px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  background: var(--accent-bg); color: var(--accent-ink); }
.tile .clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; }
/* The first tile: a big + to begin something new. */
.tile.new { align-items: center; justify-content: center; min-height: 190px; border-style: dashed; border-width: 1.5px;
  border-color: var(--accent-soft); color: var(--accent); font: 600 17px var(--title-font); letter-spacing: .06em; }
.tile.new .plus { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%;
  border: 1.5px solid var(--accent-soft); font: 300 40px/1 var(--ui-font);
  box-shadow: 0 0 24px -4px var(--accent-soft), inset 0 0 18px -6px var(--accent-soft); }
/* A story's character, in a small circle beside its name. */
.tile-head { display: flex; align-items: center; gap: 12px; min-width: 0; padding-right: 70px; }
.avatar { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; object-fit: cover; border: 1.5px solid var(--accent-soft); }

/* A character's card: an arched portrait beside the sheet. */
.char-tile { flex-direction: row; gap: 18px; }
.char-tile .body { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.portrait { width: 112px; height: 152px; flex-shrink: 0; padding: 0; overflow: hidden; cursor: pointer;
  border-radius: 999px 999px 16px 16px; border: 1.5px solid var(--accent-soft);
  box-shadow: 0 0 26px -8px var(--accent-soft); display: grid; place-items: center;
  font: 600 46px var(--title-font); color: #fff; text-shadow: 0 2px 12px #0008; }
.portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait.emblem, .avatar.emblem { background: #1f233c; }
.portrait:hover { border-color: var(--accent); }
.char-tile .edit-box { flex-basis: 100%; }
.char-tile:not(.wide) .edit-box { display: none; }
.char-tile.wide { flex-wrap: wrap; }

/* A world's card: painted sky and a planet, its name over it. */
.world-tile { padding: 0; }
.world-art { position: relative; height: 128px; display: flex; align-items: flex-end; padding: 16px 22px;
  border-bottom: 1px solid var(--border); }
.world-art::after { content: ""; position: absolute; right: 26px; top: 18px; width: 70px; height: 70px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffffcc, var(--planet) 40%, #0000 72%); filter: blur(.3px); opacity: .85; }
.world-art .tile-name { color: #fff; text-shadow: 0 2px 14px #000a; position: relative; z-index: 1; }
.world-tile .inner { display: flex; flex-direction: column; gap: 10px; padding: 16px 22px 20px; flex: 1; }
.world-tile.new { padding: 22px; }

.seeds { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 26px; }

/* Plain looks: the hero is just the title; Moonwind's ornaments stay hidden. */
.hero { margin-bottom: 4px; }
.hero-mark, .orn, .rail-moon, .new-art, .portrait-wrap .spark { display: none; }
.portrait-wrap { position: relative; flex-shrink: 0; }
.new-label { display: block; }
.session-title { flex: 1; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font: italic 16px var(--heading-font); }
.top-actions { display: flex; gap: 8px; align-items: center; position: relative; }
.top-actions button { display: inline-flex; align-items: center; gap: 8px; }
.ico { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; }
button.small .ico { width: 15px; height: 15px; }
button .ico + * { margin-left: 0; }
.tile .actions button { display: inline-flex; align-items: center; gap: 6px; }
.tile .actions button.round { width: 30px; height: 30px; padding: 0; justify-content: center; border-radius: 50%; }

button {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 6px 14px; cursor: pointer; font-weight: 600;
  transition: border-color .15s, background .15s, transform .1s;
}
button:hover:not(:disabled) { border-color: var(--accent-soft); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--primary, var(--accent-bg)); color: var(--accent-ink); border-color: var(--accent-bg); font-weight: 700; }
button.ghost { background: transparent; }
button.small { padding: 3px 10px; font-size: 13px; }
button.on { border-color: var(--accent); color: var(--accent); }

textarea, input[type=text], input[type=password], input[type=number], select {
  width: 100%; background: var(--field); border: 1px solid var(--field-border); border-radius: var(--radius-sm); padding: 8px 12px;
}
textarea:focus, input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---------- theme picker ---------- */
.theme-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 220px;
  background: var(--solid, var(--surface)); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-soft); padding: 8px; display: flex; flex-direction: column; gap: 4px;
}
.theme-choice { display: flex; align-items: center; gap: 10px; text-align: left; border-radius: var(--radius-sm);
  background: transparent; border-color: transparent; }
.theme-choice.on { border-color: var(--accent-soft); background: var(--surface-2); }
.swatch { display: inline-flex; }
.swatch i { width: 14px; height: 14px; border-radius: 50%; margin-left: -4px; border: 1.5px solid var(--surface); }
.swatch i:first-child { margin-left: 0; }
.theme-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.theme-row .theme-choice { border-color: var(--border); }
.theme-row .theme-choice.on { border-color: var(--accent); }

/* ==========================================================================
   Layout: the story is a book page
   ========================================================================== */
.layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 0; }
.story-col { display: flex; flex-direction: column; align-items: center; min-height: 0; padding: 18px 16px 16px; }
.story {
  flex: 1; overflow-y: auto; width: min(100%, 820px);
  padding: 32px clamp(18px, 5vw, 64px) 24px;
  background: var(--page); border: 1px solid var(--border); border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-soft), var(--edge, 0 0 #0000);
}
.composer {
  display: flex; justify-content: center; gap: 8px; width: min(100%, 820px);
  padding: 12px 16px 14px; background: var(--page); border: 1px solid var(--border); border-top: 1px dashed var(--border);
  border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow-soft);
}
/* About as wide as the story text, so a message doesn't look lost in a huge box. */
.composer textarea { max-width: 600px; min-height: 112px; max-height: 40vh; resize: vertical;
  border-radius: 18px; padding: 12px 16px; line-height: 1.55; }
.composer button { padding: 10px 20px; white-space: nowrap; }
.composer .send-col { display: flex; flex-direction: column; gap: 6px; align-self: flex-end; }
.composer .send-col .small { padding: 6px 10px; font-size: 12px; }
.composer .send-col #roll-btn.on { border-color: var(--accent-soft); color: var(--accent); font-weight: 700; }
.roll-ask {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: min(100%, 820px);
  padding: 10px 16px 0; background: var(--page); border: 1px solid var(--border); border-top: 0; border-bottom: 0;
}
.roll-ask[hidden] { display: none; }
.roll-ask select { flex: 0 1 260px; min-width: 0; }
.roll-ask input { flex: 1 1 220px; min-width: 0; }

.sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-left: 1px solid var(--border); }
/* Tabs are bookmark ribbons; the open one hangs a little lower. */
.tabs { display: flex; flex-wrap: wrap; gap: 5px; padding: 12px 12px 10px; border-bottom: 1px solid var(--border); }
.tabs button { padding: 5px 11px; font-size: 13px; border-radius: 8px 8px 3px 3px; }
.tabs button.active {
  background: var(--accent-bg); color: var(--accent-ink); border-color: var(--accent-bg);
  padding-bottom: 10px; margin-bottom: -5px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 5px), 0 100%);
}
.tabs .gm-tab { border-style: dashed; }
.panel { flex: 1; overflow-y: auto; padding: 16px 18px 24px; }

/* ==========================================================================
   Story
   ========================================================================== */
.msg { max-width: 680px; margin: 0 auto 20px; }
.msg.player { text-align: right; }
.msg.player .bubble {
  display: inline-block; text-align: left; background: var(--player); border-radius: 18px 18px 4px 18px;
  padding: 10px 16px; white-space: pre-wrap; max-width: 92%;
}
.msg.gm .text { font: 17px/1.75 var(--story-font); white-space: pre-wrap; }
/* The first page of a chapter starts with a drop cap. */
.msg.gm.opening .text::first-letter {
  float: left; font: 600 3.4em/.85 var(--heading-font); color: var(--accent); padding: 6px 10px 0 0;
}
.msg.arriving { animation: arrive .5s ease-out; }
@keyframes arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg .label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.status { color: var(--muted); font-style: italic; font-size: 14px; }
.status::before { content: "✦ "; font-style: normal; color: var(--accent-soft); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.toolbar .swipes { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.toolbar .sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
/* Facts recorded in a scene (the Chronicle) and choices waiting (Quests): fixable by hand. */
.facts { margin-top: 8px; }
.facts .fact { padding: 3px 0; border-top: 1px dashed var(--border); }
.facts form, .choices-waiting form { margin-top: 6px; }
.grow { flex: 1 1 auto; min-width: 0; }
.choices-waiting { margin-bottom: 14px; }
.choices-waiting input, .facts input { flex: 1 1 160px; min-width: 0; }
.popover { margin-top: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.popover .row { margin-top: 8px; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: var(--radius-pill); border: 1px solid var(--border); color: var(--muted); }
.badge.accent { border-color: var(--accent-soft); color: var(--accent); }
.badge.good { border-color: var(--good); color: var(--good); }
.badge.bad { border-color: var(--bad); color: var(--bad); }

/* ---------- chapters and scenes ---------- */
.heading { max-width: 680px; margin: 34px auto 18px; text-align: center; color: var(--muted);
  font: italic 17px/1.4 var(--heading-font); letter-spacing: .03em; }
.heading.scene::before {
  content: "☾ ✦ ☽"; display: block; font: 12px/1 var(--ui-font); letter-spacing: .6em; color: var(--accent-soft); margin-bottom: 8px;
}
.heading.chapter { color: var(--accent); font-size: 28px; font-style: italic; font-weight: 600; margin-top: 44px; }
.heading.chapter::before { content: "✦"; display: block; font: 14px/1 var(--ui-font); color: var(--accent-soft); margin-bottom: 10px; }
.heading.chapter::after {
  content: ""; display: block; width: 140px; height: 1px; margin: 12px auto 0;
  background: linear-gradient(90deg, transparent, var(--accent-soft), transparent);
}
.heading:first-child { margin-top: 4px; }
.scene-end, .debrief { max-width: 680px; margin: 12px auto 18px; }
.debrief .talk { margin: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.debrief .say { font-size: 14px; }
.debrief .say.player { color: var(--accent); }
.proposals { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.proposal { border-top: 1px solid var(--border); padding-top: 8px; }
.proposal textarea { margin: 6px 0; }
.dice { margin-top: 8px; color: var(--muted); font-family: var(--ui-font); }
.diary { font: 15px/1.7 var(--story-font); margin: 6px 0; }
.person .stance { gap: 4px; margin: 4px 0; }
/* The plan the reply on screen was written from. */
.plan.in-use { border-left: 3px solid var(--accent); padding-left: 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.plan-notes { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.judgement { margin: 6px 0; padding: 6px 10px; background: var(--field); border-radius: var(--radius-sm); }
.subtabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 4px; }
.subtabs button.on { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.debug-inline { margin-top: 10px; padding: 6px 12px; border-left: 2px solid var(--accent-soft); color: var(--muted);
  font-family: var(--ui-font); }
.panel details summary .badge { margin-left: 6px; }
.panel select { margin-bottom: 6px; }

/* ==========================================================================
   Side panels
   ========================================================================== */
.panel h2 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 20px 0 8px; }
.panel h2::before { content: "✦ "; color: var(--accent-soft); }
.panel h2:first-child { margin-top: 0; }
.panel h3 { margin: 0 0 2px; font: 600 19px/1.3 var(--heading-font); }
.panel p { margin: 4px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { color: var(--muted); font-style: italic; text-align: center; padding: 18px 8px; }
.empty::before { content: "☾"; display: block; font-style: normal; font-size: 22px; color: var(--accent-soft); margin-bottom: 6px; }
.item, .person, .entry, .quest, .plan { padding: 12px 0; border-bottom: 1px dashed var(--border); }
.item:last-child, .person:last-child, .entry:last-child { border-bottom: 0; }
/* A quest card: the hook on top, the goals beside where, people & clues beside dangers, how it can end. */
.quest-card { display: flex; flex-direction: column; gap: 10px; }
.quest-hook { padding: 10px 12px; border: 1px solid var(--accent-soft); border-radius: var(--radius); background: var(--field); }
.quest-hook b { font-size: 15px; }
.quest-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.quest-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 38%); gap: 10px; align-items: start; }
.quest-top > :only-child { grid-column: 1 / -1; }
.quest-where, .quest-col { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.quest-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.quest-end { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface); }
.quest-lines { margin: 0; padding-left: 18px; font-size: 13px; }
.quest-goals { list-style: none; margin: 0; padding: 0; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.quest-goals label.row { align-items: flex-start; cursor: pointer; flex-wrap: nowrap; }
.quest-goals label > span:first-of-type { min-width: 0; }
/* Done: a filled green tick and the text struck through; open: an empty box and full-strength text. */
.quest-goals input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--good); cursor: pointer; }
.quest-goals li.done span:not(.badge) { text-decoration: line-through; color: var(--muted); }
/* A quest in progress stands out; a finished or dropped one steps back. */
.quest-card:not(.muted-quest) .quest-hook { border-color: var(--accent); }
.muted-quest { opacity: .75; }
.muted-quest .quest-hook { background: transparent; border-style: dashed; border-color: var(--border); }
.quest-actions { flex-wrap: wrap; }
@media (max-width: 520px) {
  .quest-top, .quest-cols { grid-template-columns: minmax(0, 1fr); }
}
.attrs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.attr { background: var(--field); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; text-align: center; }
.attr .n { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.attr .s { font: 600 26px/1.1 var(--heading-font); }
.attr .m { font-size: 13px; font-weight: 700; color: var(--accent); }
.attr.pick { cursor: pointer; }
.attr.selected { border-color: var(--accent); background: var(--surface-2); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; font-size: 14px; }
.kv .k { color: var(--muted); }
details summary { cursor: pointer; color: var(--muted); margin: 6px 0; }
pre.json { white-space: pre-wrap; font-size: 12px; background: var(--field); padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.warn { border: 1px dashed var(--accent-soft); border-radius: var(--radius-sm); padding: 8px 12px; color: var(--accent); font-size: 13px; }

/* ==========================================================================
   Stories screen and creation wizard
   ========================================================================== */
.screen { flex: 1; overflow-y: auto; padding: 36px 16px; }
.card { max-width: 640px; margin: 0 auto; background: var(--page); border: 1px solid var(--border); border-radius: 22px;
  padding: 28px; box-shadow: var(--shadow-soft), var(--edge, 0 0 #0000); backdrop-filter: blur(var(--blur, 0px)); }
.card.wide { max-width: 760px; }
.card h1 { margin: 0 0 6px; font: italic 600 36px/1.15 var(--heading-font); color: var(--accent); }
.card h2 { margin: 0 0 4px; font: italic 600 28px/1.2 var(--heading-font); color: var(--accent); }
.list { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.list .choice { text-align: left; padding: 12px 16px; border-radius: var(--radius); }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.progress { height: 6px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; margin: 6px 0 18px; }
.progress div { height: 100%; background: var(--accent-bg); border-radius: var(--radius-pill); }
.section-name { color: var(--accent); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.question { font: 500 24px/1.3 var(--heading-font); margin: 6px 0 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { border-radius: var(--radius-pill); padding: 4px 12px; font-size: 14px; }
.chip.on { border-color: var(--accent); color: var(--accent); }
.classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 12px 0; }
.class-card { text-align: left; padding: 14px; border-radius: var(--radius); font-weight: 500; }
.class-card.on { border-color: var(--accent); background: var(--surface-2); }
.class-card b { display: block; margin-bottom: 4px; font: 600 19px/1.2 var(--heading-font); }
.kit-row { display: grid; grid-template-columns: 1fr 70px 32px; gap: 6px; margin-bottom: 6px; }
.kit-row textarea { grid-column: 1 / span 3; }
.field-label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 12px 0 4px; }
.loading { padding: 32px 0; text-align: center; color: var(--muted); font-style: italic; }
.loading::before { content: "✦ ✦ ✦"; display: block; font-style: normal; letter-spacing: .5em; color: var(--accent-soft);
  margin-bottom: 8px; animation: twinkle 1.2s ease-in-out infinite alternate; }

.toast {
  left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(90vw, 560px);
  background: var(--solid, var(--surface-2)); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 18px;
  box-shadow: var(--shadow-soft);
}
.toast.error { border-color: var(--bad); }
/* The game's code changed under an open page: at the top, until the page reloads. */
.toast.stale { top: calc(12px + env(safe-area-inset-top, 0px)); bottom: auto; border-color: var(--accent);
  display: flex; gap: 10px; align-items: center; }

/* Short windows: a smaller writing box, so the story keeps the room. */
@media (max-height: 640px) {
  .composer textarea { min-height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  body::before, .loading::before, .msg.arriving { animation: none; }
  button { transition: none; }
}

/* ---------- narrow screens ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .story-col { min-height: 60vh; padding: 10px 8px 8px; }
  .story { padding: 20px 16px; }
  .sidebar { border-left: 0; border-top: 1px solid var(--border); max-height: 45vh; }
  /* Tap the active tab to fold the panel away and give the story the room. */
  .sidebar.collapsed .panel { display: none; }
  .sidebar.collapsed .tabs button.active { background: var(--surface-2); color: var(--text); border-color: var(--accent); clip-path: none; padding-bottom: 5px; margin-bottom: 0; }
  .top-actions button { padding: 5px 9px; font-size: 13px; }
  .session-title { display: none; }
  .brand { font-size: 19px; }
  .brand .tagline { display: none; }
  .heading.chapter { font-size: 24px; }
}

/* ---------- phones ----------
   Nothing may be wider than the screen: a page that is makes the phone's browser shrink
   all of it to fit, which leaves an empty band under the tabs. */
@media (max-width: 600px) {
  .topbar { gap: 8px; padding: 8px 10px; justify-content: space-between; }
  .rail, body.in-game .rail { width: 50px; padding: 10px 5px; }
  .rail .label { display: none; }
  .rail button { justify-content: center; padding: 10px 0; }
  .screen { padding: 20px 12px; }
  .tiles { grid-template-columns: 1fr; gap: 14px; }
  .tile { padding: 18px; }
  .library-title { font-size: 27px; }
  .portrait { width: 96px; height: 130px; font-size: 36px; }
  /* On a phone the portrait stands above the sheet. */
  .char-tile { flex-direction: column; align-items: center; gap: 12px; }
  .char-tile .body { align-self: stretch; }
  .brand { font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .top-actions { gap: 5px; flex-shrink: 0; }
  .top-actions button { padding: 5px 10px; }
  .top-actions .long { display: none; }
  /* The writing box gets the whole width; the buttons sit in a slim row under it. */
  .composer { flex-wrap: wrap; padding: 8px 8px 10px; gap: 6px; }
  .composer textarea { flex: 1 1 100%; max-width: none; min-height: 84px; padding: 10px 14px; }
  .composer .send-col { flex-direction: row; justify-content: flex-end; align-items: center; width: 100%; align-self: auto; }
  .composer .send-col button { padding: 7px 16px; }
  .composer .send-col #send { order: 2; }       /* Send at the right edge, under the thumb */
  .composer .send-col .small { padding: 6px 12px; }
  .roll-ask { padding: 8px 8px 0; }
  .story-col, .story, .composer, .sidebar, .tabs, .panel { min-width: 0; max-width: 100%; }
}

/* The settings menu and the Data tab's export options. */
.theme-menu { max-height: min(80vh, 560px); overflow-y: auto; min-width: 260px; }
.menu-head { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 8px 4px 2px; }
.menu-head:first-child { margin-top: 2px; }
.theme-menu select { max-width: 160px; }
.row.wrap { flex-wrap: wrap; }
.setting-input { width: 110px; }

/* The Director's scene plan. */
.scene-plan { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2); margin-bottom: 8px; }
.scene-plan .situations { margin: 2px 0 0 18px; padding: 0; }
.scene-plan { font-size: 14px; }
.plan-section { margin-top: 10px; }
.plan-heading { font-weight: 600; margin-bottom: 6px; color: var(--accent); }
.plan-item { padding: 8px 10px; border-left: 3px solid var(--border); background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.plan-item + .plan-item { margin-top: 10px; }
.plan-name { font-weight: 600; margin-bottom: 3px; }
.plan-field { margin: 2px 0 0 0; line-height: 1.45; }
.plan-label { font-weight: 600; margin-right: 6px; }
.plan-label::after { content: ":"; }
textarea.plan-text { width: 100%; min-height: 480px; font: 14px/1.55 inherit; box-sizing: border-box; resize: vertical; }
/* Markdown blocks: paragraphs with room, headings, lists. */
.md p { margin: 0 0 .7em; }
.md p:last-child { margin-bottom: 0; }
.md ul { margin: 0 0 .7em 18px; padding: 0; }
.md h3, .md h4, .md h5, .md h6 { margin: .8em 0 .3em; font-size: 1em; }


/* ==========================================================================
   Moonwind: the forest at night (art/), frames of moons and flowers, glass.
   Everything here is Moonwind only; the other looks never see it.
   ========================================================================== */
[data-theme="moonwind"] {
  /* Only here, not in the default block above, so other looks never inherit them. */
  --solid: #171c45;           /* menus and messages over the page stay opaque */
  --primary: linear-gradient(135deg, #e3e2fa, #a9adec);
  --edge: inset 0 1px 0 rgba(255, 255, 255, .07);
  --blur: 16px;
  --glow: linear-gradient(rgba(10, 13, 36, .30), rgba(10, 13, 36, .55)), url("/static/art/bg-forest.webp") center / cover no-repeat;
  --frame: rgba(186, 180, 240, .55);
}
/* While playing, the forest dims so the story reads easily. */
[data-theme="moonwind"] body.in-game {
  --glow: linear-gradient(rgba(8, 10, 30, .62), rgba(8, 10, 30, .72)), url("/static/art/bg-forest.webp") center / cover no-repeat;
}
[data-theme="moonwind"] body::before { opacity: .55; }

/* The top bar: night glass, the moon and the name, outlined buttons with icons. */
[data-theme="moonwind"] .topbar { background: rgba(10, 13, 38, .38); border-bottom-color: rgba(186, 180, 240, .14); padding: 12px 22px; }
[data-theme="moonwind"] .brand { font: 500 27px/1 var(--heading-font); font-style: normal; letter-spacing: .01em; color: #ece9ff; }
[data-theme="moonwind"] .brand-moon { width: 30px; height: 30px; fill: #d9d4fb; filter: drop-shadow(0 0 8px rgba(190, 180, 255, .55)); }
[data-theme="moonwind"] .top-actions button { background: rgba(18, 22, 58, .38); border-color: rgba(190, 186, 245, .38); padding: 8px 16px; color: #e6e3fb; }
[data-theme="moonwind"] .top-actions button:hover { border-color: rgba(214, 208, 255, .75); box-shadow: 0 0 16px -6px rgba(180, 170, 255, .7); }

/* The rail: a floating glass panel, the open page a glowing pill, a moon below. */
[data-theme="moonwind"] .rail { margin: 14px 0 14px 14px; border-radius: 24px; border: 1px solid rgba(186, 180, 240, .26);
  background: linear-gradient(180deg, rgba(22, 26, 66, .55), rgba(14, 16, 44, .38)); box-shadow: 0 0 30px -14px rgba(150, 140, 255, .5); padding-top: 22px; }
[data-theme="moonwind"] .rail button { font: 500 17px var(--heading-font); color: #d8d5f3; border-radius: 16px; }
[data-theme="moonwind"] .rail button.active { color: #fbfaff; border-color: rgba(206, 200, 255, .55); box-shadow: 0 0 20px -6px rgba(170, 160, 255, .75), inset 0 1px 0 rgba(255, 255, 255, .14);
  background: linear-gradient(90deg, rgba(160, 150, 240, .42), rgba(150, 140, 235, .16)); }
[data-theme="moonwind"] .rail button.active svg { fill: rgba(240, 238, 255, .9); }
[data-theme="moonwind"] .rail-moon { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 0 auto 18px; color: #d9d4fb; }
[data-theme="moonwind"] .rail-moon i { width: 1px; height: 46px; background: linear-gradient(transparent, rgba(214, 208, 255, .6), transparent); }
[data-theme="moonwind"] .rail-moon i:first-child { height: 70px; }
[data-theme="moonwind"] .rail-moon svg { width: 30px; height: 30px; fill: #ddd8fc; filter: drop-shadow(0 0 10px rgba(190, 180, 255, .7)); }
[data-theme="moonwind"] body.in-game .rail-moon { display: none; }

/* A page's hero: the forest steps behind its title, fading into the night. */
[data-theme="moonwind"] .library { max-width: 1120px; }
[data-theme="moonwind"] .hero { position: relative; isolation: isolate; display: flex; align-items: center; gap: 18px;
  min-height: 220px; margin: -20px 0 34px; padding: 30px 32px 34px 18px; }
[data-theme="moonwind"] .hero::before { content: ""; position: absolute; inset: 0 -16px 0 0; z-index: -1; border-radius: 0 26px 26px 0;
  background: url("/static/art/banner-forest.webp") right center / cover no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, .55) 28%, #000 55%), linear-gradient(0deg, transparent 0%, #000 30%);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, .55) 28%, #000 55%), linear-gradient(0deg, transparent 0%, #000 30%);
  mask-composite: intersect; opacity: .92; }
[data-theme="moonwind"] .hero-mark { display: block; width: 46px; height: 70px; flex-shrink: 0; fill: none; stroke: #d6d0fa; stroke-width: 1.4;
  filter: drop-shadow(0 0 8px rgba(190, 180, 255, .6)); }
[data-theme="moonwind"] .hero-mark .star { fill: #f2efff; stroke: none; }
[data-theme="moonwind"] .hero .library-title { font: 500 66px/1.02 var(--heading-font); letter-spacing: .01em; color: #f4f0ff;
  text-shadow: 0 0 26px rgba(180, 165, 255, .45), 0 2px 10px rgba(5, 6, 20, .6); }
[data-theme="moonwind"] .hero .library-sub { margin: 10px 0 0; max-width: 520px; font: italic 500 19px/1.35 var(--heading-font); color: #dcd8f6;
  text-shadow: 0 1px 8px rgba(5, 6, 20, .8); }

/* Tiles: framed glass. */
[data-theme="moonwind"] .tiles { gap: 46px 30px; padding: 18px 14px 30px; }
[data-theme="moonwind"] .tile { --k: .34; overflow: visible; border-radius: 22px; padding: 30px 42px 28px; border: 1.5px solid var(--frame);
  background:
    radial-gradient(circle at 100% 0%, rgba(150, 120, 230, .22), transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(190, 80, 200, .14), transparent 45%),
    linear-gradient(160deg, rgba(42, 44, 100, .62), rgba(16, 18, 50, .70));
  box-shadow: 0 0 0 1px rgba(120, 110, 220, .12), 0 0 26px -8px rgba(160, 150, 255, .55), var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, .08); }
[data-theme="moonwind"] button.tile:hover, [data-theme="moonwind"] .tile.open:hover { border-color: rgba(214, 208, 255, .85);
  box-shadow: 0 0 0 1px rgba(170, 160, 255, .3), 0 0 34px -6px rgba(170, 160, 255, .75), var(--shadow-soft); }
[data-theme="moonwind"] .tile-name { color: #ece8ff; font-weight: 500; letter-spacing: .06em; }
[data-theme="moonwind"] .tile .facts dt { font: 500 12px var(--title-font); letter-spacing: .1em; color: #b7b3dc; padding-top: 4px; }
[data-theme="moonwind"] .tile .facts dd { font: 500 17px var(--heading-font); color: #eceaff; }
[data-theme="moonwind"] .tile { font-variant-numeric: lining-nums; }
[data-theme="moonwind"] .tile .clamp { font: 500 17px/1.3 var(--heading-font); color: #dcd9f2; }
[data-theme="moonwind"] .tile .when { font: italic 500 15px var(--heading-font); color: #aeaad3; }
[data-theme="moonwind"] .tile .actions button { font: 500 16px var(--heading-font); }
[data-theme="moonwind"] .tile .actions button.ghost { border-color: rgba(196, 190, 245, .5); color: #e6e3fb; }
[data-theme="moonwind"] .tile .badge { top: 18px; right: 22px; }

/* The frame's pieces, cut from one picture. Its lines run at x 54 and y 138.5 of 1774×887. */
[data-theme="moonwind"] .orn { display: block; position: absolute; z-index: 3; pointer-events: none;
  background: url("/static/art/frame-moon.webp") no-repeat; background-size: calc(1774px * var(--k)) auto; }
[data-theme="moonwind"] .orn.c { width: calc(190px * var(--k)); height: calc(200px * var(--k));
  background-position: calc(-30px * var(--k)) calc(-120px * var(--k)); }
[data-theme="moonwind"] .orn.tl { left: calc(-24px * var(--k)); top: calc(-18.5px * var(--k)); }
[data-theme="moonwind"] .orn.tr { right: calc(-24px * var(--k)); top: calc(-18.5px * var(--k)); transform: scaleX(-1); }
[data-theme="moonwind"] .orn.bl { left: calc(-24px * var(--k)); bottom: calc(-18.5px * var(--k)); transform: scaleY(-1); }
[data-theme="moonwind"] .orn.br { right: calc(-24px * var(--k)); bottom: calc(-18.5px * var(--k)); transform: scale(-1, -1); }
[data-theme="moonwind"] .orn.m { width: calc(295px * var(--k)); height: calc(195px * var(--k)); left: 50%;
  margin-left: calc(-147.5px * var(--k)); background-position: calc(-740px * var(--k)) calc(-30px * var(--k)); }
[data-theme="moonwind"] .orn.mt { top: calc(-108.5px * var(--k)); }

/* The "new" tile: a starred ring between crescents. */
[data-theme="moonwind"] .tile.new { border-style: solid; gap: 6px; }
[data-theme="moonwind"] .tile.new .plus { display: none; }
[data-theme="moonwind"] .new-art { display: block; width: min(100%, 340px); height: auto; fill: none; stroke: #ddd8fb; stroke-width: 1.4;
  stroke-linecap: round; filter: drop-shadow(0 0 7px rgba(190, 180, 255, .55)); }
[data-theme="moonwind"] .new-art .faint { stroke: rgba(214, 208, 255, .38); }
[data-theme="moonwind"] .new-art .plus { stroke: #f7f5ff; stroke-width: 2.2; }
[data-theme="moonwind"] .new-art .spark { fill: #f4f1ff; stroke: none; }
[data-theme="moonwind"] .tile.new .new-label { font: 500 25px var(--title-font); letter-spacing: .1em; color: #e9e5ff;
  text-shadow: 0 0 14px rgba(180, 165, 255, .5); }

/* Portraits: the arch with a star above and one below. */
[data-theme="moonwind"] .portrait { border-color: rgba(206, 200, 255, .7); box-shadow: 0 0 24px -6px rgba(170, 160, 255, .7); }
[data-theme="moonwind"] .portrait-wrap { padding: 12px 0; }
[data-theme="moonwind"] .portrait-wrap .spark { display: block; position: absolute; left: 50%; width: 18px; height: 18px; margin-left: -9px;
  fill: #f4f1ff; stroke: none; filter: drop-shadow(0 0 6px rgba(200, 190, 255, .9)); z-index: 1; }
[data-theme="moonwind"] .portrait-wrap .spark.top { top: 2px; }
[data-theme="moonwind"] .portrait-wrap .spark.bottom { bottom: 2px; }

/* World tiles keep their painted sky inside the frame. */
[data-theme="moonwind"] .tile.world-tile { padding: 0; }
[data-theme="moonwind"] .world-art { border-radius: 20px 20px 0 0; padding: 16px 42px; }
[data-theme="moonwind"] .world-tile .inner { padding: 18px 42px 26px; }

[data-theme="moonwind"] #login-card { border-color: var(--frame); margin-top: 6vh; }
[data-theme="moonwind"] #login-card h1 { font: 500 52px/1.05 var(--heading-font); color: #f4f0ff; text-shadow: 0 0 24px rgba(180, 165, 255, .45); }

/* Books and Home: the card below the hero is glass too. */
[data-theme="moonwind"] .library > .card { border-color: var(--frame); background: linear-gradient(160deg, rgba(42, 44, 100, .55), rgba(16, 18, 50, .66)); }

@media (max-width: 600px) {
  [data-theme="moonwind"] .rail { margin: 8px 0 8px 8px; border-radius: 18px; }
  [data-theme="moonwind"] .rail-moon { display: none; }
  [data-theme="moonwind"] .brand { font-size: 21px; }
  [data-theme="moonwind"] .brand-moon { width: 22px; height: 22px; }
  [data-theme="moonwind"] .top-actions button { padding: 7px 10px; }
  [data-theme="moonwind"] .hero { min-height: 140px; margin: -8px 0 22px; padding: 18px 12px 20px 4px; gap: 10px; }
  [data-theme="moonwind"] .hero-mark { width: 30px; height: 46px; }
  [data-theme="moonwind"] .hero .library-title { font-size: 40px; }
  [data-theme="moonwind"] .hero .library-sub { font-size: 16px; }
  [data-theme="moonwind"] .tiles { gap: 40px; padding: 14px 8px 24px; }
  [data-theme="moonwind"] .tile { --k: .26; padding: 24px 26px 22px; }
  [data-theme="moonwind"] .tile.new .new-label { font-size: 20px; }
}
