/* Roll Call — pixel UI skinned with generated nine-slice art. */
:root {
  --font: 'Jersey 10', 'Courier New', monospace;
  --label: 'Silkscreen', 'Jersey 10', monospace;
  --ink: #f4ead3;
  --ink-dim: #b9c7bd;
  --paper-ink: #22333a;
  --deep: #13262c;
  --teal: #2a6b60;
  --amber: #f2a93b;
  --coral: #e2725b;
  --arc: #62e6cf;
  --violet: #b58be8;
  --olive: #5e6b3a;
  --rook: #f2a93b;
  --volt: #62e6cf;
  --patch: #ef8a7e;
  --kite: #b58be8;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--deep); color: var(--ink); overflow: hidden; }
body { font-family: var(--font); font-size: 22px; line-height: 1.15; -webkit-font-smoothing: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
[hidden] { display: none !important; }
button { font-family: var(--font); font-weight: 400; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
img { image-rendering: auto; }
.pixel { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
b, strong, h1, h2, h3, h4 { font-weight: 400; }
small { font-size: 0.8em; }
.grow { flex: 1; }

#app { position: fixed; inset: 0; }
.screen { position: absolute; inset: 0; display: none; overflow: hidden; }
.screen.active { display: block; }

/* ---------------------------------------------------------------- skins */
.skin-panel { border: 21px solid transparent; border-image: url(assets/img/ui/ui_panel.png) 14 fill / 21px; image-rendering: pixelated; }
.skin-paper { border: 15px solid transparent; border-image: url(assets/img/ui/ui_paper.png) 12 fill / 15px; color: var(--paper-ink); image-rendering: pixelated; }
.skin-bar { border: 10px solid transparent; border-image: url(assets/img/ui/ui_bar.png) 12 20 fill / 10px 16px; image-rendering: pixelated; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 10px;
  border: 9px solid transparent; border-width: 9px 20px; border-image: url(assets/img/ui/ui_btn_olive.png) 9 22 fill / 9px 20px;
  font-size: 24px; color: #f4ead3; text-shadow: 0 2px 0 #2a2e18; image-rendering: pixelated; white-space: nowrap;
  transition: transform 80ms, filter 120ms;
}
.btn:hover, .btn:focus-visible { filter: brightness(1.12); outline: none; }
.btn:focus-visible { box-shadow: 0 0 0 3px var(--arc); }
.btn:active { transform: translateY(2px); }
.btn.primary { border-image: url(assets/img/ui/ui_btn_amber.png) 8 24 fill / 9px 20px; color: #3a2208; text-shadow: 0 1px 0 #ffd79a; }
.btn.big { min-height: 58px; font-size: 30px; padding: 0 18px; }
.btn.small { min-height: 36px; font-size: 20px; border-width: 7px 14px; border-image-width: 7px 14px; }
.btn[disabled] { filter: grayscale(0.85) brightness(0.75); cursor: default; transform: none; }
.btn.link { border: 0; border-image: none; min-height: 0; padding: 4px 6px; color: inherit; text-shadow: none; opacity: 0.75; font-size: 20px; text-decoration: underline; text-underline-offset: 3px; }
.icon-btn {
  width: 50px; height: 50px; padding: 0; display: inline-flex; align-items: center; justify-content: center; line-height: 1;
  font-size: 22px; color: var(--ink); flex: none;
  border: 12px solid transparent; border-image: url(assets/img/ui/ui_btn_square.png) 16 fill / 12px; image-rendering: pixelated;
}
.icon-btn svg { width: 22px; height: 22px; display: block; fill: currentColor; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.45)); }
.icon-btn .txt { display: block; line-height: 1; font-size: 24px; transform: translateY(1px); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); }
.icon-btn:hover { filter: brightness(1.15); }
.icon-btn.on { filter: drop-shadow(0 0 4px var(--arc)); color: var(--arc); }
.label { font-family: var(--label); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------------------------------------------------------------- loading */
#screen-loading { display: none; place-items: center; background: radial-gradient(circle at 50% 40%, #1d3a40, #0b171b); }
#screen-loading.active { display: grid; }
.loading-box { width: min(360px, 80vw); text-align: center; padding: 6px 10px; }
.loading-box .bar { height: 12px; background: #0c1a1e; border: 2px solid #3d4a2a; margin-top: 8px; }
.loading-box .bar i { display: block; height: 100%; width: 0; background: var(--amber); transition: width 150ms; }
.spin-tape { width: 64px; animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }

/* ---------------------------------------------------------------- title */
#screen-title { background: #1c1430; }
#title-canvas { position: absolute; left: 0; top: 0; image-rendering: auto; }
.title-ui { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding: max(16px, env(safe-area-inset-top)) 16px 16px; pointer-events: none; }
.title-ui > * { pointer-events: auto; }
.logo { width: min(560px, 76vw); margin-top: 3vh; filter: drop-shadow(0 6px 0 rgba(10, 6, 20, 0.45)); animation: logo-drop 900ms cubic-bezier(.2, 1.4, .4, 1) both 400ms; image-rendering: auto; }
@keyframes logo-drop { from { transform: translateY(-140%) rotate(-3deg); opacity: 0; } to { transform: none; opacity: 1; } }
.logo.wave { animation: logo-wave 3.2s ease-in-out infinite; }
@keyframes logo-wave { 50% { transform: translateY(-4px) rotate(-0.6deg); } }
.tagline { margin: 6px 0 0; text-align: center; font-size: clamp(20px, 2.6vw, 28px); color: #fff3d8; text-shadow: 0 2px 0 #2a1840, 0 0 12px #2a1840; animation: fade-up 800ms both 1300ms; }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.title-menu { margin-top: auto; margin-bottom: 33vh; display: flex; flex-direction: column; gap: 10px; align-items: center; animation: fade-up 500ms both; }
.title-menu .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.press { margin-top: auto; margin-bottom: 36vh; font-size: 28px; color: #fff3d8; text-shadow: 0 2px 0 #2a1840; animation: blink 1.2s steps(2) infinite, fade-up 600ms both 2000ms; }
@keyframes blink { 50% { opacity: 0.35; } }

/* ---------------------------------------------------------------- ferry */
#screen-ferry { background: #0f1c26; }
#ferry-canvas { position: absolute; left: 0; top: 0; image-rendering: auto; }
#ferry-spots { position: absolute; inset: 0; }
.spot { position: absolute; border-radius: 10px; cursor: pointer; }
.spot:hover, .spot:focus-visible, .spot.hot { outline: none; box-shadow: inset 0 0 0 3px rgba(255, 207, 90, 0.9), 0 0 18px rgba(255, 207, 90, 0.5); }
.spot .tag {
  position: absolute; left: 50%; top: -6px; transform: translate(-50%, -100%); white-space: nowrap; pointer-events: none;
  font-size: 22px; padding: 0 4px; display: flex; align-items: center; gap: 6px;
}
.spot .tag img { width: 22px; height: 22px; }
.spot.below .tag { top: auto; bottom: -6px; transform: translate(-50%, 100%); }
.spot .badge { position: absolute; right: -8px; top: -8px; min-width: 26px; height: 26px; border-radius: 13px; background: var(--coral); color: #fff; font-size: 20px; display: grid; place-items: center; box-shadow: 0 0 0 2px #2a1208; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.15); } }
.ferry-bar { position: absolute; left: 0; right: 0; top: 0; display: flex; gap: 8px; align-items: center; padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left)); pointer-events: none; }
.ferry-bar > * { pointer-events: auto; }
.chip { display: flex; align-items: center; gap: 6px; font-size: 22px; line-height: 1; padding: 0 4px; height: 50px; }
.chip img { width: 26px; height: 26px; }
.chip b { font-size: 26px; color: #fff3d8; }
.chip span { color: var(--ink-dim); }
.ferry-hint { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); font-size: 22px; padding: 0 8px; max-width: min(720px, 90vw); text-align: center; }
.ferry-hint:empty { display: none; }

/* ---------------------------------------------------------------- mission HUD */
#screen-mission { background: #0e2a30; }
#game { position: absolute; left: 0; top: 0; image-rendering: auto; }
.hud { position: absolute; inset: 0; pointer-events: none; }
.vignette { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, rgba(255, 0, 0, 0) 45%, rgba(190, 20, 10, 0.55) 80%, rgba(120, 0, 0, 0.85) 100%); }
.vignette.hit { animation: hitflash 520ms ease-out; }
@keyframes hitflash { 0% { opacity: 1; } 100% { opacity: 0; } }
.vignette.low { animation: lowpulse 0.95s ease-in-out infinite; }
.vignette.low.hit { animation: hitflash 520ms ease-out, lowpulse 0.95s ease-in-out infinite 520ms; }
@keyframes lowpulse { 0%, 100% { opacity: 0.25; } 15% { opacity: 0.75; } 35% { opacity: 0.35; } 50% { opacity: 0.6; } }
.banner { position: absolute; left: 50%; top: 22%; transform: translate(-50%, -20px) scale(0.9); opacity: 0; pointer-events: none; text-align: center; padding: 8px 26px; transition: opacity 300ms, transform 300ms cubic-bezier(.2, 1.5, .4, 1); z-index: 4; background: linear-gradient(90deg, transparent, rgba(10, 10, 12, 0.82) 15%, rgba(10, 10, 12, 0.82) 85%, transparent); }
.banner.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.banner b { display: block; font-size: clamp(30px, 4.4vw, 52px); line-height: 1; color: #fff3d8; text-shadow: 0 3px 0 #000; letter-spacing: 1px; }
.banner small { display: block; font-size: 20px; color: var(--ink-dim); margin-top: 2px; }
.banner.alarm b { color: #ff6a4d; animation: blink 0.4s steps(2) 4; }
.banner.alarm { border-top: 3px solid #ff4a3c; border-bottom: 3px solid #ff4a3c; }
.banner.support b { color: #ffcf5a; }
.banner.support { border-top: 3px solid #f2a93b; border-bottom: 3px solid #f2a93b; }
.banner.boss b { color: #ff8a6b; font-size: clamp(36px, 5.2vw, 64px); }
.banner.boss { border-top: 3px solid #ff4a3c; border-bottom: 3px solid #ff4a3c; }
.hud-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: flex-start; gap: 8px; padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); }
.hud-top > * { pointer-events: auto; }
.pips { display: flex; gap: 2px; align-items: center; height: 50px; padding: 0 2px; }
.pips img { width: 28px; height: 28px; transition: transform 150ms; }
.pips img.lost { animation: pip-lost 400ms; }
.pips img.gain { animation: pip-gain 500ms; }
@keyframes pip-lost { 30% { transform: scale(1.5) rotate(-12deg); } }
@keyframes pip-gain { 40% { transform: scale(1.5); filter: brightness(1.6); } }
.objective { display: flex; align-items: center; gap: 8px; min-width: 210px; max-width: 46vw; padding: 0 4px; }
.objective img { width: 30px; height: 30px; }
.objective b { display: block; font-size: 24px; color: #2a1d0c; }
.objective small { display: block; font-size: 18px; color: #536066; }
.obj-bar { display: block; height: 5px; background: #d6c8a6; margin-top: 3px; }
.obj-bar u { display: block; height: 100%; width: 0; background: var(--amber); }
.objective.done b { color: #1f6f4a; }
.look { display: flex; gap: 6px; align-items: center; height: 50px; padding: 0 2px; }
.score { display: flex; align-items: center; gap: 6px; height: 50px; padding: 0 4px; position: relative; line-height: 1; }
.score small { font-family: var(--label); font-size: 10px; color: var(--ink-dim); }
.score b { font-size: 28px; color: #fff3d8; min-width: 54px; text-align: right; }
.score.bump b { animation: bump 220ms; }
@keyframes bump { 40% { transform: scale(1.25); color: #ffe08a; } }
.score em { position: absolute; right: -6px; top: -12px; font-style: normal; font-size: 24px; color: #2a1208; background: #ffcf5a; padding: 0 6px; border-radius: 4px; box-shadow: 0 2px 0 #8a5a12; animation: pop 200ms; }
.boss-bar { display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 6px; min-width: min(380px, 36vw); animation: fade-up 300ms; }
.boss-bar img { width: 28px; height: 28px; }
.boss-bar div { flex: 1; }
.boss-bar b { display: block; font-size: 20px; color: #ffb3a8; line-height: 1; }
.boss-bar i { display: block; height: 8px; background: #2a0f0c; border: 1px solid #000; margin-top: 3px; }
.boss-bar u { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff5a3c, #ffb347); transition: width 150ms; }
.overcharge { display: flex; align-items: center; gap: 4px; height: 50px; padding: 0 4px; line-height: 1; margin-left: 10px; animation: pulse 0.8s infinite; }
.overcharge img { width: 26px; height: 26px; }
.overcharge b { font-size: 24px; color: #7af0ff; }
.look img { width: 26px; height: 26px; display: block; }
.hud-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; padding: 0 max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
.squad { display: flex; gap: 10px; align-items: center; padding: 0 4px; min-height: 60px; pointer-events: auto; }
.slot { display: flex; align-items: center; gap: 7px; }
.slot .face { width: 46px; height: 46px; border: 2px solid #0d1a1e; background: #0d1a1e; image-rendering: auto; }
.slot.benched .face { width: 34px; height: 34px; filter: saturate(0.6) brightness(0.8); }
.slot.benched .who, .slot.benched .key { display: none; }
.slot .who b { display: block; font-size: 23px; line-height: 1; }
.slot .who small { display: block; font-family: var(--label); font-size: 10px; color: var(--ink-dim); text-transform: uppercase; white-space: nowrap; }
.stars { color: #ffcf5a; font-size: 16px; letter-spacing: -1px; font-family: var(--font); }
.ab { position: relative; width: 44px; height: 44px; display: grid; place-items: center; background: #0d1a1e; border: 2px solid #3d4a2a; }
.slot.benched .ab { width: 34px; height: 34px; }
.ab img { width: 30px; height: 30px; }
.slot.benched .ab img { width: 24px; height: 24px; }
.ab::after { content: ''; position: absolute; inset: 0; background: conic-gradient(rgba(5, 12, 14, 0.78) calc(var(--p, 0) * 1turn), transparent 0); }
.ab .cd { position: absolute; z-index: 1; font-size: 22px; color: #fff3d8; text-shadow: 0 2px 0 #000; }
.ab.ready { box-shadow: 0 0 0 2px var(--amber), 0 0 10px rgba(242, 169, 59, 0.6); }
.ab.flash { animation: shake 260ms; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.key { font-family: var(--label); font-size: 10px; padding: 1px 4px; background: #e9dcbe; color: #2a2f33; border-radius: 3px; box-shadow: 0 2px 0 #8a7b5a; white-space: nowrap; }
.taghint { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.taghint img { width: 26px; height: 26px; }
.toast { position: absolute; left: 50%; top: 74px; transform: translateX(-50%); font-size: 24px; padding: 0 10px; text-align: center; max-width: min(640px, 88vw); animation: toast-in 250ms; z-index: 3; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } }
.toast small { display: block; font-size: 19px; color: #536066; }

/* touch */
.touch { position: absolute; inset: 0; display: none; pointer-events: none; }
body.touch-ui .touch { display: block; }
body.touch-ui .key { display: none; }
.touch > * { pointer-events: auto; }
#touch-zone { position: absolute; left: 0; top: 70px; bottom: 0; width: 55%; pointer-events: auto; }
.stick { position: absolute; width: 104px; height: 104px; margin: -52px 0 0 -52px; border-radius: 50%; border: 3px solid rgba(244, 234, 211, 0.35); background: rgba(10, 20, 24, 0.25); opacity: 0; pointer-events: none; transition: opacity 120ms; }
.stick.on { opacity: 1; }
.stick i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(244, 234, 211, 0.55); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); }
.tbtn { position: absolute; display: grid; place-items: center; border-radius: 50%; background: rgba(13, 26, 30, 0.6); border: 3px solid rgba(242, 169, 59, 0.7); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); }
.tbtn:active { transform: translateY(2px); }
.tbtn.ability { right: max(22px, env(safe-area-inset-right)); bottom: max(26px, env(safe-area-inset-bottom)); width: 92px; height: 92px; }
.tbtn.ability img { width: 54px; height: 54px; }
.tbtn.tag { right: calc(max(22px, env(safe-area-inset-right)) + 104px); bottom: max(22px, env(safe-area-inset-bottom)); width: 64px; height: 64px; border-color: rgba(98, 230, 207, 0.7); font-size: 16px; }
.tbtn.tag img { width: 30px; height: 30px; }
.tbtn.tag span { position: absolute; bottom: -20px; font-size: 18px; color: var(--ink); text-shadow: 0 2px 0 #000; }
body.touch-ui .hud-bottom { padding-right: 230px; }

.rotate { position: fixed; inset: 0; display: none; place-items: center; background: rgba(8, 14, 18, 0.94); z-index: 50; text-align: center; }
.rotate > div { padding: 8px 14px; font-size: 26px; }
.rotate img { width: 48px; animation: turn 1.6s ease-in-out infinite; }
@keyframes turn { 50% { transform: rotate(90deg); } }
@media (orientation: portrait) and (max-width: 700px) { body[data-screen='mission'] .rotate, body[data-screen='ferry'] .rotate { display: grid; } }

/* ---------------------------------------------------------------- modals */
#modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
.modal-back { position: absolute; inset: 0; background: rgba(6, 12, 16, 0.66); display: grid; place-items: center; pointer-events: auto; animation: fade 160ms; padding: 12px; }
@keyframes fade { from { opacity: 0; } }
.modal { position: relative; max-width: min(980px, 96vw); max-height: 94vh; overflow: auto; padding: 4px 8px 6px; animation: pop 220ms cubic-bezier(.2, 1.3, .4, 1); scrollbar-width: thin; }
@keyframes pop { from { transform: scale(0.92); opacity: 0; } }
.modal h2 { margin: 0 0 4px; font-size: 38px; line-height: 1; color: #fff3d8; text-shadow: 0 3px 0 #0b171b; }
.modal h2 .label { margin-left: 8px; vertical-align: middle; color: var(--amber); }
.modal .sub { margin: 0 0 10px; color: var(--ink-dim); font-size: 21px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
.modal .close { position: absolute; right: 0; top: 0; }
.paper h2, .skin-paper h2 { color: var(--paper-ink); text-shadow: none; }

/* dispatch cards */
.cards { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.dcard { width: min(400px, 44vw); min-width: 260px; display: flex; flex-direction: column; gap: 6px; padding: 2px 4px 6px; cursor: pointer; transition: transform 120ms; text-align: left; }
.dcard:hover, .dcard:focus-visible { transform: translateY(-4px) rotate(-0.5deg); outline: none; }
.dcard .art { position: relative; height: 150px; overflow: hidden; border: 3px solid #22333a; }
.dcard .art img { width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
.dcard .art .stamp { position: absolute; right: 6px; top: 6px; padding: 0 6px; background: #22333a; color: #fff3d8; font-size: 18px; }
.dcard h3 { margin: 2px 0 0; font-size: 32px; line-height: 1; color: #22333a; }
.dcard p { margin: 0; font-size: 20px; color: #3b4a50; }
.dcard .pair { font-size: 19px; color: #6a4a1c; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips span { display: inline-flex; align-items: center; gap: 4px; font-size: 18px; padding: 0 6px; background: #e8dcc0; border: 2px solid #c9b88f; color: #3b4a50; }
.chips img { width: 18px; height: 18px; }

/* roll call */
.roster { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 10px; }
@media (max-width: 760px) { .roster { grid-template-columns: repeat(2, minmax(140px, 1fr)); } }
.hcard { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 0 2px 4px; text-align: left; transition: transform 120ms; }
.hcard .por { position: relative; aspect-ratio: 3 / 4; overflow: hidden; border: 3px solid #22333a; background: #22333a; }
.hcard .por img { width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
.hcard.locked .por img { filter: grayscale(1) brightness(0.18) contrast(1.4); }
.hcard.locked .por::after { content: '?'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 64px; color: rgba(244, 234, 211, 0.35); }
.hcard h4 .stars { font-size: 22px; }
.hcard.locked { opacity: 0.85; cursor: default; }
.hcard h4 { margin: 0; font-size: 28px; line-height: 1; color: #22333a; display: flex; justify-content: space-between; align-items: baseline; }
.hcard .role { font-family: var(--label); font-size: 11px; color: #6a4a1c; text-transform: uppercase; }
.hcard .abil { font-size: 18px; color: #3b4a50; }
.hcard .abil b { color: #22333a; }
.hcard.pick { transform: translateY(-6px); }
.hcard.pick .por { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber); }
.hcard .order { position: absolute; left: 6px; top: 6px; z-index: 2; background: var(--amber); color: #2a1208; font-size: 20px; padding: 0 6px; }
.hcard .suggest { position: absolute; right: 6px; top: 6px; z-index: 2; background: #22333a; color: var(--arc); font-size: 16px; padding: 0 5px; }
.xpbar { height: 6px; background: #d6c8a6; }
.xpbar i { display: block; height: 100%; background: var(--teal); }
.formsw { display: flex; gap: 6px; margin-top: 2px; }
.formsw button { font-size: 18px; padding: 0 6px; border: 2px solid #22333a; color: #22333a; background: #efe3c6; }
.formsw button.on { background: #22333a; color: var(--arc); }

/* radio */
.radio-wrap { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, 1fr); gap: 14px; align-items: start; }
@media (max-width: 860px) { .radio-wrap { grid-template-columns: 1fr; } }
.radio { position: relative; width: 100%; aspect-ratio: 729 / 401; margin-top: 12%; }
.radio > img.body { position: absolute; inset: 0; width: 100%; height: 100%; }
.radio .dialwin { position: absolute; }
.radio canvas { width: 100%; height: 100%; display: block; }
.radio .lamp { position: absolute; width: 4.2%; aspect-ratio: 1; transition: filter 200ms; }
.radio .lamp img { width: 100%; height: 100%; }
.radio .lamp.on img { filter: drop-shadow(0 0 6px #ff4a3c); }
.radio .knob { position: absolute; width: 17%; aspect-ratio: 1; cursor: grab; transition: transform 900ms cubic-bezier(.2, .9, .3, 1); }
.radio .knob img { width: 100%; height: 100%; }
.radio .screen-tell { position: absolute; display: grid; place-items: center; pointer-events: none; }
.radio .slot { position: absolute; overflow: hidden; }
.radio .print { position: absolute; left: 6%; right: 6%; top: 0; transform: translateY(-105%); background: #f7efdc; border: 3px solid #3b2a5a; padding: 4px; color: #22333a; text-align: center; font-size: 18px; }
.radio .print img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border: 2px solid #3b2a5a; image-rendering: auto; }
.radio .tape-in { position: absolute; width: 18%; transition: transform 500ms ease-in, opacity 400ms; }
.picks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pickb { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border: 3px solid #22333a; background: #efe3c6; color: #22333a; font-size: 22px; text-align: left; }
.pickb img { width: 38px; height: 38px; border: 2px solid #22333a; image-rendering: auto; }
.pickb.on { background: #22333a; color: #fff3d8; border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber); }
.pickb[disabled] { opacity: 0.4; }
.pickb small { display: block; font-size: 16px; opacity: 0.8; }
.oddsbar { display: flex; height: 40px; border: 3px solid #22333a; margin: 8px 0 4px; overflow: hidden; }
.oddsbar div { display: grid; place-items: center; font-size: 19px; color: #22333a; white-space: nowrap; overflow: hidden; transition: flex-grow 400ms; min-width: 0; }
.lamps-row { display: flex; gap: 6px; align-items: center; font-size: 20px; color: #3b4a50; }
.lamps-row img { width: 26px; }
.reveal-card { display: flex; gap: 12px; align-items: center; }
.reveal-card img { width: 120px; border: 3px solid #22333a; image-rendering: auto; }
.reveal-card h3 { margin: 0; font-size: 34px; color: #22333a; }

/* roster / merge */
.bench { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.brow { padding: 2px 4px 6px; display: flex; flex-direction: column; gap: 6px; }
.brow h4 { margin: 0; font-size: 28px; color: #22333a; display: flex; align-items: center; gap: 8px; }
.brow h4 img { width: 44px; height: 44px; border: 2px solid #22333a; image-rendering: auto; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; min-height: 48px; }
.bdg { width: 44px; height: 50px; display: grid; place-items: center; clip-path: polygon(50% 0, 100% 18%, 100% 72%, 50% 100%, 0 72%, 0 18%); background: #7a6a44; color: #fff3d8; font-size: 18px; position: relative; }
.bdg.r2 { background: #b9c3c7; color: #22333a; }
.bdg.r3 { background: #f2c14e; color: #3a2208; }
.bdg.field { outline: 3px solid var(--amber); }
.bdg.flying { animation: slam 600ms ease-in both; }
@keyframes slam { 50% { transform: translateY(-14px) scale(1.2); } 100% { transform: scale(0.2); opacity: 0; } }
.starfx { animation: starpop 900ms cubic-bezier(.2, 1.5, .4, 1); }
@keyframes starpop { 0% { transform: scale(0.2); filter: brightness(3); } 60% { transform: scale(1.25); } }
.ranks { margin: 0; padding: 0; list-style: none; font-size: 18px; color: #6c7a7f; }
.ranks li { display: flex; gap: 6px; }
.ranks li.have { color: #22333a; }
.ranks li b { color: #b78315; min-width: 34px; }
.fusion { display: flex; align-items: center; gap: 12px; padding: 4px 8px 8px; margin-top: 10px; }
.fusion img { width: 110px; border: 3px solid #22333a; image-rendering: auto; }
.fusion h3 { margin: 0; font-size: 30px; color: #22333a; }
.fusion p { margin: 2px 0 6px; font-size: 19px; color: #3b4a50; }
.cw { display: flex; gap: 4px; flex-wrap: wrap; }
.cw button { width: 26px; height: 26px; border: 2px solid #22333a; }
.cw button.on { box-shadow: 0 0 0 2px var(--amber); }
.cw button[disabled] { opacity: 0.3; }

/* results */
.results { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
@media (max-width: 700px) { .results { grid-template-columns: 1fr; } }
.rewards { display: flex; flex-direction: column; gap: 8px; }
.reward { display: flex; align-items: center; gap: 10px; padding: 4px 8px; background: #efe3c6; border: 2px solid #c9b88f; color: #22333a; font-size: 22px; animation: fade-up 400ms both; }
.reward img { width: 34px; height: 34px; }
.reward .up { color: #1f6f4a; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 4px 14px; font-size: 20px; color: var(--ink-dim); }
.stats b { color: #fff3d8; font-size: 24px; }
.receipt { font-family: var(--label); font-size: 11px; color: #9aa79c; }
.dcard p.receipt { color: #8a7b5a; font-size: 11px; }
.salute-canvas { width: 300px; max-width: 34vw; aspect-ratio: 2 / 1; display: block; }
.rank { display: grid; place-items: center; width: 120px; height: 120px; margin: 6px auto 0; border-radius: 50%; border: 5px solid #ffcf5a; transform: rotate(-8deg); animation: stamp 500ms cubic-bezier(.2, 1.6, .4, 1) both 300ms; background: rgba(0, 0, 0, 0.25); }
.rank small { font-family: var(--label); font-size: 11px; color: var(--ink-dim); margin-bottom: -14px; }
.rank b { font-size: 84px; line-height: 0.9; color: #ffcf5a; text-shadow: 0 4px 0 #6a3a08; }
.rank-S { border-color: #7df5c8; } .rank-S b { color: #7df5c8; text-shadow: 0 4px 0 #1f6f4a; }
.rank-C { border-color: #b9c3c7; } .rank-C b { color: #b9c3c7; text-shadow: 0 4px 0 #3b4a50; }
@keyframes stamp { from { transform: scale(2.4) rotate(-20deg); opacity: 0; } }
.scoreline { text-align: center; margin-top: 8px; }
.scoreline b { display: block; font-size: 36px; color: #fff3d8; }
.scoreline small { font-family: var(--label); font-size: 11px; color: #ffcf5a; }
.scoreparts { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; max-width: 300px; margin-top: 6px; }
.scoreparts span { font-size: 16px; padding: 0 5px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); color: var(--ink-dim); }
.chips span.mod { background: #3a1d0c; color: #ffcf5a; border-color: #a35a12; }
.dcard p.modtext { font-size: 18px; color: #a34f1c; }

/* settings */
.toggles { display: flex; flex-direction: column; gap: 8px; min-width: min(380px, 80vw); }
.toggle { display: flex; justify-content: space-between; align-items: center; font-size: 24px; color: var(--paper-ink); }
.toggle button { min-width: 82px; }
.controls-table { width: 100%; border-collapse: collapse; font-size: 20px; color: var(--paper-ink); }
.controls-table td { padding: 3px 6px; border-bottom: 1px dashed #c9b88f; }
.controls-table td:first-child { color: #6a4a1c; }

/* ---------------------------------------------------------------- tour */
#tour-root { position: fixed; inset: 0; pointer-events: none; z-index: 30; }
.tour-spot { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(6, 12, 16, 0.62); transition: left 120ms, top 120ms, width 120ms, height 120ms; pointer-events: none; }
.tour-spot::after { content: ''; position: absolute; inset: -4px; border: 3px dashed var(--amber); border-radius: 14px; animation: spin-dash 1s linear infinite; }
@keyframes spin-dash { 50% { border-color: #fff3d8; } }
.tour-spot.light { box-shadow: 0 0 0 9999px rgba(6, 12, 16, 0.25); }
.tour-dim { position: fixed; inset: 0; background: rgba(6, 12, 16, 0.55); pointer-events: auto; }
.tour-card { position: fixed; width: min(440px, 92vw); display: grid; grid-template-columns: auto 1fr; gap: 10px; pointer-events: auto; padding: 2px 6px 4px; animation: pop 200ms; }
.tour-card.noface { grid-template-columns: 1fr; }
.tour-card .face { width: 72px; height: 72px; border: 3px solid #22333a; image-rendering: auto; }
.tour-card h3 { margin: 0; font-size: 28px; line-height: 1; color: #22333a; }
.tour-card p { margin: 4px 0 0; font-size: 21px; color: #2e3d43; }
.tour-card .tour-step { font-family: var(--label); font-size: 11px; color: #8a6a2c; text-transform: uppercase; }
.tour-card .tour-do { display: block; margin-top: 6px; font-size: 21px; color: #a34f1c; animation: blink 1s steps(2) infinite; }
.tour-card .tour-actions { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; }
.tour-card.nudge { animation: shake 300ms; }
.tour-pulse { animation: tpulse 1s ease-in-out infinite !important; }
@keyframes tpulse { 50% { box-shadow: 0 0 0 4px var(--amber), 0 0 20px var(--amber); } }

/* ---------------------------------------------------------------- debug */
#debug-root { position: fixed; right: 8px; bottom: 8px; z-index: 60; font-size: 18px; }
.debug { width: 290px; max-height: 80vh; overflow: auto; background: rgba(10, 18, 22, 0.94); border: 2px solid var(--amber); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.debug h4 { margin: 0; color: var(--amber); font-size: 22px; }
.debug .row { display: flex; gap: 4px; flex-wrap: wrap; }
.debug button { background: #22333a; border: 1px solid #50646b; padding: 2px 6px; font-size: 17px; }
.debug pre { margin: 0; white-space: pre-wrap; font-size: 15px; color: #cfe; max-height: 240px; overflow: auto; font-family: monospace; }
