:root {
  color-scheme: dark;
  --bg: #111717;
  --surface: #192121;
  --rule: #303c3b;
  --white: #f2f3e8;
  --quiet: #a9b5b1;
  --accent: #d3ec96;
  --discord: #cbd4ff;
  --error: #ffaf9f;
  font: 16px/1.55 system-ui, sans-serif;
  color: var(--white);
  background: var(--bg);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; display: flex; flex-direction: column; }
.frame { width: min(100% - 3.5rem, 76rem); margin-inline: auto; }
a { color: inherit; }
button, .button, input, select { font: inherit; }
button, .button {
  background: transparent; color: var(--white); border: 1px solid var(--rule);
  border-radius: .4rem; padding: .65rem 1rem; text-decoration: none; cursor: pointer;
}
button:hover:not(:disabled), .button:hover { border-color: var(--accent); }
button:disabled { color: var(--quiet); cursor: default; opacity: .7; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.primary, .discord { background: var(--accent); color: #141d15; border-color: transparent; font-weight: 720; }
.discord { background: var(--discord); display: inline-flex; gap: .75rem; align-items: center; justify-content: center; }
.discord:hover { background: #e4e9ff; }
.discord svg { width: 1.4rem; height: auto; fill: currentColor; }
.site-header { display: flex; align-items: center; justify-content: space-between; min-height: 5.2rem; gap: 1rem; border-bottom: 1px solid var(--rule); }
.wordmark { font-size: 1.28rem; font-weight: 900; letter-spacing: -.075em; text-decoration: none; line-height: 1; }
.wordmark span { color: var(--accent); }
.account { display: flex; align-items: center; justify-content: flex-end; gap: .65rem; flex-wrap: wrap; font-size: .9rem; }
.account span { color: var(--quiet); overflow-wrap: anywhere; }
#app { flex: 1; padding-block: 2.4rem 4rem; }
.site-footer { padding-block: 1.1rem; border-top: 1px solid var(--rule); color: var(--quiet); display: flex; justify-content: space-between; gap: .6rem 1rem; flex-wrap: wrap; font-size: .88rem; }
.eyebrow { color: var(--accent); font-size: .85rem; font-weight: 700; letter-spacing: .065em; margin: 0 0 .7rem; }
h1, h2, h3 { line-height: 1.05; letter-spacing: -.045em; margin: 0 0 .8rem; }
h1 { font-size: clamp(2.6rem, 5vw, 4.8rem); }
h2 { font-size: clamp(1.7rem, 3.3vw, 2.65rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1rem; }
.quiet, .muted { color: var(--quiet); }
.error { color: var(--error); }
.landing { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: stretch; gap: clamp(1.2rem, 4vw, 4rem); margin-top: clamp(.5rem, 4svh, 3.5rem); }
.poster { background: #dfebbb; color: #1b291c; padding: clamp(1.4rem, 4.5vw, 3.6rem); min-height: 30rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.poster .eyebrow { color: #30402b; }
.poster h1 { font-size: clamp(3rem, 6vw, 6.4rem); letter-spacing: -.074em; margin: 0; }
.poster-intro { max-width: 22rem; margin: 1rem 0 0; font-size: 1.05rem; }
.poster-top, .poster-bottom { z-index: 1; }
.poster-bottom { border-top: 1px solid #72806b; padding-top: .75rem; font-size: .9rem; font-weight: 650; margin-top: 3.5rem; }
.compass { position: absolute; width: clamp(15rem, 31vw, 28rem); aspect-ratio: 1; border: 1px solid #77856a66; border-radius: 50%; left: 48%; top: -12%; display: grid; place-items: center; }
.compass::before, .compass::after { content: ''; position: absolute; inset: 14%; border: 1px solid #77856a55; border-radius: 50%; }
.compass::after { inset: 30%; }
.compass span { height: 75%; width: 1px; background: #77856a66; transform: rotate(38deg); }
.compass span::before { content: ''; position: absolute; width: 100%; height: 100%; background: inherit; transform: rotate(90deg); }
.login { align-self: center; max-width: 30rem; padding-block: 1.5rem; }
.login .discord { margin: .4rem 0 1rem; }
.login .privacy { font-size: .9rem; color: var(--quiet); margin-top: 1rem; }
.login .feedback { margin-bottom: .6rem; }
.quest-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem 2rem; padding-bottom: 1.4rem; margin-bottom: 1.7rem; border-bottom: 1px solid var(--rule); }
.quest-header h1 { margin-bottom: .45rem; }
.quest-header p { margin-bottom: 0; }
.stats { display: flex; flex-wrap: wrap; gap: .75rem 1.4rem; }
.stats div { display: grid; gap: .25rem; align-content: start; }
.stats dt { color: var(--quiet); font-size: .86rem; }
.stats dd { margin: 0; font-weight: 680; }
.key { padding: .12rem .45rem; border: 1px solid var(--rule); border-radius: .25rem; margin-right: .25rem; min-width: 1.65rem; display: inline-block; text-align: center; color: var(--accent); }
.quest-layout { display: grid; grid-template-columns: minmax(14rem, 1fr) minmax(0, 2.45fr); gap: clamp(1rem, 3.3vw, 3rem); align-items: start; }
.sidebar section { margin-bottom: 1.4rem; }
.chapter-nav, .records { display: grid; gap: .34rem; }
.chapter-nav button, .records button { text-align: left; width: 100%; display: flex; justify-content: space-between; align-items: center; gap: .55rem; }
.chapter-nav button small, .records small { display: block; color: var(--quiet); font-size: .83rem; }
.chapter-nav button[aria-current="true"] { border-color: var(--accent); background: #232e26; }
.chapter-nav button .mark { color: var(--accent); }
.panel, dialog { border: 1px solid var(--rule); border-radius: .55rem; background: var(--surface); padding: clamp(1rem, 3vw, 2.15rem); }
.evidence { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); border-left: 2px solid var(--accent); padding: .85rem 1rem; line-height: 1.65; }
.matrix { border-collapse: collapse; margin: 0 0 .5rem; min-width: 12rem; text-align: center; }
.matrix td, .matrix th { border: 1px solid var(--rule); padding: .4rem .8rem; }
.doors { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.doors p { border: 1px solid var(--rule); padding: .6rem; margin: 0; }
.form-label { display: block; margin-bottom: .35rem; font-weight: 650; }
input, select { width: 100%; min-width: 0; color: var(--white); background: var(--bg); border: 1px solid var(--rule); border-radius: .4rem; padding: .65rem .8rem; }
select { margin-bottom: .8rem; }
.form-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.form-row input { flex: 1 1 12rem; }
.feedback { margin: .6rem 0 0; }
.feedback:empty { display: none; }
.hints { border-top: 1px solid var(--rule); padding-top: 1.2rem; margin-top: 1.35rem; }
.hints p { font-size: .92rem; }
.success { border-left: 2px solid var(--accent); padding: .25rem 0 .25rem 1rem; margin: 1.2rem 0; }
.success p:last-child { margin-bottom: 0; }
dialog { width: min(36rem, 100% - 1.6rem); max-height: 90svh; color: var(--white); }
dialog::backdrop { background: #060c0bd6; }
.close { float: right; padding: .2rem .7rem; font-size: 1.35rem; }
.admin-top { display: flex; align-items: start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.table-wrap { overflow: auto; }
.admin-table { border-collapse: collapse; width: 100%; text-align: left; min-width: 43rem; }
.admin-table th, .admin-table td { border-bottom: 1px solid var(--rule); padding: .75rem .65rem; vertical-align: top; }
.admin-table summary { cursor: pointer; }
.admin-table details ul { padding-inline-start: 1.1rem; }
.admin-table details li { margin-bottom: .4rem; }
@media (max-width: 720px) {
  .frame { width: calc(100% - 1.75rem); }
  #app { padding-block: 1.1rem 2.5rem; }
  .landing, .quest-layout { grid-template-columns: 1fr; }
  .landing { gap: .2rem; margin-top: 0; }
  .poster { min-height: 16rem; }
  .poster-bottom { margin-top: 2rem; }
  .login { padding: 1.5rem 0 0; }
  .login .discord { width: 100%; }
  .quest-layout .panel { grid-row: 1; }
  .chapter-nav { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
  .account span { display: none; }
}

