/* C-648: THE HOARD's site -- THE ENGINE ROOM's night palette and gold, a gallery's room to breathe. */
:root {
  --bg: #0f1420; --card: #171d2c; --raise: #1e2638; --line: #2a3349; --ink: #e6ebf5; --dim: #9aa6c4; --faint: #6c7696;
  --gold: #d9a74a; --good: #3fb950; --bad: #e5534b; --violet: #a98bf0;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans); }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--gold); }
[hidden] { display: none !important; }
.dim { color: var(--dim); } .faint { color: var(--faint); } .pad { padding: 24px 16px; }
.mono { font-family: var(--mono); }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
       padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.title { font: 700 13px var(--mono); letter-spacing: 2px; color: var(--gold); white-space: nowrap; }
.part { font: 600 11px var(--mono); letter-spacing: 2px; color: var(--dim); white-space: nowrap; }
@media (max-width: 420px) { .part { display: none; } }
.draft { font: 9px var(--mono); letter-spacing: 1px; color: var(--faint); border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; }
.who { margin-left: auto; display: flex; gap: 10px; align-items: center; font: 11px var(--mono); color: var(--dim); min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn { background: var(--raise); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; cursor: pointer;
       font: 600 12px var(--mono); letter-spacing: 1px; color: var(--ink); }
.btn:hover { border-color: var(--gold); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1a1408; }
.btn.small { padding: 4px 10px; font-size: 11px; }
.btn.bad:hover { border-color: var(--bad); color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.text { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; width: 100%; }
.text:focus { outline: none; border-color: var(--gold); }

/* the way in */
.gate { max-width: 420px; margin: 8vh auto; padding: 0 16px; text-align: center; }
.gate h1 { font: 700 22px var(--mono); letter-spacing: 4px; color: var(--gold); margin: 0 0 6px; }
.gate p { color: var(--dim); }
.gate .card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-top: 18px; text-align: left; }
.gate .card h2 { font: 600 12px var(--mono); letter-spacing: 2px; color: var(--dim); margin: 0 0 10px; }
.gate .row { display: flex; gap: 8px; }
.gate .note { min-height: 1.4em; margin-top: 8px; font-size: 13px; color: var(--bad); }
.gate .big { width: 100%; padding: 14px; font-size: 13px; }

/* the gallery */
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; max-width: 1280px; margin: 0 auto; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { background: none; border: 1px solid transparent; border-radius: 999px; padding: 6px 12px; cursor: pointer;
       font: 600 11px var(--mono); letter-spacing: 1px; color: var(--dim); }
.tab.on { background: var(--card); border-color: var(--line); color: var(--ink); }
.tab .n { color: var(--faint); margin-left: 4px; }
.bar .grow { flex: 1; }
.kinds { display: flex; gap: 4px; }
.used { font: 11px var(--mono); color: var(--faint); padding: 0 16px 4px; max-width: 1280px; margin: 0 auto; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; padding: 4px 16px 40px; max-width: 1280px; margin: 0 auto; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px 4px 40px; } }
.tile { position: relative; aspect-ratio: 1; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
        cursor: pointer; padding: 0; display: block; width: 100%; }
@media (max-width: 520px) { .tile { border-radius: 4px; } }
.tile:hover, .tile:focus-visible { border-color: var(--gold); outline: none; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
              padding: 10px; text-align: center; color: var(--dim); font-size: 12px; }
.tile .face b { font-size: 30px; line-height: 1; color: var(--faint); font-weight: 400; }
.tile .face span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.tile .badge { position: absolute; top: 6px; left: 6px; font: 700 9px var(--mono); letter-spacing: 1px; padding: 2px 6px; border-radius: 4px;
               background: rgba(15,20,32,.85); color: var(--violet); }
.tile .vers { position: absolute; bottom: 6px; right: 6px; font: 700 10px var(--mono); padding: 2px 6px; border-radius: 999px;
              background: rgba(15,20,32,.85); color: var(--gold); }
.tile .pick { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff8;
              background: rgba(15,20,32,.6); }
.tile.picked { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold) inset; }
.tile.picked .pick { background: var(--gold); border-color: var(--gold); }
.empty { padding: 60px 16px; text-align: center; color: var(--dim); }

/* the queue */
.queue { max-width: 860px; margin: 0 auto; padding: 4px 16px 40px; display: flex; flex-direction: column; gap: 8px; }
.job { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.job .what { flex: 1; min-width: 0; }
.job .what b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job .step { font-size: 12px; color: var(--dim); }
.job .meter { height: 4px; background: var(--line); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.job .meter i { display: block; height: 100%; background: var(--gold); }
.state { font: 700 10px var(--mono); letter-spacing: 1px; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--line); white-space: nowrap; }
.state.done { color: var(--good); border-color: #3fb95055; } .state.failed { color: var(--bad); border-color: #e5534b55; }
.state.making { color: var(--gold); border-color: #d9a74a55; }
.qhead { font: 600 11px var(--mono); letter-spacing: 2px; color: var(--faint); margin: 14px 0 2px; }

/* looking at one thing */
.look { position: fixed; inset: 0; z-index: 10; background: rgba(6,9,15,.96); display: flex; flex-direction: column; }
.look .lhead { display: flex; gap: 10px; align-items: center; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid var(--line); }
.look .lname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.look .versions { display: flex; gap: 4px; padding: 8px 16px 0; overflow-x: auto; scrollbar-width: none; }
.look .versions .tab { white-space: nowrap; }
.look .stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 12px; position: relative; touch-action: pan-y; }
.look .stage img, .look .stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.look .stage audio { width: min(520px, 100%); }
.look .stage pre { white-space: pre-wrap; max-width: 720px; max-height: 100%; overflow: auto; background: var(--card); border: 1px solid var(--line);
                   border-radius: 10px; padding: 16px; margin: 0; font: 14px/1.6 var(--sans); width: 100%; }
.look .nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(23,29,44,.8); border: 1px solid var(--line);
             width: 40px; height: 56px; border-radius: 8px; cursor: pointer; font-size: 22px; color: var(--dim); }
.look .nav.prev { left: 8px; } .look .nav.next { right: 8px; }
@media (max-width: 520px) { .look .nav { display: none; } }
.look .lfoot { border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.look .facts { font: 11px var(--mono); color: var(--faint); }
.look .acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spells { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spells .label { font: 600 11px var(--mono); letter-spacing: 2px; color: var(--violet); }
.spell { background: #a98bf01a; border: 1px solid #a98bf055; color: var(--ink); border-radius: 8px; padding: 7px 12px; cursor: pointer;
         font: 600 12px var(--mono); letter-spacing: 1px; position: relative; }
.spell:hover, .spell:focus-visible { border-color: var(--violet); outline: none; }
.spell .dash { font: 400 12px var(--sans); color: var(--dim); letter-spacing: 0; }
@media (min-width: 700px) { .spell .dash { display: none; } }
.castform { display: flex; gap: 8px; }

.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
         background: var(--raise); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; font-size: 13px;
         max-width: calc(100vw - 32px); opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.on { opacity: 1; }
.dropping { outline: 2px dashed var(--gold); outline-offset: -8px; }
