:root {
  --ink: #d9d3c3;
  --ink-dim: #938f83;
  --paper: #171e1d;
  --paper-deep: #0c1111;
  --panel: rgba(20, 27, 26, 0.9);
  --line: rgba(205, 198, 177, 0.19);
  --amber: #c89354;
  --amber-pale: #e1b778;
  --rust: #8e4d3d;
  --cold: #7e9ca0;
  --safe: #88a384;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  font-family: "Libre Franklin", sans-serif;
  color: var(--ink);
  background: var(--paper-deep);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 68% 16%, rgba(84, 106, 103, 0.14), transparent 31rem),
    repeating-linear-gradient(94deg, rgba(255,255,255,.012) 0 1px, transparent 1px 7px),
    var(--paper-deep);
}

body.cover-open { overflow: hidden; }

.cover-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: hidden;
  background: #080b0b;
  opacity: 1;
  transition: opacity .7s ease, visibility .7s ease;
}
.cover-screen.dismissed { opacity: 0; visibility: hidden; pointer-events: none; }
.cover-art { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center; filter: saturate(.78) contrast(1.06); }
.cover-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(3,6,7,.34) 0%, rgba(3,6,7,.04) 48%, rgba(3,6,7,.58) 100%),
    radial-gradient(ellipse at 50% 22%, rgba(5,8,9,.08) 0%, rgba(5,8,9,.18) 42%, rgba(3,5,6,.58) 100%);
  box-shadow: inset 0 0 140px rgba(0,0,0,.66);
  pointer-events: none;
}
.cover-content {
  position: absolute;
  top: clamp(62px, 10vh, 118px);
  left: 50%;
  width: min(90vw, 760px);
  transform: translateX(-50%);
  text-align: center;
  text-shadow: 0 3px 22px rgba(0,0,0,.96);
}
.cover-kicker {
  display: block;
  color: var(--amber-pale);
  text-transform: uppercase;
  letter-spacing: .32em;
  font-size: clamp(.62rem, 1.2vw, .76rem);
  font-weight: 700;
}
.cover-content h1 {
  margin: 9px 0 4px;
  color: #eee4d0;
  font-size: clamp(3.1rem, 8vw, 7.4rem);
  line-height: .92;
  letter-spacing: .025em;
  font-weight: 400;
}
.cover-content p {
  margin: 17px 0 25px;
  color: #beb6a6;
  text-transform: uppercase;
  letter-spacing: .25em;
  font-size: clamp(.64rem, 1.3vw, .78rem);
}
.cover-button {
  min-width: 210px;
  border: 1px solid rgba(225,183,120,.72);
  background: rgba(10,15,15,.76);
  color: #eadfc9;
  padding: 13px 22px;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .67rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 40px rgba(0,0,0,.38);
  backdrop-filter: blur(7px);
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}
.cover-button:hover { color: #171713; background: var(--amber-pale); border-color: var(--amber-pale); }

button { font: inherit; }

button:focus-visible {
  outline: 2px solid var(--amber-pale);
  outline-offset: 3px;
}

.snow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image: radial-gradient(circle, rgba(225,231,224,.48) 0 1px, transparent 1.5px);
  background-size: 43px 57px;
  animation: drift 24s linear infinite;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

@keyframes drift { to { background-position: 86px 114px; } }

.masthead {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(22px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 12, 12, .75);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-back {
  color: var(--muted);
  font-family: "Libre Franklin", sans-serif;
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.site-back:hover {
  color: var(--paper);
}

.account-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.host-account {
  margin: 1.3rem 0;
  padding: 1.15rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.host-account p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.host-sign-in {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.wordmark {
  color: inherit;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.eyebrow {
  display: block;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: .2em;
  font-size: .67rem;
  font-weight: 700;
}

.title, h1, h2, h3 {
  font-family: "IM Fell English", serif;
  font-weight: 400;
}

.title { display: block; font-size: clamp(1.35rem, 3vw, 2rem); letter-spacing: .025em; }
.header-actions { display: flex; gap: 10px; }
.text-button, .bare-button {
  color: var(--ink-dim);
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 10px;
}
.text-button:hover, .bare-button:hover { color: var(--amber-pale); }
.text-button span { color: var(--amber); margin-left: 3px; }

.game-shell {
  width: min(1180px, calc(100% - 44px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 220px minmax(0, 720px);
  gap: clamp(36px, 7vw, 96px);
  justify-content: center;
  padding: clamp(36px, 6vw, 80px) 0 100px;
}

.status-rail {
  position: sticky;
  top: 132px;
  align-self: start;
  color: var(--ink-dim);
  font-size: .78rem;
}

.chapter-mark { padding-bottom: 23px; border-bottom: 1px solid var(--line); }
.chapter-mark span { display: block; text-transform: uppercase; letter-spacing: .16em; font-size: .62rem; color: var(--amber); }
.chapter-mark strong { font-family: "IM Fell English", serif; display: block; margin-top: 6px; color: var(--ink); font-size: 1.08rem; line-height: 1.25; font-weight: 400; }
.meters { margin: 24px 0; display: grid; gap: 17px; }
.meters div { display: grid; gap: 7px; }
.meters dt { text-transform: uppercase; letter-spacing: .12em; font-size: .6rem; }
.meters dd { margin: 0; display: flex; align-items: center; gap: 10px; }
.meters b { color: var(--ink); font-variant-numeric: tabular-nums; }
.meter { height: 3px; flex: 1; background: rgba(255,255,255,.09); }
.meter i { display: block; height: 100%; width: 80%; background: var(--cold); transition: width .4s ease, background .4s ease; }
.meter.nerve i { background: var(--amber); }
.credit-value { color: var(--amber-pale); font-size: 1rem; }
.credit-glyph { color: var(--amber); }
.rail-section { border-top: 1px solid var(--line); padding-top: 19px; margin-top: 22px; }
.rail-section h2 { font-family: inherit; text-transform: uppercase; letter-spacing: .14em; font-size: .6rem; color: var(--ink-dim); }
.inventory-list { list-style: none; margin: 13px 0 0; padding: 0; color: var(--ink); display: grid; gap: 8px; }
.inventory-list li::before { content: "—"; color: var(--amber); margin-right: 8px; }
.inventory-list .empty { color: #6f726d; font-style: italic; }
.inventory-list .empty::before { content: ""; margin: 0; }
.companion-section p { color: var(--amber-pale); }
.checkpoint { margin-top: 28px; line-height: 1.5; color: #6f756f; }

.story-column { min-width: 0; }
.story-image {
  margin: 0 0 28px;
  position: relative;
  box-shadow: var(--shadow);
  background: #0b0f0e;
  border: 1px solid rgba(214, 198, 164, .18);
  animation: reveal .9s ease both;
}
.story-image::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 60px rgba(0,0,0,.38); pointer-events: none; }
.story-image img { width: 100%; max-height: 430px; object-fit: cover; display: block; filter: saturate(.78) contrast(1.04); }
.story-image figcaption { position: absolute; bottom: 0; right: 0; padding: 7px 11px; background: rgba(8,11,10,.82); color: #a7a292; font: italic .72rem "IM Fell English", serif; z-index: 1; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } }

.location-line { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); color: var(--amber); text-transform: uppercase; letter-spacing: .14em; font-size: .61rem; font-weight: 700; }
.location-line span:last-child { color: #747973; text-align: right; }
.passage { padding: 24px 0 18px; font-family: "IM Fell English", serif; font-size: clamp(1.17rem, 1.8vw, 1.34rem); line-height: 1.74; color: #d4d0c2; }
.passage p { margin: 0 0 1.1em; }
.passage p:first-child::first-letter { float: left; font-size: 3.35em; line-height: .76; padding: .11em .12em 0 0; color: var(--amber-pale); }
.passage em { color: #ebe2cc; }
.passage .system-line { font-family: "Libre Franklin", sans-serif; font-size: .73rem; color: var(--safe); border-left: 2px solid var(--safe); padding-left: 12px; }

.choice-heading { display: flex; justify-content: space-between; gap: 20px; margin: 16px 0 10px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .14em; font-size: .58rem; font-weight: 700; }
.key-hint { color: #666b66; }
.choices { display: grid; gap: 9px; }
.choice {
  width: 100%;
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(26, 34, 33, .66);
  padding: 15px 17px;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.choice:hover:not(:disabled) { border-color: rgba(200,147,84,.55); background: rgba(38,46,43,.9); transform: translateX(3px); }
.choice:disabled { cursor: not-allowed; opacity: .43; }
.choice-number { color: var(--amber); font-size: .72rem; }
.choice-label { line-height: 1.35; }
.choice-tag { color: var(--ink-dim); text-transform: uppercase; letter-spacing: .11em; font-size: .56rem; white-space: nowrap; }
.choice-tag.risk { color: #bc7761; }
.choice-tag.safe { color: var(--safe); }
.choice-tag.item { color: var(--amber-pale); }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); opacity: 0; z-index: 30; background: #242d2b; color: var(--ink); border: 1px solid var(--line); padding: 11px 17px; box-shadow: var(--shadow); transition: .25s ease; pointer-events: none; font-size: .8rem; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

dialog { color: var(--ink); }
dialog::backdrop { background: rgba(4,7,7,.82); backdrop-filter: blur(6px); }
.modal { width: min(720px, calc(100% - 36px)); max-height: calc(100dvh - 36px); overflow-y: auto; border: 1px solid rgba(177,104,81,.38); background: #141a19; padding: 0; box-shadow: var(--shadow); }
.modal-inner { padding: clamp(28px, 6vw, 54px); text-align: center; }
.death-image { position: relative; overflow: hidden; margin: clamp(-54px, -6vw, -28px) clamp(-54px, -6vw, -28px) 30px; border-bottom: 1px solid rgba(177,104,81,.3); background: #0a0d0c; }
.death-image::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 70px rgba(0,0,0,.45); }
.death-image img { width: 100%; max-height: 390px; aspect-ratio: 16 / 9; object-fit: cover; display: block; filter: saturate(.72) contrast(1.06); }
.modal h2 { font-size: 2.1rem; margin: 10px 0 12px; color: #e1d7c3; }
.modal p { color: var(--ink-dim); line-height: 1.65; }
.death-actions, .menu-actions { display: grid; gap: 10px; margin-top: 27px; }
.primary-button, .secondary-button {
  border: 1px solid var(--amber);
  background: var(--amber);
  color: #161713;
  padding: 13px 16px;
  cursor: pointer;
}
.secondary-button { background: transparent; color: var(--ink); border-color: var(--line); }
.primary-button:disabled, .secondary-button:disabled { opacity: .4; cursor: not-allowed; }
.primary-button span, .secondary-button span { float: right; }
.drawer { margin: 0 0 0 auto; height: 100%; max-height: 100%; width: min(480px, 92vw); border: 0; border-left: 1px solid var(--line); background: #121817; padding: 0; box-shadow: var(--shadow); }
.drawer[open] { animation: slide-in .25s ease both; }
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { display: flex; align-items: start; justify-content: space-between; padding: 32px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 1.9rem; margin: 5px 0 0; }
.close-button { border: 0; background: transparent; color: var(--ink-dim); font-size: 1.8rem; cursor: pointer; }
.journal-content, .menu-drawer > p, .menu-actions, .credits-copy { margin: 28px 32px; }
.journal-empty { color: var(--ink-dim); font-style: italic; }
.clue { border-bottom: 1px solid var(--line); padding: 0 0 22px; margin-bottom: 22px; }
.clue h3 { font-size: 1.3rem; color: var(--amber-pale); margin: 0 0 8px; }
.clue p { font-family: "IM Fell English", serif; font-size: 1.05rem; line-height: 1.6; color: #bdb8aa; }
.menu-drawer > p, .credits-copy { color: var(--ink-dim); line-height: 1.6; }
.credits-copy { border-top: 1px solid var(--line); padding-top: 24px; }
.credits-copy h3 { color: var(--ink); }

@media (max-width: 760px) {
  .cover-art { object-position: 52% center; }
  .cover-content { top: clamp(48px, 8vh, 78px); }
  .cover-content h1 { font-size: clamp(3.1rem, 15vw, 5.2rem); }
  .masthead { min-height: 76px; padding: 13px 18px; }
  .wordmark .eyebrow { display: none; }
  .title { font-size: 1.4rem; }
  .game-shell { width: min(100% - 32px, 680px); display: block; padding-top: 25px; }
  .status-rail { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; border-bottom: 1px solid var(--line); padding-bottom: 20px; margin-bottom: 28px; }
  .chapter-mark { grid-column: 1 / -1; padding-bottom: 15px; }
  .meters { margin: 0; gap: 10px; }
  .rail-section { margin: 0; padding: 0 0 0 16px; border: 0; border-left: 1px solid var(--line); }
  .companion-section { grid-column: 2; }
  .checkpoint { grid-column: 1 / -1; margin: 2px 0 0; }
  .story-image img { min-height: 220px; }
  .location-line { display: grid; gap: 7px; }
  .location-line span:last-child { text-align: left; }
  .passage { font-size: 1.13rem; line-height: 1.65; }
  .choice { grid-template-columns: 24px 1fr; }
  .choice-tag { grid-column: 2; }
  .key-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
