* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
      Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: radial-gradient(circle at top, #1f2933, #050816 70%);
    color: #e5e7eb;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .page-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
  }
  
  .game-container {
    position: relative;
    width: 480px;
    height: 720px;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    background: radial-gradient(circle at top, #020617, #020617 60%, #000 100%);
  }

  @media (max-width: 520px), (max-height: 740px) {
    .game-container {
      width: 100%;
      height: auto;
      aspect-ratio: 480 / 720;
      border-radius: 0;
    }
  }
  
  /* Canvas 全屏填充容器 */
  #gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top, #020617, #020617 40%, #000 100%);
  }
  
  /* HUD */
  .hud {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
    z-index: 2;
  }
  
  .hud.hidden {
    display: none;
  }

  /* 音效开关：与 HUD 风格一致，不抢眼 */
  .sound-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid rgba(56, 189, 248, 0.25);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    color: #9ca3af;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, border-color 0.15s;
  }
  .sound-toggle:hover {
    color: #e5e7eb;
    border-color: rgba(56, 189, 248, 0.5);
  }
  .sound-toggle.muted {
    opacity: 0.7;
  }

  /* 手机端触控：仅在小屏/触屏设备显示 */
  .touch-controls {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    touch-action: none;
  }
  .touch-controls > * {
    pointer-events: auto;
  }
  .touch-controls.hidden {
    display: none !important;
  }

  @media (max-width: 768px), (hover: none) {
    .touch-controls:not(.hidden) {
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      padding: 12px;
      padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
  }

  .touch-dpad {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
  }
  .touch-dpad-btn {
    position: absolute;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.85);
    border: 2px solid rgba(56, 189, 248, 0.4);
    color: rgba(224, 242, 254, 0.9);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
  }
  .touch-dpad-btn:active {
    background: rgba(56, 189, 248, 0.25);
    border-color: rgba(56, 189, 248, 0.7);
  }
  .touch-dpad-up { left: 50%; top: 0; transform: translate(-50%, 0); }
  .touch-dpad-down { left: 50%; bottom: 0; transform: translate(-50%, 0); }
  .touch-dpad-left { left: 0; top: 50%; transform: translate(0, -50%); }
  .touch-dpad-right { right: 0; top: 50%; transform: translate(0, -50%); }

  .touch-pause {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(56, 189, 248, 0.4);
    background: rgba(15, 23, 42, 0.85);
    color: #e5e7eb;
    font-size: 22px;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .touch-pause:active {
    background: rgba(56, 189, 248, 0.25);
  }
  
  .hud-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
  }
  
  .hud-row-bottom {
    align-items: center;
  }
  
  .hud-item {
    background: rgba(15, 23, 42, 0.8);
    border-radius: 999px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #9ca3af;
    border: 1px solid rgba(56, 189, 248, 0.25);
    backdrop-filter: blur(8px);
  }
  
  .hud-item.hidden {
    display: none;
  }
  
  .hud-item span:last-child {
    color: #e5e7eb;
    font-weight: 600;
  }
  
  .hud-item-wide {
    flex: 1;
    justify-content: space-between;
  }
  
  .hud-item-progress span:last-child {
    font-variant-numeric: tabular-nums;
  }
  
  .hud-item-shield span:last-child {
    color: #e5e7eb;
    font-variant-numeric: tabular-nums;
  }
  
  .hud-small-text {
    font-size: 11px;
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
  }
  
  /* Boss 血条 */
  .boss-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    pointer-events: none;
  }
  
  .boss-bar.hidden {
    display: none;
  }
  
  .boss-label {
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #f97316;
  }
  
  .boss-bar-track {
    flex: 1;
    max-width: 260px;
    height: 8px;
    background: rgba(15, 23, 42, 0.9);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(248, 113, 113, 0.8);
  }
  
  .boss-bar-inner {
    background: linear-gradient(90deg, #f97316, #facc15);
  }
  
  /* 通用进度条 */
  .bar {
    width: 100px;
    height: 8px;
    background: rgba(15, 23, 42, 0.9);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(56, 189, 248, 0.4);
  }
  
  .bar-wide {
    width: 160px;
  }
  
  .bar-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #4ade80);
  }
  
  .exp-bar-inner {
    background: linear-gradient(90deg, #38bdf8, #6366f1);
  }
  
  /* 叠加界面：开始 / 升级 / 结束 */
  .overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.98));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 3;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
  }
  
  .overlay.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .overlay-start,
  .overlay-game-over {
    gap: 14px;
    padding: 20px;
  }

  .screen-title {
    font-size: 32px;
    letter-spacing: 0.06em;
    color: #f0f9ff;
    text-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
    margin-bottom: 4px;
  }

  .screen-title--small {
    font-size: 22px;
    letter-spacing: 0.08em;
  }

  .screen-subtitle {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 8px;
  }

  .skill-hint {
    text-align: center;
    padding: 12px 20px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.35);
    margin: 8px 0;
  }

  .skill-hint p {
    font-size: 13px;
    color: #e2e8f0;
    margin: 4px 0;
    line-height: 1.5;
  }

  .skill-hint p:first-child {
    color: #7dd3fc;
    font-weight: 600;
  }

  .instructions {
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
    padding: 10px 16px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(56, 189, 248, 0.25);
  }

  .instructions-label {
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 2px;
  }

  .instructions p {
    margin: 0;
  }
  .instructions p + p {
    margin-top: 6px;
  }

  .game-over-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 8px 0;
  }

  .game-over-score-label {
    font-size: 12px;
    color: #94a3b8;
    letter-spacing: 0.05em;
  }

  .game-over-score-value {
    font-size: 42px;
    font-weight: 700;
    color: #38bdf8;
    text-shadow: 0 0 24px rgba(56, 189, 248, 0.5);
    font-variant-numeric: tabular-nums;
  }

  .game-over-stage {
    font-size: 13px;
    color: #94a3b8;
    margin: 0;
  }

  .title {
    font-size: 28px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #e5e7eb;
  }

  .subtitle {
    font-size: 14px;
    color: #9ca3af;
  }
  
  .primary-btn {
    appearance: none;
    border: none;
    border-radius: 999px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    background: linear-gradient(135deg, #22d3ee, #3b82f6);
    color: #020617;
    box-shadow: 0 8px 24px rgba(56, 189, 248, 0.5);
    transition: transform 0.1s ease-out, box-shadow 0.1s ease-out, filter 0.1s ease-out;
  }
  
  .primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 30px rgba(56, 189, 248, 0.6);
    filter: brightness(1.05);
  }
  
  .primary-btn:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.5);
  }
  
  .info-text {
    font-size: 14px;
    color: #e5e7eb;
  }
  
  /* 升级面板 */
  .upgrade-options {
    display: flex;
    gap: 10px;
    padding: 8px 12px;
  }
  
  .upgrade-card {
    appearance: none;
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 16px;
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.98));
    padding: 10px 12px;
    width: 120px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
    color: #e5e7eb;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 1), 0 10px 30px rgba(15, 23, 42, 0.8);
    transition: transform 0.1s ease-out, box-shadow 0.1s ease-out, border-color 0.1s ease-out,
      background 0.1s ease-out;
  }
  
  .upgrade-card:hover {
    transform: translateY(-2px);
    border-color: rgba(56, 189, 248, 0.9);
    box-shadow: 0 14px 40px rgba(56, 189, 248, 0.3);
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.99));
  }
  
  .upgrade-card:active {
    transform: translateY(0px) scale(0.97);
    box-shadow: 0 6px 18px rgba(56, 189, 248, 0.4);
  }
  
  .upgrade-name {
    font-size: 13px;
    font-weight: 600;
    color: #7dd3fc;
  }
  
  .upgrade-desc {
    font-size: 11px;
    color: #9ca3af;
    line-height: 1.4;
  }