:root {
  font-family: ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  color: #17234c;
  background: #e8edff;
  font-size: 16px;
  --ink: #17234c;
  --cream: #fff6db;
  --yellow: #ffd05c;
  --blue: #224bba;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background-image: repeating-linear-gradient(0deg,#496ac012 0 1px,transparent 1px 5px),
    radial-gradient(#4b569427 1px,transparent 1.4px);
  background-size: auto, 10px 10px;
}
button { font: inherit; color: inherit; cursor: pointer; min-width: 44px; min-height: 44px; }
button:focus-visible, a:focus-visible { outline: 3px solid #ff654d; outline-offset: 3px; }
[hidden] { display: none !important; }
#game {
  position: relative; isolation: isolate; overflow: hidden; width: 100%; height: 89svh;
  min-height: 340px; background: #244cbb; outline: none; user-select: none;
  touch-action: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
#game canvas { display: block; width: 100%; height: 100%; }
#game:fullscreen, #game.expanded {
  height: 100dvh; min-height: 0; max-height: none; width: 100%;
}
#game.expanded { position: fixed; inset: 0; z-index: 20; }
html.no-scroll { overflow: hidden; }
.game-menu { display: flex; gap: 8px; position: absolute; z-index: 5; top: max(14px, env(safe-area-inset-top)); right: max(18px, env(safe-area-inset-right)); }
button { border: 2px solid var(--ink); border-radius: 12px; background: var(--cream); padding: 8px 14px; font-weight: 800; }
button:hover { background: #fff; }
button:active { translate: 0 2px; }
.round { display: grid; place-items: center; padding: 0; width: 48px; height: 48px; border-radius: 50%; }
.game-menu .round { box-shadow: 0 4px var(--ink); }
.menu-button::before { content: ""; width: 16px; height: 2.5px; background: var(--ink); border-radius: 2px; box-shadow: 0 5px var(--ink), 0 -5px var(--ink); }
.fullscreen-exit, #game:is(:fullscreen, .expanded) .fullscreen-enter { display: none; }
#game:is(:fullscreen, .expanded) .fullscreen-exit { display: block; }
.primary { background: var(--yellow); box-shadow: 0 5px var(--ink); min-width: 116px; }
#intro { position: absolute; top: 50%; left: max(8%,env(safe-area-inset-left)); translate: 0 -50%; }
h1 { margin: 0; font-size: clamp(42px, 6vw, 106px); line-height: .96; letter-spacing: -.05em; max-width: 7em; }
.brand { display: block; letter-spacing: normal; line-height: normal; font-size: clamp(18px, 2.2vw, 27px); font-weight: 800; margin: 14px 0 25px; }
#intro .primary { font-size: 24px; min-width: 132px; min-height: 54px; }
#cover-progress { font-size: 14px; font-weight: 750; margin: 19px 0 0; min-height: 1.4em; }
#hud { display: flex; position: absolute; top: max(16px, env(safe-area-inset-top)); left: max(15px, env(safe-area-inset-left)); align-items: flex-start; gap: 7px; color: var(--ink); }
.meter { font-size: 15px; font-variant-numeric: tabular-nums; background: var(--cream); padding: 9px 11px; border-radius: 11px; font-weight: 800; white-space: nowrap; border: 2px solid var(--ink); }
#mission { position: absolute; top: max(16px, env(safe-area-inset-top)); left: 50%; translate: -50% 0; margin: 0; width: max-content; max-width: calc(100% - 24px); pointer-events: none; text-align: center; background: #ffe8ac; color: var(--ink); border: 2px solid var(--ink); border-radius: 11px; padding: 8px 11px; font-size: 15px; font-weight: 800; }
#toast { position: absolute; top: max(61px, calc(env(safe-area-inset-top) + 52px)); left: 50%; translate: -50% 0; margin: 0; width: max-content; max-width: calc(100% - 25px); text-align: center; background: var(--ink); color: white; border-radius: 9px; padding: 7px 12px; font-size: 15px; font-weight: 700; pointer-events: none; }
#toast[data-raid="watch"] { background: #ffe8ac; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
#toast[data-raid="urgent"] { background: #782837; color: #fff6db; box-shadow: inset 0 0 0 2px #ffc39c, 0 3px var(--ink); }
#controls { position: absolute; inset: 0; pointer-events: none; }
#controls button { position: absolute; top: min(89%, calc(100% - 30px - env(safe-area-inset-bottom))); translate: -50% -50%; pointer-events: auto; min-width: 104px; min-height: 51px; box-shadow: 0 4px var(--ink); }
#controls button:active, #controls button[data-pressed] { translate: -50% calc(-50% + 3px); box-shadow: 0 1px var(--ink); }
[data-control="lock"] { left: 19%; }
[data-control="lock"].ready-alert { background: #ffcb71; outline: 3px solid #fff3bb; outline-offset: 3px; }
[data-control="take"] { left: 50%; background: var(--yellow); }
[data-control="shove"] { left: 81%; }
kbd { font: inherit; font-size: 14px; opacity: .8; margin-left: .35em; }
.scrim { position: absolute; inset: 0; z-index: 4; background: #10193e91; display: grid; place-items: center; padding: 12px; }
.panel { position: relative; background: var(--cream); border: 2px solid var(--ink); border-radius: 22px; box-shadow: 9px 9px var(--ink); padding: 26px; width: min(100% - 12px, 440px); max-height: calc(100% - 20px); overflow: auto; overscroll-behavior: contain; touch-action: pan-y; }
.panel h2 { font-size: clamp(26px, 4vw, 38px); line-height: 1; margin: 0 47px 16px 0; }
.panel-close { position: absolute; top: 10px; right: 12px; width: 44px; height: 44px; font-size: 24px; }
.preferences { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 12px 0; }
.preferences button { text-align: left; font-size: 14px; overflow-wrap: anywhere; }
.language { display: grid; gap: 2px; font-size: 14px; margin-bottom: 10px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
#share-status:empty { display: none; }
.result-panel { border-radius: 12px 12px 24px 12px; border-top: 9px solid var(--yellow); }
.result-pet { float: right; transform: rotate(9deg); margin: -4px 0 7px 10px; }
[data-won="true"] .result-pet { animation: stamp-in 320ms ease-out both; }
[data-won="true"] .result-panel { box-shadow: 9px 9px var(--ink), 0 0 55px #ffce6966; }
@keyframes stamp-in { from { transform: translateY(-12px) scale(1.25) rotate(-17deg); } to { transform: rotate(9deg); } }
@media (prefers-reduced-motion: reduce) { [data-won="true"] .result-pet { animation: none; } }
#game[data-reduced="true"] .result-pet { animation: none; }
#result-stamp { margin: 0 0 9px; color: #35519a; font-weight: 800; }
#result-line { margin: 0 0 20px; font-size: 17px; }
.order-panel button:not(.panel-close) { display: block; width: 100%; margin-top: 5px; text-align: left; }
.order-panel button small { display: block; margin-top: 3px; font-size: 13px; font-weight: 650; color: #35519a; }
.order-panel button:disabled { opacity: .63; cursor: default; }
.order-panel h3 { margin: 15px 0 8px; }
.order-panel p { margin: 6px 0; }
.order-panel #map-progress { font-weight: 800; margin-bottom: 12px; }
#shift-list details { margin: 4px 0; border-top: 1px solid #718ccf; }
#shift-list summary { cursor: pointer; min-height: 44px; align-content: center; font-weight: 800; }
#shift-list summary:focus-visible { outline: 3px solid #ff654d; outline-offset: 2px; }
#shift-list details p { margin: 3px 0 8px; line-height: 1.4; }
#field-notes { margin-top: 8px; }
#field-notes summary { cursor: pointer; font-weight: 800; min-height: 44px; align-content: center; }
#field-notes summary:focus-visible { outline: 3px solid #ff654d; outline-offset: 2px; }
#field-notes p { line-height: 1.5; margin: 4px 0 12px; }
.language > div, .menu-site-links { display: flex; flex-wrap: wrap; column-gap: 12px; }
.language > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 7px; font-size: 13px; }
.language a, .menu-site-links a { color: #234486; min-height: 36px; display: inline-flex; align-items: center; }
.language a { min-height: 24px; }
.language a[aria-current="page"] { font-weight: 800; }
.menu-site-links { font-size: 13px; margin-bottom: 6px; }
#wayfinding { position: absolute; inset: 0; pointer-events: none; }
#wayfinding button { position: absolute; translate: -50% -50%; min-width: 62px; pointer-events: auto; padding: 5px; background: #d7edff; box-shadow: 0 3px var(--ink); }
#wayfinding button[data-way="home"] { background: #a4e5ef; }
.guide { max-width: 1040px; margin: auto; padding: clamp(42px,8vw,95px) clamp(18px,5vw,55px); }
.guide h2, .document h2 { font-size: clamp(24px,3vw,34px); line-height: 1.13; letter-spacing: -.025em; margin: 0 0 12px; }
.guide p, .guide li, .guide dd, .document p { line-height: 1.65; }
.guide-lead { max-width: 675px; margin: 0 0 40px; }
.guide-lead h2 { font-size: clamp(35px,5.5vw,58px); margin-bottom: 14px; }
.guide-part { display: grid; grid-template-columns: 72px 1fr; gap: clamp(15px,4vw,47px); padding: 31px 0; border-top: 2px solid #718ccf; }
.guide-part p:first-of-type { margin-top: 0; }
.guide-part p:last-child { margin-bottom: 0; }
.guide-mark { display: grid; place-items: center; width: 64px; height: 64px; border: 2px solid var(--ink); background: var(--yellow); border-radius: 18px; box-shadow: 4px 4px var(--ink); }
.guide-mark svg { width: 44px; height: 44px; fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.guide ul { padding-left: 1.2em; }
.guide li + li { margin-top: 8px; }
.guide dt { margin-top: 12px; font-weight: 800; }
.guide dd { margin: 3px 0 0; }
.independent { font-size: 15px; color: #35477a; }
footer {
  display: grid; grid-template-columns: repeat(2,minmax(0,240px)); gap: 26px; justify-content: center;
  background: #192b6a; color: var(--cream); padding: 31px 20px max(37px, env(safe-area-inset-bottom));
  border-top: 5px solid #f3b84d;
}
footer h2 { font-size: 17px; margin: 0 0 7px; }
footer a { display: block; width: fit-content; color: #d8e6ff; line-height: 1.9; }
.document { width: min(100% - 34px,740px); margin: clamp(35px,8vw,100px) auto; }
.document img { display: block; margin-bottom: 18px; }
.document h1 { margin: 0 0 24px; font-size: clamp(43px,8vw,73px); max-width: none; }
.document h2 { margin-top: 28px; }
.doc-button { display: inline-flex; align-items: center; min-height: 44px; padding: 9px 16px; border: 2px solid var(--ink); border-radius: 12px; background: var(--yellow); color: var(--ink); font-weight: 800; }
@media (pointer: coarse) { #controls kbd { display: none; } }
#game[data-cover="tall"] #intro { inset: 10% 12px auto; translate: none; text-align: center; }
#game[data-cover="tall"] h1 { font-size: clamp(40px, 9.3vw, 74px); max-width: none; }
#game[data-cover="tall"] .brand { margin: 8px 0 0; }
#game[data-cover="tall"] #intro .primary { position: absolute; left: 50%; top: var(--play-offset); translate: -50% 0; }
#game[data-cover="tall"] #cover-progress { position: absolute; width: 100%; top: calc(var(--play-offset) + 52px); color: #fff5db; }
@media (max-width: 560px) {
  #game { min-height: 340px; }
  .game-menu { top: max(9px, env(safe-area-inset-top)); right: max(9px, env(safe-area-inset-right)); }
  .round { width: 44px; height: 44px; }
  #hud { top: max(10px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left)); gap: 4px; }
  .meter { font-size: 14px; padding: 8px 7px; }
  #controls button { min-width: 86px; max-width: 29%; padding-inline: 5px; font-size: 15px; overflow-wrap: anywhere; }
  .guide-part { grid-template-columns: 44px 1fr; }
  .guide-mark { width: 42px; height: 42px; border-radius: 11px; }
  .guide-mark svg { width: 32px; height: 32px; }
}
@media (max-width: 780px) {
  #mission { top: max(56px, calc(env(safe-area-inset-top) + 46px)); padding: 6px 9px; }
  #mission:not([hidden]) + #toast { top: max(95px, calc(env(safe-area-inset-top) + 85px)); }
}
@media (max-width: 420px) {
  #hud { right: calc(max(9px, env(safe-area-inset-right)) + 102px); }
  .meter { padding-inline: 4px; }
  #cargo { align-content: center; min-height: 36px; padding-block: 3px; line-height: 16px; white-space: normal; }
}
@media (max-height: 520px) and (orientation: landscape) {
  #game { height: 94svh; min-height: 270px; }
  #intro h1 { font-size: clamp(32px, 5.9vw, 57px); }
  #intro .brand { margin-bottom: 13px; }
  #intro .primary { min-height: 46px; }
  #hud { top: max(10px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left)); gap: 5px; }
  .meter { padding-inline: 7px; }
  #controls button { translate: 0 -50%; min-width: 104px; }
  #controls button:active, #controls button[data-pressed] { translate: 0 calc(-50% + 3px); }
  #controls [data-control="lock"] { left: max(14px, env(safe-area-inset-left)); }
  #controls [data-control="take"] { left: auto; right: max(145px, calc(env(safe-area-inset-right) + 132px)); }
  #controls [data-control="shove"] { left: auto; right: max(14px, env(safe-area-inset-right)); width: 122px; }
}
@media (max-height: 520px) and (orientation: landscape) and (min-width: 781px) {
  #hud { left: 50%; translate: -50% 0; }
  #mission { top: max(54px, calc(env(safe-area-inset-top) + 46px)); padding: 5px 9px; }
  #mission:not([hidden]) + #toast { top: max(91px, calc(env(safe-area-inset-top) + 83px)); }
}
@media (max-width: 359px) {
  #hud { top: max(58px, calc(env(safe-area-inset-top) + 52px)); right: 8px; }
  #mission { top: max(104px, calc(env(safe-area-inset-top) + 94px)); }
  #toast { top: max(109px, calc(env(safe-area-inset-top) + 100px)); }
  #mission:not([hidden]) + #toast { top: max(143px, calc(env(safe-area-inset-top) + 133px)); }
}
@media (min-height: 521px) and (min-aspect-ratio: 1/1), (min-width: 600px) and (orientation: portrait) {
  #controls button { top: min(93%, calc(100% - 35px - env(safe-area-inset-bottom))); }
}
