/* Quest pages: a dark game HUD look. Phone first; wider screens get a centred column. */
@font-face {
  font-family: "Barlow Condensed"; font-weight: 700; font-display: swap;
  src: url("fonts/barlow-condensed-700.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Condensed"; font-weight: 800; font-display: swap;
  src: url("fonts/barlow-condensed-800.woff2") format("woff2");
}
:root {
  --bg: #151821; --panel: #1f2330; --panel-2: #2b3040; --sunk: #11141b;
  --line: #2a2f3d; --line-2: #3a4050;
  --text: #f2f0eb; --soft: #c9cdd6; --muted: #a3a9b7;
  --accent: #ff4f9a; --accent-text: #ff6aa8; --on-accent: #1a1020;
  --gold: #f5c84b; --hi: #ebe7df; --on-hi: #16181f; --on-hi-muted: #4a4e5a; --hi-tag: #8a2756;
  --tap: 44px; --radius: 8px;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif-condensed, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body.q {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
main {
  max-width: 600px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  padding: env(safe-area-inset-top) 16px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}
a { color: var(--accent-text); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.display {
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  letter-spacing: .02em; line-height: 1; margin: 0; overflow-wrap: anywhere;
}
h1.display { font-size: 40px; }
.display.big { font-size: 42px; line-height: .95; }
.kicker { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.kicker.accent { color: var(--accent-text); }

/* header */
.q-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: 28px 0 16px; border-bottom: 1px solid var(--line);
}
.q-head > div:not(.head-row) { display: flex; flex-direction: column; gap: 4px; }
.q-head.detail { flex-direction: column; align-items: stretch; padding-top: 8px; gap: 12px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.back {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap);
  color: var(--soft); text-decoration: none; font-size: 15px;
}
.notes { margin: 0; color: var(--soft); white-space: pre-line; overflow-wrap: anywhere; }

/* buttons */
.icon-btn {
  flex: none; width: var(--tap); height: var(--tap); border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.icon-btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.icon-btn:hover { color: var(--text); }
.btn {
  min-height: 48px; padding: 0 18px; border-radius: var(--radius);
  border: 1px solid #4a5060; background: transparent; color: var(--text);
  font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: .06em;
  text-transform: uppercase; text-decoration: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.ghost { border-color: var(--line-2); font-size: 16px; min-height: var(--tap); }
.btn.danger { color: #ff8a8a; }
.chip {
  min-height: var(--tap); padding: 0 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent; color: var(--soft);
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 600;
}
.chip.on { background: var(--hi); border-color: var(--hi); color: var(--hi-tag); }

/* sections */
.q-section { padding-top: 22px; display: flex; flex-direction: column; gap: 6px; }
.section-title {
  margin: 0 0 4px; font-family: var(--display); font-weight: 700; font-size: 20px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text);
}
.section-title.small { font-size: 18px; letter-spacing: .1em; color: var(--muted); }
.count { color: var(--muted); font-size: .85em; margin-left: 4px; }
summary.section-title { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; list-style: none; }
summary.section-title::-webkit-details-marker { display: none; }
summary.section-title::before { content: "▸"; margin-right: 8px; font-size: .8em; }
details[open] > summary.section-title::before { content: "▾"; }
.completed summary.section-title { color: var(--muted); }
.empty { margin: 0; padding: 8px 0; }
.empty a { display: inline-flex; align-items: center; min-height: var(--tap); }

/* quest rows */
.quests, .objectives, .links, .journal { list-style: none; margin: 0; padding: 0; }
.quests { display: flex; flex-direction: column; gap: 2px; }
.quest {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  padding: 11px 10px; border-radius: 6px; text-decoration: none; color: var(--text);
  min-height: 52px;
}
.quest:hover { background: var(--panel); }
.quest-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.quest-title { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.quest-line { font-size: 13.5px; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.quest.is-tracked { background: var(--hi); color: var(--on-hi); }
.quest.is-tracked .quest-line { color: var(--on-hi-muted); }
.quest.is-locked { color: #8d93a1; }
.quest.is-closed .quest-title { text-decoration: line-through; color: var(--muted); }
.tag {
  flex: none; align-self: flex-start; margin-top: 3px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hi-tag);
}
.new { flex: none; width: 9px; height: 9px; margin: 8px 4px 0; background: var(--gold); transform: rotate(45deg); }

/* round icon badge; the quest's status at a glance */
.badge-ic {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  display: inline-flex; align-items: center; justify-content: center;
}
.badge-ic.hollow { background: transparent; border: 1.5px solid #5b6170; color: var(--muted); }
.badge-ic.ic-done.hollow { border-color: var(--gold); color: var(--gold); }
.badge-ic.dim { background: var(--panel-2); color: var(--soft); }

/* next move card */
.move-card {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--hi); color: var(--on-hi); text-decoration: none;
}
.move-card .badge-ic { width: 30px; height: 30px; }
.move-card > span:last-child { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.move-card .label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--hi-tag); }
.move-card .text { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.move-card.locked { background: var(--panel); color: var(--soft); border: 1px dashed var(--line-2); }
.move-card.locked .label { color: var(--muted); }
.move-card.empty { background: transparent; border: 1px dashed #5b6170; color: var(--soft); }
.move-card.empty .label { color: var(--accent-text); }

/* objectives */
.objectives li { display: flex; align-items: center; gap: 6px; }
.obj-btn {
  width: var(--tap); height: var(--tap); flex: none; padding: 0; border: 0; background: transparent;
  color: var(--gold); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.diamond { width: 11px; height: 11px; border: 1.75px solid #7b8190; transform: rotate(45deg); }
.obj-btn:hover .diamond { border-color: var(--accent); }
.objectives .is-current .diamond { background: var(--accent); border-color: var(--accent); }
.objectives .is-current .obj-title { font-weight: 600; }
.obj-title { font-size: 15px; color: var(--soft); overflow-wrap: anywhere; min-width: 0; }
.objectives .is-current .obj-title { color: var(--text); }
.objectives .is-done .obj-title, .objectives .is-dropped .obj-title { color: #8d93a1; text-decoration: line-through; }
.objectives .is-dropped .obj-btn { color: var(--muted); }

/* small add forms */
.inline-add { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.inline-add input, .inline-add select { flex: 1; min-width: 0; }
input:not([type=radio]):not([type=checkbox]), select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: var(--sunk);
  border: 1px solid var(--line-2); border-radius: var(--radius); padding: 10px 12px; min-height: var(--tap);
  width: 100%;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #7b8190; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* requires / unlocks */
.links { display: flex; flex-direction: column; gap: 6px; }
.links li { display: flex; align-items: center; gap: 6px; }
.link-card {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: var(--tap);
  padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--line-2);
  color: var(--soft); text-decoration: none; font-size: 15px;
}
.link-card span { overflow-wrap: anywhere; min-width: 0; }
.link-card .ic { flex: none; }
.link-card.met { color: #8d93a1; }
.link-card.met .ic { color: var(--gold); }
.link-card.dashed { border-style: dashed; }

/* journal */
.journal li { display: flex; gap: 12px; align-items: flex-start; position: relative; padding-bottom: 14px; }
.journal li:not(:last-child)::before {
  content: ""; position: absolute; left: 12px; top: 28px; bottom: 2px; width: 1.5px; background: #2f3443;
}
.journal .badge-ic { width: 25px; height: 25px; }
.entry { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.when { font-size: 12.5px; color: var(--muted); }
.what { font-size: 14.5px; line-height: 1.4; overflow-wrap: anywhere; white-space: pre-line; }
.journal .is-event .what, .journal .is-update:not(.is-latest) .what { color: var(--soft); }
.journal form { margin-top: -10px; }

/* manage */
.manage { padding-bottom: 8px; }
.stack { display: flex; flex-direction: column; gap: 14px; padding-top: 6px; }
.stack label, .stack-label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.stack .muted { font-size: 13px; }
.stack label.check { flex-direction: row; align-items: center; gap: 10px; min-height: var(--tap); color: var(--soft); font-size: 15px; }
input[type=checkbox], input[type=radio] { font-size: 16px; width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.seg { border: 0; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.seg legend { padding: 0; margin-bottom: 6px; font-size: 14px; color: var(--muted); }
.seg label {
  flex-direction: row; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: var(--radius); color: var(--text); font-size: 15px; cursor: pointer;
}
.seg label { position: relative; }
.seg input { position: absolute; inset: -1px; width: calc(100% + 2px); height: calc(100% + 2px); opacity: 0; margin: 0; cursor: pointer; }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--panel-2); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg label::before {
  content: ""; width: 10px; height: 10px; border: 1.75px solid #7b8190; transform: rotate(45deg); flex: none;
}
.seg label:has(input:checked)::before { background: var(--accent); border-color: var(--accent); }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; }

/* sticky bottom actions */
.action-bar {
  position: sticky; bottom: 0; margin: 18px -16px calc(-24px - env(safe-area-inset-bottom));
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line); display: flex; gap: 10px;
}
.action-bar > * { flex: 1; min-width: 0; }
.action-bar .btn { padding: 0 10px; font-size: 18px; white-space: nowrap; }
.action-bar form .btn { width: 100%; }

/* log update: a sheet over the dimmed quest */
.sheet-backdrop { padding: 56px 0 24px; opacity: .35; display: flex; flex-direction: column; gap: 12px; }
.sheet {
  margin: auto -16px calc(-24px - env(safe-area-inset-bottom)); padding: 14px 16px calc(28px + env(safe-area-inset-bottom));
  background: #1b1f2a; border-top: 1px solid #343a4a; border-radius: 16px 16px 0 0;
  display: flex; flex-direction: column; gap: 14px;
}
.sheet h1.display { font-size: 28px; letter-spacing: .04em; }
.moves { border: 0; margin: 0; padding: 0; }
.moves legend { padding: 0; margin-bottom: 8px; font-size: 14px; color: var(--muted); }
.move-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.move {
  position: relative; min-height: 66px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid #343a4a; background: var(--sunk); color: var(--soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 600;
}
.move input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.move .badge-ic { width: 28px; height: 28px; background: var(--panel-2); color: var(--soft); }
.move:has(input:checked) { border: 1.5px solid var(--accent); background: var(--panel-2); color: var(--text); }
.move:has(input:checked) .badge-ic { background: var(--accent); color: var(--on-accent); }
.move:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* quest complete */
.complete {
  flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 24px;
  padding: 40px 8px; text-align: center;
}
.complete-head { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.display.huge { font-size: 64px; line-height: .9; color: var(--gold); }
.display.sub { font-size: 24px; font-weight: 700; letter-spacing: .06em; }
.stats { margin: 0; border-top: 1px solid #2f3443; border-bottom: 1px solid #2f3443; }
.stats div { display: flex; justify-content: space-between; padding: 12px 4px; font-size: 15px; }
.stats div + div { border-top: 1px solid #22262f; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-weight: 600; }
.unlocked {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--accent); background: #1b1f2a; text-align: left; text-decoration: none; color: var(--text);
}
.unlocked .ic { color: var(--accent-text); flex: none; }
.unlocked > span { display: flex; flex-direction: column; gap: 1px; }
.unlocked .label { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-text); }
.unlocked .text { font-size: 15px; font-weight: 600; }
.complete form .btn { width: 100%; }

/* footer: player progress */
.q-foot { margin-top: auto; padding-top: 28px; display: flex; flex-direction: column; gap: 8px; }
.player {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid #2f3443; font-size: 13px;
}
.player.wide { flex-direction: column; align-items: stretch; background: none; border: 0; padding: 0; gap: 6px; }
.lvl { font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.bar { flex: 1; height: 6px; border-radius: 3px; background: #2f3443; overflow: hidden; display: flex; }
.bar > span { background: var(--gold); }
.plain { align-self: center; display: inline-flex; align-items: center; min-height: var(--tap); color: var(--muted); font-size: 14px; }

.q-flash {
  position: sticky; top: 0; z-index: 5; padding: 12px 16px; text-align: center;
  background: var(--gold); color: #1d1600; font-weight: 600;
}

@media (min-width: 720px) {
  main { padding-top: 24px; }
  h1.display { font-size: 48px; }
  .display.big { font-size: 52px; }
  .move-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .sheet { margin: 24px 0 0; border-radius: 16px; border: 1px solid #343a4a; }
  .action-bar { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
}

/* landing, account, legal pages */
.landing { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 48px 0; }
.landing-head { display: flex; flex-direction: column; gap: 14px; }
.landing .display.huge { color: var(--text); font-size: 56px; }
.lede { margin: 0; color: var(--soft); font-size: 17px; line-height: 1.5; }
.fine { color: var(--muted); font-size: 13px; }
code.url { display: block; padding: 10px 12px; border-radius: var(--radius); background: var(--sunk); border: 1px solid var(--line-2); overflow-wrap: anywhere; }
.prose { padding: 24px 0 40px; color: var(--soft); line-height: 1.55; }
.prose h1 { margin: 12px 0 4px; color: var(--text); }
.prose h2 { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text); font-size: 20px; margin: 28px 0 8px; }
.prose ul { padding-left: 20px; }
.prose a { display: inline; }
mark { background: var(--gold); color: #1d1600; padding: 0 4px; border-radius: 3px; }
.foot-links { display: flex; justify-content: center; gap: 20px; }
.move-card.new-key > span { display: flex; flex-direction: column; gap: 8px; min-width: 0; width: 100%; }
.move-card.new-key code.url { background: #fff; color: var(--on-hi); border-color: #cfcabf; user-select: all; }
.notes.error { color: #ff8a8a; }
