/* ================= 海豹06 · 极速闯关 样式 ================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ocean-deep: #061020;
  --ocean-mid: #0b2545;
  --cyan: #38e1ff;
  --cyan-soft: #7ef0ff;
  --blue: #2f7dff;
  --gold: #ffd166;
  --danger: #ff4d6d;
  --text: #eaf6ff;
  --text-dim: #9db8d2;
  --glass: rgba(10, 30, 54, 0.72);
}

html, body {
  height: 100%;
  background: radial-gradient(circle at 50% 0%, #10375f 0%, #071526 45%, #03080f 100%);
  font-family: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.app {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage {
  position: relative;
  width: min(100vw, calc(100dvh * 480 / 854));
  aspect-ratio: 480 / 854;
  overflow: hidden;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(120, 220, 255, 0.16);
  background: #0a1626;
}

@media (max-width: 640px) {
  .stage { border-radius: 0; box-shadow: none; }
}

#game {
  display: block;
  width: 100%;
  height: 100%;
}

/* ================= 通用覆盖层 ================= */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: radial-gradient(circle at 50% 35%, rgba(12, 44, 76, 0.78), rgba(4, 10, 20, 0.86));
  backdrop-filter: blur(6px);
  z-index: 30;
  animation: fadeIn 0.24s ease;
}

.overlay.hidden,
.hidden { display: none !important; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.panel {
  width: 100%;
  max-width: 380px;
  padding: 26px 22px;
  border-radius: 22px;
  background: linear-gradient(165deg, rgba(20, 56, 92, 0.92), rgba(7, 20, 36, 0.94));
  border: 1px solid rgba(110, 220, 255, 0.22);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: popIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  text-align: center;
}

.panel-small { max-width: 330px; }
.panel-title { font-size: 22px; letter-spacing: 2px; margin-bottom: 6px; }
.panel-desc { font-size: 13px; color: var(--text-dim); margin-bottom: 18px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.panel-head h2 { font-size: 18px; letter-spacing: 2px; }

/* ================= 菜单 ================= */
.brand { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 10px; }
.brand-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 2px 7px;
  border-radius: 6px;
  color: #04121f;
  background: linear-gradient(120deg, var(--cyan), #9ff8ff);
}
.brand-sub { font-size: 10px; letter-spacing: 3px; color: var(--text-dim); }

.title {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 4px;
  line-height: 1.05;
  background: linear-gradient(100deg, #ffffff 10%, var(--cyan-soft) 55%, var(--blue) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 18px rgba(56, 225, 255, 0.35));
}
.title span { font-size: 0.72em; margin-left: 2px; }

.subtitle {
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: 8px;
  color: var(--cyan-soft);
  opacity: 0.85;
}

.menu-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }

.btn {
  position: relative;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(140, 225, 255, 0.28);
  border-radius: 13px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.16s ease, box-shadow 0.16s ease;
  font-family: inherit;
}
.btn:hover { background: rgba(120, 220, 255, 0.16); transform: translateY(-1px); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  color: #04121f;
  background: linear-gradient(120deg, #66ecff, #38b6ff 55%, #2f7dff);
  border-color: transparent;
  box-shadow: 0 10px 26px rgba(56, 180, 255, 0.38);
}
.btn-primary:hover { box-shadow: 0 12px 30px rgba(56, 200, 255, 0.55); }
.btn-ghost { background: transparent; color: var(--text-dim); border-color: rgba(160, 200, 230, 0.2); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.tips {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px dashed rgba(140, 210, 255, 0.18);
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.9;
}
.tips-title { font-size: 11px; letter-spacing: 3px; color: var(--cyan-soft); margin-bottom: 4px; opacity: 0.9; }
.tips-row { font-size: 12px; }

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 5px;
  margin: 0 1px;
  font-family: inherit;
  font-size: 11px;
  color: #d7f4ff;
  background: rgba(120, 220, 255, 0.12);
  border: 1px solid rgba(140, 220, 255, 0.3);
  border-radius: 5px;
}

.record-line { margin-top: 14px; font-size: 11px; color: var(--text-dim); letter-spacing: 1px; }

/* ================= 关卡选择 ================= */
.panel-levels { max-width: 400px; max-height: 100%; overflow-y: auto; text-align: left; }

.level-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.level-card {
  position: relative;
  padding: 12px 12px 10px;
  border-radius: 14px;
  background: linear-gradient(155deg, rgba(40, 96, 148, 0.55), rgba(10, 26, 44, 0.75));
  border: 1px solid rgba(120, 210, 255, 0.18);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.16s, box-shadow 0.16s;
  font-family: inherit;
  color: inherit;
  text-align: left;
}
.level-card:hover { transform: translateY(-2px); border-color: rgba(90, 230, 255, 0.5); }
.level-card.locked { opacity: 0.45; cursor: not-allowed; }
.level-card.locked:hover { transform: none; border-color: rgba(120, 210, 255, 0.18); }

.level-card .lv-no { font-size: 11px; letter-spacing: 2px; color: var(--cyan-soft); }
.level-card .lv-name { font-size: 15px; font-weight: 700; margin: 3px 0 6px; }
.level-card .lv-meta { font-size: 11px; color: var(--text-dim); }
.level-card .lv-stars { margin-top: 6px; font-size: 12px; letter-spacing: 2px; color: var(--gold); }
.level-card .lv-stars .off { color: rgba(255, 255, 255, 0.18); }
.level-card .lv-lock { position: absolute; top: 10px; right: 11px; font-size: 12px; }

.legend {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin-top: 16px;
  font-size: 11px;
  color: var(--text-dim);
}
.legend i { font-style: normal; margin-right: 3px; }
.legend-star { color: var(--gold); }

/* ================= HUD ================= */
.hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  padding: 14px 14px 0;
}

.hud-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.hud-left { display: flex; flex-direction: column; gap: 6px; }
.hud-right { display: flex; align-items: center; gap: 8px; }

.level-tag {
  font-size: 12px;
  letter-spacing: 1px;
  color: #dff3ff;
  background: rgba(6, 22, 40, 0.66);
  border: 1px solid rgba(120, 210, 255, 0.22);
  border-radius: 9px;
  padding: 4px 9px;
  backdrop-filter: blur(4px);
}

.score-row { display: flex; gap: 6px; align-items: center; }

.coin-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  color: #ffe9b0;
  background: rgba(6, 22, 40, 0.66);
  border: 1px solid rgba(255, 209, 102, 0.28);
  border-radius: 9px;
}

.score-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 700;
  color: #fff6d8;
  background: rgba(6, 22, 40, 0.66);
  border: 1px solid rgba(255, 209, 102, 0.32);
  border-radius: 9px;
}
.score-chip .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3c4, var(--gold));
  box-shadow: 0 0 8px rgba(255, 209, 102, 0.8);
}

.hearts { display: flex; gap: 3px; font-size: 15px; line-height: 1; }
.heart { color: var(--danger); text-shadow: 0 0 8px rgba(255, 77, 109, 0.7); transition: transform 0.2s, opacity 0.2s; }
.heart.off { color: rgba(255, 255, 255, 0.2); text-shadow: none; }
.heart.lost { animation: heartPop 0.45s ease; }
@keyframes heartPop {
  0% { transform: scale(1.5); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}

.icon-btn {
  pointer-events: auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #dff3ff;
  background: rgba(6, 22, 40, 0.66);
  border: 1px solid rgba(120, 210, 255, 0.25);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  backdrop-filter: blur(4px);
}
.icon-btn:hover { background: rgba(56, 225, 255, 0.2); }

.progress-wrap { margin-top: 10px; }
.progress {
  height: 7px;
  border-radius: 6px;
  background: rgba(4, 16, 30, 0.7);
  border: 1px solid rgba(120, 210, 255, 0.18);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, #38e1ff, #6cf9c5 60%, #ffd166);
  box-shadow: 0 0 12px rgba(56, 225, 255, 0.7);
  transition: width 0.14s linear;
}
.progress-label {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 1px;
  color: #bcdcf5;
  text-align: right;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.speedo {
  position: absolute;
  right: 16px;
  bottom: 18px;
  text-align: right;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
}
.speed-value {
  font-size: 40px;
  font-weight: 900;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #ffffff, #6fe0ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 12px rgba(56, 200, 255, 0.5));
}
.speed-unit { font-size: 10px; letter-spacing: 3px; color: #a8cbe8; }

.combo {
  position: absolute;
  left: 50%;
  top: 32%;
  transform: translate(-50%, -50%) scale(0.7);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 190, 60, 0.9);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}
.combo.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ================= 提示条 ================= */
.toast {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%) scale(0.9);
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #eafcff;
  background: rgba(8, 30, 52, 0.86);
  border: 1px solid rgba(110, 230, 255, 0.35);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  transition: opacity 0.22s ease, transform 0.22s ease;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.toast.danger { border-color: rgba(255, 90, 120, 0.6); color: #ffd9e2; }

/* ================= 触屏控制 ================= */
.touch-controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 96px;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 16px 18px;
  z-index: 12;
  pointer-events: none;
}
.tbtn {
  pointer-events: auto;
  touch-action: none;
  width: 78px;
  height: 62px;
  font-size: 20px;
  color: #dff7ff;
  background: rgba(10, 30, 52, 0.5);
  border: 1px solid rgba(120, 210, 255, 0.3);
  border-radius: 16px;
  backdrop-filter: blur(4px);
  font-family: inherit;
  cursor: pointer;
}
.tbtn:active,
.tbtn.pressed { background: rgba(56, 225, 255, 0.32); transform: scale(0.96); }

.tc-group { display: flex; gap: 10px; align-items: flex-end; }

/* 油门踏板 */
.tbtn-throttle {
  width: 92px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #04121f;
  background: linear-gradient(150deg, rgba(110, 240, 255, 0.94), rgba(47, 125, 255, 0.94));
  border: 1px solid rgba(170, 248, 255, 0.7);
  box-shadow: 0 10px 24px rgba(56, 180, 255, 0.38);
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}
.tbtn-throttle span { pointer-events: none; }
.tbtn-throttle:active,
.tbtn-throttle.pressed {
  transform: scale(0.94);
  background: linear-gradient(150deg, #9ff8ff, #58b4ff);
  box-shadow: 0 4px 26px rgba(90, 230, 255, 0.85);
}

/* 油门力度条（仅触屏） */
.throttle-gauge { display: none; }

@media (pointer: coarse) {
  .touch-controls { display: flex; }
  .speedo { bottom: 132px; right: 18px; }
  .throttle-gauge {
    display: block;
    position: absolute;
    right: 18px;
    bottom: 112px;
    width: 88px;
    height: 6px;
    border-radius: 4px;
    background: rgba(6, 22, 40, 0.72);
    border: 1px solid rgba(120, 210, 255, 0.25);
    overflow: hidden;
    z-index: 12;
  }
  .throttle-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #38e1ff, #6cf9c5 60%, #ffd166);
    transition: width 0.08s linear;
  }
}

/* ================= 结算 ================= */
.stars { font-size: 34px; letter-spacing: 6px; color: rgba(255, 255, 255, 0.16); margin: 8px 0 14px; }
.stars .on { color: var(--gold); text-shadow: 0 0 16px rgba(255, 200, 80, 0.9); }
.stars .on { animation: starPop 0.4s ease backwards; }
.stars .on:nth-child(2) { animation-delay: 0.1s; }
.stars .on:nth-child(3) { animation-delay: 0.2s; }
@keyframes starPop { from { transform: scale(0.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
  font-size: 12px;
  color: var(--text-dim);
}
.stats div {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(120, 210, 255, 0.12);
  text-align: left;
}
.stats b { display: block; font-size: 15px; color: #eafcff; margin-top: 2px; font-variant-numeric: tabular-nums; }
