:root {
  color-scheme: dark;
  --ink: #0c151d;
  --panel: #192733;
  --paper: #fff5dd;
  --muted: #afc3c4;
  --gold: #ffd68b;
  --mint: #9ce1c9;
  --line: #e2f8ef35;
  --ui: 'Bahnschrift','Segoe UI',system-ui,sans-serif;
  --display: 'Arial Black','Arial Bold','Segoe UI',system-ui,sans-serif;
}
* { box-sizing: border-box }
html,body { margin: 0; min-height: 100%; background: var(--ink); color: var(--paper); font-family: var(--ui) }
button,select,input { font: inherit }
button { color: inherit; cursor: pointer }
button:disabled { cursor: default }
[hidden] { display: none !important }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #ffdf93; outline-offset: 3px }
.screen { min-height: 100vh; min-height: 100svh; position: relative }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap }
.load-error { position:fixed; inset:0; z-index:20; display:grid; place-content:center; padding:2rem; background:var(--ink); font-size:1.25rem }
button { -webkit-tap-highlight-color: transparent }
.title-art,.menu-screen::after { position:absolute; inset:0; pointer-events:none }
.menu-screen { isolation:isolate; background:#142631; overflow:hidden }
.title-art { z-index:-2; background-size:cover; background-position:center }
.menu-screen[data-title="fresh"] .title-art { background-image:url('assets/art/brigade-keyart.webp') }
.menu-screen::after { content:''; z-index:-1; background:linear-gradient(90deg,#081018dc 0%,#0b131ca6 26%,#0c151c2b 51%,transparent 72%),linear-gradient(0deg,#071219eb 0%,transparent 23%,transparent 79%,#09141d66 100%) }
.menu-frame,.board-frame { max-width:1800px; margin:auto; padding:clamp(20px,4vh,45px) clamp(25px,5.8vw,96px) }
.menu-frame { position:relative; display:flex; flex-direction:column; min-height:100vh; min-height:100svh }
.studio-bar,.studio-brand,.studio-controls,.save-strip,.save-route,.progress-copy,.launch-button,.board-button,.quiet-button,.screen-title,.board-header,.chapter-navigation,.game-header,.game-nav,.mission-heading,.transport,.release-control,.dialog-heading { display:flex; align-items:center }
.studio-bar,.save-strip,.progress-copy,.board-header,.game-header,.dialog-heading { justify-content:space-between }
.studio-brand { gap:10px; font-family:var(--display); font-weight:900; letter-spacing:.065em; font-size:17px; text-shadow:0 1px 6px #000 }
.studio-brand img { width:31px; height:31px; border-radius:8px }
.studio-brand span { transform:skewX(-7deg) }
.studio-brand b { color:var(--gold) }
.studio-brand i { height:15px; width:1px; background:#d9dfd380 }
.studio-brand small { font:700 10px var(--ui); letter-spacing:.25em }
.studio-controls,.game-nav { gap:8px }
.quiet-button,.round-back,.rail-arrow,.close-dialog { border:1px solid var(--line); background:#0a151bbd; color:#f2f1df; transition:background .16s,border-color .16s }
.quiet-button { justify-content:center; gap:9px; border-radius:24px; min-height:38px; padding:6px 16px; font-size:13px; font-weight:700 }
.quiet-button span[aria-hidden] { font:18px system-ui }
.quiet-button:hover,.rail-arrow:hover:not(:disabled),.round-back:hover,.close-dialog:hover { background:#2c4049; border-color:#d8e7d6 }
.fullscreen-button { width:39px; padding:0; font-size:19px; line-height:1 }
.title-stack { width:fit-content; max-width:52%; margin:auto 0; padding:clamp(36px,6vh,82px) 0 }
.game-logo { margin:0 0 clamp(22px,4vh,45px); font-family:Impact,'Arial Black',var(--display); font-weight:900; font-size:clamp(78px,min(9.5vw,15vh),170px); line-height:.83; letter-spacing:.004em; text-transform:uppercase; transform:skewY(-4deg) rotate(-.5deg); transform-origin:left; color:#fff4ce; text-shadow:0 .024em #594a39,0 .06em #302c2b,0 .09em #131c20,0 .13em .18em #071015b3 }
.game-logo span,.game-logo strong { display:block; width:fit-content }
.game-logo strong { margin-left:.105em; font-weight:inherit; color:#ffc16e }
.menu-actions { width:clamp(270px,24vw,360px); display:grid; gap:9px }
.launch-button,.board-button { border-radius:7px; transition:transform .18s,border-color .18s,background .18s; text-align:left; font-weight:700 }
.launch-button { padding:10px 20px; min-height:68px; border:1px solid #fff0ad; background:linear-gradient(110deg,#ffe5a9,#ebaf61); color:#18232a; box-shadow:0 4px 0 #7c5530,0 8px 22px #040a1073; gap:16px }
.launch-button:hover,.board-button:hover { transform:translateX(4px) }
.launch-button b,.launch-button small { display:block }
.launch-button b { font-size:clamp(18px,1.45vw,25px); line-height:1.1 }
.launch-button small { margin-top:3px; font-size:12px; color:#44392d }
.play-triangle { width:0; height:0; border-top:8px solid transparent; border-bottom:8px solid transparent; border-left:13px solid currentColor }
.chevron { margin-left:auto; width:8px; height:8px; border:solid currentColor; border-width:2px 2px 0 0; transform:rotate(45deg) }
.board-button { padding:12px 20px; gap:16px; min-height:47px; font-size:16px; background:#101e27cc; color:#f6eed8; border:1px solid #fff5d260; box-shadow:0 4px 16px #06101840 }
.grid-symbol { display:inline-block; width:6px; height:6px; margin:0 8px 8px 0; border-radius:1px; background:currentColor; box-shadow:8px 0 currentColor,0 8px currentColor,8px 8px currentColor; flex:none }
.save-strip { border-top:1px solid #f3efcc4d; padding-top:17px; gap:18px }
.save-route { gap:12px }
.save-cover { width:72px; height:43px; background-position:center; background-size:cover; border:1px solid #e1e2ca66; border-radius:3px }
.save-route small,.region-caption small,.mission-heading small,.mission-code { display:block; color:var(--gold); font-size:10px; font-weight:700; letter-spacing:.14em; text-transform:uppercase }
.save-route strong { display:block; font-size:18px; margin-top:2px }
.menu-progress { width:clamp(200px,25vw,370px) }
.progress-copy { gap:12px; font-size:12px; color:var(--muted) }
.progress-copy b { color:var(--paper) }
.progress-track { position:relative; height:5px; margin-top:8px; background:#b1cec140; border-radius:3px; overflow:hidden }
.progress-track span { display:block; height:100%; background:linear-gradient(90deg,#a2d9bb,var(--gold)); transition:width .2s }
.board-screen,.game-screen { background:radial-gradient(ellipse at 8% 8%,#233745,transparent 45%),#0c161e }
.board-frame { padding-top:clamp(14px,3.7vh,38px) }
.board-header { padding-bottom:clamp(10px,2vh,22px); border-bottom:1px solid var(--line); gap:15px }
.screen-title,.mission-heading { gap:14px }
.board-header h2,.region-poster h3,.dialog-heading h2,.mission-heading h2 { font-family:var(--display); letter-spacing:-.055em; line-height:1.02; margin:0; font-weight:900 }
.board-header h2 { font-size:clamp(26px,3.2vw,52px) }
.round-back,.rail-arrow,.close-dialog { width:38px; height:38px; border-radius:50%; display:grid; place-content:center; font-family:Arial,sans-serif; font-size:28px; line-height:1; flex:none }
.board-progress { width:min(25vw,295px) }
.board-progress>div:first-child { display:flex; align-items:baseline; justify-content:space-between; gap:10px }
.board-progress strong { font-size:20px; white-space:nowrap }
.board-progress span:not(.progress-track span) { font-size:12px; color:var(--muted) }
.chapter-navigation { gap:9px; margin:clamp(13px,2.4vh,26px) 0 }
.rail-arrow { width:30px; height:40px; border-radius:5px; font-size:24px }
.rail-arrow:disabled { opacity:.28 }
.chapter-list { flex:1; min-width:0; position:relative; display:flex; gap:8px; overflow-x:auto; padding:5px 4px 7px; scrollbar-width:thin; scrollbar-color:#657980 #111d25; overscroll-behavior-inline:contain }
.chapter-tab { flex:1 0 clamp(110px,10vw,165px); position:relative; isolation:isolate; display:flex; align-items:end; text-align:left; gap:5px; min-height:60px; border:1px solid #90acb34a; border-radius:5px; background:#182b35; padding:6px; color:#e8eeda; overflow:hidden }
.chapter-tab i { position:absolute; inset:0; z-index:-1; background-size:cover; background-position:center }
.chapter-tab::after { position:absolute; content:''; z-index:-1; inset:0; background:linear-gradient(0deg,#101922f7,#10202a15 95%) }
.chapter-tab[aria-pressed=true] { border:2px solid var(--gold); box-shadow:0 0 0 1px #141e22,0 0 12px #ffcd6c36 }
.chapter-index { color:var(--gold); font-size:9px; letter-spacing:.04em }
.chapter-name { font-size:11px; line-height:1.05 }
.board-content { display:grid; grid-template-columns:minmax(200px,.86fr) minmax(0,2fr); gap:clamp(12px,1.8vw,25px); align-items:stretch }
.region-poster { min-height:380px; position:relative; border:1px solid #c5d8ce55; border-radius:8px; overflow:hidden; display:flex; align-items:end; background-size:cover; background-position:center }
.region-poster::before { content:''; position:absolute; inset:0; background:linear-gradient(0deg,#09141df5,#101b2699 28%,transparent 65%) }
.region-caption { position:relative; padding:clamp(14px,2vw,32px) }
.region-caption h3 { font-size:clamp(28px,3.35vw,56px); margin:8px 0; color:#fff1d1 }
.region-caption>span { font-size:13px; color:#e2e9dc }
.mission-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px }
.mission-card { isolation:isolate; position:relative; min-height:clamp(64px,9.4vh,111px); overflow:hidden; display:flex; align-items:center; border:1px solid #9fbeb652; border-radius:5px; text-align:left; background:linear-gradient(130deg,#243940,#1e313c); padding:9px 12px; color:var(--paper) }
.map-preview { opacity:1; width:54%; height:100%; position:absolute; right:0; bottom:0; z-index:-2; object-fit:fill }
.mission-card::after { content:''; position:absolute; z-index:-1; inset:0; background:linear-gradient(90deg,#1b2a34f8 2%,#1b2a34ed 38%,#1b2a344d 72%,transparent) }
.mission-card.current { border:2px solid var(--gold); background-color:#354844 }
.mission-card:not(:disabled):hover { border-color:#f9e6ac; transform:translateY(-1px) }
.mission-info { display:block; max-width:86%; text-shadow:0 1px 5px #101a21 }
.mission-code { font-size:9px; white-space:nowrap }
.mission-name { font-size:clamp(13px,1.25vw,20px); display:block; line-height:1.08; margin-top:5px }
.mission-card.done .mission-code { color:var(--mint) }
.mission-card.locked { border-color:#7f97952e; color:#d2ddd7 }
.mission-card.locked .mission-code { color:#a6b8b8 }
.mission-card.locked .map-preview { opacity:.76 }
.game-screen { padding:0 clamp(8px,2.3vw,42px) 10px }
.game-frame { max-width:1800px; margin:auto }
.game-header { gap:12px; min-height:clamp(51px,8.1vh,75px); border-bottom:1px solid var(--line); margin-bottom:8px }
.mission-heading h2 { font-size:clamp(16px,1.8vw,31px); margin-top:3px }
.mission-heading small { font-size:9px }
.game-nav .quiet-button { min-height:34px }
.play-layout { display:flex; flex-direction:column; align-items:stretch; gap:6px }
.playfield { display:flex; justify-content:center }
.canvas-wrap { width:min(100%,calc((100svh - 224px)*2)); aspect-ratio:2; border-radius:5px; overflow:hidden; box-shadow:0 0 0 1px #b1c6b447,0 8px 22px #050b1160; background:#132830 }
#game { display:block; width:100%; height:100%; touch-action:manipulation; cursor:crosshair }
.playfield-bottom { display:flex; justify-content:space-between; align-items:center; gap:15px; padding:6px 0; min-height:44px }
.mission-readout { min-width:0 }
#status { font-size:clamp(11px,1vw,16px); font-weight:700; color:#ffdf9f; font-variant-numeric:tabular-nums }
#message { font-size:clamp(11px,.88vw,14px); color:#d4e2dd; line-height:1.25; margin-top:2px }
.transport { gap:6px; flex:none }
.transport button,.release-control { border:1px solid var(--line); border-radius:5px; color:#edf0e0; background:#23343e; font-size:12px; font-weight:700; white-space:nowrap }
.transport button { min-height:34px; padding:3px 11px }
.transport button:hover:not(:disabled) { border-color:#e2dcab }
.transport button:disabled { opacity:.55 }
.transport .play-button,.transport .next-button { min-width:72px; background:var(--gold); color:#263032; border-color:#ffedaa }
.transport .next-button { background:var(--mint) }
.release-control { overflow:hidden; background:#16252e }
.release-control button { font-size:17px; min-height:31px; min-width:32px; padding:0 7px; border:0 }
.release-control span { padding:0 5px; text-align:center; font-size:11px; font-variant-numeric:tabular-nums }
#restart { font:700 20px/1 var(--ui); padding:0 10px }
.toolbox { border-top:1px solid var(--line); padding-top:7px }
.skill-grid { display:grid; grid-template-columns:repeat(10,minmax(0,1fr)); gap:6px; max-width:1500px; margin:auto }
.skill { position:relative; display:grid; grid-template-columns:minmax(0,1fr) auto; grid-template-rows:1fr auto; align-items:center; min-height:66px; min-width:0; border:1px solid #74908b70; border-radius:5px; background:radial-gradient(ellipse at 20% 10%,#36505a,#1a2a35 80%); padding:3px 8px 5px; text-align:left; color:#eef1e2 }
.skill:hover:not(:disabled) { border-color:var(--gold) }
.skill[aria-pressed=true]:not(:disabled) { border:2px solid var(--gold); background:radial-gradient(ellipse at 20% 5%,#62624c,#2e3a37 80%); box-shadow:0 2px 0 var(--gold) }
.skill:disabled { opacity:.5; filter:saturate(.4) }
.skill .skill-icon { display:block; font-size:24px; text-align:center; grid-column:1; grid-row:1 }
.skill-name { grid-column:1 / -1; grid-row:2; font-size:clamp(11px,.96vw,15px); font-weight:700; letter-spacing:.01em }
.skill-count { grid-column:2; grid-row:2; justify-self:end; border-radius:3px; padding:0 3px; font-size:12px; font-weight:800; background:#08151dc7; color:#ffe0a0 }
.skill-key { font-size:10px; opacity:.78; align-self:start; justify-self:end; grid-row:1; grid-column:2 }
.console-dialog { width:min(90vw,480px); padding:clamp(18px,3vw,32px); border:1px solid #b8c7ae88; border-radius:10px; background:linear-gradient(150deg,#273c44,#101f29 80%); color:var(--paper); box-shadow:0 25px 90px #000a; max-height:85svh; overflow:auto }
.console-dialog::backdrop { background:#08131bd6; backdrop-filter:blur(7px) }
.dialog-heading { gap:10px; margin-bottom:20px }
.dialog-heading h2 { font-size:clamp(24px,3vw,38px) }
.close-dialog { width:34px; height:34px; font-size:22px }
.sound-sliders { display:grid; gap:18px }
.sound-sliders label,.level-picker { display:grid; gap:8px; font-size:14px; font-weight:700 }
.sound-sliders input { width:100%; accent-color:var(--gold) }
.guide-dialog { width:min(92vw,620px) }
.level-picker select { padding:7px 10px; border-radius:4px; background:#111f29; color:var(--paper); border:1px solid var(--line) }
.guide-copy,.guide-dialog p { font-size:14px; line-height:1.45; color:#d1dfdb }
.guide-dialog #level-lesson,.guide-copy b { color:var(--gold) }
@media(min-width:1700px) { .game-frame { max-width:min(1800px,calc((100svh - 205px)*2 + 120px)) } }
@media(max-width:950px) {
  .menu-frame,.board-frame { padding-left:4vw; padding-right:4vw }
  .canvas-wrap { width:min(100%,calc((100svh - 255px)*2)) }
  .skill-grid { gap:4px }
  .skill { padding:3px 4px; min-height:60px }
  .skill-name { font-size:11px }
  .skill-count { font-size:10px }
  .board-content { grid-template-columns:minmax(160px,.72fr) minmax(0,2fr) }
  .rail-arrow { width:27px }
}
@media(max-width:700px) {
  .menu-screen::after { background:linear-gradient(90deg,#10192494,transparent 78%),linear-gradient(0deg,#0a141df7 0%,#0b151bd9 21%,transparent 62%) }
  .title-art { background-position:65% center }
  .menu-frame { padding-top:18px; padding-bottom:max(20px,env(safe-area-inset-bottom)); min-height:100svh }
  .title-stack { margin:auto 0 0; max-width:100%; padding:34vh 0 22px }
  .game-logo { font-size:clamp(62px,13vw,92px); margin-bottom:20px }
  .menu-actions { width:min(305px,82vw) }
  .save-cover { width:46px; height:36px }
  .save-route { gap:7px }
  .save-route strong { font-size:14px }
  .save-route small { font-size:8px }
  .menu-progress { width:40%; min-width:100px }
  .progress-copy { display:block; font-size:10px }
  .progress-copy b { display:block; font-size:12px }
  .save-strip { padding-top:11px }
  .board-content { grid-template-columns:1fr; gap:12px }
  .region-poster { min-height:100px; background-position:center 48% }
  .region-caption { padding:13px 18px }
  .region-caption h3 { font-size:25px; margin:4px 0 }
  .region-caption>span { font-size:11px }
  .board-header { gap:6px }
  .board-progress { width:auto; min-width:100px }
  .board-progress>div:first-child { display:block; text-align:right }
  .board-progress strong,.board-progress span:not(.progress-track span) { display:block }
  .board-progress strong { font-size:16px }
  .board-progress span:not(.progress-track span) { font-size:10px }
  .chapter-tab { flex-basis:106px; min-height:53px }
  .mission-card { min-height:68px }
  .game-header { flex-wrap:wrap; padding:7px 0; gap:6px; margin-bottom:5px }
  .game-nav { gap:4px }
  .game-nav .quiet-button { padding:5px 8px; font-size:11px; min-height:30px }
  .game-nav .fullscreen-button { width:30px }
  .mission-heading { gap:7px }
  .game-header .round-back { width:30px; height:30px }
  .canvas-wrap { width:100% }
  .playfield-bottom { flex-direction:column; align-items:start; gap:7px; padding:3px }
  .transport { flex-wrap:wrap }
  .skill-grid { grid-template-columns:repeat(5,minmax(0,1fr)) }
  .skill { min-height:56px; padding:2px 6px 4px }
}
@media (max-height:620px) and (min-width:701px) {
  .menu-frame,.board-frame { padding-top:12px; padding-bottom:12px }
  .title-stack { padding:20px 0 }
  .game-logo { font-size:clamp(62px,14vh,95px); margin-bottom:21px }
  .game-header { min-height:38px }
  .game-header .round-back,.game-nav .quiet-button { min-height:28px; height:28px }
  .mission-heading h2 { font-size:17px }
  .game-header,.play-layout { margin-bottom:0; gap:4px }
  .canvas-wrap { width:min(100%,calc((100svh - 177px)*2)) }
  .skill { min-height:49px; padding-bottom:3px }
  .toolbox { padding-top:4px }
  .playfield-bottom { padding:2px 0; min-height:36px }
  .region-poster { min-height:0 }
  .mission-card { min-height:54px }
  .chapter-navigation { margin:7px 0 }
  .chapter-tab { min-height:45px }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { transition:none !important; animation:none !important; scroll-behavior:auto !important } }


@media (max-width:700px) and (orientation:portrait) {
  .title-art {
    background-repeat:no-repeat;
    background-position:82% top;
    background-size:auto 68svh;
    -webkit-mask-image:linear-gradient(#000 0 49svh,transparent 69svh);
    mask-image:linear-gradient(#000 0 49svh,transparent 69svh);
  }
  .menu-screen { background:linear-gradient(160deg,#263b40,#15212a 65%,#101b23) }
  .studio-brand { gap:7px }
  .studio-brand small { font-size:9px }
  .studio-controls { gap:5px }
  .studio-controls .quiet-button { padding-inline:10px; white-space:nowrap; font-size:12px }
  .studio-controls .fullscreen-button { width:34px; padding:0 }
}

#view-notice { position:fixed; z-index:10; left:50%; transform:translateX(-50%); top:12px; max-width:90vw; background:#172932; color:#fff3d3; border:1px solid #e5d8b8a6; border-radius:5px; padding:9px 15px; text-align:center; font-size:13px; box-shadow:0 3px 15px #0006; pointer-events:none }
