/* 铁哥的滚动天空 · 深海捕鱼
   主题：深海蓝 + 单一青色强调色，深色玻璃拟态 UI */

:root {
  --accent: #3df0d0;
  --accent-dim: rgba(61, 240, 208, 0.35);
  --ink: #eaf6fb;
  --ink-dim: rgba(234, 246, 251, 0.62);
  --deep: #03141f;
  --panel: rgba(7, 28, 42, 0.58);
  --panel-border: rgba(148, 226, 255, 0.16);
  --radius: 14px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--deep);
  font-family: var(--font);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* 暗角，纯 CSS 避免 Canvas 每帧重绘 */
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 38%, transparent 55%, rgba(1, 10, 17, 0.55) 100%);
  z-index: 2;
}

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(10px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) 0 calc(14px + env(safe-area-inset-left));
  z-index: 10;
  pointer-events: none;
}

body[data-mode="menu"] #hud .hud-left,
body[data-mode="menu"] #pauseBtn { display: none; }

.hud-left { display: flex; align-items: center; gap: 10px; }

.hud-score {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 8px 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.hud-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
}

.hud-value {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.combo-badge {
  background: var(--accent);
  color: #032830;
  font-weight: 800;
  font-size: 15px;
  border-radius: var(--radius);
  padding: 7px 11px;
  transform: scale(1);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 18px var(--accent-dim);
}

.combo-badge.pop { transform: scale(1.22); }

.hud-right { display: flex; align-items: center; gap: 8px; pointer-events: auto; margin-left: auto; }

.hud-chip {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 7px;
}

.hud-chip .hud-label { letter-spacing: 0.1em; }

/* 小鱼图标（纯 CSS） */
.fish-ico {
  width: 16px;
  height: 10px;
  background: var(--accent);
  border-radius: 50% 60% 60% 50%;
  position: relative;
  display: inline-block;
}
.fish-ico::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 1px;
  border: 4px solid transparent;
  border-left: 6px solid var(--accent);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, border-color 0.2s ease;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn:hover { border-color: var(--accent-dim); }

.pause-ico {
  width: 12px;
  height: 14px;
  border-left: 4px solid var(--ink);
  border-right: 4px solid var(--ink);
}

.snd-on, .snd-off {
  position: relative;
  width: 14px;
  height: 14px;
  display: inline-block;
}
.snd-on::before, .snd-off::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 5px;
  height: 6px;
  background: var(--ink);
  border-radius: 1px;
}
.snd-on::after, .snd-off::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  border: 6px solid transparent;
  border-left: 8px solid var(--ink);
}
.snd-off { opacity: 0.45; }
.snd-off > i {
  position: absolute;
  left: -2px;
  top: 6px;
  width: 20px;
  height: 2px;
  background: #ff6b6b;
  transform: rotate(-38deg);
  border-radius: 1px;
}

/* ---------- 提示条 ---------- */
.hint {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 14px;
  color: var(--ink-dim);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 10;
  white-space: nowrap;
  animation: hintFade 4s ease forwards;
  pointer-events: none;
}

@keyframes hintFade {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
  8% { opacity: 1; transform: translateX(-50%) translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* 静音等状态提示 */
.toast {
  bottom: auto;
  top: calc(64px + env(safe-area-inset-top));
  animation: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  color: var(--ink);
}
.toast.show { opacity: 1; }

/* 区域横幅 */
.zone-banner {
  position: fixed;
  left: 50%;
  top: 26%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
  font-size: clamp(22px, 4.5vw, 34px);
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--ink);
  text-shadow: 0 2px 24px rgba(61, 240, 208, 0.5), 0 1px 3px rgba(0, 0, 0, 0.6);
  opacity: 0;
  white-space: nowrap;
}
.zone-banner.show { animation: zoneIn 2.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

@keyframes zoneIn {
  0% { opacity: 0; transform: translateX(-50%) translateY(16px) scale(0.94); }
  12% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ---------- 覆盖层 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 12, 20, 0.32);
}

.overlay[hidden] { display: none; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: calc(var(--radius) + 6px);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 24px 80px rgba(0, 0, 0, 0.45);
  padding: 36px 40px;
  text-align: center;
  max-width: 480px;
  width: 100%;
  animation: panelIn 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.small-panel { max-width: 380px; }

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--accent);
  margin-bottom: 14px;
}

.title {
  font-size: clamp(30px, 7vw, 44px);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.15;
  margin-bottom: 14px;
  text-shadow: 0 2px 30px rgba(61, 240, 208, 0.25);
}

.title em {
  font-style: normal;
  color: var(--accent);
}

.subtitle {
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-dim);
  max-width: 34em;
  margin: 0 auto 26px;
}

.panel-title {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 20px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 17px;
  font-weight: 700;
  padding: 15px 20px;
  cursor: pointer;
  margin-top: 12px;
  transition: transform 0.1s ease, box-shadow 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px) scale(0.98); }

.btn-primary {
  background: linear-gradient(160deg, #5ff5d8, #2cd4b4);
  color: #032830;
  box-shadow: 0 8px 30px rgba(61, 240, 208, 0.32);
}
.btn-primary:hover { box-shadow: 0 10px 38px rgba(61, 240, 208, 0.45); }

.btn-ghost {
  background: rgba(148, 226, 255, 0.07);
  color: var(--ink);
  border: 1px solid var(--panel-border);
}
.btn-ghost:hover { border-color: var(--accent-dim); }

/* ---------- 起始海域选择 ---------- */
.zone-label {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  margin-bottom: 10px;
}

.zone-select {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.zone-select::-webkit-scrollbar { display: none; }

.zone-card {
  flex: 1 0 0;
  min-width: 76px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: rgba(148, 226, 255, 0.05);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: transform 0.12s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.zone-card:active { transform: scale(0.95); }
.zone-card img {
  width: 100%;
  aspect-ratio: 8 / 5;
  object-fit: cover;
  display: block;
}
.zone-card span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  padding: 12px 2px 5px;
  background: linear-gradient(transparent, rgba(2, 12, 20, 0.85));
  white-space: nowrap;
}
.zone-card.sel {
  border-color: var(--accent);
  box-shadow: 0 4px 22px var(--accent-dim);
}

/* ---------- 菜单 tab ---------- */
.menu-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(148, 226, 255, 0.06);
}
.tab {
  flex: 1;
  padding: 9px 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.tab.sel { background: rgba(61, 240, 208, 0.16); color: var(--accent); }

/* ---------- 关卡网格 ---------- */
.level-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.level-card {
  border: 2px solid transparent;
  border-radius: 12px;
  background: rgba(148, 226, 255, 0.05);
  padding: 0 0 6px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  color: var(--ink);
  font: inherit;
  display: flex;
  flex-direction: column;
  transition: transform 0.12s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.level-card:active { transform: scale(0.95); }
.level-card img {
  width: 100%;
  aspect-ratio: 8 / 5;
  object-fit: cover;
  display: block;
  margin-bottom: 5px;
}
.level-card .lv-num { font-size: 10px; color: var(--ink-dim); letter-spacing: 0.06em; }
.level-card .lv-name { font-size: 12px; font-weight: 700; }
.level-card .lv-stars { font-size: 11px; color: #ffd964; letter-spacing: 0.1em; min-height: 14px; }
.level-card.sel {
  border-color: var(--accent);
  box-shadow: 0 4px 22px var(--accent-dim);
}
.level-card.locked { cursor: not-allowed; filter: grayscale(0.85) brightness(0.6); }
.level-card.locked .lv-stars { color: var(--ink-dim); }

/* ---------- 关卡进度条 ---------- */
.progress {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(46vw, 340px);
  height: 6px;
  border-radius: 3px;
  background: rgba(148, 226, 255, 0.14);
  display: none;
  z-index: 15;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), #9adcff);
  box-shadow: 0 0 10px var(--accent-dim);
  transition: width 0.15s linear;
}
.progress span {
  position: absolute;
  top: 9px;
  right: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-dim);
}
body[data-mode="playing"][data-level="1"] .progress { display: block; }

/* ---------- 过关星级 ---------- */
.stars {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 6px 0 18px;
}
.stars span {
  font-size: 40px;
  color: rgba(148, 226, 255, 0.18);
  transform: scale(0.6);
  animation: star-pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) forwards;
}
.stars span.on {
  color: #ffd964;
  text-shadow: 0 0 18px rgba(255, 217, 100, 0.55);
}
@keyframes star-pop {
  to { transform: scale(1); }
}
.go-prog {
  margin: -8px 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

/* ---------- 菜单附加 ---------- */
.controls-help {
  margin-top: 24px;
  border-top: 1px solid var(--panel-border);
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.help-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-dim);
  text-align: left;
}

.help-key {
  flex: none;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 8px;
  padding: 4px 9px;
  min-width: 74px;
  text-align: center;
}

.menu-best {
  margin-top: 18px;
  font-size: 13px;
  color: var(--ink-dim);
}
.menu-best strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- 结算 ---------- */
.new-best {
  display: inline-block;
  background: var(--accent);
  color: #032830;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2em;
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px var(--accent-dim);
  animation: bestPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.new-best[hidden] { display: none; }

@keyframes bestPop {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.stat {
  background: rgba(148, 226, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-num {
  font-size: 21px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.stat-name {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
}

/* ---------- 小屏适配 ---------- */
@media (max-width: 560px) {
  .panel { padding: 28px 22px; }
  .hud-value { font-size: 20px; }
  .hud-chip { padding: 8px 10px; font-size: 13px; }
  .subtitle { font-size: 14px; }
  .help-row { font-size: 12px; }
  /* 海域卡片 3+2 换行，避免横向溢出被裁切 */
  .zone-select { flex-wrap: wrap; overflow-x: visible; }
  .zone-card { flex: 1 1 28%; min-width: 0; }
  /* 关卡卡片 2 列 */
  .level-grid { grid-template-columns: repeat(2, 1fr); }
  .progress { width: 56vw; }
}

@media (prefers-reduced-motion: reduce) {
  .panel, .new-best, .hint { animation: none; }
  .combo-badge { transition: none; }
}
