:root {
  color-scheme: dark;
  --ink: #e9f1f6;
  --muted: #95a7b2;
  --bg: #101a25;
  --line: rgba(255,255,255,.13);
  --mint: #bbf379;
  --coral: #ff8c73;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100svh;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 12% 5%, rgba(96,161,163,.18), transparent 31rem),
    radial-gradient(circle at 88% 88%, rgba(124,94,153,.13), transparent 35rem),
    var(--bg);
}
button { font: inherit; }
.page { width: min(1100px, calc(100% - 40px)); margin: 0 auto; padding: 25px 0 30px; }
.intro { margin: 0 auto 20px; }
.eyebrow, .game-topline, .overlay-kicker { font-size: 11px; letter-spacing: .18em; font-weight: 800; }
.eyebrow { color: var(--mint); display: flex; align-items: center; gap: 10px; }
.eyebrow-mark { width: 23px; height: 2px; background: var(--mint); display: inline-block; }
h1 { font-size: clamp(50px, 6vw, 72px); letter-spacing: -.095em; line-height: .96; margin: 12px 0 10px; font-weight: 900; }
h1 > span:first-child { color: var(--mint); }
.title-period { color: var(--coral); }
.lede { max-width: 960px; font-size: 15px; line-height: 1.6; color: #d6e4e8; margin: 0 0 14px; }
.rule-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rule { display: flex; align-items: center; gap: 10px; min-height: 45px; padding-right: 12px; }
.rule + .rule { border-left: 1px solid var(--line); padding-left: 18px; }
.rule-number { color: var(--mint); font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.rule strong { font-size: 14px; white-space: nowrap; }
.rule small { color: var(--muted); font-size: 11px; }
.keyboard-note { color: #8299a7; font-size: 11px; margin: 10px 0 0; }
.game-column { width: min(100%, 1000px); margin-inline: auto; }
.game-topline { display: flex; justify-content: space-between; color: #9bb0bb; margin: 0 5px 8px; letter-spacing: .1em; }
.rotate-notice { display: none; }
.game-shell {
  background: #21333e;
  padding: 9px;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 23px;
  box-shadow: 0 25px 80px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.1);
}
.hud { display: grid; grid-template-columns: 1fr 1.2fr 1fr; align-items: center; height: 54px; padding: 0 12px 8px; }
.hud-cell { display: flex; flex-direction: column; gap: 1px; }
.hud-center { text-align: center; }
.hud-right { align-items: flex-end; }
.hud-label { font-size: 10px; color: #a4b6bd; letter-spacing: .06em; }
.hud strong { font-size: 17px; letter-spacing: .02em; }
.hud strong span { font-size: 11px; color: #718995; }
.hud-score { color: var(--mint); font-size: 12px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
#time-label { font-size: 16px; white-space: nowrap; color: var(--mint); }
.music-toggle { border: 1px solid rgba(255,255,255,.22); border-radius: 8px; background: #314751; color: #f2f6ef; font-size: 11px; padding: 3px 8px; cursor: pointer; }
.music-toggle[aria-pressed="false"] { color: #9cafb7; }
.life { display: flex; gap: 5px; padding: 3px 0 0; }
.life i { width: 12px; height: 12px; transform: rotate(45deg); background: var(--coral); border-radius: 4px; display: block; transition: opacity .2s, transform .2s; }
.life i.empty { opacity: .18; transform: rotate(45deg) scale(.72); }
.canvas-wrap { position: relative; overflow: hidden; width: 100%; border-radius: 15px; background: #a5e0d4; line-height: 0; }
canvas { width: 100%; height: auto; display: block; touch-action: none; }
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: linear-gradient(180deg, rgba(15,31,43,.18), rgba(10,24,35,.79) 34%, rgba(10,24,35,.92));
  line-height: normal;
  transition: opacity .25s ease, visibility .25s ease;
}
.overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.overlay-panel { width: min(100%, 610px); color: white; text-align: center; }
.overlay-kicker { color: var(--mint); margin-bottom: 14px; }
.overlay h2 { font-size: clamp(32px, 5vw, 54px); line-height: 1.15; letter-spacing: -.05em; margin: 0 0 13px; }
.overlay p { line-height: 1.6; font-size: 15px; color: #d1e0e1; max-width: 460px; margin: 0 auto 22px; }
.primary-button {
  border: 0;
  color: #15211b;
  background: var(--mint);
  border-radius: 13px;
  width: min(100%, 240px);
  min-height: 50px;
  padding: 10px 19px;
  font-size: 16px;
  font-weight: 850;
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 6px 0 #75a648, 0 14px 30px rgba(0,0,0,.28);
  transition: transform .12s, box-shadow .12s;
}
.primary-button:active { transform: translateY(4px); box-shadow: 0 2px 0 #75a648, 0 8px 17px rgba(0,0,0,.22); }
.primary-button span { font-size: 22px; line-height: 1; }
.overlay-footnote { display: block; margin-top: 20px; font-size: 11px; letter-spacing: .03em; color: #92aab4; }
.game-toast {
  position: absolute;
  top: 13px;
  left: 50%;
  transform: translate(-50%, -8px);
  background: rgba(15,31,43,.9);
  color: white;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 5;
}
.game-toast.visible { opacity: 1; transform: translate(-50%, 0); }
.controls { display: flex; justify-content: space-between; gap: 12px; padding: 9px 3px 3px; }
.move-controls { display: flex; gap: 9px; }
.control-button {
  background: #314751;
  color: #eff9f6;
  border: 1px solid rgba(255,255,255,.18);
  border-bottom-color: rgba(0,0,0,.2);
  border-radius: 13px;
  width: 64px;
  height: 52px;
  font-size: 27px;
  font-weight: 800;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 4px 0 rgba(0,0,0,.2);
}
.control-button:active, .control-button.pressed { background: #49616a; transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 1px 0 rgba(0,0,0,.2); }
.jump-button { width: 120px; background: #de806c; border-color: #f39b83; font-size: 16px; color: #182631; display: flex; align-items: center; justify-content: center; gap: 9px; }
.jump-button:active, .jump-button.pressed { background: #ef9b83; }
.jump-button span { font-size: 22px; line-height: 1; }
.game-caption { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 11px; color: #90a6af; margin: 10px 0 0; letter-spacing: .03em; }
.caption-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--mint); }

@media (max-width: 850px) and (orientation: portrait) {
  .page { width: calc(100% - 26px); padding: 22px 0; }
  .intro { margin-bottom: 22px; }
  h1 { font-size: 56px; }
  .lede { font-size: 14px; }
  .rule-grid, .keyboard-note, .game-topline, .game-caption { display: none; }
  .overlay h2 { font-size: clamp(19px, 4vw, 30px); }
  .overlay p { font-size: 11px; margin-bottom: 10px; }
  .overlay-kicker, .overlay-footnote { display: none; }
  .primary-button { min-height: 38px; font-size: 13px; width: 170px; }
  .controls { padding-top: 7px; }
  .control-button { width: 54px; height: 48px; }
  .jump-button { width: 100px; }
}

@media (max-width: 850px) and (orientation: portrait) and (pointer: coarse) {
  .game-shell { display: none; }
  .rotate-notice { display: block; margin: 0 auto; border: 1px solid rgba(187,243,121,.4); background: #20363a; border-radius: 18px; padding: 34px 24px; color: #e6f5df; text-align: center; font-size: 18px; line-height: 1.8; }
}

@media (orientation: landscape) and (max-height: 850px) {
  html, body { overflow: hidden; }
  .page { width: min(calc(100svw - env(safe-area-inset-left) - env(safe-area-inset-right) - 8px), calc((100svh - 20px) * 16 / 9)); padding: 4px 0; }
  .intro, .game-topline, .game-caption { display: none; }
  .game-column { width: 100%; }
  .game-shell { position: relative; padding: 4px; border-radius: 11px; }
  .canvas-wrap { border-radius: 7px; }
  .hud { position: absolute; top: 8px; left: 10px; right: 10px; z-index: 4; height: 41px; padding: 2px 11px; border-radius: 9px; background: rgba(17,38,47,.76); }
  .hud-label { font-size: 8px; }
  .hud strong, #time-label { font-size: 13px; }
  .hud-score { font-size: 10px; }
  .music-toggle { font-size: 9px; padding: 1px 5px; }
  .life i { width: 9px; height: 9px; }
  .controls { position: absolute; bottom: 14px; left: 12px; right: 12px; z-index: 4; padding: 0; }
  .control-button { width: 52px; height: 49px; background: rgba(25,43,53,.74); border-color: rgba(255,255,255,.27); }
  .jump-button { width: 93px; background: rgba(222,128,108,.82); }
  .overlay { padding: 14px; }
  .overlay-kicker { margin-bottom: 8px; font-size: 9px; }
  .overlay h2 { font-size: clamp(24px, 4svh, 36px); margin-bottom: 8px; }
  .overlay p { font-size: 11px; margin-bottom: 13px; max-width: 460px; }
  .primary-button { min-height: 42px; width: 190px; font-size: 14px; }
  .overlay-footnote { margin-top: 12px; font-size: 9px; }
  .game-toast { top: 54px; }
}
