:root {
  color-scheme: dark;
  --ink: #101f29;
  --panel: #182d38;
  --cream: #f6f0dc;
  --muted: #acc2c7;
  --orange: #ffaf61;
  --line: #36505a;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  background: var(--ink);
  color: var(--cream);
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at 50% 14%, #253d48 0, #101f29 68%); min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, canvas:focus-visible { outline: 3px solid var(--orange); outline-offset: 4px; }
button:disabled { cursor: default; opacity: .36; }
[hidden] { display: none !important; }
.game-shell { width: min(100% - 48px, 1060px); margin: 0 auto; padding: 24px 0 36px; }
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { font: 38px/1 Georgia, serif; color: var(--orange); }
h1 { font-size: 23px; letter-spacing: -.7px; margin: 0; }
.version { font-size: 12px; letter-spacing: 1.5px; color: var(--muted); white-space: nowrap; }
.game { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 20px 70px #0005; }
.dashboard { display: grid; grid-template-columns: 1fr minmax(160px, 42%) 1fr; align-items: center; gap: 22px; padding: 16px 26px 18px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-label { color: var(--muted); font-size: 12px; letter-spacing: 1.7px; }
.stat > strong { font-size: 25px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.life-stat { align-items: flex-end; }
#lives { color: #ffa794; white-space: nowrap; letter-spacing: 2px; }
#lives .lost { color: #596972; }
.altitude-label { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.altitude-label > span:first-child { letter-spacing: 1.4px; }
.altitude-label strong { color: var(--cream); font-weight: 400; font-variant-numeric: tabular-nums; }
.progress { height: 5px; background: #3a5059; border-radius: 4px; overflow: hidden; }
#progress-fill { display: block; height: 100%; width: 0; background: var(--orange); border-radius: inherit; }
.playfield { position: relative; width: 100%; aspect-ratio: 1.9; min-height: 350px; background: #224752; overflow: hidden; }
canvas { width: 100%; height: 100%; display: block; outline-offset: -5px !important; touch-action: none; }
.summit-label { position: absolute; left: 50%; top: 4%; transform: translateX(-50%); color: #223d42; font-size: 12px; font-weight: 700; letter-spacing: 2px; display: grid; justify-items: center; gap: 7px; pointer-events: none; }
.summit-line { width: 1px; height: 18px; background: #3c625e88; }
.rex-status { position: absolute; left: 15px; top: 14px; width: 142px; padding: 11px 13px; border: 1px solid #7c998b66; border-radius: 8px; background: #16353beb; pointer-events: none; }
.rex-status > span { display: block; color: #b7cbb6; font-size: 12px; letter-spacing: 1.5px; }
.rex-status strong { display: block; font-size: 16px; font-variant-numeric: tabular-nums; margin-top: 3px; color: #e6efcc; }
.rex-gap-track { height: 4px; margin-top: 8px; background: #51695f; border-radius: 3px; overflow: hidden; }
#rex-gap-fill { display: block; width: 75%; height: 100%; background: #c6dc86; }
.rex-status.is-close { background: #5b3028ed; border-color: #f59871; }
.rex-status.is-close strong { color: #ffc8a6; }
.rex-status.is-close #rex-gap-fill { background: #ff9f76; }
.power-status { position: absolute; right: 15px; top: 14px; width: 152px; min-height: 58px; padding: 10px 12px; border: 1px solid #7c998b66; border-radius: 8px; background: #16353beb; color: #d9e6dc; font-size: 14px; line-height: 1.45; pointer-events: none; }
.power-status > span { display: block; }
.power-status .power-label { color: #a8c1bc; font-size: 12px; letter-spacing: 1.4px; margin-bottom: 2px; }
.power-status.has-power { border-color: #83ddc4aa; box-shadow: inset 0 0 20px #74e3cb12; }
#shield-active { color: #a8f8e4; }
#jetpack-active { color: #ffd48b; }
#magnet-active { color: #ffaea7; }
.power-status strong { font-variant-numeric: tabular-nums; color: inherit; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; align-items: safe center; overflow-y: auto; overscroll-behavior: contain; padding: 20px; background: #0c263850; backdrop-filter: blur(2px); }
.game-card { width: min(100%, 430px); padding: 26px 30px 22px; background: #122a35f5; border: 1px solid #6a86847a; border-radius: 13px; box-shadow: 0 16px 48px #04172150; text-align: center; }
.eyebrow { color: var(--orange); font-size: 12px; letter-spacing: 2.1px; font-weight: 700; }
.game-card h2 { margin: 11px 0 12px; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(32px, 4vw, 47px); line-height: 1.06; letter-spacing: -.8px; overflow-wrap: break-word; }
.game-card > p { font-size: 16px; line-height: 1.5; color: #bed0d1; margin: 0 0 16px; }
.game-card.is-victory { border-color: #d9c075; box-shadow: 0 16px 48px #04172150, 0 0 48px #fbd18122; }
.game-card.is-victory h2 { color: #ffe3a0; font-family: "Trebuchet MS", "Segoe UI", sans-serif; font-weight: 800; font-size: clamp(27px, 3.8vw, 40px); line-height: 1.12; letter-spacing: -.5px; }
.game-card.is-defeat { border-color: #b47b66; }
.pickup-tip { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 11px 10px; background: #243b42; border: 1px solid #46615e; border-radius: 7px; font-size: 14px; line-height: 1.45; margin: 17px 0 12px; text-align: left; }
.pickup-tip strong { color: #ffc58a; }
.orange-icon { color: #ffac59; font-size: 26px; }
.primary-button { display: flex; width: 100%; align-items: center; justify-content: center; gap: 20px; border: 0; border-radius: 6px; padding: 15px 18px; background: var(--orange); color: #182a30; font-weight: 700; font-size: 17px; min-height: 51px; box-shadow: 0 3px 0 #b77b41; }
.primary-button:hover { background: #ffc58c; }
.primary-button:active { transform: translateY(2px); box-shadow: 0 1px 0 #b77b41; }
.game-card .card-controls { margin: 14px 0 0; font-size: 14px; color: #adc2c8; }
.game-card .chase-tip { font-size: 14px; margin: 0; color: #d8c9ac; }
.result { margin: 18px 0 20px; }
.result > span { display: block; font-size: 12px; letter-spacing: 2px; color: var(--muted); }
.result > strong { display: block; font-size: 60px; font-variant-numeric: tabular-nums; color: var(--orange); line-height: 1.2; }
.result p { font-size: 14px; line-height: 1.5; margin: 3px 0 0; color: var(--muted); }
.control-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 18px; padding: 14px 22px; border-top: 1px solid #54727555; }
.control-bar p { flex-basis: 100%; order: 2; margin: 0; text-align: center; font-size: 14px; line-height: 1.5; color: var(--muted); }
.control-bar p strong { color: var(--cream); display: block; font-size: 15px; font-weight: 400; }
.control-bar p span { display: block; }
.steer-button { display: grid; place-items: center; border: 1px solid #56727b; border-radius: 9px; min-width: 84px; min-height: 54px; color: var(--cream); background: #263e49; font-size: 28px; user-select: none; -webkit-user-select: none; touch-action: none; }
.steer-button:not(:disabled):hover, .steer-button.is-held { background: #456370; border-color: #ffd09e; }
.jump-button { min-width: 92px; color: #1b3037; background: #f0bd72; border-color: #f4d7a7; font-size: 14px; font-weight: 800; letter-spacing: .7px; }
.jump-button:not(:disabled):hover, .jump-button.is-held { color: #152a31; background: #ffd89c; border-color: #fff1cd; }
.game-footer { display: flex; justify-content: space-between; gap: 20px; margin: 18px 1px 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.game-footer p { margin: 0; }
.legend-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin: 0 8px 1px 0; }
.danger-dot { background: #ff9d87; }
.food-dot { background: var(--orange); }
.scoring-note { text-align: right; }
.scoring-note strong { font-weight: 400; color: #d8e1d8; }
.power-guide { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 18px 0 0; padding: 16px 0; border-top: 1px solid #37505a; font-size: 14px; line-height: 1.5; }
.power-guide dt { font-weight: 700; margin-bottom: 3px; }
.power-guide dd { margin: 0; color: var(--muted); }
.heart-color, .magnet-color { color: #ffb5ad; }
.shield-color { color: #a8f8e4; }
.jetpack-color { color: #ffd48b; }
.leaderboard-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid #37505a; }
.leaderboard-section h2 { font-size: 17px; font-weight: 400; margin: 0 0 6px; }
#leaderboard-note { color: var(--muted); font-size: 14px; margin: 0; line-height: 1.5; }
#mis-leaderboard { margin-top: 12px; color-scheme: normal; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.noscript { padding: 20px; background: #5e3435; }
@media (min-width: 1400px) { .game-shell { padding-top: 35px; } }
@media (max-width: 680px) {
  .game-shell { width: min(100% - 24px, 510px); padding: 16px 0 24px; }
  .page-header { margin-bottom: 13px; gap: 8px; }
  h1 { font-size: 19px; letter-spacing: -.5px; }
  .brand { gap: 7px; }
  .brand-mark { font-size: 30px; }
  .version { font-size: 12px; letter-spacing: .5px; }
  .game { border-radius: 12px; }
  .dashboard { grid-template-columns: .8fr 1.55fr .9fr; padding: 13px 13px 15px; gap: 10px; }
  .stat > strong { font-size: 22px; }
  .stat-label { font-size: 12px; letter-spacing: 1px; }
  #lives { font-size: 21px; letter-spacing: 0; }
  .altitude-label { display: block; font-size: 12px; margin-bottom: 7px; }
  .altitude-label > span:first-child { display: block; margin-bottom: 4px; font-size: 12px; }
  .playfield { aspect-ratio: auto; height: clamp(330px, calc(100svh - 226px), 600px); min-height: 330px; max-height: 600px; }
  .overlay { padding: 14px; }
  .summit-label { display: none; }
  .rex-status { left: 10px; top: 10px; width: min(42%, 130px); padding: 9px 10px; }
  .rex-status strong { font-size: 14px; }
  .power-status { right: 10px; top: 10px; width: min(45%, 145px); padding: 8px 9px; font-size: 14px; }
  .game-card { padding: 23px 20px 21px; }
  .game-card h2 { font-size: 41px; }
  .game-card > p { font-size: 16px; }
  .eyebrow { font-size: 12px; letter-spacing: 1.7px; }
  .control-bar { padding: 12px 10px; gap: 10px; }
  .control-bar p { display: none; }
  .control-bar p strong { font-size: 14px; }
  .steer-button { flex: 1; min-width: 60px; min-height: 56px; }
  .jump-button { flex: 1; max-width: 132px; }
  .game-footer { display: block; font-size: 14px; margin-top: 14px; }
  .power-guide { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .scoring-note { text-align: left; margin-top: 8px !important; }
  .leaderboard-section { margin-top: 20px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .game-shell { width: min(100% - 24px, 1060px); padding-top: 6px; }
  .page-header { margin-bottom: 6px; }
  .dashboard { padding-top: 8px; padding-bottom: 8px; }
  .playfield { height: max(190px, calc(100svh - 195px)); min-height: 190px; aspect-ratio: auto; }
  .control-bar { padding: 8px; }
  .control-bar p { display: none; }
  .game-card { padding: 14px 22px; }
  .game-card h2 { font-size: 30px; }
  .summit-label { display: none; }
}
@media (max-width: 360px) {
  .version { letter-spacing: 0; font-size: 12px; }
  h1 { font-size: 17px; }
  .brand-mark { display: none; }
  .game-card { padding: 19px 15px; }
  .game-card h2 { font-size: 37px; }
  .steer-button { min-width: 51px; }
}
@media (prefers-reduced-motion: reduce) {
  .overlay { backdrop-filter: none; }
  .primary-button:active { transform: none; }
}
