/* quests.temporalhollow.com: the dark workbench of the #345 mockup. Fonts are the local ones when installed, else system fallbacks (the CSP allows
   only 'self', so no web font service). */
:root {
  --bg: #0e1115;
  --panel: #13161b;
  --raised: #1a1f26;
  --line: #2a313b;
  --text: #e7e9ec;
  --text-2: #c4cad1;
  --muted: #9aa3ae;
  --gold: #e6b450;
  --gold-hi: #f3cd7d;
  --green: #a9e0b4;
  --red: #f0a3a3;
  --ui: Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --story: Spectral, Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --r: 8px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
code { font-family: var(--mono); font-size: 0.9em; white-space: nowrap; color: var(--gold-hi); }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--ui); min-height: 100vh; }
a { color: var(--gold-hi); }
a:hover { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; border-radius: 4px; }
h1, h2 { font-weight: 600; letter-spacing: -0.01em; margin: 0 0 0.4em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; color: var(--text-2); margin-top: 1.6em; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; }
p { margin: 0 0 0.7em; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--raised); padding: 6px 10px; z-index: 10; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.mono { font-family: var(--mono); font-size: 0.86em; }
.label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.3em; }
.player-text { font-family: var(--story); color: var(--text); font-size: 1.04em; }
.loading { color: var(--muted); padding: 2rem 0; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; margin-right: auto; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--raised); border: 1px solid var(--line);
  color: var(--gold); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.04em; }
.brand-text { font-weight: 600; }
.brand-sub { color: var(--gold); font-family: var(--story); font-weight: 500; margin-left: 4px; }
.servers, .seg { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.who { display: flex; align-items: center; gap: 10px; }
.avatar { border-radius: 50%; border: 1px solid var(--line); }
.who-name { font-weight: 500; }
.level { color: var(--gold-hi); border: 1px solid #4a3d22; background: #231d10; border-radius: 999px; padding: 1px 9px; font-size: 0.78rem; }
.level:empty { display: none; }

/* buttons */
button, .button { font: inherit; color: var(--text); background: var(--raised); border: 1px solid var(--line); border-radius: var(--r);
  padding: 7px 14px; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .button:hover { border-color: #3c4552; color: var(--text); }
.button.primary { background: var(--gold); color: #1a1406; border-color: var(--gold); font-weight: 600; }
.button.primary:hover { background: var(--gold-hi); color: #1a1406; }
button.ghost { background: transparent; color: var(--text-2); padding: 5px 10px; }
.pill { border-radius: 999px; padding: 4px 12px; border: 0; background: transparent; color: var(--text-2); font-size: 0.85rem; display: inline-flex;
  align-items: center; gap: 6px; }
.pill.on { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.on .dot { background: var(--green); }
.pill:disabled { opacity: 0.45; cursor: not-allowed; }

/* layout */
main { max-width: 1180px; margin: 0 auto; padding: 24px; }
main:focus { outline: none; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.notice { max-width: 560px; margin: 8vh auto; }
body.plain .notice { margin-top: 12vh; }
.notice.error { margin: 24px 0; border-color: #5b2f2f; }
.login { max-width: 460px; margin: 12vh auto; padding: 32px; }
.login h1 { font-family: var(--story); font-size: 2rem; font-weight: 500; }
.eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.75rem; }
body.plain { display: block; padding: 0 16px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }

/* library */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.field input, .field select { font: inherit; font-size: 0.95rem; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 7px 10px; min-width: 220px; }
.field select { min-width: 160px; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; background: var(--panel); }
table.lib { width: 100%; border-collapse: collapse; }
.lib th { text-align: left; font-weight: 500; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--raised); }
.lib td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text-2); }
.lib tbody tr:last-child td { border-bottom: 0; }
.lib tbody tr:hover { background: var(--raised); }
.title-cell { display: flex; flex-direction: column; gap: 2px; }
.quest-title { font-family: var(--story); font-size: 1.08rem; color: var(--text); text-decoration: none; }
.quest-title:hover { color: var(--gold-hi); text-decoration: underline; }
.quest-title.big { font-size: 2rem; font-weight: 500; }
.id { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.badges { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 0.74rem; border-radius: 999px; padding: 1px 8px; border: 1px solid var(--line); color: var(--text-2);
  margin-left: 4px; }
.badges .badge { margin-left: 0; }
.badge.published { color: var(--green); border-color: #2f4a35; background: #142019; }
.badge.draft { color: var(--gold-hi); border-color: #4a3d22; background: #231d10; }
.badge.retired { color: var(--muted); }
.badge.bad { color: var(--red); border-color: #5b2f2f; background: #241414; }

/* quest view */
.back { display: inline-block; margin-bottom: 12px; font-size: 0.9rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0; }
.step { position: relative; margin-left: 18px; }
.step + .step { margin-top: 18px; }
.step + .step::before { content: ""; position: absolute; left: 22px; top: -19px; height: 18px; border-left: 2px solid var(--line); }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.step-n { color: var(--gold); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; }
.goals, .choices ul, .rewards { margin: 0.2em 0 0.6em; padding-left: 1.2em; }
.goals li, .choices li, .rewards li { margin: 3px 0; }
.rewards { padding: 14px 18px 14px 34px; }
.raw { margin-top: 24px; }
.raw summary { cursor: pointer; color: var(--text-2); }
.raw pre { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; overflow: auto; max-height: 60vh; color: var(--text-2); }

/* phones: the table stacks into cards */
@media (max-width: 720px) {
  main { padding: 16px; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .field, .field input, .field select { width: 100%; min-width: 0; }
  .toolbar { flex-direction: column; }
  .table-wrap { border: 0; background: transparent; }
  .lib thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .lib, .lib tbody, .lib tr, .lib td { display: block; width: 100%; }
  .lib tr { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; padding: 8px 4px; }
  .lib td { border: 0; padding: 4px 12px; }
  .lib td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-family: var(--ui); font-size: 0.85rem; }
  .step { margin-left: 0; }
  .quest-title.big { font-size: 1.6rem; }
}
