:root{color-scheme:dark;--bg:#060b1b;--panel:#121b31;--line:#293754;--muted:#aabbd6;--teal:#4cead8;--yellow:#ffd46f}*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:var(--bg);color:#f5f8ff;font-family:system-ui,-apple-system,'Segoe UI',sans-serif}body{background:radial-gradient(ellipse at 20% 0%,#1f2850 0,transparent 40%),radial-gradient(ellipse at 90% 95%,#1c1247 0,transparent 45%),#070b19}a{color:inherit}button,input,select{font:inherit}button{cursor:pointer}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #96f9ed;outline-offset:3px}.wrap{max-width:1170px;margin:0 auto;padding:18px 18px 40px}.head{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:4px 0 21px}.logo{display:inline-flex;align-items:center;gap:10px;text-decoration:none;font-weight:900;letter-spacing:.07em;font-size:14px}.logo-mark{height:34px;width:34px;object-fit:cover;border-radius:10px}.logo b{color:var(--teal)}.head-links{display:flex;align-items:center;gap:15px;font-size:13px;color:#d6deef}.head-links a{text-decoration:none}.head-links a:hover{color:var(--teal)}.headline{margin:0 0 15px;display:flex;align-items:end;justify-content:space-between;gap:12px;flex-wrap:wrap}.kicker{display:inline-block;text-transform:uppercase;letter-spacing:.2em;font-size:10px;color:var(--teal);font-weight:900;margin-bottom:5px}h1{font-size:clamp(32px,5.1vw,56px);line-height:1.02;margin:0;letter-spacing:-.04em}h1 span{color:var(--teal)}.sub{margin:9px 0 0;line-height:1.5;color:var(--muted);font-size:14px}.game-layout{display:grid;grid-template-columns:minmax(0,1fr) 265px;gap:16px}.game-main{min-width:0}.stage{position:relative;border:1px solid #415177;border-radius:19px;overflow:hidden;box-shadow:0 22px 70px #0009,0 0 50px #4cead80c;background:#080e1d;touch-action:none}.stage canvas{display:block;width:100%;height:auto;aspect-ratio:16/9;touch-action:none;user-select:none;-webkit-user-select:none}.hud{position:absolute;left:12px;right:12px;top:12px;display:flex;gap:8px;pointer-events:none;align-items:flex-start}.hud-chip{background:#071021e8;border:1px solid #ffffff33;border-radius:10px;padding:7px 11px;min-width:85px;backdrop-filter:blur(9px)}.hud-chip small{display:block;color:#a9bbd8;font-size:9px;letter-spacing:.12em;font-weight:800}.hud-chip strong{display:block;font-size:18px;color:#fff}.hud-chip.best strong{color:var(--yellow)}.hud-tail{margin-left:auto;pointer-events:auto;display:flex;gap:7px}.iconbtn{background:#071021e9;border:1px solid #ffffff4a;color:#fff;border-radius:11px;min-width:40px;min-height:40px;font-size:18px}.iconbtn:hover{background:#253250}.screen{position:absolute;inset:0;background:#061122b9;backdrop-filter:blur(7px);display:flex;align-items:center;justify-content:center;padding:16px;text-align:center}.screen[hidden]{display:none}.dialog{padding:25px;border-radius:20px;border:1px solid #607caa;background:linear-gradient(140deg,#172445,#0b152d);width:min(420px,100%);box-shadow:0 15px 50px #0008}.dialog .symbol{font-size:43px}.dialog h2{font-size:clamp(23px,3vw,35px);margin:5px 0 8px;line-height:1.06}.dialog p{font-size:13px;color:#bacbea;line-height:1.55;margin:7px 0 16px}.dialog input{padding:12px 13px;width:100%;border:1px solid #4d668d;border-radius:10px;background:#09152d;color:white;text-align:center;margin-bottom:10px}.primary{border:0;background:linear-gradient(120deg,#4ef4dc,#5ea0ff);color:#07162b;padding:13px 22px;border-radius:11px;font-weight:900;min-height:45px}.primary:hover{filter:brightness(1.12)}.meta{color:#8faccd;font-size:11px;line-height:1.4;margin-top:12px}.sidebar{display:flex;flex-direction:column;gap:13px}.panel{border:1px solid var(--line);border-radius:16px;background:linear-gradient(160deg,#121d36,#0e1629);padding:18px}.panel h3{font-size:14px;margin:0 0 10px}.panel p,.panel li{font-size:13px;line-height:1.6;color:#b9c8e1}.panel p{margin:0}.panel ul{margin:0;padding-left:19px}.panel li+li{margin-top:5px}.board{list-style:none!important;padding:0!important;margin:0}.board li{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #ffffff19;padding:8px 0;gap:8px}.board li:last-child{border:0}.board strong{color:#ffe287}.controls{display:flex;gap:12px;align-items:center;justify-content:space-between;margin:12px 0 0;flex-wrap:wrap;color:#b4c9e2;font-size:12px}.touch-controls{display:none;align-items:center;justify-content:center;gap:14px;flex-wrap:wrap;padding:13px 4px 3px;touch-action:none;user-select:none}.touch-key{display:flex;justify-content:center;align-items:center;min-width:72px;min-height:66px;border-radius:15px;border:2px solid #7be9f9a0;background:linear-gradient(160deg,#234e77,#162d52);color:#fff;font-weight:900;font-size:17px;touch-action:none;box-shadow:inset 0 1px 0 #ffffff38}.touch-key:active,.touch-key.active{background:#3285a5;transform:scale(.97)}.touch-key.special{border-color:#ffe19b;background:linear-gradient(160deg,#845523,#53321d)}.dpad{display:grid;grid-template-columns:repeat(3,64px);grid-template-rows:repeat(2,58px);gap:5px}.dpad .touch-key{min-width:0;min-height:0}.dpad .up{grid-column:2}.dpad .left{grid-column:1;grid-row:2}.dpad .down{grid-column:2;grid-row:2}.dpad .right{grid-column:3;grid-row:2}.foot{color:#8194b5;font-size:11px;text-align:center;padding-top:19px}.foot a{color:#bfeef9}.play-tip{font-size:12px;color:#a8bddb}.setting{display:flex;align-items:center;gap:8px;font-size:12px;color:#b9cee4;margin-top:9px}.setting select{min-width:0;max-width:160px;border:1px solid #3e567a;background:#081629;color:#fff;border-radius:8px;padding:7px}.game-tag{font-size:10px;letter-spacing:.14em;text-transform:uppercase;font-weight:800;color:#f3d594}@media(max-width:930px){.game-layout{grid-template-columns:1fr}.sidebar{display:grid;grid-template-columns:1fr 1fr}}@media(max-width:680px){.wrap{padding:12px 10px 25px}.head{padding-bottom:15px}.head-links{gap:9px}.head-links a{font-size:11px}.headline{margin-bottom:12px}h1{font-size:36px}.game-layout{gap:11px}.sidebar{grid-template-columns:1fr}.panel{padding:13px}.stage{border-radius:12px}.hud{top:5px;left:5px;right:5px;gap:4px}.hud-chip{padding:5px 6px;min-width:49px;border-radius:7px}.hud-chip small{font-size:8px}.hud-chip strong{font-size:14px}.hud-tail{gap:4px}.iconbtn{min-width:32px;min-height:32px;font-size:15px}.touch-controls{display:flex}.dialog{padding:15px}.dialog .symbol{font-size:32px}.dialog h2{font-size:25px}.dialog p{font-size:12px}.controls{justify-content:center}.foot{font-size:10px}}@media(pointer:coarse){.touch-controls{display:flex}}@media(max-height:440px) and (orientation:landscape){.headline{margin:0 0 5px}.headline h1{font-size:22px}.sub{display:none}.head{padding-bottom:3px}.wrap{padding-top:3px}.stage canvas{max-height:72svh;aspect-ratio:auto;object-fit:contain}.touch-controls{position:fixed;left:12px;bottom:8px;right:12px;z-index:10;pointer-events:none;justify-content:space-between;padding:0}.touch-key,.dpad{pointer-events:auto}.hud-chip{padding:4px 6px}.sidebar{display:none}}



/* Mobile control safeguards: additive rules only; preserve the original arcade layout. */
.stage canvas,
.touch-controls,
.touch-controls .touch-key,
.hud .iconbtn,
.dialog .primary {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.touch-controls,
.touch-controls .touch-key {
  touch-action: none;
  overscroll-behavior: contain;
  -webkit-user-drag: none;
}
.touch-key::selection,
.touch-key *::selection { background: transparent; color: inherit; }
.touch-key:focus:not(:focus-visible) { outline: none; }
#music { min-width: 65px; font-size: 12px; font-weight: 800; white-space: nowrap; }
/* Allow the longer level-selection menus to fit on small screens. */
@media (max-width: 680px) {
  #music { min-width: 54px; font-size: 10px; padding: 5px; }
  .stage:has(.screen:not([hidden])) { min-height: 440px; }
  body[data-game="trail-rush"] .stage:has(.screen:not([hidden])) { min-height: 545px; }
  .screen { padding: 7px; }
  .dialog { max-height: calc(100% - 8px); overflow-y: auto; overscroll-behavior: contain; }
  .setting.chooser { font-size: 10px; margin-bottom: 7px; }
  .chooser select { padding: 9px 10px; }
}
/* Trail Rush has two selectors; keep its start button visible on desktop too. */
@media (min-width: 681px) {
  body[data-game="trail-rush"] .stage:has(.screen:not([hidden])) { min-height: 580px; }
}
/* Full-screen games retain their visible on-screen touch controls. */
.game-main:fullscreen {
  background: #070b19;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  padding: 12px;
  overflow: auto;
}
.game-main:fullscreen .stage { max-width: calc(100vw - 24px); margin: 0 auto; width: 100%; }
.game-main:fullscreen canvas { max-height: 76vh; object-fit: contain; }
.game-main:fullscreen .touch-controls { display: flex; }
