:root {
  color-scheme: dark;
  --ink: #f3eee3;
  --muted: #b9c7c4;
  --rose: #ff9b90;
  --red: #e48176;
  --glass: #111c20;
  --rule: #668b865c;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #10171a; color: var(--ink); }
button, select, input { font: inherit; accent-color: var(--red); }
button { color: inherit; }
button:hover, a:hover, select:hover { cursor: pointer; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--rose);
  outline-offset: 4px;
}
h2:focus { outline: none; }

.front-end { min-height: 100svh; isolation: isolate; }
.artwork, .shade { position: fixed; inset: 0; z-index: -1; }
.artwork {
  background: #182126 url("intro-media/bridge-cover-in-game.webp") center center / cover;
  filter: saturate(.78) brightness(.77);
}
.shade {
  background:
    linear-gradient(90deg, #111c20fa, #111c20e0 22%, #111c2065 46%, #111c2014 70%, transparent),
    linear-gradient(0deg, #111c20e8, transparent 27%, transparent 80%, #111c209c);
}
.front-end[data-story-page="2"] .artwork { filter: saturate(.85) brightness(1.72); }
.front-end[data-story-page="3"] .artwork { filter: saturate(.78) brightness(1.24); }
.front-end.story-mode .shade {
  background: linear-gradient(0deg, #111c20fc 2%, #111c20c9 33%, #111c2038 66%, transparent 93%);
}
.shell {
  width: min(100%, 112rem);
  min-height: 100svh;
  margin: auto;
  padding: clamp(1.1rem, 3.5vh, 2rem) clamp(1.25rem, 6vw, 6rem);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(1.1rem, 3vh, 2rem);
}
.top-bar, .footer {
  display: flex;
  align-items: center;
  gap: .75rem 1.5rem;
  color: var(--muted);
  font-size: .875rem;
}
.top-bar { justify-content: flex-end; }
.footer { justify-content: space-between; align-self: end; }
.footer a { color: var(--muted); text-underline-offset: .24em; }
.sound-button {
  min-height: 2.75rem;
  padding: .35rem 0 .35rem .55rem;
  border: 0;
  background: transparent;
  text-shadow: 0 2px 8px #000;
}
.sound-button[aria-pressed="true"] { color: var(--ink); }
.sound-button:hover, .footer a:hover { color: var(--rose); }

.panel { width: min(100%, 34rem); align-self: center; }
.title-panel { margin-block: -.5rem 1.75rem; }
h1, h2 { margin: 0; }
h1 img {
  display: block;
  width: min(100%, 31.5rem);
  height: auto;
  margin-left: -.1rem;
  filter: drop-shadow(0 .28em .22em #060a0bd0);
}
.chapter-title {
  color: var(--muted);
  font-size: clamp(.95rem, 1.8vw, 1.15rem);
  margin: .65rem 0 clamp(1.25rem, 4vh, 2rem);
}
.menu-actions { display: grid; justify-items: start; gap: .14rem; }
.action, .text-button {
  display: inline-flex;
  align-items: center;
  min-height: 2.8rem;
  background: transparent;
  border: 0;
  padding: .44rem .85rem;
  color: var(--ink);
  font: 650 1rem "Bahnschrift", "Segoe UI", sans-serif;
}
.action { border-inline-start: 2px solid transparent; }
.action.primary {
  border-inline-start-color: var(--red);
  color: var(--rose);
}
.action:hover, .action:focus-visible {
  color: var(--rose);
  border-inline-start-color: var(--red);
  background: linear-gradient(90deg, #853c4096 0%, #853c4000 95%);
}
.menu-actions .action {
  justify-content: start;
  padding-inline: .9rem 3.5rem;
  font-size: clamp(1.25rem, 2.6vw, 1.65rem);
}
.text-button { padding-inline: .5rem; color: var(--muted); text-decoration: underline; text-underline-offset: .2em; }
.text-button:hover { color: var(--rose); }
h2 {
  font: 650 clamp(2rem, 4.6vw, 3.35rem)/1.06 "Bahnschrift", "Segoe UI", sans-serif;
  text-wrap: balance;
}
.summary {
  max-width: 33rem;
  color: var(--ink);
  margin: .95rem 0 1.15rem;
  font-size: clamp(1rem, 1.7vw, 1.13rem);
  line-height: 1.55;
}
.eyebrow { margin: 0 0 .7rem; color: var(--rose); font-size: .875rem; font-weight: 650; }
.panel-actions { display: flex; flex-wrap: wrap; gap: .3rem .55rem; }
.story-panel { align-self: end; margin-bottom: clamp(.5rem, 3vh, 2rem); }
.settings-panel { padding-block: .75rem; }
.settings-panel h2 { margin-bottom: 1.15rem; }
.settings-panel form {
  display: grid;
  grid-template-columns: minmax(8rem, .85fr) minmax(7rem, 1.15fr);
  align-items: center;
  gap: .75rem 1rem;
}
.settings-panel form label { color: var(--muted); }
.settings-panel select {
  min-height: 2.5rem;
  color: var(--ink);
  background: #162326;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: .35rem .45rem;
  width: 100%;
}
.settings-panel input[type="checkbox"] { justify-self: start; width: 1.25rem; height: 1.25rem; margin: 0; }
.settings-panel input[type="range"] { width: 100%; min-width: 0; }
.settings-panel .panel-actions { grid-column: 1 / -1; margin-top: .55rem; }
.range-control { display: grid; grid-template-columns: minmax(0, 1fr) 3.5rem; align-items: center; gap: .55rem; }
.range-control output { text-align: end; color: var(--muted); font-size: .9rem; }
.loading-panel progress { width: min(100%, 25rem); height: .7rem; margin: 1.35rem 0 .3rem; accent-color: var(--red); }
.loading-panel p { margin: .6rem 0 1rem; line-height: 1.5; }
.area-loading {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: #10171a;
}
.area-loading .panel { padding-block: 1rem; }
.area-loading p { color: var(--muted); }
.area-loading #area-percent { margin-block: -.55rem .65rem; font-variant-numeric: tabular-nums; }
#canvas { display: block; width: 100vw; height: 100vh; outline: none; touch-action: none; }
body.playing { overflow: hidden; }
body.starting #canvas { position: fixed; inset: 0; z-index: -2; }

@media (max-width: 620px) {
  .artwork { background-position: 60% center; }
  .shade, .front-end.story-mode .shade {
    background: linear-gradient(0deg, #111c20fc 1%, #111c20cf 44%, #111c2060 78%, #111c209f);
  }
  .title-panel { align-self: end; margin-block: .5rem; }
  .settings-panel form { column-gap: .65rem; }
  .settings-panel form label { font-size: .95rem; }
}
