/* Project hub — night-blue frost with ember warmth. Warm vs cold is the game's core idea,
   so the UI uses it too: cold blues for the world, ember orange for anything you can act on. */

:root {
  color-scheme: dark;
  --night-0: #070c12;
  --night-1: #0c141d;
  --night-2: #121d29;
  --panel: rgba(20, 31, 44, 0.78);
  --panel-solid: #15212e;
  --panel-hi: rgba(32, 47, 64, 0.85);
  --frost: rgba(178, 208, 232, 0.14);
  --frost-hi: rgba(178, 208, 232, 0.28);
  --text: #dce6ee;
  --text-dim: #93a7b8;
  --text-faint: #64798b;
  --ice: #9fcbe8;
  --ice-deep: #5f93b8;
  --ember: #e8833a;
  --ember-hi: #ffad5e;
  --ember-dim: rgba(232, 131, 58, 0.16);
  --ok: #86c2a0;
  --warn: #e3c46e;
  --danger: #e06a5c;
  --paper: #e9e1cd;
  --paper-ink: #2c261e;
  --radius: 10px;
  --font-head: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-body: "Barlow", "Segoe UI", system-ui, sans-serif;
  --font-note: "Special Elite", "Courier New", monospace;
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--night-0); }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 75% -10%, rgba(95, 147, 184, 0.22), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(232, 131, 58, 0.08), transparent 60%),
    linear-gradient(180deg, var(--night-1), var(--night-0));
  background-attachment: fixed;
}
img { max-width: 100%; }
a { color: var(--ice); text-decoration-color: rgba(159, 203, 232, 0.35); text-underline-offset: 3px; }
a:hover { color: #c9e4f5; }
[hidden] { display: none !important; }
::selection { background: rgba(232, 131, 58, 0.35); }

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; letter-spacing: 0.02em; line-height: 1.15; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 4vw, 3rem); text-transform: uppercase; letter-spacing: 0.06em; }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.3rem; }

#snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }

/* ---------- layout ---------- */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(10, 17, 25, 0.92), rgba(8, 13, 19, 0.96));
  border-right: 1px solid var(--frost);
  padding: 22px 14px 0;
}
.brand { display: block; text-decoration: none; color: var(--text); padding: 0 8px 18px; }
.brand-kicker { font-family: var(--font-head); font-size: 0.78rem; letter-spacing: 0.32em; text-transform: uppercase; color: var(--ember); }
.brand-title { font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; line-height: 1.05; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  font-family: var(--font-head); font-size: 1.08rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim); text-decoration: none;
  border-left: 2px solid transparent;
}
.nav a:hover { color: var(--text); background: rgba(178, 208, 232, 0.06); }
.nav a.active { color: var(--text); background: linear-gradient(90deg, var(--ember-dim), transparent); border-left-color: var(--ember); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: 0.85; }
.nav-sep { height: 1px; background: var(--frost); margin: 10px 6px; }
.sidebar-search { margin: 0 4px 14px; }
.sidebar-foot { margin-top: auto; padding: 14px 8px 0; color: var(--text-faint); font-size: 0.85rem; }
.sidebar-foot a { color: var(--text-dim); }
.treeline { display: block; width: 100%; height: 70px; margin-top: 10px; color: #0e1923; }

.main { min-width: 0; padding: 28px clamp(16px, 4vw, 48px) 80px; }
.topbar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: min(84vw, 300px); transform: translateX(-102%); transition: transform 0.2s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, 0.6); }
  .topbar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
    padding: 10px 16px; background: rgba(8, 13, 19, 0.92); border-bottom: 1px solid var(--frost); backdrop-filter: blur(8px);
  }
  .topbar .brand-title { font-size: 1.2rem; }
  .main { padding-top: 18px; }
}

/* ---------- building blocks ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-dim); max-width: 60ch; }
.kicker { font-family: var(--font-head); font-size: 0.82rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--ember); margin-bottom: 4px; }

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--frost);
  border-radius: var(--radius);
  padding: 18px 20px;
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.panel > h3:first-child, .panel-title {
  font-family: var(--font-head); font-size: 0.95rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ice);
  margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); font-size: 0.88rem; }
.empty { color: var(--text-faint); font-style: italic; padding: 10px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 0.95rem var(--font-body); letter-spacing: 0.02em;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  color: var(--text); background: rgba(178, 208, 232, 0.07); border: 1px solid var(--frost-hi);
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: rgba(178, 208, 232, 0.13); color: var(--text); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--ember-hi); outline-offset: 2px;
}
.btn.primary { background: linear-gradient(180deg, var(--ember-hi), var(--ember)); color: #241205; border-color: transparent; box-shadow: 0 0 18px rgba(232, 131, 58, 0.25); }
.btn.primary:hover { filter: brightness(1.07); color: #241205; }
.btn.danger { color: #ffd3cc; border-color: rgba(224, 106, 92, 0.5); background: rgba(224, 106, 92, 0.12); }
.btn.small { padding: 4px 9px; font-size: 0.85rem; }
.btn.icon { padding: 6px; }
.btn svg { width: 16px; height: 16px; }
.btn[disabled] { opacity: 0.5; cursor: default; }

input[type="text"], input[type="search"], input[type="password"], input[type="url"], input[type="date"], textarea, select {
  width: 100%; font: 400 1rem var(--font-body); color: var(--text);
  background: rgba(5, 10, 15, 0.55); border: 1px solid var(--frost-hi); border-radius: 8px; padding: 9px 11px;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
textarea.code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.92rem; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-family: var(--font-head); font-size: 0.85rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 4px; }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font: 600 0.72rem var(--font-head); letter-spacing: 0.14em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 99px; border: 1px solid var(--frost-hi); color: var(--text-dim);
  white-space: nowrap;
}
.pill.tag { cursor: pointer; text-transform: none; letter-spacing: 0.04em; font-size: 0.8rem; font-family: var(--font-body); font-weight: 500; }
.pill.tag:hover, .pill.tag.on { border-color: var(--ember); color: var(--ember-hi); }
.pill.st-idea { color: var(--ice); }
.pill.st-greybox { color: #b9c4cc; }
.pill.st-art { color: var(--warn); border-color: rgba(227, 196, 110, 0.4); }
.pill.st-done { color: var(--ok); border-color: rgba(134, 194, 160, 0.4); }
.newdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ember); box-shadow: 0 0 10px var(--ember); vertical-align: middle; }

/* ---------- markdown ---------- */
.md { overflow-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { margin-top: 1.2em; text-transform: none; letter-spacing: 0.02em; }
.md h1 { font-size: 1.8rem; } .md h2 { font-size: 1.45rem; } .md h3 { font-size: 1.2rem; color: var(--ice); }
.md p, .md ul, .md ol { margin: 0 0 0.8em; }
.md li { margin: 0.2em 0; }
.md img { border-radius: 8px; display: block; margin: 10px 0; }
.md blockquote { margin: 0 0 1em; padding: 4px 14px; border-left: 3px solid var(--ember); color: var(--text-dim); }
.md code { font-size: 0.9em; background: rgba(0, 0, 0, 0.35); padding: 1px 5px; border-radius: 4px; }
.md pre { background: rgba(0, 0, 0, 0.4); padding: 12px; border-radius: 8px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; width: 100%; margin: 0 0 1em; font-size: 0.95rem; display: block; overflow-x: auto; }
.md th, .md td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--frost); vertical-align: top; }
.md th { font-family: var(--font-head); letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.85rem; color: var(--ice); }
.md hr { border: 0; border-top: 1px solid var(--frost); margin: 1.5em 0; }
.md input[type="checkbox"] { accent-color: var(--ember); }

/* ---------- paper notes (in-world epigraphs) ---------- */
.note-paper {
  position: relative; max-width: 620px; margin: 6px 0 18px;
  font-family: var(--font-note); font-size: 1rem; line-height: 1.5;
  color: var(--paper-ink);
  background: linear-gradient(180deg, #efe8d6, var(--paper) 60%, #ddd3bb);
  padding: 16px 20px 14px; border-radius: 2px;
  transform: rotate(-0.6deg);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35), inset 0 0 40px rgba(120, 95, 60, 0.12);
}
.note-paper::before {
  content: ""; position: absolute; top: -9px; left: 46%; width: 70px; height: 20px;
  background: rgba(222, 212, 185, 0.65); transform: rotate(2deg); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.note-paper .src { display: block; margin-top: 8px; font-size: 0.86rem; opacity: 0.75; }

/* ---------- basecamp ---------- */
.hero {
  position: relative; border-radius: 14px; overflow: hidden; min-height: 320px;
  display: flex; align-items: flex-end; margin-bottom: 22px;
  background: var(--night-2) center/cover no-repeat; border: 1px solid var(--frost);
}
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7, 12, 18, 0.1) 10%, rgba(7, 12, 18, 0.55) 45%, rgba(7, 12, 18, 0.94)), linear-gradient(90deg, rgba(7, 12, 18, 0.55), transparent 70%); }
.hero-inner { position: relative; z-index: 1; padding: 26px clamp(18px, 3vw, 34px); width: 100%; }
.hero h1 { margin: 0 0 6px; text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6); font-size: clamp(1.7rem, 6vw, 3rem); overflow-wrap: break-word; }
.hero .pitch { text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7); }
.hero-tools .btn, .loc-hero .btn { background: rgba(7, 12, 18, 0.78); backdrop-filter: blur(4px); }
@media (max-width: 600px) { .hero { min-height: 380px; } .hero-inner { padding-top: 64px; } }
.hero .pitch { max-width: 70ch; color: #e6eef4; font-size: 1.08rem; }
.hero-tools { position: absolute; top: 12px; right: 12px; z-index: 2; display: flex; gap: 6px; }

.meter { margin: 6px 0 2px; }
.meter-track { position: relative; height: 12px; border-radius: 99px; background: rgba(5, 10, 15, 0.7); border: 1px solid var(--frost-hi); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--ice-deep), var(--ice) 35%, var(--ember) 80%, var(--ember-hi)); box-shadow: 0 0 14px rgba(232, 131, 58, 0.45); transition: width 0.6s ease; }
.meter-ticks { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 9.6%, rgba(0, 0, 0, 0.35) 9.6% 10%); }
.meter-label { display: flex; justify-content: space-between; font-family: var(--font-head); letter-spacing: 0.16em; text-transform: uppercase; font-size: 0.82rem; color: var(--text-dim); margin-top: 6px; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid rgba(178, 208, 232, 0.07); }
.feed li:last-child { border-bottom: 0; }
.feed .when { flex: none; width: 76px; color: var(--text-faint); font-size: 0.82rem; }
.feed .who { color: var(--ember-hi); font-weight: 600; }
.feed li.fresh { background: linear-gradient(90deg, var(--ember-dim), transparent 70%); }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.thumbs a { display: block; aspect-ratio: 4/3; border-radius: 6px; overflow: hidden; border: 1px solid var(--frost); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s; }
.thumbs a:hover img { transform: scale(1.05); }

/* ---------- design doc ---------- */
.doc { display: grid; grid-template-columns: 220px 1fr; gap: 30px; align-items: start; }
.toc { position: sticky; top: 24px; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a { display: block; padding: 5px 8px; border-radius: 6px; color: var(--text-dim); text-decoration: none; font-size: 0.95rem; }
.toc a::before { content: counter(toc, decimal-leading-zero) "  "; color: var(--text-faint); font-family: var(--font-head); }
.toc a:hover { color: var(--text); background: rgba(178, 208, 232, 0.06); }
.doc-section { margin-bottom: 34px; scroll-margin-top: 70px; }
.doc-section .sec-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; border-bottom: 1px solid var(--frost); padding-bottom: 8px; margin-bottom: 14px; }
.doc-section .sec-head h2 { margin: 0; flex: 1; min-width: 200px; }
.doc-section .sec-num { font-family: var(--font-head); color: var(--ember); margin-right: 8px; }
.sec-tools { display: flex; gap: 4px; opacity: 0.55; transition: opacity 0.2s; }
.doc-section:hover .sec-tools, .sec-tools:focus-within { opacity: 1; }
@media (max-width: 960px) { .doc { grid-template-columns: 1fr; } .toc { position: static; } .sec-tools { opacity: 1; } }

/* ---------- world ---------- */
.chain { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 18px; counter-reset: loc; }
.loc-card {
  position: relative; display: flex; flex-direction: column; text-decoration: none; color: var(--text);
  background: var(--panel); border: 1px solid var(--frost); border-radius: var(--radius); overflow: hidden;
  transition: transform 0.15s, border-color 0.15s; counter-increment: loc;
}
.loc-card:hover { transform: translateY(-3px); border-color: var(--frost-hi); color: var(--text); }
.loc-img { aspect-ratio: 16/9; background: var(--night-2) center/cover no-repeat; position: relative; }
.loc-img.placeholder { background: repeating-linear-gradient(135deg, #101b26 0 14px, #0d1620 14px 28px); display: grid; place-items: center; color: var(--text-faint); font-family: var(--font-head); letter-spacing: 0.2em; text-transform: uppercase; }
.loc-img::before { content: counter(loc, decimal-leading-zero); position: absolute; left: 10px; top: 8px; font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; color: rgba(255, 255, 255, 0.85); text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7); }
.loc-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.loc-body h3 { margin: 0; font-size: 1.35rem; text-transform: uppercase; letter-spacing: 0.06em; }
.loc-body p { margin: 0; color: var(--text-dim); font-size: 0.94rem; }
.lock { position: absolute; right: 10px; top: 10px; font: 600 0.72rem var(--font-head); letter-spacing: 0.16em; text-transform: uppercase; padding: 3px 8px; border-radius: 99px; background: rgba(7, 12, 18, 0.8); border: 1px solid var(--frost-hi); }
.lock.locked { color: var(--warn); } .lock.open { color: var(--ok); } .lock.final { color: var(--danger); }
.loc-hero { aspect-ratio: 21/8; border-radius: 12px; background: var(--night-2) center/cover no-repeat; border: 1px solid var(--frost); margin-bottom: 18px; position: relative; }

/* ---------- moodboard ---------- */
.masonry { columns: 4 260px; column-gap: 14px; }
.tile {
  break-inside: avoid; margin: 0 0 14px; position: relative; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--frost); background: var(--night-2); cursor: zoom-in; display: block; width: 100%; padding: 0;
}
.tile img { display: block; width: 100%; height: auto; transition: transform 0.35s, filter 0.35s; }
.tile:hover img { transform: scale(1.03); filter: brightness(1.08); }
.tile .cap { position: absolute; inset: auto 0 0 0; padding: 22px 10px 8px; background: linear-gradient(transparent, rgba(5, 9, 14, 0.9)); font-size: 0.88rem; text-align: left; color: var(--text); opacity: 0; transition: opacity 0.2s; }
.tile:hover .cap, .tile:focus-visible .cap { opacity: 1; }
.tile .newdot { position: absolute; top: 8px; right: 8px; }
.dropzone { border: 2px dashed var(--frost-hi); border-radius: var(--radius); padding: 18px; text-align: center; color: var(--text-dim); margin-bottom: 18px; transition: border-color 0.2s, background 0.2s; }
body.dragging .dropzone, .dropzone.over { border-color: var(--ember); background: var(--ember-dim); color: var(--text); }

/* ---------- boards ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.column { background: rgba(10, 17, 25, 0.6); border: 1px solid var(--frost); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.column.over { border-color: var(--ember); background: var(--ember-dim); }
.column-head { display: flex; align-items: baseline; gap: 8px; padding: 2px 4px 10px; }
.column-head h3 { margin: 0; font-size: 1.05rem; text-transform: uppercase; letter-spacing: 0.12em; }
.column-head .sub { color: var(--text-faint); font-size: 0.82rem; }
.column-head .count { margin-left: auto; color: var(--text-faint); font-family: var(--font-head); }
.card {
  display: block; width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--panel-hi); border: 1px solid var(--frost); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--frost-hi); transform: translateY(-1px); }
.card.dragging { opacity: 0.4; }
.card-title { font-weight: 600; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; color: var(--text-faint); font-size: 0.82rem; }
.add-card { width: 100%; justify-content: flex-start; color: var(--text-dim); background: transparent; border-style: dashed; }

/* ---------- lists ---------- */
.list-table { width: 100%; border-collapse: collapse; }
.list-table th, .list-table td { padding: 10px 10px; border-bottom: 1px solid var(--frost); text-align: left; vertical-align: top; }
.list-table th { font-family: var(--font-head); letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.85rem; color: var(--ice); }
.list-table tr.clickable { cursor: pointer; }
.list-table tr.clickable:hover td { background: rgba(178, 208, 232, 0.04); }
.table-wrap { overflow-x: auto; }
.link-card { display: flex; flex-direction: column; gap: 4px; }
.link-card a.title { font-weight: 600; font-size: 1.05rem; }
.link-card .url { color: var(--text-faint); font-size: 0.82rem; overflow-wrap: anywhere; }

.entry { margin-bottom: 18px; }
.entry-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; margin-bottom: 8px; }
.entry-head h2 { margin: 0; font-size: 1.45rem; }

.progress { height: 6px; background: rgba(5, 10, 15, 0.7); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--ice), var(--ember)); width: 0; transition: width 0.2s; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(3, 6, 10, 0.72); backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center; padding: max(4vh, env(safe-area-inset-top, 0px)) 14px 4vh; overflow-y: auto; }
.modal { width: min(820px, 100%); background: var(--panel-solid); border: 1px solid var(--frost-hi); border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.modal.wide { width: min(1200px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--frost); }
.modal-head h2 { margin: 0; flex: 1; font-size: 1.4rem; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--frost); }
.lightbox-img { display: block; max-height: 72vh; width: auto; margin: 0 auto 14px; border-radius: 8px; }

.editor-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.editor-tabs .btn.on { border-color: var(--ember); color: var(--ember-hi); }
.editor-preview { min-height: 120px; padding: 10px 12px; border: 1px solid var(--frost); border-radius: 8px; background: rgba(5, 10, 15, 0.35); }
.editor-help { font-size: 0.82rem; color: var(--text-faint); margin-top: 4px; }

.comments { margin-top: 18px; border-top: 1px solid var(--frost); padding-top: 14px; }
.comment { padding: 8px 0; border-bottom: 1px solid rgba(178, 208, 232, 0.07); }
.comment .by { color: var(--ember-hi); font-weight: 600; margin-right: 8px; }

.rev-list { display: grid; grid-template-columns: 240px 1fr; gap: 14px; }
.rev-list .revs { max-height: 60vh; overflow-y: auto; }
.rev-list .revs button { display: block; width: 100%; text-align: left; margin-bottom: 4px; }
.rev-list .revs button.on { border-color: var(--ember); }
@media (max-width: 700px) { .rev-list { grid-template-columns: 1fr; } }

.toast-wrap { position: fixed; z-index: 80; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel-solid); border: 1px solid var(--frost-hi); border-left: 3px solid var(--ember); border-radius: 8px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); max-width: 360px; }
.toast.err { border-left-color: var(--danger); }

/* ---------- login ---------- */
.login-wrap { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(400px, 100%); }
.login-card h1 { font-size: 2.2rem; margin-bottom: 4px; }
.login-card .err { color: #ffbdb3; min-height: 1.4em; margin: 6px 0 0; }

/* ---------- audio ---------- */
.wave { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 10px; min-width: 0; }
.wave-canvas { display: block; width: 100%; min-width: 0; cursor: pointer; border-radius: 6px; background: rgba(5, 10, 15, 0.45); }
.wave-play {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  background: linear-gradient(180deg, var(--ember-hi), var(--ember)); color: #241205; border: 0; box-shadow: 0 0 14px rgba(232, 131, 58, 0.3);
}
.wave-play svg { width: 18px; height: 18px; }
.wave-play[data-state="false"] svg path, .wave-play:not([data-state]) svg path { fill: currentColor; }
.wave-time { font-family: var(--font-head); letter-spacing: 0.06em; color: var(--text-dim); font-size: 0.9rem; min-width: 44px; text-align: right; white-space: nowrap; }
.wave-loop { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; background: transparent; color: var(--text-faint); border: 1px solid transparent; }
.wave-loop svg { width: 16px; height: 16px; }
.wave-loop:hover { color: var(--text); }
.wave-loop.on { color: var(--ember-hi); border-color: var(--ember); }
.sound-hero { padding: 14px; border-radius: 10px; background: linear-gradient(180deg, rgba(95, 147, 184, 0.12), rgba(5, 10, 15, 0.3)); border: 1px solid var(--frost); }
.sound-hero .wave-play { width: 52px; height: 52px; }
.sound-hero .wave-play svg { width: 24px; height: 24px; }
.sound-card { padding: 12px 16px; }
.sound-card .row { margin-bottom: 8px; }
.sound-title { font-weight: 600; font-size: 1.05rem; color: var(--text); text-decoration: none; }
.sound-title:hover { color: var(--ember-hi); }
.group-head { text-transform: uppercase; letter-spacing: 0.14em; color: var(--ice); font-size: 1rem; }
.pill.au-sketch { color: var(--ice); }
.pill.au-wip { color: var(--warn); border-color: rgba(227, 196, 110, 0.4); }
.pill.au-ready { color: var(--ok); border-color: rgba(134, 194, 160, 0.4); }
.btn.on-tab { border-color: var(--ember); color: var(--ember-hi); background: var(--ember-dim); }
.timechip {
  display: inline-flex; align-items: center; gap: 3px; cursor: pointer;
  font: 600 0.8rem var(--font-head); letter-spacing: 0.06em; color: #241205;
  background: var(--ember); border: 0; border-radius: 99px; padding: 2px 8px 2px 5px;
}
.timechip svg { width: 11px; height: 11px; }
.timechip svg path { fill: currentColor; }
.pick-row, .version-row { display: grid; grid-template-columns: minmax(140px, 220px) 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--frost); }
.version-row { grid-template-columns: 1fr; gap: 4px; }
@media (max-width: 600px) { .pick-row { grid-template-columns: 1fr; } }
.sound-slot { margin-top: 14px; padding: 12px; border: 1px dashed var(--frost-hi); border-radius: 8px; }
.tile-sound { position: absolute; left: 8px; top: 8px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(7, 12, 18, 0.8); color: var(--ember-hi); }
.tile-sound svg { width: 15px; height: 15px; }
.sound-table td { vertical-align: middle; }
.st-sel { width: auto; }
.st-sel.st-done { color: var(--ok); }
.st-sel.st-working { color: var(--warn); }

.mood { position: fixed; inset: 0; z-index: 70; background: #000; }
.mood-img { position: absolute; inset: 0; background: #000 center/cover no-repeat; transition: opacity 0.6s ease; cursor: pointer; }
.mood-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.85)); }
.mood-cap { position: absolute; left: clamp(16px, 4vw, 48px); right: 16px; bottom: calc(clamp(20px, 5vh, 56px) + env(safe-area-inset-bottom, 0px)); max-width: 640px; pointer-events: none; }
.mood-cap h2 { font-size: clamp(1.6rem, 4vw, 2.6rem); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 6px; }
.mood-tools { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; display: flex; gap: 6px; }
.mood-tools .btn { background: rgba(7, 12, 18, 0.7); }
.mood-hint { position: absolute; top: calc(20px + env(safe-area-inset-top, 0px)); left: 18px; color: rgba(255, 255, 255, 0.5); font-size: 0.85rem; }
.ico { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.15em; }
.sound-table .st-name { min-width: 200px; }
.sound-table .st-status { width: 150px; }
.sound-table .st-file { min-width: 220px; }
.sound-table .st-edit { width: 44px; }
@media (max-width: 760px) {
  .sound-table, .sound-table tbody { display: block; }
  .sound-table tr { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; padding: 10px 0; border-bottom: 1px solid var(--frost); }
  .sound-table td { display: block; border: 0; padding: 0; min-width: 0; width: auto; }
  .sound-table .st-name { grid-column: 1; }
  .sound-table .st-edit { grid-column: 2; grid-row: 1; }
  .sound-table .st-status, .sound-table .st-file { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .sound-hero .wave { grid-template-columns: auto 1fr auto; }
  .sound-hero .wave-canvas { grid-column: 1 / -1; order: -1; }
}
