/* =========================================================
 * 蜂巢迷宫 · 全站样式
 * ========================================================= */
:root {
  --bg: #070a12;
  --panel: rgba(16, 22, 38, 0.92);
  --panel2: rgba(22, 30, 50, 0.85);
  --line: rgba(140, 170, 255, 0.16);
  --text: #dfe7fb;
  --dim: #8b97b8;
  --cyan: #46e6ff;
  --green: #3efe8c;
  --orange: #ffb347;
  --blind: #b58cff;
  --blue: #5aa2ff;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}
.hidden { display: none !important; }

/* ---------------- 画布 ---------------- */
#game-canvas {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  display: block;
}

/* ---------------- HUD ---------------- */
#hud {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  z-index: 5; pointer-events: none;
}
#hud .hud-left, #hud .hud-right { display: flex; align-items: center; gap: 10px; }
#hud .hud-right { pointer-events: auto; }
#hud > * { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
#hud .hud-left, #hud .hud-right { padding: 8px 12px; backdrop-filter: blur(6px); }
#hud .hud-timer {
  padding: 8px 22px;
  font-size: 26px; font-weight: 700; letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(70, 230, 255, 0.45);
  backdrop-filter: blur(6px);
}
#hud-info, #hud-visited { color: var(--dim); font-size: 13px; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 18px;
}
.badge.normal { background: rgba(90, 162, 255, 0.18); color: var(--blue); border: 1px solid rgba(90, 162, 255, 0.4); }
.badge.blind { background: rgba(181, 140, 255, 0.16); color: var(--blind); border: 1px solid rgba(181, 140, 255, 0.4); }

#hint {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 20px; font-size: 14px; color: var(--dim);
  z-index: 5; pointer-events: none; white-space: nowrap;
  transition: opacity 1.2s;
  max-width: 92vw;
}
#hint.fade { opacity: 0; }

/* ---------------- 盲玩：暗角 & 红光 ---------------- */
#vignette {
  position: fixed; inset: 0; z-index: 4; pointer-events: none;
  background: radial-gradient(ellipse at center,
    transparent 26%, rgba(0, 0, 8, 0.5) 68%, rgba(0, 0, 6, 0.94) 100%);
}
#blind-flash {
  position: fixed; inset: 0; z-index: 6; pointer-events: none;
  opacity: 0; transition: opacity 0.4s ease-out;
  background: radial-gradient(circle at center,
    rgba(255, 46, 36, 0.72) 0%, rgba(150, 10, 8, 0.4) 45%, transparent 74%);
}
#blind-flash.on { opacity: 1; transition: opacity 0.03s; }

/* ---------------- 通用覆盖层 / 面板 ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(10px);
  overflow-y: auto;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 34px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  max-width: min(92vw, 560px);
  margin: 24px 0;
}
.panel h2 { font-size: 26px; margin-bottom: 8px; }
.panel p { color: var(--dim); font-size: 14px; }

.btn {
  display: inline-block;
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 22px;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
  font-family: inherit;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(120, 200, 255, 0.5); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(135deg, #1b8fd6, #1668b8);
  border-color: rgba(120, 210, 255, 0.6);
  color: #fff;
  box-shadow: 0 6px 24px rgba(30, 140, 220, 0.35);
}
.btn.ghost { background: transparent; }
.btn.mini { padding: 6px 14px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }

/* ---------------- 主菜单 ---------------- */
#menu { background: linear-gradient(160deg, #06080f 0%, #0a1226 55%, #0d1a33 100%); }
#menu::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 25%, rgba(70, 230, 255, 0.08), transparent 42%),
    radial-gradient(circle at 80% 70%, rgba(181, 140, 255, 0.09), transparent 45%);
}
.menu-inner { position: relative; text-align: center; padding: 34px 20px; max-width: 1020px; }
.logo {
  font-size: 52px; font-weight: 800; letter-spacing: 14px; text-indent: 14px;
  background: linear-gradient(120deg, #7ee9ff 10%, #46e6ff 40%, #b58cff 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 60px rgba(70, 230, 255, 0.25);
}
.tagline { color: var(--dim); margin: 10px 0 22px; font-size: 15px; letter-spacing: 2px; }

.size-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 24px; color: var(--dim); font-size: 14px; }
.chip {
  background: var(--panel2); border: 1px solid var(--line); color: var(--dim);
  border-radius: 999px; padding: 6px 16px; font-size: 13px; cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.chip.on { color: var(--cyan); border-color: rgba(70, 230, 255, 0.55); box-shadow: 0 0 14px rgba(70, 230, 255, 0.2) inset; }

.cards { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; }
.mode-card {
  width: 320px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px 24px 24px;
  text-align: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
.mode-card:hover { transform: translateY(-3px); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5); }
.mode-card .mode-icon { font-size: 40px; margin-bottom: 8px; }
.mode-card h2 { font-size: 22px; margin-bottom: 10px; letter-spacing: 4px; }
.mode-card.blind h2 { color: var(--blind); }
.mode-card p { font-size: 13.5px; line-height: 1.7; min-height: 66px; }
.mode-card ul { list-style: none; margin: 12px 0 18px; color: var(--dim); font-size: 12.5px; }
.mode-card li { margin: 4px 0; }

.menu-foot { margin-top: 26px; display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--dim); font-size: 13px; }
.menu-foot .ops { line-height: 1.8; }

/* ---------------- 通关面板 ---------------- */
.win-panel { max-width: min(94vw, 640px); }
.win-time {
  font-size: 54px; font-weight: 800; letter-spacing: 3px;
  color: var(--green);
  text-shadow: 0 0 30px rgba(62, 254, 140, 0.4);
  font-variant-numeric: tabular-nums;
  margin: 6px 0 10px;
}
.win-stats { display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap; color: var(--dim); font-size: 13.5px; margin-bottom: 16px; }
.submit-row { display: flex; gap: 10px; justify-content: center; margin: 10px 0 6px; }
.submit-row input {
  background: #0b101d; border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); padding: 11px 16px; font-size: 15px; width: 220px; outline: none;
  font-family: inherit;
}
.submit-row input:focus { border-color: rgba(70, 230, 255, 0.55); }
.submit-note { font-size: 12.5px; color: var(--dim); margin-bottom: 14px; }
.rp-mount { margin: 6px auto 14px; max-width: 520px; }
.btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------------- 回放组件 ---------------- */
.rp { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.rp-canvas {
  width: 100%; border-radius: 14px;
  border: 1px solid var(--line);
  background: #0a0e18;
}
.rp-bar { display: flex; align-items: center; gap: 10px; width: 100%; padding: 0 4px; }
.rp-bar button {
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  width: 44px; height: 30px; cursor: pointer; font-size: 13px; font-family: inherit;
  flex: none;
}
.rp-bar .rp-speed { width: 48px; }
.rp-bar .rp-seek { flex: 1; accent-color: var(--orange); height: 4px; cursor: pointer; }
.rp-bar .rp-time { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; flex: none; }

/* ---------------- 排行榜页 ---------------- */
body.page-plain { overflow: auto; }
.site {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 26px; border-bottom: 1px solid var(--line);
  background: rgba(10, 14, 26, 0.8);
  position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px);
}
.site h1 { font-size: 20px; letter-spacing: 3px; }
.wrap { max-width: 1080px; margin: 26px auto 60px; padding: 0 20px; }
.tabs { display: flex; gap: 10px; margin-bottom: 16px; }
.tab {
  background: var(--panel2); border: 1px solid var(--line); color: var(--dim);
  border-radius: 999px; padding: 7px 20px; font-size: 14px; cursor: pointer; font-family: inherit;
}
.tab.on { color: var(--cyan); border-color: rgba(70, 230, 255, 0.55); }
.tbl-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 12px 14px; text-align: left; }
.tbl thead th {
  color: var(--dim); font-weight: 600; font-size: 12.5px; letter-spacing: 1px;
  border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.02);
}
.tbl tbody tr { border-bottom: 1px solid rgba(140, 170, 255, 0.07); }
.tbl tbody tr:last-child { border-bottom: none; }
.tbl tbody tr:hover { background: rgba(90, 162, 255, 0.06); }
.tbl .rank { color: var(--dim); width: 40px; }
.tbl .rank.top { color: var(--orange); font-weight: 700; }
.tbl .t { font-variant-numeric: tabular-nums; color: var(--cyan); font-weight: 600; }
.tbl .date { color: var(--dim); font-size: 12.5px; }
.tbl .name { font-weight: 600; }
.empty { padding: 60px 20px; text-align: center; color: var(--dim); font-size: 15px; }

.modal-panel { max-width: min(94vw, 620px); text-align: left; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.modal-head h3 { font-size: 18px; }
.modal-meta { color: var(--dim); font-size: 13px; margin-bottom: 12px; }
#modal-rp { max-width: 540px; margin: 0 auto; }

/* ---------------- 后台 ---------------- */
.login-box { display: flex; justify-content: center; padding-top: 8vh; }
.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.stat-card {
  flex: 1; min-width: 120px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 4px;
}
.stat-card b { font-size: 26px; color: var(--cyan); font-variant-numeric: tabular-nums; }
.stat-card span { color: var(--dim); font-size: 12.5px; }
.admin-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }

/* ---------------- 提示条 ---------------- */
#toast {
  position: fixed; top: 74px; left: 50%; transform: translateX(-50%) translateY(-12px);
  background: rgba(20, 28, 48, 0.95); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 22px; font-size: 14px;
  opacity: 0; pointer-events: none; z-index: 30;
  transition: opacity 0.25s, transform 0.25s;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- WebGL 错误 ---------------- */
#webgl-err { z-index: 40; }
#webgl-err .panel { max-width: 420px; }

@media (max-width: 720px) {
  .logo { font-size: 34px; letter-spacing: 8px; }
  .mode-card { width: min(86vw, 320px); }
  .hud-timer { font-size: 19px !important; padding: 6px 12px !important; }
  .tbl th:nth-child(6), .tbl td:nth-child(6),
  .tbl th:nth-child(7), .tbl td:nth-child(7),
  .tbl th:nth-child(8), .tbl td:nth-child(8) { display: none; }
}
