:root{
  color-scheme: dark;
  --bg:#070a10;
  --panel:#101722;
  --line:#273449;
  --text:#eef5ff;
  --muted:#94a4bb;
  --accent:#58d7ff;
}
*{box-sizing:border-box}
body{margin:0;background:radial-gradient(circle at top,#142237 0,#070a10 45%);font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--text);min-height:100vh}
header{max-width:1240px;margin:auto;padding:22px 20px 10px;display:flex;justify-content:space-between;gap:18px;align-items:center}
h1{font-size:clamp(22px,3vw,34px);margin:0;letter-spacing:.12em}
header p{margin:6px 0 0;color:var(--muted)}
.panel{background:rgba(16,23,34,.88);border:1px solid var(--line);box-shadow:0 18px 50px rgba(0,0,0,.25);border-radius:16px}
.camera-panel{max-width:1200px;margin:10px auto 14px;padding:14px 16px}.camera-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.hint{font-size:12px;color:var(--muted);margin-top:8px}
button,select{background:#172335;color:var(--text);border:1px solid #33445e;border-radius:9px;padding:9px 12px;font-size:14px}button{cursor:pointer}button:hover{filter:brightness(1.18)}button.accent{background:#0e6982;border-color:#4de0ff}.check{color:var(--muted);font-size:14px}
.tabs{max-width:1200px;margin:0 auto 12px;display:flex;gap:8px;padding:0 4px}.tab.active{background:#1d7896;border-color:#61dfff}
main{max-width:1200px;margin:0 auto;padding:0 0 30px}.game-section{display:none}.game-section.active{display:block}.game-wrap{padding:16px}.stage-title{display:flex;justify-content:space-between;gap:16px;margin-bottom:10px;color:var(--muted)}.stage-title b{color:var(--text)}
.viewport{position:relative;width:100%;aspect-ratio:16/9;overflow:hidden;background:#000;border:1px solid #344257;border-radius:12px}.camera-video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}.camera-video.mirror{transform:scaleX(-1)}.hidden{display:none!important}#breakoutCanvas,#puzzleCanvas{position:absolute;inset:0;width:100%;height:100%}.center-message{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);padding:12px 16px;background:rgba(0,0,0,.68);border:1px solid rgba(255,255,255,.28);border-radius:12px;text-align:center;pointer-events:none;white-space:pre-line}.controls{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}.legend{display:flex;gap:16px;flex-wrap:wrap;margin-top:12px;color:var(--muted);font-size:13px}.legend i{display:inline-block;width:14px;height:10px;border-radius:2px;margin-right:5px}.legend .sky{background:#40a8ff}.legend .building{background:#a4abb8}.legend .tree{background:#41d67c}.legend .person{background:#ffd54f}.analysis-line{font-size:13px;color:#afbdd0;margin-top:10px}
.puzzle-layout{display:grid;grid-template-columns:minmax(360px,760px) 260px;gap:16px}.puzzle-view{max-height:76vh;aspect-ratio:2/3;margin:auto}.video-dim{position:absolute;inset:0;background:rgba(0,0,0,.28)}.puzzle-side{padding:10px}.puzzle-side h3{margin-top:0}.theme-badge{font-weight:800;letter-spacing:.12em;padding:12px;border-radius:10px;border:1px solid #455269;text-align:center;margin-bottom:14px}.theme-badge.red{background:rgba(190,31,51,.4)}.theme-badge.blue{background:rgba(22,102,203,.4)}.theme-badge.green{background:rgba(29,150,84,.4)}.theme-badge.neutral{background:rgba(110,120,135,.25)}.meter-row{display:grid;grid-template-columns:88px 1fr 42px;gap:6px;align-items:center;font-size:12px;margin:10px 0}.meter-row meter{width:100%}.small,.key-help{color:var(--muted);font-size:12px;line-height:1.6}.puzzle-side button{width:100%;margin:5px 0}
@media(max-width:760px){header{align-items:flex-start;flex-direction:column}.puzzle-layout{grid-template-columns:1fr}.puzzle-side{display:grid;grid-template-columns:1fr 1fr;gap:8px}.puzzle-side h3,.theme-badge,.small,.key-help,.meter-row{grid-column:1/-1}.stage-title{font-size:12px;flex-direction:column;gap:4px}}
.image-mode-note{margin-top:12px;padding:10px 12px;border:1px solid #314057;border-radius:10px;background:rgba(13,22,34,.65);color:#c5d1df;font-size:13px;line-height:1.6}.image-mode-note b{color:#edf8ff}


/* ===== V5 mobile gameplay improvements ===== */
#breakoutViewport{touch-action:none;-webkit-user-select:none;user-select:none}
.in-game-settings,.touch-zone-hint{display:none}

body.breakout-playing{overflow:hidden;background:#000;overscroll-behavior:none}
body.breakout-playing header,
body.breakout-playing .camera-panel,
body.breakout-playing .tabs,
body.breakout-playing #breakoutSection .controls,
body.breakout-playing #breakoutSection .image-mode-note,
body.breakout-playing #breakoutSection .analysis-line{display:none!important}
body.breakout-playing main{max-width:none;margin:0;padding:0;width:100vw;height:100dvh}
body.breakout-playing #breakoutSection{display:block!important;width:100vw;height:100dvh}
body.breakout-playing #breakoutSection .game-wrap{position:relative;width:100vw;height:100dvh;padding:0;border:0;border-radius:0;background:#000;box-shadow:none}
body.breakout-playing #breakoutViewport{position:fixed;inset:0;width:100vw;height:100dvh;aspect-ratio:auto;border:0;border-radius:0;background:#000}
body.breakout-playing #breakoutVideo,
body.breakout-playing #breakoutCanvas{width:100%;height:100%;object-fit:cover}
body.breakout-playing #breakoutSection .stage-title{position:fixed;z-index:30;top:calc(env(safe-area-inset-top) + 8px);right:calc(env(safe-area-inset-right) + 8px);margin:0;padding:7px 10px;border-radius:10px;background:rgba(0,0,0,.48);font-size:13px;line-height:1.2;backdrop-filter:blur(5px)}
body.breakout-playing #breakoutSection .stage-title>div:first-child{display:none}
body.breakout-playing .in-game-settings{display:block;position:fixed;z-index:35;left:calc(env(safe-area-inset-left) + 8px);top:calc(env(safe-area-inset-top) + 8px);padding:7px 11px;border-radius:10px;background:rgba(0,0,0,.50);border:1px solid rgba(255,255,255,.55);font-size:13px}
body.breakout-playing .touch-zone-hint{display:block;position:fixed;z-index:25;left:50%;bottom:calc(env(safe-area-inset-bottom) + 8px);transform:translateX(-50%);max-width:80vw;padding:5px 9px;border-radius:9px;background:rgba(0,0,0,.32);color:rgba(255,255,255,.75);font-size:11px;pointer-events:none;white-space:nowrap}

@media (orientation:portrait){
  body.breakout-playing #breakoutViewport{height:100dvh}
  body.breakout-playing .touch-zone-hint{bottom:calc(env(safe-area-inset-bottom) + 12px)}
}
@media (orientation:landscape){
  body.breakout-playing #breakoutSection .stage-title{font-size:12px}
  body.breakout-playing .touch-zone-hint{bottom:calc(env(safe-area-inset-bottom) + 5px)}
}


/* ===== V6 mode selector + sound ===== */
.breakout-mode-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:12px;padding-top:10px;border-top:1px solid rgba(255,255,255,.08)}
.mode-label{font-size:13px;color:var(--muted);font-weight:700;margin-right:2px}
.mode-choice.active{background:#1d7896;border-color:#61dfff;box-shadow:0 0 0 1px rgba(97,223,255,.22) inset}
.sound-check{display:inline-flex;align-items:center;gap:5px;margin-left:4px}
.mode-help{margin-top:7px!important}
body.breakout-playing .breakout-mode-row,
body.breakout-playing .mode-help{display:none!important}
@media(max-width:760px){.breakout-mode-row{gap:6px}.breakout-mode-row button{flex:1 1 130px}.sound-check{flex:0 0 auto}}


/* ===== V6.2 speed control + Puzzle touch controls ===== */
.speed-setting{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:13px;margin-left:4px;color:var(--text)}
.speed-setting input[type="range"]{width:150px;accent-color:#61dfff}
.speed-setting output{min-width:92px;color:#bfeeff;font-weight:700;font-variant-numeric:tabular-nums}
.puzzle-touch-controls{display:grid;grid-template-columns:repeat(5,minmax(54px,1fr));gap:7px;max-width:760px;margin:10px auto 0}
.puzzle-touch-controls button{min-height:54px;padding:7px 5px;font-size:24px;font-weight:800;touch-action:manipulation;user-select:none;-webkit-user-select:none}
.puzzle-touch-controls button span{display:block;font-size:10px;font-weight:600;margin-top:2px;color:var(--muted)}
.puzzle-touch-controls .puzzle-drop{font-size:15px}
@media(max-width:760px){
  .speed-setting{width:100%;margin-left:0;padding-top:5px}
  .speed-setting input[type="range"]{flex:1;min-width:130px}
  .puzzle-touch-controls{grid-template-columns:repeat(5,1fr);gap:5px}
  .puzzle-touch-controls button{min-height:58px;font-size:26px;padding:6px 2px}
  .puzzle-touch-controls .puzzle-drop{font-size:13px}
}

/* V6.3 audio controls */
.sound-test-btn{
  min-height:38px;
  padding:7px 11px;
  border-radius:10px;
  white-space:nowrap;
}
.audio-status{
  font-size:.82rem;
  color:#ffd37a;
  white-space:nowrap;
}
.audio-status.ok{
  color:#86f7ae;
  font-weight:700;
}
@media (max-width: 720px){
  .sound-test-btn{min-height:44px}
  .audio-status{width:100%; padding-left:2px}
}

/* V6.4 original procedural BGM controls */
.bgm-check{white-space:nowrap}
.bgm-volume-setting{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:210px;
  font-size:.9rem;
  white-space:nowrap;
}
.bgm-volume-setting input[type="range"]{
  width:110px;
  accent-color:#58d7ff;
}
.bgm-volume-setting output{
  min-width:38px;
  text-align:right;
  font-variant-numeric:tabular-nums;
}
@media (max-width:720px){
  .bgm-volume-setting{
    width:100%;
    min-width:0;
    justify-content:flex-start;
  }
  .bgm-volume-setting input[type="range"]{
    flex:1;
    max-width:210px;
  }
}

/* ===== V7.0 separate game launcher ===== */
main{padding-left:12px;padding-right:12px}.launcher-screen{max-width:1120px;margin:0 auto}.launcher-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin:10px auto 18px}.game-card{min-height:180px;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:8px;padding:22px;text-align:left;border-radius:18px;background:linear-gradient(145deg,rgba(26,39,58,.96),rgba(10,17,28,.96));box-shadow:0 18px 45px rgba(0,0,0,.28)}.game-card strong{font-size:20px;letter-spacing:.03em}.game-card small{font-size:13px;line-height:1.55;color:var(--muted)}.game-card-mark{display:block;font-size:32px;min-height:42px;font-weight:800;letter-spacing:.12em;color:#9deeff;text-shadow:0 0 18px rgba(88,215,255,.48)}.puzzle-card .game-card-mark{color:#d5a6ff}.space-card .game-card-mark{color:#ffd166}.common-settings{max-width:none;margin:0;padding:0;overflow:hidden}.common-settings summary{cursor:pointer;padding:14px 16px;font-weight:800;color:#d7e9ff}.common-settings .camera-row,.common-settings .common-audio-row,.common-settings .hint{margin-left:16px;margin-right:16px}.common-settings .camera-row{padding-top:4px}.common-settings .common-audio-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:12px;padding-top:12px;border-top:1px solid rgba(255,255,255,.08)}.common-settings .hint{padding-bottom:14px}.game-topbar{display:flex;align-items:center;gap:12px;max-width:1200px;margin:0 auto 10px}.game-topbar strong{font-size:18px;letter-spacing:.04em}.back-game-btn{background:#101a28}.breakout-settings{max-width:1200px;margin:0 auto 12px;padding:12px 14px}.tabs{display:none!important}body.breakout-playing .launcher-screen,body.breakout-playing #breakoutSection>.game-topbar,body.breakout-playing #breakoutSection>.breakout-settings{display:none!important}
/* Block Puzzle */
.puzzle-layout{display:grid;grid-template-columns:minmax(360px,760px) 260px;gap:16px}.puzzle-view{max-height:76vh;aspect-ratio:2/3;margin:auto}.puzzle-side{padding:10px}.puzzle-side h3{margin-top:0}.puzzle-side button{width:100%;margin:5px 0}.puzzle-touch-controls{display:grid;grid-template-columns:repeat(5,minmax(54px,1fr));gap:7px;max-width:760px;margin:10px auto 0}.puzzle-touch-controls button{min-height:54px;padding:7px 5px;font-size:24px;font-weight:800;touch-action:manipulation;user-select:none;-webkit-user-select:none}.puzzle-touch-controls button span{display:block;font-size:10px;font-weight:600;margin-top:2px;color:var(--muted)}.puzzle-touch-controls .puzzle-drop{font-size:15px}
/* Space Defense */
.space-layout{display:grid;grid-template-columns:minmax(360px,760px) 270px;gap:16px}.space-main{min-width:0}.space-view{max-height:78vh;aspect-ratio:3/4;margin:auto;background:#02050a}.space-view #spaceCanvas{position:absolute;inset:0;width:100%;height:100%}.space-dim{background:rgba(0,0,10,.46)}.space-side{padding:10px}.space-side h3{margin-top:0}.space-side button{width:100%;margin:5px 0}.space-touch-controls{display:grid;grid-template-columns:1fr 1.35fr 1fr;gap:8px;max-width:760px;margin:10px auto 0}.space-touch-controls button{min-height:60px;font-size:26px;font-weight:900;touch-action:none;user-select:none;-webkit-user-select:none}.space-touch-controls button span{display:block;margin-top:2px;font-size:10px;color:var(--muted)}.space-touch-controls .space-fire{font-size:18px;border-color:#ff7d9d;background:#50213b}.rights-note{margin-top:12px;padding:10px 11px;border:1px solid rgba(255,209,102,.28);border-radius:10px;color:#b9c5d5;font-size:11px;line-height:1.65;background:rgba(255,209,102,.045)}
@media(max-width:760px){main{padding-left:7px;padding-right:7px}.launcher-grid{grid-template-columns:1fr;gap:10px}.game-card{min-height:118px;padding:16px}.game-card-mark{font-size:26px;min-height:30px}.game-topbar{margin-bottom:8px}.puzzle-layout,.space-layout{grid-template-columns:1fr}.puzzle-side,.space-side{display:grid;grid-template-columns:1fr 1fr;gap:8px}.puzzle-side h3,.puzzle-side .theme-badge,.puzzle-side .small,.puzzle-side .key-help,.puzzle-side .meter-row,.space-side h3,.space-side .small,.space-side .key-help,.space-side .rights-note{grid-column:1/-1}.puzzle-touch-controls{grid-template-columns:repeat(5,1fr);gap:5px}.puzzle-touch-controls button{min-height:58px;font-size:26px;padding:6px 2px}.puzzle-touch-controls .puzzle-drop{font-size:13px}.space-view{max-height:68vh}.space-touch-controls button{min-height:64px}}

/* ===== V7.1 AR Dive Squadron ===== */
.launcher-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.dive-card .game-card-mark{color:#8fffd2}
.dive-layout{display:grid;grid-template-columns:minmax(360px,760px) 270px;gap:16px}
.dive-main{min-width:0}
.dive-view{max-height:78vh;aspect-ratio:3/4;margin:auto;background:#02050a}
.dive-view #diveCanvas{position:absolute;inset:0;width:100%;height:100%}
.dive-dim{background:rgba(0,4,14,.40)}
.dive-side{padding:10px}
.dive-side h3{margin-top:0}
.dive-side button{width:100%;margin:5px 0}
.dive-touch-controls{
  display:grid;
  grid-template-columns:1fr 1.35fr 1fr;
  gap:8px;
  max-width:760px;
  margin:10px auto 0;
}
.dive-touch-controls button{
  min-height:60px;
  font-size:26px;
  font-weight:900;
  touch-action:none;
  user-select:none;
  -webkit-user-select:none;
}
.dive-touch-controls button span{
  display:block;
  margin-top:2px;
  font-size:10px;
  color:var(--muted);
}
.dive-touch-controls .dive-fire{
  font-size:18px;
  border-color:#7fffd0;
  background:#16483d;
}
@media(max-width:760px){
  .launcher-grid{grid-template-columns:1fr}
  .dive-layout{grid-template-columns:1fr}
  .dive-side{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .dive-side h3,.dive-side .small,.dive-side .theme-badge,.dive-side .key-help,.dive-side .rights-note{grid-column:1/-1}
  .dive-view{max-height:68vh}
  .dive-touch-controls button{min-height:64px}
}

/* ===== V7.2: all play actions immediately above the game viewport ===== */
body.game-open header {padding:8px 12px 5px;max-width:1200px}
body.game-open header h1 {font-size:clamp(17px,3vw,23px)}
body.game-open header p{display:none}
body.game-open .game-topbar{margin:0 auto 6px}
body.game-open .game-topbar strong{font-size:15px}
.game-actionbar{
  display:flex;
  align-items:stretch;
  gap:8px;
  margin:0 0 8px;
  width:100%;
}
.game-actionbar button{
  min-height:47px;
  padding:9px 12px;
  font-size:14px;
  line-height:1.2;
  font-weight:750;
  white-space:nowrap;
}
.game-actionbar .camera-action{background:#163349;border-color:#53bce2}
.game-actionbar .start-action{background:#18634d;border-color:#62e8b2;flex:1}
.game-actionbar .reset-action{background:#202a39;border-color:#55667e}
body.breakout-playing #breakoutSection .game-actionbar{display:none!important}

/* Both shooting games: FIRE - horizontal swipe pad - FIRE. */
.space-touch-controls.shooter-touch-controls,
.dive-touch-controls.shooter-touch-controls{
  display:grid;
  grid-template-columns:minmax(76px,1fr) minmax(130px,2.2fr) minmax(76px,1fr);
  gap:8px;
  align-items:stretch;
  margin:9px auto 0;
  width:100%;
  padding-bottom:max(4px,env(safe-area-inset-bottom));
}
.shooter-touch-controls .shooter-fire{
  border:2px solid #f9a569;
  background:linear-gradient(145deg,#b64239,#572128);
  box-shadow:inset 0 2px 7px rgba(255,255,255,.1);
  color:#fff;
  font-size:18px;
  font-weight:850;
  min-height:78px;
  touch-action:none;
  user-select:none;
  -webkit-user-select:none;
  -webkit-tap-highlight-color:transparent;
}
.shooter-touch-controls .shooter-fire.is-pressed{background:#d4513f;transform:scale(.98)}
.shooter-touch-controls .shooter-fire span{display:block;font-size:11px;color:#ffe0ce;margin-top:3px}
.shooter-touch-controls .shooter-move-pad{
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:stretch;
  gap:6px;
  min-height:78px;
  padding:8px 12px;
  border:2px solid #4ebadb;
  border-radius:12px;
  background:linear-gradient(180deg,#1d3b56,#102338);
  touch-action:none;
  cursor:ew-resize;
  user-select:none;
  -webkit-user-select:none;
  -webkit-tap-highlight-color:transparent;
  overflow:hidden;
}
.shooter-move-pad .pad-hint{font-size:12px;color:#effcff;text-align:center;font-weight:800;white-space:nowrap}
.shooter-move-pad .pad-line{
  height:15px;
  position:relative;
  display:block;
  margin:2px 4px;
  border-top:3px solid rgba(130,231,255,.65);
}
.shooter-move-pad .pad-marker{
  position:absolute;
  left:50%;
  transform:translate(-50%,-9px);
  font-size:18px;
  line-height:1;
  color:#d6fcff;
  text-shadow:0 0 9px #00adff;
  pointer-events:none;
}
.shooter-move-pad .pad-caption{text-align:center;font-size:10px;color:#b5d5e9}
.shooter-move-pad:focus-visible{outline:3px solid #f3e88c;outline-offset:2px}

/* Keep start/camera and both FIRE buttons visible without needing to scroll. */
@media(max-width:760px){
  body.game-open header {padding:5px 9px 2px}
  body.game-open header h1{font-size:17px;letter-spacing:.055em}
  body.game-open .game-topbar{gap:7px;margin:0 auto 4px}
  body.game-open .game-topbar strong{font-size:13px}
  body.game-open .back-game-btn{font-size:12px;padding:7px 9px}
  body.game-open .game-wrap{padding:7px}
  body.game-open .stage-title{margin-bottom:5px;font-size:10px;gap:1px}
  .game-actionbar{gap:5px;margin:0 0 6px}
  .game-actionbar button{min-height:45px;padding:8px 7px;font-size:12px}
  .game-actionbar .start-action{flex:1.2}
  .game-actionbar .reset-action{font-size:11px}
  .space-view,.dive-view{
    width:min(100%, calc(53dvh * .75));
    max-height:53dvh;
    margin-left:auto;
    margin-right:auto;
  }
  .space-touch-controls.shooter-touch-controls,
  .dive-touch-controls.shooter-touch-controls{
    grid-template-columns:minmax(68px,1fr) minmax(132px,2.1fr) minmax(68px,1fr);
    gap:5px;
    margin-top:7px;
  }
  .shooter-touch-controls .shooter-fire,
  .shooter-touch-controls .shooter-move-pad{min-height:76px}
  .shooter-move-pad .pad-hint{font-size:11px}
}
@media(max-width:390px){
  .shooter-move-pad .pad-hint{font-size:10px}
  .shooter-touch-controls .shooter-move-pad{padding:8px 5px}
  .space-touch-controls.shooter-touch-controls,
  .dive-touch-controls.shooter-touch-controls{
    grid-template-columns:minmax(64px,1fr) minmax(125px,2fr) minmax(64px,1fr);
  }
}

/* ===== V7.3 AR Block Puzzle: side rotation + central 2D touch pad ===== */
.puzzle-touch-controls.puzzle-swipe-controls{
  display:grid;
  grid-template-columns:minmax(70px,1fr) minmax(142px,3.2fr) minmax(70px,1fr);
  align-items:stretch;
  gap:8px;
  width:100%;
  max-width:760px;
  margin:8px auto 0;
  padding-bottom:max(4px,env(safe-area-inset-bottom));
}
.puzzle-swipe-controls .puzzle-rotate{
  min-width:0;
  min-height:78px;
  padding:8px 4px;
  font-size:30px;
  font-weight:800;
  background:linear-gradient(150deg,#513679,#261a46);
  border:2px solid #a57be3;
  color:#f1e7ff;
  touch-action:manipulation;
  user-select:none;
  -webkit-user-select:none;
  -webkit-tap-highlight-color:transparent;
}
.puzzle-swipe-controls .puzzle-rotate span{
  display:block;
  margin-top:0;
  font-size:11px;
  color:#eee1ff;
}
.puzzle-swipe-controls .puzzle-move-pad{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  justify-content:center;
  gap:7px;
  min-height:78px;
  border-radius:12px;
  border:2px solid #57cae8;
  background:linear-gradient(160deg,#173f58,#102337);
  padding:8px 11px;
  touch-action:none;
  user-select:none;
  -webkit-user-select:none;
  -webkit-tap-highlight-color:transparent;
  cursor:grab;
  overflow:hidden;
}
.puzzle-swipe-controls .puzzle-move-pad.is-dragging{
  border-color:#a9f0ff;
  background:linear-gradient(160deg,#245773,#13324b);
  cursor:grabbing;
}
.puzzle-swipe-controls .puzzle-pad-title{
  text-align:center;
  color:#f0fcff;
  font-size:12px;
  font-weight:800;
  white-space:nowrap;
}
.puzzle-swipe-controls .puzzle-pad-track{
  position:relative;
  height:14px;
  border-top:3px solid rgba(133,231,255,.65);
  margin:1px 7px;
}
.puzzle-swipe-controls .puzzle-pad-marker{
  position:absolute;
  top:-3px;
  left:50%;
  transform:translate(-50%,-35%);
  font-size:16px;
  line-height:1;
  color:#d7ffff;
  text-shadow:0 0 9px #2cc5ff;
  pointer-events:none;
}
.puzzle-swipe-controls .puzzle-pad-caption{
  text-align:center;
  font-size:10px;
  line-height:1.2;
  color:#d1e7f2;
  white-space:normal;
}
.puzzle-swipe-controls .puzzle-move-pad:focus-visible{
  outline:3px solid #ffe18d;
  outline-offset:2px;
}
@media(max-width:760px){
  body.game-open .puzzle-view{max-height:60dvh;width:min(100%,40dvh);margin-left:auto;margin-right:auto}
  .puzzle-touch-controls.puzzle-swipe-controls{
    grid-template-columns:minmax(64px,.9fr) minmax(134px,2.6fr) minmax(64px,.9fr);
    gap:5px;
    margin-top:7px;
  }
  .puzzle-swipe-controls .puzzle-rotate,.puzzle-swipe-controls .puzzle-move-pad{min-height:76px}
  .puzzle-swipe-controls .puzzle-move-pad{padding:8px 5px}
  .puzzle-swipe-controls .puzzle-pad-title{font-size:11px}
  .puzzle-swipe-controls .puzzle-pad-caption{font-size:9px}
}
@media(max-width:390px){
  .puzzle-touch-controls.puzzle-swipe-controls{grid-template-columns:minmax(60px,.9fr) minmax(126px,2.4fr) minmax(60px,.9fr)}
  .puzzle-swipe-controls .puzzle-pad-title{font-size:10px}
}
@media(max-width:760px) and (max-height:700px){
  body.game-open .puzzle-view{max-height:53dvh;width:min(100%,calc(53dvh * 2 / 3))}
}

/* V7.5: separate settings page (game UI stays compact) */
.menu-settings-link{display:block;max-width:580px;margin:16px auto 8px;padding:14px 18px;
  border:1px solid #5e8eaf;border-radius:14px;color:#e3faff;text-align:center;
  text-decoration:none;font-weight:750;background:linear-gradient(125deg,#1a4058,#132436)}
.game-settings-link{margin-left:auto;white-space:nowrap;color:#e2f6ff;border:1px solid #576d87;
  border-radius:10px;padding:8px 12px;text-decoration:none;font-size:13px;background:#1b2b3f}
.settings-layout{max-width:750px;margin:0 auto;padding:10px 15px 35px}
.settings-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:16px}
.settings-heading h2{margin:0;font-size:24px}
.settings-return{display:inline-flex;justify-content:center;align-items:center;text-decoration:none;
  color:#fff;padding:12px 16px;border:1px solid #5c7794;border-radius:12px;background:#17283c}
.settings-return.primary{background:#176b4f;border-color:#62e8b2}
.prefs-card{padding:18px 20px;margin:0 0 14px}
.prefs-card h3{margin:0 0 10px;font-size:18px}
.prefs-line{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:54px;
  padding:9px 0;border-bottom:1px solid rgba(255,255,255,.09)}
.prefs-line:last-of-type{border-bottom:none}
.prefs-line>span{min-width:90px;font-weight:650}
.prefs-line input[type='checkbox']{width:26px;height:26px;accent-color:#58d7ff}
.prefs-line select{max-width:220px;font-size:15px;min-height:44px}
.prefs-volume input[type='range']{min-width:80px;max-width:300px;flex:1;accent-color:#58d7ff}
.prefs-volume output{min-width:46px;text-align:right}
.prefs-note{font-size:13px;line-height:1.65;color:#a7c7d9;margin:12px 0 0}
.settings-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.shooter-move-pad.is-dragging{border-color:#a6ffef;box-shadow:0 0 0 2px rgba(166,255,239,.16) inset}
@media(max-width:600px){.prefs-card{padding:15px}.settings-foot>*{flex:1;min-width:145px}
  .game-settings-link{font-size:12px;padding:7px 9px}}


/* ===== V7.8: 2× total score digits (vs V7.7), distinct pink-magenta HUD ===== */
#breakoutSection .breakout-scoreboard {
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  justify-content:center;
  gap:3px;
  flex-shrink:0;
  font-variant-numeric:tabular-nums;
}
#breakoutSection .breakout-score-line {
  display:flex;
  align-items:baseline;
  justify-content:flex-end;
  gap:8px;
}
#breakoutSection .breakout-score-label {
  color:#c5d7e9;
  font-size:12px;
  font-weight:800;
  letter-spacing:.1em;
}
#breakoutSection #breakoutScore {
  display:inline-block;
  vertical-align:middle;
  font-size:78px; /* V7.7 39px × 2 */
  line-height:.95;
  font-weight:900;
  font-variant-numeric:tabular-nums;
  letter-spacing:-.04em;
  color:#ff5bcf;  /* unlike yellow/cyan floating +points */
  -webkit-text-stroke:.6px #52113e;
  text-shadow:0 0 12px rgba(255,65,188,.76), 0 2px 5px rgba(0,0,0,.95);
}
#breakoutSection .breakout-lives-line {
  font-size:12px;
  font-weight:800;
  color:#e3efff;
  white-space:nowrap;
}
#breakoutSection .breakout-lives-line b {color:#fff;}
body.breakout-playing #breakoutSection .stage-title {
  display:flex;
  align-items:center;
  max-width:calc(100vw - 90px - env(safe-area-inset-right));
}
body.breakout-playing #breakoutSection .breakout-score-line {
  flex-direction:column;
  align-items:flex-end;
  gap:0;
}
@media(max-width:760px) {
  #breakoutSection #breakoutScore {font-size:72px;} /* V7.7 36px × 2 */
  body.breakout-playing #breakoutSection .stage-title {padding:5px 7px;}
}

/* V7.9: speed controls remain readable on mobile */
.prefs-volume output { min-width: 52px; font-weight: 800; color: #8de6ff; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .prefs-volume > span { min-width: 112px; max-width: 132px; font-size: 13px; } .prefs-volume input[type='range'] { min-width: 60px; } }


/* ===== V8.0: large scores for all four games ===== */
.arcade-scoreboard{
  display:flex; flex-direction:column; align-items:flex-end; justify-content:center;
  flex-shrink:0; gap:0; min-width:110px; font-variant-numeric:tabular-nums;
}
.arcade-score-caption{font-size:12px;letter-spacing:.15em;font-weight:800;color:#e4c6ff}
.stage-title .arcade-score-value{
  display:block; color:#ffca5c; font-weight:950; font-size:clamp(40px,5.4vw,76px);
  line-height:1.04; letter-spacing:-.045em; text-shadow:0 2px 8px #000,0 0 15px rgba(255,159,64,.3);
}
.arcade-score-meta{font-size:13px;font-weight:750;color:#e8f1ff;white-space:nowrap}
.arcade-score-meta b{color:#d5fbff}
/* Keep breakout's already-large magenta score; ensure it is easily legible. */
#breakoutSection .breakout-score-label{color:#ffe6fc}

.menu-rankings-link{display:inline-block;margin:6px 0 10px 8px;min-height:44px;background:#442f62;border-color:#ab78e6;font-weight:800}
.game-ranking-link{padding:8px 11px;background:#332b4c;border:1px solid #9576c2;font-weight:800}
.rankings-screen{max-width:900px;margin:0 auto}
.rankings-panel{padding:18px;}
.rankings-panel>p{line-height:1.6;color:#c7d9ed;margin:4px 0 14px}
.ranking-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin:12px 0}
.ranking-tabs button{min-height:45px;font-weight:750;font-size:12px;padding:8px 4px}
.ranking-tabs button.selected{background:#3e2767;border-color:#cc99ff;color:#fff}
.ranking-status{min-height:25px;font-size:14px;color:#cfe8f8}
.ranking-table-wrap{width:100%;overflow-x:auto}
.ranking-table{border-collapse:collapse;width:100%;font-variant-numeric:tabular-nums;text-align:left}
.ranking-table thead{background:#1b3042}
.ranking-table th,.ranking-table td{padding:12px 9px;border-bottom:1px solid #334458}
.ranking-table th:nth-child(3),.ranking-table td:nth-child(3){text-align:right;font-weight:800}
.ranking-table td:nth-child(2){overflow-wrap:anywhere}
.ranking-table tbody tr:nth-child(1) td{color:#ffe184;font-weight:900;font-size:1.07em}
.ranking-table tbody tr:nth-child(2) td{color:#bde5ff}
.ranking-table tbody tr:nth-child(3) td{color:#ffbcac}
.ranking-notice{font-size:12px!important;color:#b0c1d4!important;line-height:1.5;margin:10px 0}
.ranking-dialog[hidden]{display:none!important}
.ranking-dialog{position:fixed;inset:0;z-index:150;background:rgba(3,6,15,.83);display:flex;align-items:center;justify-content:center;padding:16px;overflow:auto}
.ranking-dialog-inner{padding:22px;width:min(460px,100%);box-shadow:0 0 45px rgba(180,108,255,.28);border-color:#8b5aca}
.ranking-dialog-inner h2{font-size:clamp(25px,6vw,38px);color:#ffd477;text-align:center;margin:0 0 12px}
.ranking-dialog-inner #rankEntrySummary{line-height:1.6;font-weight:750}
.ranking-dialog-inner label{display:block;margin:12px 0 6px;font-size:14px;font-weight:750}
.ranking-dialog-inner input{width:100%;min-height:48px;font-size:18px;border:1px solid #7e8eaf;background:#101a28;color:white;border-radius:9px;padding:10px}
.ranking-dialog-actions{display:flex;gap:10px;justify-content:stretch}
.ranking-dialog-actions button{flex:1;min-height:47px;font-weight:800}
#rankEntrySave{background:#8c497a;border-color:#f39ccd}
@media(max-width:760px){
  .stage-title .arcade-score-value{font-size:clamp(42px,11vw,68px)}
  .stage-title .arcade-scoreboard{align-self:flex-end}
  .ranking-tabs{grid-template-columns:repeat(2,1fr)}
  .ranking-table th,.ranking-table td{padding:10px 5px;font-size:13px}
  .game-ranking-link{font-size:12px}
  .rankings-panel{padding:12px}
}

/* ===== V8.1: mandatory camera safety check before game/camera use ===== */
.camera-safety-gate[hidden]{display:none!important}
.camera-safety-pending{overflow:hidden}
.camera-safety-gate{
  position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;
  background:rgba(2,6,14,.93);padding:16px;overflow-y:auto;overscroll-behavior:contain;
}
.camera-safety-panel{
  width:min(540px,100%);padding:clamp(20px,5vw,30px);margin:auto;
  border:1px solid #66bdd1;box-shadow:0 0 50px rgba(49,181,214,.16);
}
.camera-safety-icon{font-size:36px;text-align:center}
.camera-safety-panel h2{text-align:center;font-size:clamp(22px,5.7vw,30px);margin:8px 0 10px;color:#fff}
.camera-safety-panel #cameraSafetyIntro{text-align:center;color:#c9deeb;line-height:1.65;margin:0 0 17px}
.camera-safety-check{
  display:flex;align-items:flex-start;gap:13px;padding:15px;margin:11px 0;
  background:#162b39;border:1px solid #4c7285;border-radius:12px;cursor:pointer;
}
.camera-safety-check:has(input:checked){background:#163e43;border-color:#79d5cd}
.camera-safety-check input{flex:0 0 auto;width:26px;height:26px;margin:1px 0 0;accent-color:#54e0ba}
.camera-safety-check strong{display:block;font-size:17px;line-height:1.4;color:#fff}
.camera-safety-check small{display:block;color:#bfd0dd;font-size:12px;line-height:1.55;margin-top:5px}
.camera-safety-note{border-left:3px solid #eec46f;padding:8px 12px;background:#342b1d;color:#ffe2a6;font-size:13px;line-height:1.7}
#cameraSafetyContinue{display:block;width:100%;min-height:54px;margin:18px 0 0;font-size:17px;font-weight:850;background:#116e82;color:white;border-color:#69edff}
#cameraSafetyContinue:disabled{opacity:.42;cursor:not-allowed;filter:none;background:#293d4a}
.camera-safety-footnote{font-size:11px;line-height:1.6;color:#a9c1d0;margin:14px 0 0;text-align:center}
@media(max-width:480px){.camera-safety-panel{padding:17px}.camera-safety-check{padding:12px;margin:8px 0}.camera-safety-check strong{font-size:16px}}


/* ===== V8.2: inline TOP3/TOP10 next to each launcher game; no horizontal swipe ===== */
.launcher-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-items:start;gap:13px}
.launcher-entry{min-width:0;border:1px solid #3d506b;border-radius:16px;background:linear-gradient(140deg,rgba(19,32,48,.98),rgba(10,15,27,.96));overflow:hidden;box-shadow:0 10px 25px rgba(0,0,0,.25)}
.launcher-entry-row{display:grid;grid-template-columns:minmax(0,48fr) minmax(0,52fr);align-items:stretch;gap:0;min-width:0}
.launcher-entry .game-card{width:100%;min-width:0;min-height:160px;border:0;border-right:1px solid #3d506b;border-radius:0;background:transparent;box-shadow:none;padding:13px 11px;gap:5px;justify-content:center}
.launcher-entry .game-card:hover,.launcher-entry .game-card:focus-visible{background:rgba(48,112,155,.23)}
.launcher-entry .game-card-mark{min-height:0;font-size:25px;margin-bottom:2px}
.launcher-entry .game-card strong{font-size:clamp(13px,1.3vw,18px);line-height:1.3;overflow-wrap:anywhere}
.launcher-entry .game-card small{font-size:11px;line-height:1.45;overflow-wrap:anywhere}
.launcher-top3{min-width:0;padding:12px 9px 7px;background:rgba(6,13,25,.5)}
.launcher-top3-heading{font-size:13px;letter-spacing:.05em;color:#ffe1a4;margin-bottom:8px}
.launcher-top3-list{padding:0;margin:0;list-style:none;display:grid;gap:6px}
.launcher-rank-item{display:grid;grid-template-columns:18px minmax(0,1fr) auto;align-items:center;gap:5px;min-width:0;font-size:12px;white-space:nowrap}
.launcher-rank-number{display:flex;align-items:center;justify-content:center;width:18px;height:20px;border-radius:5px;font-size:11px;font-weight:900;background:#374458;color:#eff5ff}
.rank-place-1{color:#251500;background:#fbd477}.rank-place-2{color:#14283c;background:#bedce8}.rank-place-3{color:#281406;background:#e9ae85}
.launcher-rank-name{min-width:0;overflow:hidden;text-overflow:ellipsis;color:#f0f7ff;font-weight:650}
.launcher-rank-score{font-variant-numeric:tabular-nums;font-weight:850;color:#ffe194;letter-spacing:-.02em}
.launcher-rank-message{font-size:11px;color:#b6c8db;line-height:1.5;overflow-wrap:anywhere}
.launcher-rank-toggle{width:100%;min-height:38px;border:0;border-top:1px solid #34465f;border-radius:0;background:#182b40;color:#d3f3ff;padding:7px 10px;font-weight:800;font-size:12px;text-align:center}
.launcher-rank-toggle.expanded{background:#274c64;color:#fff}
.launcher-rank-toggle .rank-chevron{display:inline-block;margin-left:5px;transition:transform .18s}
.launcher-rank-toggle.expanded .rank-chevron{transform:rotate(180deg)}
.launcher-rank-detail[hidden]{display:none!important}
.launcher-rank-detail{padding:10px 10px 11px;background:#101d2e;border-top:1px solid #52738e;min-width:0}
.launcher-rank-detail-header{display:flex;align-items:baseline;justify-content:space-between;gap:8px;flex-wrap:wrap;font-size:12px;margin-bottom:7px}
.launcher-rank-detail-header strong{color:#ffe19c}
.launcher-rank-status{color:#bed0e0;font-size:11px}
.launcher-rank-table{width:100%;border-collapse:collapse;table-layout:fixed;font-size:12px;font-variant-numeric:tabular-nums}
.launcher-rank-table th,.launcher-rank-table td{padding:6px 4px;border-bottom:1px solid #2d4056;text-align:left;overflow-wrap:anywhere}
.launcher-rank-table th:first-child,.launcher-rank-table td:first-child{width:33px;text-align:center}
.launcher-rank-table th:nth-child(3),.launcher-rank-table td:nth-child(3){width:73px;text-align:right;font-weight:800}
.launcher-rank-table th:nth-child(4),.launcher-rank-table td:nth-child(4){width:82px;text-align:right;font-size:11px;color:#a9bed1}
.launcher-rank-table tbody tr:nth-child(1){color:#ffe184}
.launcher-rank-table tbody tr:nth-child(2){color:#c0e4f8}
.launcher-rank-table tbody tr:nth-child(3){color:#ffbca5}
.launcher-ranking-note{color:#9cb5c8;font-size:10px;line-height:1.4;margin:7px 0 0}
.launcher-rank-help{font-size:12px;line-height:1.5;color:#b2c8d9;margin:6px 0 8px}
@media(max-width:760px){
  .launcher-grid{grid-template-columns:1fr;gap:8px;margin:9px auto 12px}
  .launcher-entry-row{grid-template-columns:minmax(0,46fr) minmax(0,54fr)}
  .launcher-entry .game-card{min-height:111px;padding:8px 7px;gap:3px}
  .launcher-entry .game-card-mark{font-size:21px}
  .launcher-entry .game-card strong{font-size:13px;line-height:1.2}
  .launcher-entry .game-card small{font-size:10px;line-height:1.3}
  .launcher-top3{padding:7px 7px 5px}
  .launcher-top3-heading{font-size:11px;margin-bottom:5px}
  .launcher-top3-list{gap:4px}
  .launcher-rank-item{font-size:11px;gap:4px;grid-template-columns:17px minmax(0,1fr) auto}
  .launcher-rank-number{width:17px;height:18px;font-size:10px}
  .launcher-rank-toggle{min-height:36px;font-size:12px}
  .launcher-rank-table{font-size:12px}
  .launcher-rank-table th,.launcher-rank-table td{padding:5px 3px}
  .launcher-rank-table th:nth-child(4),.launcher-rank-table td:nth-child(4){width:75px;font-size:10px}
}
@media(max-width:340px){
  .launcher-entry .game-card small{display:none}
  .launcher-rank-item{font-size:10px}
  .launcher-rank-table th:nth-child(4),.launcher-rank-table td:nth-child(4){width:64px;font-size:9px}
}
