/* Hallmark · pre-emit critique: P5 H4 E4 S5 R4 V5
 * macrostructure: Scroll-scrubbed world (studied DNA: Arsenals, Awwwards) · genre: atmospheric · tone: dusk war map
 * theme: studied-DNA (source: arsenals) · ink #15110e · gold #e0a530 · Pixelify Sans + Newsreader
 * nav: icon chips over the scene · footer: wordmark cropped by the bottom edge · contrast: pass (40-41) · mobile: pass (34, 49-57) */
@font-face { font-family: 'Pixelify'; src: url('/assets/fonts/pixelify.woff2') format('woff2'); font-weight: 500 700; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('/assets/fonts/newsreader.woff2') format('woff2'); font-weight: 400 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('/assets/fonts/newsreader-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --ink: #15110e;
  --ember: #26120b;
  --gold: #e0a530;
  --gold-shade: #9a6a14;
  --gold-deep: #5a3a0c;
  --cream: #ede6d6;
  --crimson: #b8322a;
  --verdigris: #2f8f6f;
  --purple: #7a3f86;
  --orange: #c8652a;
  --ash: #6f6253;
  --ash-2: #a39684;
  --line: rgba(237, 230, 214, .14);
  --px: 'Pixelify', 'Trebuchet MS', sans-serif;
  --serif: 'Newsreader', Georgia, serif;
  --pad: clamp(18px, 4vw, 64px);
  /* one art pixel of the display face */
  --s: max(1px, .032em);
  --bevel: calc(var(--s) * -1) calc(var(--s) * -1) 0 var(--cream), var(--s) var(--s) 0 var(--gold-shade), calc(var(--s) * 2) calc(var(--s) * 2) 0 var(--gold-deep), calc(var(--s) * 3) calc(var(--s) * 3) 0 var(--ink), calc(var(--s) * 4) calc(var(--s) * 4) 0 var(--ink);
  /* translucent inks and rims used by the page */
  --c1: rgba(237, 230, 214, .28);
  --c2: rgba(21, 17, 14, .55);
  --c3: rgba(237, 230, 214, .12);
  --c4: rgba(237, 230, 214, .2);
  --c5: rgba(21, 17, 14, .75);
  --c6: rgba(38, 18, 11, .55);
  --c7: rgba(21, 17, 14, .8);
  --c8: rgba(21, 17, 14, .9);
  --c9: rgba(237, 230, 214, .04);
  --c10: rgba(237, 230, 214, .08);
  --c11: rgba(237, 230, 214, .3);
  --c12: rgba(21, 17, 14, .82);
  --c13: rgba(237, 230, 214, .25);
  --c14: rgba(21, 17, 14, .7);
  --c15: #e0806f;
  --c16: rgba(21, 17, 14, .96);
  --c17: rgba(21, 17, 14, .88);
}

* { box-sizing: border-box; }
html { overflow-x: clip; background: var(--ink); color: var(--cream); scrollbar-width: thin; scrollbar-color: var(--gold-shade) var(--ink); }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--gold-shade); border-radius: 8px; }
::-webkit-scrollbar-button { display: none; }
body { margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.5; overflow-x: clip; -webkit-font-smoothing: antialiased; }
img, canvas { display: block; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 99; top: 8px; left: 8px; background: var(--gold); color: var(--ink); padding: 8px 12px; }

/* ---------- display type, drawn in the cover's pixel style ---------- */
.px { font-family: var(--px); font-weight: 700; color: var(--gold); text-shadow: var(--bevel); letter-spacing: .01em; text-transform: uppercase; margin: 0; line-height: 1; overflow-wrap: normal; word-break: keep-all; hyphens: none; }
.px-s { font-family: var(--px); font-weight: 600; color: var(--gold); font-size: 21px; letter-spacing: .01em; margin: 0 0 8px; text-shadow: 1px 1px 0 var(--gold-deep), 2px 2px 0 var(--ink); }
.book { font-family: var(--serif); color: var(--cream); margin: 0; }

/* ---------- header ---------- */
.bar { position: fixed; z-index: 30; inset: 0 0 auto 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px var(--pad); pointer-events: none; }
.bar > * { pointer-events: auto; }
.bar-home { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.bar-home img { width: 36px; height: 36px; image-rendering: pixelated; }
.bar-home span { font-family: var(--px); font-weight: 700; font-size: 20px; color: var(--gold); text-shadow: 1px 1px 0 var(--gold-deep), 2px 2px 0 var(--ink); }
.bar-links { display: flex; align-items: center; gap: 8px; }
.ico, .ca, .buy, .phantom { height: 36px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--c1); background: var(--c2); backdrop-filter: blur(6px); padding: 0 12px; font-size: 15px; text-decoration: none; cursor: pointer; transition: background .25s, border-color .25s, color .25s; }
.ico { width: 36px; padding: 0; justify-content: center; }
.ico svg, .phantom svg { width: 17px; height: 17px; fill: currentColor; }
.ico:hover, .ca:hover, .phantom:hover { background: var(--c3); border-color: var(--cream); }
.ca b { font-weight: 500; color: var(--ash-2); font-family: var(--px); }
.ca.live b { color: var(--cream); }
.buy { background: var(--gold); color: var(--ink); border-color: var(--gold); font-family: var(--px); font-weight: 700; }
.buy:hover { background: var(--cream); border-color: var(--cream); }
.buy[aria-disabled="true"] { background: transparent; color: var(--ash-2); border-color: var(--c4); cursor: not-allowed; }
.ico[aria-disabled="true"] { opacity: .45; }
.phantom.on { border-color: var(--gold); color: var(--gold); }

/* ---------- the scene: fixed map behind hero, fly, manifesto, rules ---------- */
.scene { position: relative; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; margin-bottom: -100vh; margin-bottom: -100svh; overflow: hidden; z-index: 0; }
.stage canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(120% 90% at 50% 40%, transparent 55%, var(--c5) 100%), linear-gradient(to bottom, var(--c6), transparent 22%, transparent 70%, var(--c7)); }
.hero, .fly, .manifesto, .rules { position: relative; z-index: 2; }
.hero { height: 100vh; height: 100svh; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding-top: 0; overflow: hidden; }
.mark { width: 100%; text-align: center; white-space: nowrap; transform-origin: 50% 0; font-size: 22vw; margin-top: -0.17em; }
.fit { display: inline-block; }
.plate { font-family: var(--px); font-weight: 600; font-size: clamp(18px, 2vw, 26px); color: var(--cream); background: var(--ink); border: 2px solid var(--crimson); padding: 8px 24px 12px; margin: 0 0 9vh; box-shadow: 4px 4px 0 var(--c8); }
.status { position: absolute; right: var(--pad); bottom: 22px; margin: 0; font-family: var(--px); font-size: 14px; color: var(--ash-2); }

.fly { min-height: 160vh; display: flex; align-items: center; justify-content: center; }
.stack { display: flex; flex-direction: column; align-items: center; text-align: center; font-size: clamp(64px, 12.5vw, 220px); }
.stack .ln { display: block; overflow: hidden; padding: 0 .12em .14em .04em; }
.stack .ln > span { display: block; white-space: nowrap; }

.manifesto { min-height: 120vh; display: flex; align-items: center; padding: 0 var(--pad); }
.book.drop { max-width: 46ch; margin-left: 12vw; font-size: clamp(19px, 1.55vw, 24px); line-height: 1.48; }
.cap { float: left; font-size: 4.3em; line-height: .78; margin: .04em .1em 0 0; }

.rules { min-height: 150vh; padding: 20vh var(--pad) 24vh; display: flex; flex-direction: column; align-items: center; gap: 12vh; }
.rules .stack { font-size: clamp(54px, 9.5vw, 170px); }
.rule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 45ch)); gap: 9vh 7vw; justify-content: center; }
.rule { font-size: 19px; }
.rule-h { display: block; margin-bottom: 8px; }

/* ---------- sections after the scene ---------- */
.houses, .room, .raise, .chronicle { position: relative; z-index: 3; background: var(--ink); padding: 13vh var(--pad); }
.houses { background: linear-gradient(to bottom, transparent, var(--ink) 18vh); }
.sec-head, .room-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; margin-bottom: 7vh; flex-wrap: wrap; }
.head { font-size: clamp(46px, 7vw, 120px); white-space: nowrap; }
.lede { max-width: 46ch; color: var(--ash-2); font-style: italic; }

.house-list, .days, .members, .reigns { list-style: none; margin: 0; padding: 0; }
.house { display: grid; grid-template-columns: 56px 72px minmax(0, 1fr) minmax(160px, 28%) 92px; align-items: center; gap: 24px; padding: 20px 0; border-top: 1px solid var(--line); cursor: pointer; transition: background .3s; }
.house:last-child { border-bottom: 1px solid var(--line); }
.house:hover, .house:focus-visible { background: var(--c9); }
.house .rank { font-family: var(--px); font-size: 28px; color: var(--ash-2); text-align: right; }
.house img { width: 64px; height: 76px; image-rendering: pixelated; }
.house .nm { font-family: var(--px); font-weight: 700; font-size: clamp(22px, 2.4vw, 34px); color: var(--cream); line-height: 1.05; }
.house .mt { font-style: italic; color: var(--ash-2); font-size: 17px; }
.house .crowned { color: var(--gold); }
.bar-power { height: 12px; background: var(--c10); position: relative; }
.bar-power i { position: absolute; inset: 0 auto 0 0; display: block; }
.house .pw { font-family: var(--px); font-size: 15px; color: var(--ash-2); margin-top: 8px; }
.house .rg { font-family: var(--px); font-size: 15px; color: var(--ash-2); text-align: right; }
.empty { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 36px 0; }
.empty .book { max-width: 52ch; color: var(--ash-2); font-style: italic; }

.room { padding-left: 0; padding-right: 0; }
.room-head { padding: 0 var(--pad); }
.room-frame { position: relative; height: 82vh; min-height: 420px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; }
.room-frame canvas { width: 100%; height: 100%; image-rendering: pixelated; cursor: grab; touch-action: none; }
.room-frame canvas:active { cursor: grabbing; }
.room-tip { position: absolute; pointer-events: none; background: var(--ink); border: 2px solid var(--crimson); padding: 8px 12px; font-family: var(--px); font-size: 15px; transform: translate(14px, 14px); white-space: nowrap; }
.room-zoom { position: absolute; right: var(--pad); top: 20px; display: flex; flex-direction: column; gap: 8px; }
.room-zoom button { width: 40px; height: 40px; background: var(--c7); border: 1px solid var(--c11); font-family: var(--px); font-size: 22px; cursor: pointer; }
.room-zoom button:hover { border-color: var(--gold); color: var(--gold); }
.room-plate { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--ink); border: 2px solid var(--crimson); padding: 16px 24px; max-width: min(460px, 86vw); pointer-events: none; }
.room-plate p { margin: 0; font-family: var(--px); font-size: 18px; text-align: center; line-height: 1.35; }
.replay { position: absolute; left: var(--pad); right: var(--pad); bottom: 18px; display: flex; align-items: center; gap: 16px; background: var(--c12); padding: 12px 16px; border: 1px solid var(--line); }
.replay label, .replay output { font-family: var(--px); font-size: 14px; color: var(--ash-2); white-space: nowrap; }
.replay input { flex: 1; accent-color: var(--gold); }

.raise-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 8vw; align-items: start; }
.raise .stack { align-items: flex-start; text-align: left; font-size: clamp(54px, 8vw, 140px); }
.raise-copy .book { max-width: 40ch; margin-top: 5vh; }
.my-side { margin-top: 6vh; border-top: 1px solid var(--line); padding-top: 24px; max-width: 46ch; }
.my-side .book { color: var(--ash-2); }
.forge { background: var(--ember); border: 2px solid var(--gold-deep); padding: 32px; display: flex; flex-direction: column; gap: 20px; box-shadow: 8px 8px 0 var(--c5); }
.forge-crest { display: flex; justify-content: center; padding: 20px 0 8px; }
.forge-crest canvas { width: 160px; height: 190px; image-rendering: pixelated; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field span { font-size: 15px; color: var(--ash-2); }
.field input { background: var(--ink); border: 1px solid var(--c13); padding: 12px 16px; font-size: 18px; }
.field input { outline: 2px solid transparent; outline-offset: 1px; min-height: 48px; }
.field input:hover { border-color: var(--ash-2); }
.field input:focus-visible, .field input:focus { border-color: var(--gold); outline: 2px solid var(--gold); }
.field input:disabled { opacity: .55; cursor: not-allowed; }
.act { background: var(--gold); color: var(--ink); border: 0; padding: 16px 20px; font-family: var(--px); font-weight: 700; font-size: 18px; cursor: pointer; box-shadow: 3px 3px 0 var(--gold-deep), 6px 6px 0 var(--c14); transition: transform .15s, box-shadow .15s; }
.act:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--gold-deep), 7px 7px 0 var(--c14); }
.act:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--gold-deep); }
.act[disabled] { background: var(--ash); color: var(--cream); opacity: .8; cursor: not-allowed; box-shadow: none; transform: none; }
.ghost { background: transparent; border: 1px solid var(--c11); padding: 12px 20px; cursor: pointer; font-size: 16px; }
.ghost:hover { border-color: var(--cream); }
.forge-note { min-height: 1.4em; margin: 0; font-size: 16px; color: var(--ash-2); font-style: italic; }
.forge-note.bad { color: var(--c15); }

.days { border-top: 1px solid var(--line); }
.day { display: grid; grid-template-columns: 150px 48px minmax(0, 1fr) auto; gap: 20px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.day time { font-family: var(--px); color: var(--ash-2); font-size: 15px; }
.day img { width: 40px; height: 48px; image-rendering: pixelated; }
.day .nm { font-family: var(--px); font-size: 22px; }
.day .pw { font-family: var(--px); color: var(--ash-2); font-size: 15px; }

/* ---------- footer ---------- */
.foot { position: relative; z-index: 3; background: var(--ink); padding: 12vh var(--pad) 0; overflow: hidden; }
.foot-row { display: grid; grid-template-columns: 48px minmax(0, 46ch) minmax(0, 1fr); gap: 24px; align-items: center; }
.foot-row img { image-rendering: pixelated; }
.foot-row .book { color: var(--ash-2); font-size: 17px; }
.foot-links { display: flex; gap: 24px; justify-content: flex-end; flex-wrap: wrap; margin: 0; }
.foot-links a { text-decoration: none; border-bottom: 1px solid var(--line); }
.foot-links a:hover { border-color: var(--gold); color: var(--gold); }
.giant { font-size: 22vw; text-align: center; white-space: nowrap; margin-top: 8vh; margin-bottom: -4.6vw; }

/* ---------- drawer ---------- */
.drawer { position: fixed; z-index: 40; inset: 0 0 0 auto; width: min(520px, 100vw); background: var(--ink); border-left: 2px solid var(--gold-deep); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--gold-shade) var(--ink); transform: translateX(0); transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
.drawer[hidden] { display: block; transform: translateX(105%); visibility: hidden; }
.drawer-in { padding: 64px 36px 40px; display: flex; flex-direction: column; gap: 24px; }
.drawer-x { position: absolute; top: 14px; right: 18px; width: 40px; height: 40px; background: none; border: 1px solid var(--line); font-size: 24px; cursor: pointer; }
.d-top { display: flex; gap: 20px; align-items: center; }
.d-top img { image-rendering: pixelated; }
.head-s { font-size: clamp(30px, 4vw, 44px); line-height: 1; overflow-wrap: anywhere; word-break: normal; }
.d-motto { font-style: italic; color: var(--ash-2); margin-top: 8px; }
.d-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; margin: 0; }
.d-stats div { border-top: 1px solid var(--line); padding-top: 8px; }
.d-stats dt { font-size: 14px; color: var(--ash-2); }
.d-stats dd { margin: 4px 0 0; font-family: var(--px); font-size: 22px; }
.d-acts { display: flex; gap: 12px; flex-wrap: wrap; }
.members li, .reigns li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.members code { font-family: var(--px); font-size: 15px; }
.members span, .reigns span { color: var(--ash-2); }

.toast { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translate(-50%, 160%); visibility: hidden; background: var(--ink); border: 2px solid var(--crimson); padding: 12px 20px; font-family: var(--px); font-size: 16px; transition: transform .35s; max-width: 90vw; }
.toast.on { transform: translate(-50%, 0); visibility: visible; }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  body { font-size: 18px; }
  .bar { padding: 12px 12px; }
  .bar-home span { display: none; }
  .bar-links { gap: 4px; }
  .ico, .ca, .buy, .phantom { height: 34px; padding: 0 8px; font-size: 14px; }
  .ico { width: 34px; padding: 0; }
  .ca b { display: none; }
  .phantom span { display: none; }
  .mark { font-size: 22vw; margin-top: 10vh; }
  .book.drop { margin-left: 0; }
  .rule-grid { grid-template-columns: minmax(0, 1fr); gap: 6vh; }
  .house { grid-template-columns: 34px 48px minmax(0, 1fr); gap: 12px; }
  .house img { width: 44px; height: 52px; }
  .house .rank { font-size: 20px; }
  .house .bars, .house .rg { grid-column: 2 / -1; }
  .house .rg { text-align: left; }
  .raise-grid { grid-template-columns: minmax(0, 1fr); }
  .forge { padding: 20px; }
  .day { grid-template-columns: 100px 36px minmax(0, 1fr); }
  .day .pw { grid-column: 3; }
  .foot-row { grid-template-columns: 48px minmax(0, 1fr); }
  .foot-links { grid-column: 1 / -1; justify-content: flex-start; }
  .replay label { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
.manifesto .book, .rule { text-shadow: 0 1px 0 var(--ink), 0 0 18px var(--c8), 0 0 4px var(--c7); }
.bar::before { content: ''; position: absolute; inset: 0 0 -18px 0; z-index: -1; background: linear-gradient(to bottom, var(--c16) 0%, var(--c8) 70%, transparent); opacity: 0; transition: opacity .35s; pointer-events: none; }
.bar.solid::before { opacity: 1; }
.ico, .ca, .phantom, .buy[aria-disabled="true"] { background: var(--c17); }
.bar-home span { transition: opacity .3s; }
.bar:not(.solid) .bar-home span { opacity: 0; }
/* full state set for every control: nowrap labels, a press, a disabled look */
.ico, .ca, .buy, .phantom, .act, .ghost, .room-zoom button, .drawer-x { white-space: nowrap; }
.ico:active, .ca:active, .buy:active, .phantom:active, .ghost:active, .room-zoom button:active, .drawer-x:active { transform: translateY(1px); }
.ghost[disabled], .room-zoom button[disabled], .phantom[disabled] { opacity: .55; cursor: not-allowed; }
.ico[aria-disabled="true"] { cursor: not-allowed; }
.drawer-x:hover, .ghost:focus-visible { border-color: var(--cream); }
.act { min-height: 48px; }
