@font-face {
  font-family: Barlow;
  src: url('./art/barlow-bold.woff2') format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url('../../assets/fonts/inter-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --ink: #19292f;
  --paper: #fff8e8;
  --yellow: #ffc43d;
  --blue: #174f79;
  --inset-x: max(13px, env(safe-area-inset-left));
  --inset-r: max(13px, env(safe-area-inset-right));
  --inset-y: max(10px, env(safe-area-inset-top));
  --base: max(9px, env(safe-area-inset-bottom));
  font-family: Inter, system-ui, sans-serif;
  color: var(--paper);
  background: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body, #game { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
#game { position: relative; height: 100dvh; isolation: isolate; user-select: none; }
button, select, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible, select:focus-visible, summary:focus-visible, input:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
button:active { filter: brightness(.91); }
button:disabled { cursor: wait; }
#world, #targets, #title-screen, #title-screen > img { position: absolute; inset: 0; width: 100%; height: 100%; }
#world { display: block; touch-action: none; }
#title-screen { z-index: 4; background: #374a4c; }
#title-screen > img { object-fit: cover; object-position: 58% 54%; }
#title-screen::after { content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(11,22,24,.85), rgba(14,24,25,.66) 27%, rgba(15,24,25,.08) 65%, transparent); }
.intro { position: absolute; z-index: 1; top: 49%; left: max(6%, env(safe-area-inset-left)); transform: translateY(-44%); }
h1, h2, p { margin: 0; }
h1 { font: 700 clamp(3rem, 6.9vw, 7.2rem)/.91 Barlow, system-ui, sans-serif; letter-spacing: -.052em; text-shadow: 0 2px 10px #1224263d; }
.intro > p:first-of-type { margin: .85rem 0 1.5rem; color: #fffdf5; font-size: clamp(1rem, 2vw, 1.3rem); }
button canvas { width: 1.36em; height: 1.36em; flex: none; }
.action, .steel, .radio, .hats button {
  color: var(--paper); font: 700 clamp(1rem, 1.7vw, 1.27rem)/1.1 Barlow, system-ui, sans-serif;
  border: 1px solid #ffffff28; display: inline-flex; align-items: center; justify-content: center; gap: .45em;
}
.action { min-height: 50px; padding: .65em 1.15em; border-color: #ffe18c; border-bottom-color: #c68b1c;
  border-radius: 9px; background: var(--yellow); color: #17282d; box-shadow: 0 3px 0 #815700, 0 4px 13px #0c171a35; }
.play-mark { width: 0; height: 0; border: .43em solid transparent; border-right: 0; border-left: .68em solid currentColor; }
#boot-status { max-width: 21rem; font-size: .9rem; margin-top: .7rem; }
.steel, .radio, .hats button { background: linear-gradient(150deg, #29363a, #172328); box-shadow: 0 2px 3px #10232842; }
.steel { min-height: 44px; padding: .43em .73em; border-radius: 10px; }
.top-left, .crew, .blueprint, #site-tools { position: absolute; z-index: 3; }
.top-left { top: var(--inset-y); left: var(--inset-x); display: flex; align-items: center; gap: 6px; }
#station-name { font: 700 clamp(1rem, 1.7vw, 1.27rem)/1.1 Barlow, sans-serif; }
.crew { right: var(--inset-r); top: var(--inset-y); z-index: 5; }
.blueprint {
  top: var(--inset-y); left: 50%; transform: translateX(-50%); padding: .35em .72em;
  display: flex; align-items: center; gap: .16em; border: 2px solid #8cb3c9; border-radius: 6px;
  background-color: var(--blue);
  background-image: linear-gradient(#c9e5f51b 1px,transparent 1px),linear-gradient(90deg,#c9e5f51b 1px,transparent 1px);
  background-size: 11px 11px; box-shadow: inset 0 0 0 2px #0d3c62,0 2px 5px #20353f45;
}
.blueprint::before, .blueprint::after { content: ''; position: absolute; top: 4px; width: 4px; height: 4px; border-radius: 50%; background: #c5d4db; box-shadow: inset 0 -1px 0 #334f66; }
.blueprint::before { left: 4px; } .blueprint::after { right: 4px; }
#plan { font: 700 clamp(2.1rem, 5.1vw, 3.8rem)/1 Barlow, sans-serif; padding: .12em .48em; }
.letter { display: grid; place-items: center; width: 1.12em; height: 1.16em; border: 3px solid transparent; border-radius: 6px; }
.letter.active { border-color: var(--yellow); }
.letter.done { color: #ffeea8; } .letter.empty { color: #b3d6eb; }
.progress { gap: .65rem; min-height: 43px; padding: .35em .86em; font-size: .81rem; }
.progress strong { font: 700 1.15rem/1 Barlow, sans-serif; }
#stage-meter { display: flex; gap: 3px; }
#stage-meter i { width: 7px; height: 12px; transform: skew(-12deg); background: #a9c2d150; border: 1px solid #cfdeea50; }
#stage-meter i.filled { background: var(--yellow); border-color: #ffe4a5; }
#targets { z-index: 1; pointer-events: none; }
.hit { position: absolute; pointer-events: auto; transform: translate(-50%, -50%); min-width: 46px; min-height: 46px; padding: 0;
  border: 3px solid transparent; border-radius: 12px; color: var(--paper); background: transparent; }
.hit:focus-visible { outline: 3px solid var(--yellow); }
.hit.hint { border-color: var(--yellow); box-shadow: 0 0 0 3px #35280678; animation: indicate 1.2s ease-in-out infinite; }
.hit.named { width: max-content; max-width: 39vw; min-height: 44px; padding: .38em .76em;
  font: 700 clamp(1rem, 1.8vw, 1.25rem)/1.05 Barlow, sans-serif; border: 1px solid #f4dd9859;
  border-radius: 8px; background: #1d2a2ff2; box-shadow: 0 2px 5px #15242763; }
.hit.named::after { content:''; position:absolute; left:calc(50% - 5px); bottom:-5px; width:9px; height:9px; transform:rotate(45deg); background:#1d2a2f; }
.hit.named.hint { box-shadow: 0 0 0 3px var(--yellow); }
@keyframes indicate { 50% { box-shadow: 0 0 0 5px #ffd46b9c; } }
#radio-area { position: absolute; z-index: 3; bottom: var(--base); left: 50%; transform: translateX(-50%); display: flex; gap: .55rem; justify-content: center; align-items: center; max-width: calc(100% - var(--inset-x) - var(--inset-r)); width: max-content; }
.radio { text-align: left; min-height: 46px; border-radius: 40px; padding: 3px .95em 3px 4px; gap: .54em; max-width: min(66vw, 620px); line-height: 1.12; }
.speaker-disc { background: var(--yellow); color: var(--ink); display: grid; place-items: center; border-radius: 50%; border: 1px solid #fdda77; width: 36px; height: 36px; flex-shrink: 0; }
.speaker-disc canvas { width: 22px; height: 22px; }
.compact { min-height: 44px; max-width: 38vw; }
#site-tools { left: var(--inset-x); bottom: var(--base); }
dialog { width: min(520px, calc(100% - 28px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid #748184; border-radius: 15px;
  color: var(--paper); background: #1b2b32; box-shadow: 0 16px 60px #09202b70; overflow: hidden; }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #0f1b23b5; }
.panel-head { padding: .85rem 1.15rem; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid #ffffff20; }
.panel-head h2 { font: 700 1.8rem/1 Barlow, sans-serif; letter-spacing: -.035em; }
.panel-content { padding: 1.05rem 1.2rem; overflow: auto; overscroll-behavior: contain; }
fieldset { margin: 0 0 1rem; padding: 0; border: 0; }
legend { font-weight: 700; font-size: .98rem; margin-bottom: .55rem; }
.hats { display: flex; flex-wrap: wrap; gap: .45rem; }
.hats button { min-height: 45px; border-radius: 8px; padding: .45rem .8rem; }
.hats button[aria-pressed=true] { border-color: var(--yellow); box-shadow: inset 0 0 0 1px var(--yellow); }
#levels label, .sound-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .27rem 0; font-size: .96rem; }
select { padding: .3rem; color: var(--paper); border: 1px solid #6d8088; border-radius: 6px; background: #293c44; min-height: 43px; max-width: 59%; }
#levels small { display: block; margin-top: .13rem; color: #c1d0d3; font-size: .875rem; }
.sound-row input { width: 24px; height: 24px; accent-color: var(--yellow); }
#save-note, details { font-size: .875rem; color: #cfdbdd; margin-top: .78rem; line-height: 1.45; }
details summary { cursor: pointer; min-height: 32px; } details p { margin: .45em 0; }
details a { color: #ffdc89; }
noscript { position:absolute; z-index:9; inset:40% 5% auto; color:white; background:#17282d; padding:1em; }
@media (max-height: 480px) {
  .intro > p:first-of-type { margin: .68rem 0 1.05rem; }
  .blueprint { top: max(6px, env(safe-area-inset-top)); }
  .steel { padding: .38em .63em; }
  .panel-head { padding: .45rem 1rem; } .panel-content { padding: .75rem 1rem; }
}
@media (max-width: 660px) {
  #station-name { display: none; }
  .progress { left: var(--inset-x); transform: none; }
  #stage-label { display: none; }
}
@media (orientation: portrait) {
  #title-screen > img { object-position: 63% center; }
  #title-screen::after { background: linear-gradient(0deg,#0d1c23f2 0%,#10232a95 36%,transparent 72%); }
  .intro { left: 7%; top: auto; bottom: 10%; transform:none; }
  h1 { font-size: clamp(3.25rem, 12vw, 6rem); }
  #radio-area { flex-direction: column; width: 94%; }
  .radio { max-width: 100%; } .compact { max-width: 94%; }
  #site-tools { top: calc(var(--inset-y) + 55px); bottom: auto; }
  .hit.named { font-size: .98rem; padding: .3em .55em; }
}
@media (prefers-reduced-motion: reduce) { .hit.hint { animation: none; } }
