:root {
  --ink: #e8edf0;
  --muted: #84929b;
  --panel: #0c1114;
  --panel-soft: #151d21;
  --line: rgba(218, 231, 236, .15);
  --cyan: #73d7d0;
  --cyan-bright: #a0fff5;
  --red: #f27868;
  --yellow: #e4cf72;
  --floor: #1a2326;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body {
  background: #070a0c;
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; opacity: .32;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.014) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
}

.shell { width: min(1440px, 100vw); height: 100%; margin: 0 auto; padding: 22px 28px 18px; display: flex; flex-direction: column; gap: 16px; }
.hud { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 52px; }
.brand-lockup { display: flex; flex-direction: column; gap: 2px; }
.brand-kicker, .eyebrow, .footer-note, .score-label, .status-cluster { font-size: 10px; letter-spacing: .18em; color: var(--muted); }
.brand-title { font-family: "Barlow Condensed", sans-serif; font-size: 24px; font-weight: 700; letter-spacing: .12em; color: var(--ink); }
.scoreboard { display: flex; align-items: baseline; gap: 20px; padding: 8px 22px; border: 1px solid var(--line); background: rgba(12,17,20,.82); clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
.score-card { display: flex; align-items: baseline; gap: 9px; }
.score-card strong { font-family: "Barlow Condensed", sans-serif; font-size: 26px; line-height: 1; }
.player-score strong { color: var(--cyan); }.cpu-score strong { color: var(--red); }
.score-divider { color: #526068; font-size: 18px; }
.status-cluster { justify-self: end; display: flex; align-items: center; gap: 8px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 13px var(--yellow); }

.game-frame { position: relative; width: 100%; max-height: calc(100vh - 145px); aspect-ratio: 16 / 9; margin: 0 auto; overflow: hidden; border: 1px solid rgba(170, 209, 214, .22); background: #11181b; box-shadow: 0 20px 70px rgba(0,0,0,.42), inset 0 0 0 1px rgba(255,255,255,.03); }
#gameCanvas { display: block; width: 100%; height: 100%; image-rendering: auto; cursor: crosshair; }
.canvas-vignette { pointer-events: none; position: absolute; inset: 0; box-shadow: inset 0 0 110px rgba(3,5,6,.62), inset 0 0 0 1px rgba(255,255,255,.05); }
.round-banner { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); text-align: center; font-family: "Barlow Condensed", sans-serif; font-size: clamp(36px, 6vw, 78px); font-weight: 700; letter-spacing: .08em; color: var(--ink); text-shadow: 0 8px 26px #000; opacity: 0; pointer-events: none; }
.round-banner.show { animation: banner-in .9s cubic-bezier(.2,.8,.2,1) both; }
@keyframes banner-in { 0% { opacity: 0; transform: translate(-50%, -36%) scale(.88); } 25%, 72% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -62%) scale(1.02); } }

.start-panel { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding-left: clamp(34px, 9vw, 130px); background: linear-gradient(90deg, rgba(5,8,9,.96) 0%, rgba(5,8,9,.85) 42%, rgba(5,8,9,.12) 100%), radial-gradient(circle at 76% 48%, rgba(115,215,208,.13), transparent 34%); }
.start-panel::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(120deg, transparent 0 44%, rgba(115,215,208,.06) 44.1% 44.3%, transparent 44.4% 70%, rgba(242,120,104,.05) 70.1% 70.2%, transparent 70.3%); }
.panel-mark { display: flex; align-items: center; gap: 6px; margin-bottom: 22px; color: var(--cyan); font-size: 12px; letter-spacing: .18em; }
.panel-mark span { padding: 6px 8px; border: 1px solid rgba(115,215,208,.55); }.panel-mark i { display: block; width: 4px; height: 4px; background: var(--cyan); opacity: .8; }.panel-mark i:nth-child(3) { opacity: .45; }.panel-mark i:nth-child(4) { opacity: .2; }
.eyebrow { color: var(--cyan); margin: 0 0 5px; }
.start-panel h1 { position: relative; z-index: 1; margin: 0; font-family: "Barlow Condensed", sans-serif; font-size: clamp(52px, 8vw, 100px); line-height: .76; letter-spacing: -.015em; font-weight: 700; text-transform: uppercase; }
.start-panel h1 em { color: var(--cyan); font-style: normal; }
.panel-copy { position: relative; z-index: 1; margin: 22px 0 28px; color: #9aa6ab; font-size: 12px; line-height: 1.8; }
.start-button { position: relative; z-index: 1; display: flex; align-items: center; gap: 34px; padding: 13px 16px 13px 18px; border: 1px solid rgba(115,215,208,.66); color: #061011; background: var(--cyan); font: 600 12px "IBM Plex Mono", monospace; letter-spacing: .13em; cursor: pointer; transition: background .2s, transform .2s, box-shadow .2s; }
.start-button b { font-size: 20px; line-height: 10px; font-weight: 400; }.start-button:hover { background: var(--cyan-bright); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(115,215,208,.18); }.start-button:active { transform: translateY(0); }
.control-hint { position: relative; z-index: 1; margin-top: 18px; font-size: 10px; color: #718188; letter-spacing: .03em; }.control-hint span { color: var(--ink); }.mobile-hint { display: none; }
.match-panel { position: absolute; inset: 0; z-index: 6; display: none; align-items: center; flex-direction: column; justify-content: center; text-align: center; background: radial-gradient(circle at 50% 42%, rgba(115,215,208,.16), rgba(5,8,9,.94) 58%); }
.match-panel.show { display: flex; }
.match-panel .eyebrow { margin-bottom: 8px; }
.match-panel h2 { margin: 0 0 16px; font: 700 clamp(42px, 7vw, 86px)/.9 "Barlow Condensed", sans-serif; letter-spacing: .04em; color: var(--cyan); text-shadow: 0 8px 30px rgba(0,0,0,.55); }
.final-score { display: flex; gap: 18px; align-items: baseline; margin-bottom: 26px; font: 700 52px/1 "Barlow Condensed", sans-serif; }.final-score span:first-child { color: var(--cyan); }.final-score span:last-child { color: var(--red); }.final-score i { color: #526068; font: 400 26px "IBM Plex Mono", monospace; font-style: normal; }
.orientation-overlay { display: none; position: absolute; z-index: 10; inset: 0; align-items: center; justify-content: center; flex-direction: column; gap: 8px; text-align: center; background: #090e10; }.orientation-overlay.show { display: flex; position: fixed; z-index: 50; }.rotate-glyph { font-size: 52px; color: var(--cyan); animation: rotate-pulse 2s ease-in-out infinite; }.orientation-overlay p { margin: 0; font: 600 26px "Barlow Condensed", sans-serif; letter-spacing: .1em; }.orientation-overlay span { font-size: 11px; color: var(--muted); letter-spacing: .1em; }
@keyframes rotate-pulse { 0%,100% { transform: rotate(-20deg); opacity: .65; } 50% { transform: rotate(20deg); opacity: 1; } }
.touch-controls { display: none; position: absolute; z-index: 3; inset: 0; pointer-events: none; }.joystick, .fire-button { pointer-events: auto; }.joystick { position: absolute; left: max(22px, env(safe-area-inset-left)); bottom: max(20px, env(safe-area-inset-bottom)); width: 144px; height: 144px; border: 1px solid rgba(227,242,242,.25); border-radius: 50%; background: rgba(8,13,15,.3); box-shadow: inset 0 0 0 16px rgba(115,215,208,.025), 0 8px 30px rgba(0,0,0,.25); }.joystick-ring { position: absolute; inset: 20px; border: 1px dashed rgba(115,215,208,.28); border-radius: 50%; }.joystick-knob { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; margin: -31px; border: 1px solid rgba(160,255,245,.8); border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(160,255,245,.38), rgba(42,111,111,.5)); box-shadow: 0 0 24px rgba(115,215,208,.22); }.fire-button { position: absolute; right: max(22px, env(safe-area-inset-right)); bottom: max(24px, env(safe-area-inset-bottom)); width: 90px; height: 90px; border: 1px solid rgba(242,120,104,.8); border-radius: 50%; color: #ffd7d1; background: rgba(85,25,25,.54); box-shadow: inset 0 0 0 8px rgba(242,120,104,.06), 0 8px 30px rgba(0,0,0,.35); font: 600 11px "IBM Plex Mono", monospace; letter-spacing: .12em; }.fire-button i { position: absolute; inset: 9px; border: 1px solid rgba(242,120,104,.24); border-radius: 50%; }.fire-button:active { background: rgba(164,53,44,.7); transform: scale(.96); }
.footer-note { display: flex; justify-content: space-between; margin-top: auto; font-size: 9px; color: #59676d; letter-spacing: .13em; }

@media (max-width: 780px) { .shell { padding: 10px 10px max(10px, env(safe-area-inset-bottom)); gap: 8px; }.hud { min-height: 38px; }.brand-kicker, .footer-note span:nth-child(2) { display: none; }.brand-title { font-size: 19px; }.scoreboard { gap: 10px; padding: 6px 12px; }.score-card { gap: 5px; }.score-label, .status-cluster { font-size: 8px; }.score-card strong { font-size: 20px; }.status-cluster { letter-spacing: .08em; }.game-frame { max-height: calc(100vh - 76px); }.start-panel { padding-left: 9vw; }.start-panel h1 { font-size: clamp(50px, 12vw, 86px); }.panel-copy { font-size: 11px; margin: 16px 0 20px; }.panel-mark { margin-bottom: 14px; }.footer-note { font-size: 8px; }.desktop-hint { display: none; }.mobile-hint { display: block; } }
@media (orientation: landscape) and (max-width: 1180px) {
  html, body { width: 100%; height: 100%; min-height: 100%; }
  body { display: grid; place-items: center; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
  .shell { position: relative; width: min(100%, 177.7778vh); width: min(100%, 177.7778dvh); height: auto; aspect-ratio: 16 / 9; padding: 0; gap: 0; overflow: hidden; }
  .hud { position: absolute; z-index: 8; inset: max(6px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) auto; min-height: 28px; pointer-events: none; }
  .brand-lockup { display: none; }
  .scoreboard { gap: 8px; padding: 4px 10px; }
  .scoreboard { grid-column: 2; }
  .score-card { gap: 4px; }
  .score-label, .status-cluster { font-size: 7px; }
  .score-card strong { font-size: 18px; }
  .score-divider { font-size: 14px; }
  .status-cluster { grid-column: 3; align-self: start; justify-self: end; margin-top: 7px; letter-spacing: .06em; }
  .game-frame { width: 100%; height: 100%; max-height: none; aspect-ratio: auto; }
  .footer-note { position: absolute; z-index: 8; inset: auto max(10px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); margin: 0; pointer-events: none; font-size: 7px; }
  .footer-note span:first-child, .footer-note span:nth-child(2) { display: none; }
  .footer-note span:last-child { display: block; opacity: .55; }
  .start-panel { align-items: center; justify-content: center; padding: 0; text-align: center; background: radial-gradient(circle at 50% 48%, rgba(115,215,208,.14), rgba(5,8,9,.91) 64%); }
  .panel-mark { margin-bottom: clamp(6px, 2vh, 14px); }
  .start-panel h1 { font-size: clamp(42px, 12vh, 74px); line-height: .78; }
  .panel-copy { margin: clamp(8px, 2.4vh, 18px) 0; font-size: clamp(9px, 2.5vh, 12px); line-height: 1.6; }
  .start-button { gap: 24px; padding: 10px 13px 10px 15px; }
  .control-hint { margin-top: clamp(8px, 2vh, 14px); font-size: clamp(8px, 2vh, 10px); }
  .touch-controls { inset: 0; }
  .joystick { left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); width: clamp(84px, 24vh, 126px); height: clamp(84px, 24vh, 126px); }
  .joystick-ring { inset: 14px; }
  .joystick-knob { width: clamp(42px, 10vh, 58px); height: clamp(42px, 10vh, 58px); margin: calc(clamp(42px, 10vh, 58px) / -2); }
  .fire-button { right: max(14px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); width: clamp(68px, 18vh, 94px); height: clamp(68px, 18vh, 94px); }
  .fire-button i { inset: 7px; }
  .canvas-vignette { box-shadow: inset 0 0 70px rgba(3,5,6,.58), inset 0 0 0 1px rgba(255,255,255,.05); }
}

@media (orientation: landscape) and (max-width: 1180px) and (max-height: 360px) {
  .panel-mark { display: none; }
  .panel-copy { margin: 7px 0 10px; }
  .start-panel h1 { font-size: clamp(38px, 11vh, 58px); }
}

body.touch-mode.game-playing:not(.match-complete) .touch-controls { display: block; }
body.game-playing .start-panel { display: none; }
body.match-complete .match-panel { display: flex; }
body.is-paused.game-playing:not(.match-complete)::after { content: "点击继续"; position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; color: var(--ink); background: rgba(4,7,8,.72); font: 600 18px "Barlow Condensed", sans-serif; letter-spacing: .18em; }
