:root {
  color-scheme: light;
  --paper: #f2eee5;
  --ink: #18201f;
  --concrete: #d9d5ca;
  --steel: #405d66;
  --river: #2f7f97;
  --yellow: #efbd45;
  --orange: #db5a3c;
  --green: #397259;
  --line: #18201f;
  --white: #fffdf7;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Arial, Helvetica, sans-serif; }
button, a { font: inherit; }
button { color: inherit; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 30; background: var(--ink); color: white; padding: .8rem 1rem; }
.skip-link:focus { top: 1rem; }
.topbar { min-height: 58px; padding: 0 clamp(1rem, 5vw, 5rem); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.topbar a { color: inherit; text-decoration: none; }
.topbar a:hover, .topbar a:focus-visible { text-decoration: underline; text-underline-offset: .25rem; }
.topbar p { margin: 0; }

.opening { min-height: 410px; padding: clamp(3.5rem, 8vw, 7.5rem) clamp(1rem, 6vw, 6rem) clamp(3rem, 7vw, 6rem); display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 4rem; align-items: end; }
.eyebrow { margin: 0 0 1rem; color: #a42f20; font-size: .72rem; line-height: 1.2; font-weight: 900; text-transform: uppercase; }
.opening h1 { max-width: 850px; margin: 0; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(4rem, 9vw, 9rem); font-weight: 400; line-height: .82; letter-spacing: 0; }
.opening > p { max-width: 570px; margin: 0 0 .5rem; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(1.15rem, 1.8vw, 1.55rem); line-height: 1.45; }

.game { background: var(--ink); color: var(--white); padding: clamp(1.25rem, 4vw, 4rem); }
.game-head { max-width: 1380px; margin: 0 auto 1.5rem; display: flex; align-items: end; justify-content: space-between; gap: 2rem; }
.game-head h2 { margin: 0; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(2.25rem, 5vw, 4.5rem); font-weight: 400; }
.game-head > div > p:last-child { max-width: 640px; margin: .7rem 0 0; color: #cbd2cf; line-height: 1.5; }
.game .eyebrow { color: var(--yellow); }
.meters { display: grid; grid-template-columns: repeat(3, minmax(100px, 1fr)); margin: 0; border: 1px solid #64706d; }
.meters div { min-width: 110px; padding: .85rem 1rem; border-left: 1px solid #64706d; }
.meters div:first-child { border-left: 0; }
.meters dt { color: #9facaa; font-size: .64rem; font-weight: 900; text-transform: uppercase; }
.meters dd { margin: .35rem 0 0; font-family: Georgia, 'Times New Roman', serif; font-size: 1.45rem; }
.meters strong { color: var(--yellow); }

.stage-wrap { max-width: 1380px; margin: 0 auto; border: 1px solid #65716e; overflow: hidden; }
.stage { position: relative; height: clamp(350px, 48vw, 610px); min-height: 350px; overflow: hidden; background: #c8d6d2; }
.skyline { position: absolute; inset: 0 0 42%; background: linear-gradient(#dfe6df, #b9c9c4); }
.skyline i { position: absolute; bottom: 0; width: 18%; background: #79908d; opacity: .5; }
.skyline i:nth-child(1) { left: 3%; height: 22%; }
.skyline i:nth-child(2) { left: 28%; height: 34%; }
.skyline i:nth-child(3) { right: 26%; height: 18%; }
.skyline i:nth-child(4) { right: 2%; height: 39%; }
.river { position: absolute; inset: 62% 0 0; overflow: hidden; background: var(--river); }
.river::before, .river::after { content: ''; position: absolute; left: -8%; width: 116%; height: 12px; background: repeating-linear-gradient(90deg, rgba(255,255,255,.45) 0 28px, transparent 28px 52px); animation: water 9s linear infinite; }
.river::before { top: 24%; }
.river::after { top: 68%; opacity: .55; animation-direction: reverse; animation-duration: 12s; }
@keyframes water { to { transform: translateX(80px); } }

.bridge { position: absolute; z-index: 3; left: 5%; right: 5%; top: 48%; display: grid; grid-template-columns: repeat(7, 1fr); }
.span { position: relative; height: clamp(110px, 16vw, 210px); border: 0; border-top: clamp(14px, 2vw, 25px) solid #273432; border-right: 2px solid #273432; background: transparent; cursor: pointer; padding: 0; }
.span:first-child { border-left: 2px solid #273432; }
.span::after { content: ''; position: absolute; left: 50%; top: 0; width: 4px; height: 68%; transform: translateX(-50%); background: #657673; transform-origin: top; transition: transform .35s, background .35s; }
.span:hover, .span:focus-visible { background: rgba(239,189,69,.12); outline: 3px solid var(--yellow); outline-offset: -3px; }
.span:disabled { cursor: default; }
.span.broken { border-top-color: var(--orange); animation: shake .38s ease-in-out 2; }
.span.broken::after { background: var(--orange); transform: translateX(-50%) rotate(13deg) scaleY(.72); }
@keyframes shake { 33% { translate: -4px 2px; } 66% { translate: 4px -1px; } }
.span-neighbor { background: rgba(239,189,69,.16); }
.span-index { position: absolute; left: .25rem; top: calc(-1 * clamp(43px, 4.5vw, 55px)); color: #31413e; font-size: .7rem; font-weight: 900; }
.strength { position: absolute; left: 8%; right: 8%; top: 17%; padding: .45rem .25rem; background: rgba(24,32,31,.9); color: var(--white); border: 1px solid #7c8b87; font-size: clamp(.62rem, 1vw, .78rem); font-weight: 800; text-align: center; }
.strength b { display: block; color: var(--yellow); font-size: 1.05rem; }
.demand { display: none; margin-top: .25rem; color: #f7a28f; font-size: .6rem; }
.tested .demand { display: block; }
.bolt-bank { position: absolute; z-index: 2; left: 50%; top: 69%; min-width: 34px; display: flex; justify-content: center; gap: 3px; transform: translateX(-50%); }
.bolt-bank i { display: block; width: clamp(9px, 1.3vw, 16px); aspect-ratio: 1; border-radius: 50%; background: var(--yellow); border: 2px solid #26312f; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.bolt-bank i::after { content: ''; display: block; width: 60%; height: 2px; margin: calc(50% - 1px) auto 0; background: #26312f; }

.vehicle { --vehicle-color: #db5a3c; position: absolute; z-index: 7; left: 2%; top: calc(48% - 62px); width: clamp(72px, 9vw, 124px); height: 58px; transition: left .38s linear, transform .28s; }
.vehicle-load { position: absolute; left: 0; bottom: 13px; width: 64%; height: 36px; background: var(--vehicle-color); border: 3px solid #202b29; }
.vehicle-cab { position: absolute; right: 2%; bottom: 13px; width: 34%; height: 29px; background: var(--yellow); border: 3px solid #202b29; }
.vehicle-cab::before { content: ''; position: absolute; left: 4px; top: 4px; width: 45%; height: 9px; background: #b9d4d4; }
.vehicle i { position: absolute; bottom: 2px; width: 18px; aspect-ratio: 1; border-radius: 50%; background: #202b29; border: 4px solid #87928e; }
.vehicle i:nth-of-type(1) { left: 12%; }
.vehicle i:nth-of-type(2) { right: 12%; }
.vehicle.waiting { transform: translateX(-120%); }
.vehicle.fallen { transform: translateY(170px) rotate(18deg); }

.work-panel { max-width: 1380px; margin: 0 auto; display: grid; grid-template-columns: 1fr auto; gap: 1rem 2rem; padding: 1rem 0 0; align-items: center; }
.legend { display: flex; flex-wrap: wrap; gap: 1rem; color: #b8c2bf; font-size: .72rem; }
.legend span { display: flex; align-items: center; gap: .4rem; }
.sample { width: 18px; height: 7px; display: inline-block; }
.sample.base { background: #71807c; }
.sample.need { background: var(--orange); }
.sample.bolt { width: 12px; height: 12px; border-radius: 50%; background: var(--yellow); }
.actions { display: flex; gap: .65rem; }
.actions button, .result button { min-height: 48px; padding: .75rem 1.1rem; border: 1px solid #b2bdb9; background: transparent; color: var(--white); font-weight: 900; cursor: pointer; }
.actions .primary { background: var(--yellow); border-color: var(--yellow); color: var(--ink); box-shadow: 5px 5px 0 var(--orange); }
.actions button:hover, .actions button:focus-visible, .result button:hover, .result button:focus-visible { outline: 3px solid var(--white); outline-offset: 2px; }
.actions button:disabled { opacity: .45; cursor: wait; }
.status { grid-column: 1 / -1; min-height: 1.5rem; margin: 0; color: #d9dfdd; font-family: Georgia, 'Times New Roman', serif; }
.status strong { color: var(--yellow); }

.levels { max-width: 1380px; margin: 2rem auto 0; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid #65716e; }
.levels button { min-height: 68px; display: flex; gap: .8rem; align-items: center; justify-content: center; border: 0; border-left: 1px solid #65716e; background: transparent; color: #dfe5e2; cursor: pointer; font-weight: 800; }
.levels button:first-child { border-left: 0; }
.levels button span { color: var(--yellow); font-size: .66rem; }
.levels button[aria-current="step"] { background: #f5f1e7; color: var(--ink); }
.levels button:disabled { color: #71807c; cursor: not-allowed; }
.levels button:not(:disabled):hover, .levels button:not(:disabled):focus-visible { box-shadow: inset 0 0 0 3px var(--yellow); outline: 0; }

.rules, .result { padding: clamp(3.5rem, 8vw, 8rem) clamp(1rem, 6vw, 6rem); }
.rules-head, .result { display: grid; grid-template-columns: minmax(60px, .15fr) minmax(0, 1fr); gap: 2rem; }
.number { margin: 0; color: var(--orange); font-size: .75rem; font-weight: 900; }
.rules h2, .result h2 { max-width: 900px; margin: 0; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(2.5rem, 6vw, 6.5rem); font-weight: 400; line-height: .95; }
.rules ol { max-width: 1380px; margin: 3.5rem auto 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); list-style: none; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rules li { min-height: 170px; padding: 1.4rem; border-left: 1px solid var(--line); }
.rules li:first-child { border-left: 0; }
.rules li > strong { display: grid; place-items: center; width: 28px; aspect-ratio: 1; border-radius: 50%; background: var(--ink); color: var(--white); }
.rules li p { margin: 1.6rem 0 0; line-height: 1.45; }
.result { background: var(--yellow); }
.result .eyebrow { color: #8c281b; }
.result p:not(.number, .eyebrow) { max-width: 720px; font-size: 1.2rem; line-height: 1.5; }
.result button { color: var(--ink); border-color: var(--ink); }
footer { padding: 1.25rem clamp(1rem, 6vw, 6rem); display: flex; justify-content: space-between; border-top: 1px solid var(--line); font-size: .74rem; text-transform: uppercase; }
footer a { color: inherit; font-weight: 900; }
footer p { margin: 0; }

@media (max-width: 900px) {
  .opening { grid-template-columns: 1fr; min-height: 0; gap: 2rem; }
  .opening h1 { font-size: clamp(4rem, 16vw, 7rem); }
  .game-head { align-items: stretch; flex-direction: column; }
  .meters { width: 100%; }
  .work-panel { grid-template-columns: 1fr; }
  .actions { grid-row: 1; }
  .status { grid-column: 1; }
  .rules ol { grid-template-columns: repeat(2, 1fr); }
  .rules li:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .rules li:nth-child(4) { border-top: 1px solid var(--line); }
}

@media (max-width: 560px) {
  .topbar p { display: none; }
  .opening { padding-top: 3rem; }
  .opening h1 { font-size: 4rem; }
  .game { padding-inline: .7rem; }
  .meters { grid-template-columns: 1fr 1fr; }
  .meters div { min-width: 0; border-bottom: 1px solid #64706d; }
  .meters div:nth-child(3) { grid-column: 1 / -1; border-left: 0; border-bottom: 0; }
  .stage { height: 390px; }
  .bridge { left: 2%; right: 2%; }
  .span-index { display: none; }
  .strength { left: 3%; right: 3%; font-size: .55rem; }
  .strength b { font-size: .85rem; }
  .vehicle { width: 72px; }
  .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .actions button { padding-inline: .4rem; font-size: .82rem; }
  .levels { grid-template-columns: 1fr; }
  .levels button { min-height: 52px; border-left: 0; border-top: 1px solid #65716e; }
  .levels button:first-child { border-top: 0; }
  .rules-head, .result { grid-template-columns: 1fr; gap: .8rem; }
  .rules ol { grid-template-columns: 1fr; }
  .rules li, .rules li:nth-child(2), .rules li:nth-child(4) { min-height: 0; border-left: 0; border-top: 1px solid var(--line); }
  .rules li:first-child { border-top: 0; }
  footer { align-items: flex-start; gap: 1rem; flex-direction: column; }
}

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