@font-face {
  font-family: "IM FELL English SC";
  src: url("/fonts/im-fell-english-sc-latin-400-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Spectral";
  src: url("/fonts/spectral-latin-500-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Spectral";
  src: url("/fonts/spectral-latin-600-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Spectral";
  src: url("/fonts/spectral-latin-500-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Courier Prime";
  src: url("/fonts/courier-prime-latin-400-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Courier Prime";
  src: url("/fonts/courier-prime-latin-700-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  --card-gap: clamp(16px, 2.25vw, 28px);
  color-scheme: dark;
  --body: "Spectral", Georgia, serif;
  --display: var(--letterpress);
  --letterpress: "IM FELL English SC", Georgia, serif;
  font: 500 1rem/1.5 var(--body);
  color: #f2f4fa;
  background: #0b1220;
  --ink: #f2f4fa;
  --muted: #aab6cc;
  --line: #29374d;
  --accent: #ffd492;
  --surface: #131e30;
  --deeper: #0e1829;
  --blue: #adcfff;
  --mono: "Courier Prime", "Courier New", monospace;
}
* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
/* Keep the destination opaque while the previous document clears. */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-group(root) { animation: none; }
  ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
  ::view-transition-old(root) {
    z-index: 1;
    mix-blend-mode: normal;
    animation: page-handoff 110ms ease-out both;
  }
  @keyframes page-handoff { to { opacity: 0; } }
}
[hidden] { display: none !important; }
body { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
:where(h1, h2, h3, h4, h5, h6) { font-family: var(--display); font-weight: 400; }
:where(dialog, [popover]) { font-family: var(--body); }
button { cursor: pointer; }
:is(.action, .hero-primary, .hero-secondary, .seal-replay) { font-family: var(--letterpress); }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid #96bcff; outline-offset: 4px; }
.shell { width: min(1216px, calc(100% - 64px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid #222e44; background: #0e1727; }
.navigation { min-height: 65px; display: flex; align-items: center; gap: clamp(12px, 2vw, 30px); }
.wordmark { font: 400 1.2rem/1 var(--letterpress); display: flex; gap: 6px; align-items: center; text-decoration: none; white-space: nowrap; }
.wordmark > span:last-child { color: var(--accent); }
.site-mark { display: block; width: 32px; height: 32px; margin-right: 2px; border-radius: 7px; }
.navigation nav { display: flex; gap: clamp(12px, 1.6vw, 25px); margin-inline: auto 0; }
.navigation nav a, .play-heading > a { color: var(--muted); font-size: .85rem; text-decoration: none; font-weight: 650; }
.navigation a:hover, .play-heading > a:hover, .level-link:hover { color: var(--ink); }
.subtle { min-height: 37px; border: 1px solid #3b4d6c; border-radius: 7px; background: #1b2941; color: var(--ink); padding: 6px 11px; font-size: .78rem; font-weight: 750; }
.subtle:hover { background: #253753; }
.sound { white-space: nowrap; }
.intro { position: relative; isolation: isolate; display: flex; align-items: center; border-radius: 18px; min-height: clamp(275px, 29vw, 388px); overflow: hidden; margin-top: 22px; border: 1px solid #2a3a57; background: #101b30; }
.hero-picture { display: contents; }
.hero-art { position: absolute; inset: 0 0 0 auto; width: 78%; height: 100%; object-fit: cover; object-position: 68% 48%; z-index: -2; }
.intro::before { position: absolute; inset: 0; background: linear-gradient(90deg,#0d1729 0%,#0d1729 25%,#0d1729dc 45%,#0d172932 70%,transparent 100%); content: ""; z-index: -1; }
.hero-copy { padding: clamp(24px,4vw,53px); max-width: 560px; }
h1 { font-size: clamp(3.05rem, 6vw, 5.1rem); line-height: .89; letter-spacing: -.088em; margin: 0; }
h1 span { color: var(--accent); }
.intro p { color: #c5d2e8; max-width: 380px; line-height: 1.45; margin: 15px 0 19px; font-size: 1rem; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px 15px; }
.hero-primary, .hero-secondary { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; border-radius: 8px; padding: 7px 13px; font-size: .83rem; font-weight: 700; }
.hero-primary { background: var(--accent); border: 1px solid #ffdb9e; color: #36230d; text-decoration: none; }
.hero-primary:hover, .action:hover:not(:disabled) { background: #ffe4b5; }
.hero-secondary { border: 1px solid #607da5; background: #192a45; color: #edf5ff; }
.hero-secondary:hover { background: #243c5c; }
.play-heading { display: flex; justify-content: space-between; align-items: center; margin-block: 22px 10px; scroll-margin-top: 12px; }
.mode-switch { display: flex; align-items: stretch; gap: 4px; background: #101a2d; border: 1px solid var(--line); border-radius: 9px; padding: 4px; }
.mode-switch button { min-height: 37px; border: 1px solid transparent; background: transparent; color: var(--muted); font-weight: 750; border-radius: 6px; padding: 0 12px; font-size: .83rem; white-space: nowrap; }
.mode-switch button[aria-pressed="true"] { background: #273e61; border-color: #516c92; color: #f1f5fc; }
.game-grid { display: grid; grid-template-columns: minmax(0, 1fr) 292px; gap: var(--card-gap); align-items: start; }
.game { border: 1px solid #354965; border-radius: 15px; background: var(--surface); padding: clamp(12px, 2vw, 20px); min-width: 0; }
.game-header { display: flex; justify-content: space-between; align-items: end; gap: 8px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); text-transform: uppercase; font: 750 .8125rem var(--mono); letter-spacing: .09em; }
h2 { margin: 0; font-size: clamp(1.4rem, 2.6vw, 1.93rem); line-height: 1.1; letter-spacing: -.045em; }
.instruction { margin: 7px 0 12px; color: var(--muted); font-size: .87rem; }
.gate-count { font: 700 .8125rem var(--mono); border: 1px solid #47638b; background: #1a2b45; color: #c1d6f6; border-radius: 6px; padding: 5px 8px; white-space: nowrap; }
.route-switch { display: flex; align-items: center; gap: 5px; margin: 0 0 9px; font: 700 .77rem var(--mono); color: var(--blue); }
.route-switch span { margin-right: 5px; }
.route-switch button { min-width: 43px; min-height: 38px; color: var(--blue); background: #16243c; border: 1px solid #415574; border-radius: 6px; }
.route-switch button[aria-pressed="true"] { background: #314f74; color: white; border-color: #8cb7ec; }
.workbench { container-type: inline-size; touch-action: pan-y pinch-zoom; cursor: ew-resize; position: relative; overflow: hidden; border-radius: 10px; border: 1px solid #455778; background: #0b182b; }
canvas { display: block; width: 100%; aspect-ratio: 900 / 351; }
.drag-zone { position: absolute; inset: 18% auto 20% 0; width: 22%; cursor: ew-resize; touch-action: none; }
.controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(145px, 190px); align-items: end; gap: 14px; margin-top: 11px; }
.angle-label { display: flex; justify-content: space-between; font-size: .82rem; font-weight: 750; margin-bottom: 3px; }
output { font: 600 .94rem/1.2 var(--mono); font-variant-numeric: tabular-nums; color: var(--accent); }
.angle-inputs { display: flex; align-items: center; gap: 11px; }
input[type="range"] { min-width: 0; flex: 1; margin: 0; accent-color: var(--accent); cursor: pointer; height: 43px; }
.step { flex: 0 0 43px; height: 43px; border: 1px solid #425577; border-radius: 7px; color: var(--blue); background: #1b2b45; font-size: 1.35rem; line-height: 1; }
.step:hover:not(:disabled) { background: #283e60; }
.step:disabled, input:disabled, .action:disabled { opacity: .6; cursor: default; }
.action { font-size: 1.0625rem; min-height: 45px; background: var(--accent); color: #36230d; border: 1px solid #ffdcaa; border-bottom: 3px solid #af7742; border-radius: 8px; padding: 8px 11px; font-weight: 700; }
.result-row { display: flex; align-items: center; gap: 9px; min-height: 36px; margin-top: 3px; }
.result { font-size: .81rem; line-height: 1.35; color: var(--muted); margin: 4px 0 0; flex: 1; }
.post-score { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--accent); font-size: .82rem; font-weight: 800; text-underline-offset: 4px; }
.result[data-kind="pass"] { color: #a6ecc6; font-weight: 600; }
.result[data-kind="miss"] { color: #ffb5a8; font-weight: 600; }
.text-button { background: transparent; border: 0; text-decoration: underline; color: var(--blue); min-height: 39px; padding: 4px 0 4px 3px; font-size: .875rem; }
.text-button:disabled { opacity: .55; }
.run-panel { background: #111c2f; border: 1px solid var(--line); border-radius: 13px; padding: 15px; }
.run-panel h2 { font-size: 1rem; letter-spacing: -.025em; }
.run-score { margin: 9px 0 2px; color: var(--ink); font-weight: 850; letter-spacing: -.075em; font-size: 2.34rem; line-height: 1; }
.run-score span { color: var(--muted); font-weight: 650; font-size: 1.25rem; }
.run-caption { margin: 3px 0 9px; color: var(--muted); font-size: .79rem; }
progress { display: block; width: 100%; height: 6px; border: 0; border-radius: 8px; background: #263751; overflow: hidden; accent-color: var(--accent); }
progress::-webkit-progress-bar { background: #263751; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.run-stats { margin: 8px 0 10px; }
.run-stats div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.run-stats dt { color: var(--muted); font-size: .76rem; }
.run-stats dd { margin: 0; color: var(--accent); font: 800 .82rem var(--mono); }
.level-link { display: inline-block; font-size: .8rem; color: var(--blue); font-weight: 800; text-decoration: none; }
.share { width: 100%; }

.below { margin-top: clamp(36px, 6vw, 65px); scroll-margin-top: 14px; }
.section-heading p { color: var(--muted); font-size: .91rem; margin: 7px 0 16px; }
.chapters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--card-gap); }
.chapter { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #111b2c; }
.chapter-art { display: block; width: 100%; height: 112px; object-fit: cover; background: #192947; }
.chapter-body { padding: 12px; }
.chapter h3 { margin: 0; font-size: .98rem; }
.chapter p { color: var(--muted); font-size: .77rem; margin: 5px 0 9px; min-height: 2.3em; }
.level-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.level-card { width: 100%; text-align: left; display: flex; align-items: center; gap: 6px; color: var(--ink); background: #1a2840; border: 1px solid #354966; border-radius: 6px; min-height: 42px; padding: 6px; font-size: .77rem; }
.level-card[aria-current="step"] { border-color: var(--accent); }
.level-card:not(:disabled):hover { border-color: var(--blue); }
.level-card:disabled { color: var(--muted); background: #162034; }
.level-number, .level-status { font: 600 .8125rem/1.3 var(--mono); color: var(--muted); }
.level-status { margin-left: auto; white-space: nowrap; }
.level-status[data-stars] { color: var(--accent); }
.guide h2 { margin-bottom: 15px; }
.guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.guide article { border-top: 1px solid var(--line); padding: 11px 4px 4px 0; }
.guide h3 { margin: 0 0 4px; font-size: .96rem; }
.guide p { color: var(--muted); font-size: .83rem; line-height: 1.55; margin-bottom: 5px; }
.site-footer {
  margin-top: clamp(2rem, 5vw, 4rem);
  border-top: 1px solid #897653;
  background: linear-gradient(110deg, #1c2d33, #101d27 62%);
}
.footer-layout {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  align-items: start;
  gap: clamp(2rem, 6vw, 6rem);
  padding-block: clamp(2rem, 4vw, 3.5rem);
}
.footer-layout::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: repeating-linear-gradient(90deg, #a28f6a 0 1px, transparent 1px 16px);
  opacity: .48;
}
.footer-wordmark {
  display: inline-flex; align-items: center; gap: .65rem; min-height: 44px;
  color: var(--paper); font: 400 2rem/1 var(--letterpress); text-decoration: none;
}
.footer-wordmark img { border-radius: 7px; }
.footer-signature p {
  max-width: 36ch; margin: .75rem 0 .35rem;
  color: #d4dcd8; font: 500 1.0625rem/1.55 var(--body);
}
.footer-board, .footer-links a { display: flex; align-items: center; width: fit-content; min-height: 44px; }
.footer-board { color: var(--accent); font-weight: 600; text-underline-offset: .3em; }
.footer-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.footer-links h2 {
  margin: 0 0 .45rem; color: #e4c791;
  font: 400 .875rem/1.4 var(--mono); letter-spacing: .025em;
}
.footer-links a { color: #e1e7e3; text-decoration: none; }
.site-footer a:hover { color: white; text-decoration: underline; text-underline-offset: .3em; }
@media (max-width: 700px) {
  .footer-layout { grid-template-columns: 1fr; gap: 1.25rem; }
  .footer-links { border-top: 1px solid #415054; padding-top: 1.25rem; }
}
@media(max-width: 900px) {
  .shell { width: calc(100% - 36px); }
  .game-grid { grid-template-columns: minmax(0,1fr) 233px; }
  .chapters { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width: 700px) {
  .game-grid { grid-template-columns: 1fr; }
}
@media(max-width: 560px) {
  .shell { width: calc(100% - 24px); }
  .navigation { min-height: 52px; gap: 6px; }
  .navigation nav { gap: 6px; }
  .navigation .menu-toggle { padding-inline: 8px; }
  .sound { padding-inline: 6px; }
  .site-mark { height: 26px; width: 26px; font-size: 18px; }
  .wordmark { font-size: 1rem; gap: 4px; }
  .intro { margin-top: 12px; min-height: 230px; border-radius: 12px; }
  .hero-art { width: 100%; }
  .intro::before { background: linear-gradient(90deg,#0d1729f8,#0d1729bd 56%,#0d17293d); }
  .hero-copy { padding: 17px; }
  h1 { font-size: clamp(2.5rem, 11vw, 3.7rem); }
  .intro p { margin: 9px 0 11px; max-width: 230px; font-size: .84rem; }
  .hero-primary, .hero-secondary { min-height: 38px; padding-inline: 8px; font-size: .72rem; }
  .hero-actions { gap: 6px; }
  .play-heading { margin-top: 13px; }
  .mode-switch button { min-height: 34px; padding-inline: 8px; }
  .game { border-radius: 11px; }

  .controls { grid-template-columns: 1fr; gap: 6px; margin-top: 8px; }
  .instruction { min-height: 2.4em; margin-bottom: 7px; font-size: .79rem; }
  .guide-grid { grid-template-columns: 1fr; }
}
@media(max-width: 356px) {
  .chapters { grid-template-columns: 1fr; }
  .result-row { gap: 5px; }
  .text-button { white-space: normal; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-primary, .hero-secondary, .action, .step, .subtle, .route-switch button, .mode-switch button {
    transition: background-color .18s ease, border-color .18s ease, opacity .18s ease, transform .16s ease;
  }
  .action:active:not(:disabled), .step:active:not(:disabled) { transform: translateY(1px); }
  .result[data-kind="pass"], .post-score:not([hidden]) { animation: feedback-enter .22s ease-out both; }
}
@keyframes feedback-enter {
  from { opacity: .52; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (pointer: coarse) {
  .route-switch button { min-width: 48px; min-height: 44px; }
  .drag-zone { width: 25%; }
}

.award {
  position:relative; isolation:isolate; overflow:hidden;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:13px 16px; margin-top:10px; border:1px solid #86704c; border-radius:9px;
  background:radial-gradient(ellipse at 100% 110%,#a67d3520,transparent 45%), linear-gradient(110deg,#382e24,#192337 78%);
  box-shadow:inset 0 1px #ffe3a919,inset 0 -1px #080e1880;
}
.award strong { min-width:0; font-size:.94rem; color:#ffe6b4; }
#award-stars { display:flex; flex:none; gap:.2em; font:1.48rem/1 var(--mono); }
#award-stars > span {
  position:relative; display:grid; place-items:center; width:1em;
  color:#252936; -webkit-text-stroke:1px #978568;
}
#award-stars .earned::before {
  content:"★"; position:absolute; inset:0; display:grid; place-items:center;
  color:#ffd283; -webkit-text-stroke:.55px #ffdf98;
  text-shadow:0 1px 2px #6a411a;
}
@media (prefers-reduced-motion:no-preference) {
  .award { animation:panel-seat .34s cubic-bezier(.2,.76,.25,1) backwards; }
  .award strong { animation:award-title-in .36s .08s ease-out backwards; }
  .award::after {
    content:""; position:absolute; z-index:-1; inset:0; pointer-events:none;
    background:linear-gradient(105deg,transparent 29%,#ffd68d09 43%,#ffe3a929 50%,transparent 66%);
    animation:award-sheen .85s .08s ease-in-out both;
  }
  #award-stars .earned::before { animation:star-seat .44s var(--delay) backwards; }
  #award-stars .earned::after {
    content:""; position:absolute; inset:-.36em; pointer-events:none;
    background:radial-gradient(circle at 22% 19%,#ffdc96 1px,transparent 1.5px),
      radial-gradient(circle at 81% 26%,#fff2c5 1px,transparent 1.6px),
      radial-gradient(circle at 76% 82%,#e6b66a .8px,transparent 1.4px),
      radial-gradient(circle at 13% 68%,#efc477 .8px,transparent 1.4px);
    animation:star-sparks .32s calc(var(--delay) + .12s) both;
  }
}
@keyframes award-title-in { from { opacity:0; transform:translateX(-5px); } }
@keyframes award-sheen {
  from { opacity:0; transform:translateX(-75%); }
  22%,65% { opacity:1; }
  to { opacity:0; transform:translateX(75%); }
}
@keyframes star-seat {
  0% { opacity:0; transform:translateY(4px) rotate(-14deg) scale(.48); }
  48% { opacity:1; transform:translateY(-1px) rotate(4deg) scale(1.18); text-shadow:0 0 7px #ffe6a6; }
  76% { transform:rotate(-1deg) scale(.97); }
  100% { transform:none; }
}
@keyframes star-sparks {
  from { opacity:0; transform:scale(.58); }
  30% { opacity:.9; }
  to { opacity:0; transform:scale(1.12); }
}
#seal-panel { padding:12px 14px; margin-top:9px; background:linear-gradient(105deg,#29271f,#162236); border:1px solid #6c5b42; border-radius:8px; }
.seal-head { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:4px 12px; font-size:.8rem; }
#seal-brief { color:#ddcfb5; }
.seal-count,.seal-replay { color:#f5d49b; font-size:.8rem; }
.seal-count { margin:10px 0; }
.seal-replay { background:#2c2b28; border:1px solid #77684d; border-radius:7px; min-height:42px; padding:5px 11px; margin-top:5px; font-weight:750; }

.guide details { margin-top: 1rem; border-top: 1px solid var(--line); padding-block: .85rem; }
.guide summary { cursor: pointer; font-weight: 600; }
.guide details p { max-width: 72ch; }

.gate-sequence { display: flex; gap: 5px; margin: 0 0 9px; padding: 0; list-style: none; }
.gate-sequence[hidden] { display: none; }
.gate-sequence li { flex: 1; padding: 5px 7px; border-top: 2px solid #54687d; background: #172538; color: #ccdaea; }
.gate-sequence strong, .gate-sequence span { display: block; font: .75rem/1.45 var(--mono); }
.gate-sequence strong { color: var(--muted); }
.gate-sequence li[data-state="passed"] { border-color: #8ddcb2; }
.gate-sequence li[data-state="blocked"] { border-color: #ff917e; }

.workshop-medal { display:flex; align-items:center; gap:.65rem; color:#d2bf9b; font:.8125rem var(--mono); margin:.65rem 0; }
.workshop-medal::before { content:""; width:42px; height:52px; flex:none; border-radius:6px; background: var(--medal-image, url("./assets/workshop-medals.jpg")) var(--medal-offset) center / var(--medal-size, 500% auto) no-repeat; filter:saturate(.45); }
.workshop-medal[data-earned="true"]::before { filter:none; box-shadow:0 0 0 1px #bc9657; }

.award.workshop-medal { justify-content:flex-start; }
.award.workshop-medal #award-stars { margin-left:auto; }
@media (max-width:600px) {
  .intro { min-height:0; }
  .hero-copy { padding:14px; }
  .intro h1 { font-size:clamp(1.9rem,8vw,2.8rem); }
  .intro h1 br { display:none; }
  .intro h1 span::before { content:" "; }
  .intro p { max-width:29ch; }
}

#mirror-lesson { color:#bce8dc; margin:.5rem 0; font-size:.86rem; }
#mirror-lesson summary { cursor:pointer; padding:.5rem 0; }
.mirror-dials { display:flex; gap:1.5rem; margin:.75rem 0; }
.mirror-dials span { display:flex; align-items:center; gap:.45rem; }
.mirror-dials b { display:flex; align-items:center; gap:.45rem; font-family:var(--mono); }
.mirror-dials b::before { content:""; width:28px; height:5px; background:linear-gradient(90deg,#50867c,#ffdb93); border-radius:3px; transform:rotate(var(--tilt)); }
#first-light { margin:1rem 0; overflow:hidden; background:#101d30; border-radius:12px; }
.ending-scene img { width:100%; height:auto; display:block; }
#first-light figcaption { padding:1rem; color:var(--muted); }
#first-light strong { display:block; color:var(--accent); margin-bottom:.3rem; }
.coast-ending-art { position:relative; }
.ending-scene[data-signal="pier"] { --lamp-x:93.1%; --lamp-y:24.2%; }
.ending-scene[data-signal="0"] { --lamp-x:62.95%; --lamp-y:43.4%; }
.ending-scene[data-signal="1"] { --lamp-x:65.05%; --lamp-y:49.9%; }
.ending-scene[data-signal="0"] .coast-ending-art img,
.ending-scene[data-signal="1"] .coast-ending-art img { aspect-ratio:1600/616; }
@media (max-width:560px) {
  .ending-scene:is([data-signal="0"],[data-signal="1"]) .coast-ending-art { width:116%; margin-left:-8%; }
}
@media (prefers-reduced-motion:no-preference) {
  .ending-scene.signal-visible.signal-loaded .coast-ending-art::after {
    content:""; position:absolute; pointer-events:none; opacity:0;
    left:var(--lamp-x); top:var(--lamp-y); transform:translate(-50%,-50%);
    width:4.3%; aspect-ratio:1; border-radius:50%;
    background:radial-gradient(circle,#fffce8 0 8%,#ffecac 16%,#ffbe5bd9 24%,#ffb24b60 42%,transparent 70%);
  }
  .ending-scene[data-signal="0"].signal-visible.signal-loaded .coast-ending-art::after {
    animation:pilot-flash .85s ease-in-out .25s 2;
  }
  .ending-scene[data-signal="1"].signal-visible.signal-loaded .coast-ending-art::after {
    animation:trawler-flash 1.85s ease-in-out .25s 1;
  }
  .ending-scene[data-signal="pier"].signal-visible.signal-loaded .coast-ending-art::after {
    background:radial-gradient(circle,#fff 0 12%,#e5f6ff 19%,#d7efffa8 32%,transparent 70%);
    animation:pilot-flash .85s ease-in-out .25s 2;
  }
  @keyframes pilot-flash { 0%,64%,100% { opacity:0; } 18%,38% { opacity:1; } }
  @keyframes trawler-flash { 0%,100% { opacity:0; } 18%,78% { opacity:1; } }
}

.work-order { margin:.65rem 0 .2rem; color:#ffdda3; font-weight:650; }
.work-order + .instruction { margin-top:.2rem; }
.repair-result { line-height:1.5; color:#d4dfec; }
.repair-log {
  width:100%; min-height:44px; margin-top:.65rem; padding:.65rem 0; border:0; border-top:1px solid var(--line);
  background:transparent; color:#eed2a2; text-align:left; font-size:.85rem; font-weight:650;
  text-decoration:underline; text-underline-offset:.25em;
}
.repair-log:hover { color:var(--paper); }
html { scrollbar-gutter:stable; }
html:has(.log-reader[open]) { overflow:hidden; }
.log-reader {
  width:min(30rem,calc(100% - 2rem)); max-height:min(36rem,85dvh); padding:0; overflow:hidden;
  border:1px solid #80765f; border-radius:12px; background:#162632; color:var(--paper); box-shadow:0 14px 65px #0008;
}
.log-reader[open] { display:flex; flex-direction:column; }
.log-reader::backdrop { background:#060e18b8; }
.log-reader header { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:1rem 1.25rem; border-bottom:1px solid #475453; }
.log-reader .edition { margin:0 0 .3rem; }
.log-reader h2 { font:500 1.8rem/1.15 var(--display); }
.log-reader .subtle { min-height:44px; }
.log-reader ol { list-style:none; margin:0; padding:0 1.25rem; overflow:auto; overscroll-behavior:contain; }
.log-reader li { padding:.9rem 0; }
.log-reader li + li { border-top:1px solid #39494d; }
.log-reader li strong { color:#ead4ab; }
.log-reader li p { margin:.25rem 0 0; line-height:1.55; color:#d4dfec; }

.rotation-guide { max-width:760px; padding-block:clamp(28px,6vw,68px); }
.rotation-guide h1 { font-size:clamp(2.3rem,6vw,4rem); line-height:1.04; letter-spacing:-.05em; }
.rotation-guide section { padding:1.4rem 0; border-top:1px solid var(--line); }
.rotation-guide p { color:var(--muted); line-height:1.65; }
.rotation-guide a { color:var(--accent); }

.field-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1.1rem; }
.field-grid article { padding-block:.7rem; }
.field-grid img,.rotation-guide figure img { display:block; width:100%; height:auto; border-radius:8px; }
.field-grid h3 { margin:.75rem 0 .3rem; }
.field-grid p,.field-guide > p,.rotation-guide figcaption { color:var(--muted); line-height:1.55; }
.field-guide a { color:var(--accent); }
.rotation-guide figure { margin:1rem 0; }
.rotation-guide figcaption { margin-top:.45rem; font-size:.88rem; }
@media(max-width:720px) { .field-grid { grid-template-columns:1fr; } }

.field-guide { padding-top:1.3rem; border-top:1px solid var(--line); }
.field-grid article { display:flex; flex-direction:column; align-items:flex-start; }
.field-grid article p { margin:.2rem 0 .85rem; }
.field-grid article a { margin-top:auto; text-underline-offset:.22em; }
.field-grid h3 { font-size:1.15rem; }
@media (prefers-reduced-motion:no-preference) {
  .field-grid img { transition:transform .22s ease-out; }
  .field-grid article:focus-within img { transform:translateY(-3px); }
  @media (hover:hover) { .field-grid article:hover img { transform:translateY(-3px); } }
}

.daily-next { display:flex; align-items:center; gap:.6rem 1.1rem; flex-wrap:wrap; margin:.8rem 0; }
.daily-next .level-link { margin:0; }
.launch-comparison { border-left:2px solid var(--accent); padding-left:.65rem; color:var(--muted); font:.8rem/1.5 var(--mono); }

.navigation nav { align-items: center; }
.wide-links { display: flex; gap: inherit; }
.menu-toggle { display: none; }
#site-menu {
  inset: 3.5rem 12px auto auto; margin: 0; padding: 6px;
  width: min(15rem, calc(100% - 24px)); max-height: calc(100dvh - 4.25rem); overflow-y: auto;
  background: #16232c; color: var(--ink); border: 1px solid #64675a; border-radius: 8px;
  box-shadow: 0 8px 22px #060d1680;
}
#site-menu a {
  display: flex; align-items: center; min-height: 44px; padding: .55rem .85rem;
  color: #e1e7e6; font-size: 1.1875rem; border-radius: 4px;
}
#site-menu a:is(:hover,:focus-visible) { background: #27383f; color: #ffe1aa; }
.hero-secondary { text-decoration: none; }
.mechanic-intro { margin-block: 20px 10px; }
.mechanic-intro h1 { font-size: clamp(1.65rem, 3vw, 2.4rem); line-height: 1.1; letter-spacing: -.045em; }
.mechanic-intro p { color: var(--muted); margin: 5px 0 0; }
.daily-context { margin: 0 0 12px; color: var(--accent); font-size: .85rem; }
.daily-context a { display: inline-block; margin-inline-start: .4em; color: var(--blue); }
@media (max-width: 60em) {
  .wide-links { display: none; }
  .menu-toggle { display: inline-block; }
}

@container (max-width: 530px) {
  canvas { aspect-ratio: 560 / 350; min-height: 188px; }
}
.skip-link { position: absolute; z-index: 2; left: 12px; top: 6px; padding: 10px; background: var(--deeper); color: var(--accent); transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.angle-controls { position: relative; }
.dial-keys { display: none; color: var(--muted); font: 400 .8125rem/1.4 var(--mono); }
@media (hover: hover) and (pointer: fine) {
  .dial-keys { display: block; margin-bottom: 3px; }
}
@media (pointer: coarse) {
  .step { height: 44px; flex-basis: 44px; }
  .menu-toggle, .sound, .mode-switch button, .level-card, .text-button { min-height: 44px; }
  .navigation nav > a { display: inline-flex; align-items: center; min-height: 44px; }
}
@media (max-width: 480px) {
  .chapters { grid-template-columns: 1fr; }
}

@media (orientation: landscape) and (max-height: 500px) and (min-width: 600px) and (max-width: 1000px) {
  .game-grid { grid-template-columns: 1fr; }
  .game { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); column-gap: 14px; }
  .game > * { grid-column: 1 / -1; }
  .game > .workbench { grid-column: 1; }
  .game > .controls { grid-column: 2; grid-template-columns: 1fr; align-self: center; margin-top: 0; }
  .game > .award:not([hidden]) ~ .controls,
  .game > .repair-result:not([hidden]) ~ .controls,
  .game > #ending-link:not([hidden]) ~ .controls,
  .game > #seal-panel:not([hidden]) ~ .controls { grid-column: 1 / -1; }
  .game > .workbench:has(~ .award:not([hidden]), ~ #seal-panel:not([hidden])) { grid-column: 1 / -1; }
  .game .workbench canvas { aspect-ratio: 2.3; }
}

/* The game and the control desk share the finish of the workshop instruments. */
body { background: radial-gradient(ellipse at 70% 0%, #1b2d40 0, transparent 44rem), #0a121e; }
.intro { border-color: #86725280; box-shadow: 0 18px 44px #02091452; }
.intro h1, .game-header h2, .section-heading h2, .chapter h3 {
  font-family: var(--display);
  font-weight: 500; letter-spacing: -.028em;
}
.intro h1 span { display: inline-block; font-family: var(--body); font-style: italic; color: #f0cf96; }
.game, .run-panel { background: linear-gradient(145deg,#203346,#132232 57%,#111c2c); border-color:#596066; box-shadow: inset 0 1px #e8ddc018, 0 12px 26px #030a1255; }
.game-header h2 { font-size:clamp(1.8rem,3vw,2.6rem); }
.workbench { border: 2px solid #86775f; box-shadow: 0 0 0 1px #080e16, 0 3px 8px #050a1588; }
.controls { padding: 10px 12px; background:linear-gradient(165deg,#263a48,#142330 65%); border:1px solid #53606a; border-radius:9px; box-shadow:inset 0 1px #c6cfd421; }
.angle-label { text-transform: uppercase; font: 650 .8125rem var(--mono); letter-spacing:.09em; align-items:center; }
.angle-label output { background:#0a1822; padding:3px 6px; border-radius:3px; letter-spacing:0; }
.dial-track { flex:1; min-width:0; position:relative; display:flex; align-items:center; background:repeating-linear-gradient(90deg,#ad9d786b 0 1px,transparent 1px 5%) center bottom 5px / calc(100% - 12px) 5px no-repeat; }
#aim-memory { position:absolute; pointer-events:none; top:2px; width:0; height:0; border:4px solid transparent; border-top-color:#ffa88e; transform:translateX(-50%); }
.action,.hero-primary { color:#2d2116; background:linear-gradient(170deg,#fff0c7,#e9c083 66%,#cb975d); box-shadow:inset 0 1px #fff6dc,0 2px 4px #070e1980; }
.step { background:linear-gradient(#334958,#1b2c3b); border-color:#64717a; }
.chapter { background:linear-gradient(145deg,#1c3041,#101b2a); border-color:#3b4955; }
.chapter h3 { font-size:1.3rem; }
.gate-sequence { margin-top:10px; }
@media(max-width:560px) {
  .controls { padding:7px 9px; }
  .instruction { min-height:0; }
  .intro p { max-width:34ch; }
  .hero-copy { padding-block:12px; }
  .game { padding:10px; }
}

.showcase { min-width:0; position:relative; padding:5px; background:linear-gradient(135deg,#7c735d,#253445 3%,#122230 65%,#4c473d); border:1px solid #b19a73; border-radius:12px; box-shadow:0 8px 28px #0008,inset 0 1px #e7d2a23b; }
#demo-board { aspect-ratio:2.35; border-radius:7px; background:#162333; }
.demo-choices { display:flex; gap:3px; padding:4px 0 0; }
.demo-choices button,.showcase a { font:650 .8125rem var(--mono); color:#d5dce1; }
.demo-choices button { border:1px solid transparent; background:transparent; border-radius:4px; min-height:34px; padding:4px 8px; }
.demo-choices button[aria-pressed="true"] { background:#35444b; border-color:#91836c; color:#ffe1a4; }
#demo-pause { margin-right:auto; }
.showcase a { position:absolute; right:12px; bottom:14px; color:var(--accent); }
@keyframes drive-wheel { to { transform:rotate(1turn); } }

/* Dissolve the old workbench over the live rail. Only the snapshot moves. */
.workbench .board-change {
  position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%;
  pointer-events: none; will-change: transform, opacity;
}
@media (prefers-reduced-motion: no-preference) {
  .workbench[data-board-change="workshop"]::after {
    content: ""; position: absolute; z-index: 3; pointer-events: none;
    inset: 0 auto 0 0; width: 45%;
    background: linear-gradient(106deg, transparent 18%, color-mix(in srgb, var(--shop-light) 14%, transparent) 50%, transparent 82%);
    animation: workshop-reflection 460ms cubic-bezier(.28,.35,.35,1) both;
  }
}
@keyframes workshop-reflection {
  from { opacity: 0; transform: translateX(-100%); }
  35% { opacity: .9; }
  to { opacity: 0; transform: translateX(225%); }
}
.sound::before { content:""; display:inline-block; vertical-align:middle; width:14px; height:13px; margin-right:5px; background:linear-gradient(currentColor 0 0) left center/2px 35%,linear-gradient(currentColor 0 0) center/2px 80%,linear-gradient(currentColor 0 0) right center/2px 55%; background-repeat:no-repeat; }
.sound[aria-pressed="false"]::before { opacity:.62; background-size:2px 18%,2px 18%,2px 18%; }
#refresh-ranks::before { content:"↻"; display:inline-block; margin-right:4px; }
@media(prefers-reduced-motion:no-preference) {
  .sound[aria-pressed="true"]::before { animation:audio-meter .4s ease-in-out 2 alternate; }
  #refresh-ranks:disabled::before { animation:drive-wheel .85s linear infinite; }
  .mode-switch button[aria-pressed="true"], .route-switch button[aria-pressed="true"] { animation:switch-engage .28s ease-out; }
  .gate-sequence li:is([data-state="passed"],[data-state="blocked"]) { animation:switch-engage .24s ease-out; }
  #seal-panel:not([hidden]) { animation:panel-seat .36s cubic-bezier(.2,.8,.2,1) both; }
  .guide details[open] p, #mirror-lesson[open] .mirror-dials, #site-menu:popover-open { animation:panel-seat .25s ease-out; }
  .site-mark { transition:transform .38s cubic-bezier(.2,.8,.3,1); }
  .wordmark:is(:hover,:focus-visible) .site-mark { transform:rotate(-12deg); }
  .chapter-art,.chapter,.level-card,.hero-secondary { transition:transform .24s ease-out, border-color .24s ease-out; }
  .chapter:focus-within .chapter-art { transform:scale(1.025); }
  @media(hover:hover) {
    .chapter:hover { border-color:#928169; }
    .chapter:hover .chapter-art { transform:scale(1.035); }
    .level-card:enabled:hover,.hero-secondary:hover { transform:translateY(-2px); }
  }
}
@keyframes audio-meter { to { background-size:2px 85%,2px 36%,2px 91%; } }
@keyframes switch-engage { 0% { transform:scale(.96); } 65% { transform:scale(1.02); } }
@keyframes panel-seat { from { opacity:.15; transform:translateY(7px); } to { opacity:1; transform:none; } }
.gate-options { display:flex; gap:6px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
#motor-phase-control { display:flex; gap:10px; align-items:center; color:var(--accent); font:700 .78rem var(--mono); }

.watch-mode { display:inline-flex; align-items:center; color:var(--muted); padding:0 10px; text-decoration:none; font-size:.83rem; font-weight:750; border:1px solid transparent; border-radius:6px; }
.night-invitation { min-height:215px; margin-top:38px; display:grid; align-items:center; background:linear-gradient(90deg,#091a1d 4%,#0b1d20e6 28%,#0b1d2066 53%,transparent 75%),url("./assets/night-watch.jpg") center 52%/cover; border:1px solid #766950; border-radius:14px; overflow:hidden; }
.night-invitation > div { padding:clamp(18px,3vw,38px); max-width:435px; }
.night-invitation h2 { font:italic 500 clamp(2rem,4vw,3rem)/1 var(--body); color:#f6dfb9; }
.night-invitation p { color:#e1e6dd; line-height:1.5; margin:.6rem 0 .9rem; }
body[data-entry="night-watch"] { background:radial-gradient(ellipse at 70% 0%,#29362e,transparent 48rem),#0b151a; }
body[data-entry="night-watch"] .intro { border-color:#9e8461; }
body[data-entry="night-watch"] .hero-art { width:100%; object-position:55% 50%; }
body[data-entry="night-watch"] .intro::before { background:linear-gradient(90deg,#091720e8,#10202bc7 28%,#1223303d 56%,transparent 73%); }
body[data-entry="night-watch"] .game { background:linear-gradient(145deg,#263a3d,#14272b 60%,#13202a); }
body[data-entry="night-watch"] .chapters { grid-template-columns:repeat(3,minmax(0,1fr)); }
body[data-entry="night-watch"] .chapter-art { height:clamp(160px,19vw,235px); }

@media (max-width:560px) {
  body[data-entry="night-watch"] .hero-art { object-position:74% center; }
  body[data-entry="night-watch"] .intro .hero-copy { padding-block:10px; }
  body[data-entry="night-watch"] .intro p { max-width:min(30ch,68%); }
  .ending-scene[data-signal="pier"] .coast-ending-art { width:174.4%; margin-left:-64%; }
  .night-invitation { background-image:linear-gradient(90deg,#091720ee,#10202b9c 52%,transparent 78%),url("./assets/night-watch-mobile.webp"); }
}
@media(max-width:650px) {
  body[data-entry="night-watch"] .chapters { grid-template-columns:1fr; }
  .watch-mode { padding-inline:5px; font-size:.75rem; }
  .night-invitation { background-position:center,72% center; }
  .night-invitation > div { max-width:85%; }
}
.workshop-index { display:flex; flex-wrap:wrap; gap:0 18px; border-bottom:1px solid #576158; margin-bottom:20px; }
.workshop-index a { display:inline-flex; align-items:center; min-height:44px; text-decoration:none; font:400 1.125rem/1.3 var(--letterpress); color:var(--muted); padding:8px 0; }
.workshop-index a[aria-current] { color:var(--accent); border-bottom:2px solid currentColor; }

/* The desk picks up the paint, edge metal and nameplate of the current instrument. */
#game[data-workshop] {
  --accent: var(--shop-light);
  --blue: color-mix(in srgb, var(--shop-light) 75%, white);
  --muted: color-mix(in srgb, var(--shop-trim) 37%, #d0d8df);
  --edge: color-mix(in srgb, var(--shop-trim) 52%, var(--shop-frame));
  --grain: repeating-linear-gradient(0deg, transparent 0 3px, #e7edf305 3px 4px);
  background: radial-gradient(ellipse at 0 0, var(--shop-enamel), transparent 66%),
    linear-gradient(142deg, var(--shop-frame), color-mix(in srgb, var(--shop-frame) 52%, #091017));
  border-color: var(--edge);
}
#game:is([data-material="timber"], [data-material="rail"]) {
  --grain: repeating-linear-gradient(174deg, #b8936119 0 1px, transparent 2px 8px, #17100c22 9px 11px, transparent 12px 17px);
}
#game:is([data-material="optical"], [data-material="copper"]) {
  --grain: repeating-linear-gradient(123deg, transparent 0 23px, #fff2de12 24px, transparent 26px 48px);
}
#game[data-material="celestial"] {
  --grain: repeating-radial-gradient(ellipse at 92% 105%, transparent 0 21px, #e8cb8e1f 22px, transparent 23px 39px);
}
#game:is([data-material="water"], [data-material="bronze"]) {
  --grain: repeating-radial-gradient(ellipse at -8% 140%, transparent 0 17px, #cfddd511 18px, transparent 20px 31px);
}
.game[data-workshop] .game-header {
  isolation: isolate; position: relative; align-items: center; overflow: hidden;
  padding: clamp(9px, 1.3vw, 16px); gap: clamp(8px, 1.2vw, 16px);
  border: 1px solid var(--edge); border-radius: 8px;
  background: var(--grain), linear-gradient(108deg,
    color-mix(in srgb, var(--shop-frame) 68%, var(--shop-enamel)), var(--shop-frame) 65%);
  box-shadow: inset 0 1px #ffffff12, inset 0 -2px #0003;
}
.game[data-workshop] .game-header::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  inset: 5px 10px; border-block: 1px solid color-mix(in srgb, var(--shop-trim) 32%, transparent);
  mask-image: linear-gradient(90deg, transparent, black 14%, black 86%, transparent);
}
.game[data-workshop] .game-header::after {
  content: ""; order: -1; flex: 0 0 clamp(42px, 5vw, 67px); aspect-ratio: 1;
  background: url("./assets/workshop-dials.webp") var(--shop-emblem) / 400% 300%;
  filter: drop-shadow(0 2px 3px #0009);
}
.game[data-workshop] .game-header > div:first-child { flex: 1; min-width: 0; }
.game[data-workshop] .game-header h2 { text-shadow: 0 2px 7px #080c13; }
.game[data-workshop] .game-header .eyebrow { color: var(--shop-light); margin-bottom: 3px; }
.game[data-workshop] .gate-count, .game[data-workshop] .route-switch button {
  border-color: var(--edge); color: var(--blue); background: var(--shop-frame);
}
.game[data-workshop] .route-switch button[aria-pressed="true"] { background: var(--shop-enamel); border-color: var(--shop-light); }
.game[data-workshop] .workbench { border-color: var(--shop-trim); }
.game[data-workshop] .controls {
  background: var(--grain), linear-gradient(165deg, var(--shop-enamel), var(--shop-frame) 80%);
  border-color: var(--edge); border-top-color: var(--shop-trim);
}
.game[data-workshop] .step {
  color: var(--blue); border-color: var(--edge);
  background: linear-gradient(var(--shop-enamel), var(--shop-frame));
}
.game[data-workshop] .step:hover:not(:disabled) { border-color: var(--shop-light); }
.game[data-workshop] .action {
  color: #181914; border-color: var(--shop-light); border-bottom-color: var(--edge);
  background: linear-gradient(160deg, color-mix(in srgb, var(--shop-light) 70%, white), var(--shop-light) 52%, var(--shop-trim));
}
.game[data-workshop] .action:hover:not(:disabled) { filter: brightness(1.08); }
.game[data-workshop] .gate-sequence li {
  background: linear-gradient(115deg, var(--shop-frame), color-mix(in srgb, var(--shop-enamel) 35%, var(--shop-frame)));
}
.game[data-workshop] .gate-sequence li:not([data-state="passed"]):not([data-state="blocked"]) { border-color: var(--edge); }
.game[data-workshop] .workbench.driving { box-shadow: 0 0 10px color-mix(in srgb, var(--shop-light) 38%, transparent); }
@media (max-width: 550px) {
  .game[data-workshop] .game-header { flex-wrap: wrap; gap: 5px 9px; }
  .game[data-workshop] .game-header::after { flex-basis: 38px; }
  .game[data-workshop] .game-header > div:first-child { flex: 1 1 40%; }
  .game[data-workshop] .gate-options { margin-left: auto; }
  .game[data-workshop] .gate-count { font-size: .8125rem; padding: 3px 6px; }
}

/* Keep the instrument colourful and the surrounding pages quiet. */
:root {
  --paper: #f3ead7;
}
body { background: #0c1620; }
.lost-page {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  align-items: center; margin-block: clamp(1rem, 5vw, 4rem); overflow: hidden;
  background: #15232c; border: 1px solid #54615e; border-radius: 10px;
}
.lost-page img { width: 100%; height: clamp(180px, 36vw, 410px); object-fit: cover; }
.lost-page > div { padding: clamp(1.25rem, 4vw, 3rem); }
.lost-page h1 { font: 500 clamp(2.4rem, 5vw, 4.5rem)/1.05 var(--display); color: var(--paper); letter-spacing: -.03em; }
.lost-page p { max-width: 38ch; line-height: 1.55; color: #ced8d8; }
.lost-daily { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); text-underline-offset: .22em; }
.site-header { background: #0c1620; border-color: #354047; }
.navigation { min-height: 58px; }
.navigation nav a, .navigation .subtle { font: 400 1.125rem/1.25 var(--letterpress); }
.navigation nav > a, .wide-links a { display: inline-flex; align-items: center; min-height: 44px; }
.navigation .wordmark { min-height: 44px; letter-spacing: .035em; }
.navigation .subtle { min-height: 44px; background: transparent; border-color: #455258; color: #d9dedb; }
.intro {
  min-height: clamp(225px, 20vw, 280px);
  margin-top: 18px; border-radius: 10px; border-color: #5e6056;
  background: #101c24;
}
.hero-art { width: 84%; object-position: 65% 50%; }
.intro::before { background: linear-gradient(90deg,#101c24 7%,#101c24fa 21%,#101c24cc 39%,#101c2444 59%,transparent 76%); }
.hero-copy { padding: clamp(20px,2.5vw,36px); max-width: 640px; }
.edition { display: block; margin-bottom: .6rem; font: 600 .76rem/1.3 var(--mono); letter-spacing: .075em; color: #ead2a4; }
.intro h1 { font: 500 clamp(2.5rem,4.5vw,4.5rem)/1 var(--display); letter-spacing: -.03em; color: var(--paper); }
.intro h1 br { display: none; }
.intro h1 span::before { content: " "; }
.intro p { max-width: 37ch; margin: .6rem 0 1rem; font-size: 1rem; color: #d5dfde; }
.hero-primary,.hero-secondary { min-height: 44px; font-size: 1.0625rem; font-weight: 400; }
.hero-secondary { background: transparent; border: 0; padding-inline: 4px; color: #ebdec4; text-decoration: underline; text-underline-offset: .28em; }
.hero-secondary:hover { background: transparent; color: white; }
.play-heading { margin-block: clamp(14px, 2vw, 24px) clamp(12px, 1.5vw, 20px); }
.mode-switch { border: 0; padding: 0; background: none; gap: 4px; }
.mode-switch a, .help-trigger {
  display: inline-flex; align-items: center; min-height: 44px; padding: .45rem .9rem;
  border: 1px solid transparent; border-radius: 6px; background: transparent;
  color: #becbcf; font: 400 1.125rem/1.25 var(--letterpress); text-decoration: none;
}
.mode-switch a:hover, .help-trigger:hover { color: white; background: #22313a; }
.mode-switch a[aria-current="page"] {
  position: relative; color: #ffe1a8; background: #252d2d;
}
.mode-switch a[aria-current="page"]::after {
  content: ""; position: absolute; bottom: 3px; left: 22%; right: 22%;
  border-bottom: 2px solid currentColor; border-radius: 1px;
}
.mode-switch a:focus-visible {
  outline: 1px dashed #ffe1a8; outline-offset: -2px;
}
.help-trigger { text-decoration: underline; text-underline-offset: .25em; }
.control-note {
  width: min(28rem, calc(100% - 32px)); max-height: 85dvh; padding: 1.4rem;
  color: var(--ink); background: #162733; border: 1px solid #8c8064; border-radius: 12px;
  box-shadow: 0 18px 80px #0008;
}
.control-note::backdrop { background: #030a14a8; }
.control-note > div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.control-note h2,.bench-note h2,.field-guide > h2,.guide-entries h2 { font: 500 clamp(1.55rem,2.5vw,2.25rem)/1.1 var(--display); color: var(--paper); }
.control-note button { color: var(--paper); background: transparent; border: 1px solid #627073; border-radius: 6px; padding: .6rem .8rem; }
.control-note dl { margin: .8rem 0 0; }
.control-note dt { color: var(--accent); margin-top: .85rem; font-weight: 650; }
.control-note dd,.collision-note p,.score-help p { margin: .2rem 0; line-height: 1.55; color: #ccd4d8; }
.instruction { font-size: .95rem; line-height: 1.4; }
.result { font-size: .95rem; line-height: 1.4; }
#cloud-status { margin: .75rem 0 .1rem; color: var(--muted); font-size: .9rem; line-height: 1.45; }
#cloud-status { min-height: 1lh; }
.run-panel { padding: 19px; background: #15232d; border-color: #414e52; }
.run-score { font: 400 2.8rem/1.05 var(--mono); letter-spacing: -.045em; font-variant-numeric: lining-nums; }
.run-score span { font: 400 1.3rem var(--mono); }
.score-help,.collision-note { border-top: 1px solid #435057; margin-top: .4rem; font-size: .875rem; }
.score-help summary,.collision-note summary,.demo-lesson summary { cursor: pointer; padding-block: .7rem; color: #ead4ab; }
.level-link { padding-block: .5rem; text-underline-offset: .25em; text-decoration: underline; }
/* Adjacent cards share tracks for the artwork, title, note, progress, jobs, medal and log. */
.chapters { row-gap: 0; }
.chapter { display: grid; grid-row: span 7; grid-template-rows: subgrid; margin-bottom: var(--card-gap); }
.chapter-art { height: auto; aspect-ratio: 2.15; }
.chapter-body { display: grid; grid-row: span 6; grid-template-rows: subgrid; min-width: 0; padding: 14px; }
.chapter p { font-size: .9rem; line-height: 1.45; }
.chapter-progress { border-top: 1px solid #465258; padding-block: .7rem; color: #ead4ab; font: 600 .82rem/1.4 var(--mono); }
.chapter .level-list { grid-auto-rows: 1fr; }
.chapter .level-card { height: 100%; font-size: .86rem; }
.field-guide,.bench-note { border-top: 1px solid #59615e; padding-top: 1.4rem; }
.field-grid { margin-top: .8rem; }
.field-grid img { border: 1px solid #596365; border-radius: 5px; }
.field-grid h3 { font: 500 1.5rem/1.15 var(--display); color: var(--paper); }
.bench-note { display: grid; grid-template-columns: minmax(180px,1fr) minmax(0,2fr); gap: 2rem; margin: 2.5rem 0; }
.bench-note p { max-width: 65ch; margin: 0 0 .7rem; line-height: 1.6; color: #bfcccf; }
.bench-note a,.guide-entries a { color: var(--accent); text-underline-offset: .25em; }
.demo-lesson { margin-top: 1rem; }
.demo-lesson .showcase { max-width: 640px; }
.showcase .demo-choices { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.demo-choices button { min-height: 44px; }
.showcase a { position: static; display: inline-flex; padding: .55rem; text-underline-offset: .2em; }
.mechanic-intro { position: relative; overflow: hidden; isolation: isolate; background: #13212b; border-block: 1px solid #485554; border-radius: 6px; }
.mechanic-intro .hero-art { width: 45%; mask-image: linear-gradient(90deg,transparent,#000 65%); opacity: .75; }
.mechanic-intro .hero-copy { max-width: 80%; padding: 18px 22px; }
.mechanic-intro h1 { font: 500 clamp(2rem,3.6vw,3.5rem)/1 var(--display); color: var(--paper); }
.mechanic-intro p { color: #d4dfe1; line-height: 1.4; }
.rotation-guide { max-width: 1050px; }
.guide-cover { border-bottom: 1px solid #746e5c; padding-bottom: 1.2rem; }
.guide-cover h1 { font: 500 clamp(2.7rem,6vw,5rem)/1 var(--display); letter-spacing: -.04em; color: var(--paper); }
.guide-cover p { max-width: 60ch; margin-bottom: 0; }
.guide-layout { display: grid; grid-template-columns: minmax(9rem,1fr) minmax(0,3fr); gap: clamp(20px,5vw,76px); }
.guide-contents { align-self: start; position: sticky; top: 1rem; display: grid; margin-top: 1.3rem; }
.guide-contents strong { color: #bfc9c9; font-size: .85rem; margin-bottom: .4rem; }
.guide-contents a { display: inline-flex; align-items: center; min-height: 44px; padding: .5rem 0; font: 400 1.125rem/1.35 var(--letterpress); text-underline-offset: .22em; }
.guide-entries section { scroll-margin-top: 1rem; }
.guide-entries section:first-child { border: 0; }
.guide-entries figcaption { font-family: var(--mono); font-size: .8rem; }
@media (prefers-reduced-motion: no-preference) {
  .control-note:popover-open,.collision-note[open] p { animation: panel-seat .18s ease-out; }
}
@media (max-width: 700px) {
  .guide-layout,.bench-note { grid-template-columns: 1fr; gap: .75rem; }
  .guide-contents { position: static; display: flex; align-items: center; flex-wrap: wrap; gap: 0 1rem; }
  .guide-contents strong { width: 100%; }
}
@media (max-width: 560px) {
  .navigation { min-height: 49px; }
  .navigation nav > a, .navigation .subtle { font-size: 1rem; }
  .intro { min-height: 0; margin-top: 10px; }
  .hero-copy { padding: 14px; }
  .edition { margin-bottom: .35rem; font-size: .75rem; letter-spacing: .035em; }
  .intro h1 { font-size: clamp(1.85rem,7.7vw,2.7rem); }
  .intro p { max-width: 31ch; font-size: .92rem; margin: .35rem 0 .55rem; }
  .intro::before { background: linear-gradient(90deg,#101c24f7 6%,#101c24e3 40%,#101c249e 65%,#101c2433); }
  .hero-primary,.hero-secondary { font-size: .82rem; }
  .play-heading { margin-block: 12px 10px; }
  .mode-switch a,.help-trigger { padding-inline: .4rem; font-size: 1rem; }
  .instruction, .result { font-size: 1rem; line-height: 1.5; }
  .instruction { min-height: 0; color: #d9e3ec; }
  .controls { padding: 10px; gap: 9px; }
  .dial-keys { display: none; }
  .angle-label { font-size: .875rem; margin-bottom: 4px; }
  .angle-label output { min-width: 5ch; text-align: right; font-size: 1.25rem; }
  .result-row { flex-direction: column; align-items: flex-start; gap: 0; }
  .result-row .result { flex: auto; margin-top: 8px; }
  .result[data-kind=""] { color: #d9e3ec; }
  .gate-sequence { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .gate-sequence li { padding: 7px 9px; }
  .gate-sequence strong { font-size: .875rem; font-weight: 700; color: var(--paper); }
  .gate-sequence span { font-size: .875rem; margin-top: 2px; }
  #demo-board { aspect-ratio: 1.6; min-height: 188px; }
  .chapter-art { aspect-ratio: 2.65; }
  .mechanic-intro { margin: 10px 0 0; }
  .mechanic-intro .hero-copy { max-width: 100%; padding: 12px 14px; }
  .mechanic-intro .hero-art { opacity: .35; }
  .mechanic-intro p { font-size: .9rem; max-width: 36ch; }
  .demo-choices button { font-size: .8rem; }
  .run-panel { padding: 15px; }
}

@media (max-width: 389px) {
  .navigation .sound { width: 44px; flex: none; font-size: 0; }
  .navigation .sound::before { width: 20px; height: 19px; margin: 0; }
}
@media (min-width: 1000px) and (max-height: 900px) {
  .intro { min-height: 0; margin-top: 12px; }
  .intro .hero-copy { padding: 15px 26px; max-width: 680px; }
  .intro h1 { font-size: 2.9rem; }
  .intro p { max-width: 55ch; margin: 4px 0 8px; font-size: .95rem; }
  .intro .edition { margin-bottom: 3px; }
  .play-heading { margin-block: 18px 16px; }
  .game[data-workshop] .game-header { padding-block: 9px; }
  .game[data-workshop] .game-header::after { flex-basis: 46px; }
  .game-header h2 { font-size: 2rem; }
  .workbench #board { aspect-ratio: 3.1; }
}

/* Keep the responsive canvas in flow while its first frame is loading. */
.board-poster { position:absolute; inset:0; width:100%; height:100%; z-index:1; pointer-events:none; transition:opacity 150ms ease-out; }
.workbench[data-painted] .board-poster { opacity:0; }
@media (prefers-reduced-motion: reduce) { .board-poster { transition:none; } }

/* Keep the coast campaign copy clear of the launch dial. */
.intro:has(.hero-art[src$="/workshop.jpg"]) .hero-art {
  width: 77%;
  object-position: center;
}
.intro:has(.hero-art[src$="/workshop.jpg"]) .hero-copy {
  box-sizing: border-box;
  width: 41%;
}
.intro:has(.hero-art[src$="/workshop.jpg"])::before {
  background: linear-gradient(90deg, #101c24 24%, #101c24ed 30%, transparent 43%);
}
@media (max-width: 1050px) {
  body[data-entry="coast"] .intro:has(.hero-art) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44%;
    min-height: 0;
    align-items: stretch;
  }
  body[data-entry="coast"] .intro:has(.hero-art) .hero-art {
    position: absolute;
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    height: 100%;
    object-position: 34% center;
  }
  body[data-entry="coast"] .intro:has(.hero-art) .hero-copy {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    max-width: none;
  }
  body[data-entry="coast"] .intro:has(.hero-art)::before { content: none; }
}
@media (max-width: 560px) {
  body[data-entry="coast"] .intro:has(.hero-art) { grid-template-columns: minmax(0, 1fr) 27%; }
  body[data-entry="coast"] .intro:has(.hero-art) .hero-art { object-position: center; }
  body[data-entry="coast"] .intro:has(.hero-art) .hero-copy { padding: 8px 12px; }
  body[data-entry="coast"] .play-heading { margin-block: 6px; }
  body[data-entry="coast"] .controls { margin-top: 5px; padding-block: 7px; }
  body[data-entry="coast"] .intro h1 {
    display: flex;
    flex-wrap: wrap;
    column-gap: .2em;
    font-size: clamp(1.62rem, 6.8vw, 2.05rem);
  }
  body[data-entry="coast"] .intro h1 span { white-space: nowrap; }
  body[data-entry="coast"] .intro h1 span::before { content: none; }
  body[data-entry="coast"] .hero-secondary { display: none; }
}

.rotation-guide.policy-page { max-width: 760px; }
.policy-page h1 { margin-bottom: 1rem; }
.policy-page p { overflow-wrap: anywhere; }
