/* ════════════════════════════════════════════════
   贪吃蛇 · 样式表
   ════════════════════════════════════════════════ */

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

body {
  background: #0a0a0f;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-family: 'Segoe UI', 'PingFang SC', sans-serif;
  color: #e0e0e0;
  overflow: hidden;
  user-select: none;
}

/* ── 顶部信息栏 ── */
#hud {
  display: flex;
  gap: 40px;
  margin-bottom: 14px;
  font-size: 16px;
  letter-spacing: 1px;
}

.hud-item { text-align: center; }
.hud-label {
  font-size: 11px;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 2px;
}
.hud-value {
  font-size: 24px;
  font-weight: 700;
  color: #4efa88;
  text-shadow: 0 0 12px #4efa8866;
}
#hi-value { color: #f9d56e; text-shadow: 0 0 12px #f9d56e66; }
#lv-value { color: #7eb8ff; text-shadow: 0 0 12px #7eb8ff66; }

/* ── Buff 状态栏 ── */
#buff-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  min-height: 30px;
  align-items: center;
  justify-content: center;
}
.buff-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 12px;
  border: 1.5px solid;
  border-radius: 20px;
  background: rgba(255,255,255,0.04);
  font-size: 13px;
  animation: buffPulse 1.5s ease-in-out infinite;
}
.buff-icon { font-size: 14px; }
.buff-label { font-weight: 600; letter-spacing: 1px; }
.buff-timer { font-size: 11px; color: #888; margin-left: 2px; font-variant-numeric: tabular-nums; }
@keyframes buffPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ── Canvas 容器 ── */
#canvas-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 40px #0005, 0 0 0 2px #2a2a3a;
}
canvas { display: block; }

/* ── 遮罩层（开始 / 暂停 / 结束） ── */
#overlay {
  position: absolute;
  inset: 0;
  background: rgba(8,8,18,0.82);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity .3s;
}
#overlay.hidden { opacity: 0; pointer-events: none; }

.overlay-title {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 4px;
  background: linear-gradient(135deg, #4efa88, #7eb8ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.overlay-sub {
  font-size: 14px;
  color: #aaa;
  letter-spacing: 1px;
}
.overlay-score {
  font-size: 52px;
  font-weight: 900;
  color: #f9d56e;
  text-shadow: 0 0 20px #f9d56e88;
}

/* ── 难度选择器 ── */
#diff-group {
  display: flex;
  gap: 12px;
}
.diff-btn {
  padding: 10px 24px;
  border: 2px solid #2a2a3a;
  border-radius: 8px;
  background: #111120;
  color: #aaa;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
}
.diff-btn:hover, .diff-btn.active {
  border-color: #4efa88;
  color: #4efa88;
  background: #0d1f18;
  box-shadow: 0 0 12px #4efa8844;
}

/* ── 开关组 ── */
.toggle-group {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
}

/* ── 穿墙开关 ── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}
.toggle-label {
  font-size: 14px;
  color: #aaa;
  letter-spacing: 1px;
}
.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: #2a2a3a;
  border-radius: 26px;
  transition: background .25s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  background: #888;
  border-radius: 50%;
  transition: transform .25s, background .25s;
}
.toggle-switch input:checked + .toggle-slider {
  background: #1a3d2a;
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
  background: #4efa88;
  box-shadow: 0 0 8px #4efa8866;
}

/* 穿透模式开关 - 紫色主题 */
.ghost-slider {
  background: #2a2a3a;
}
.toggle-switch input:checked + .ghost-slider {
  background: #2a1a3d;
}
.toggle-switch input:checked + .ghost-slider::before {
  transform: translateX(22px);
  background: #c89bff;
  box-shadow: 0 0 8px #c89bff66;
}

/* ── 开始按钮 ── */
#start-btn {
  padding: 13px 44px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #4efa88, #3dd68c);
  color: #081a10;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 2px;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 4px 20px #4efa8855;
}
#start-btn:hover { transform: scale(1.05); box-shadow: 0 6px 28px #4efa8877; }
#start-btn:active { transform: scale(.97); }

/* ── 键位提示 ── */
.hint {
  font-size: 12px;
  color: #555;
  text-align: center;
  line-height: 1.8;
}
