/* ============================================================
   AimForge — 全局样式
   深色科幻实验室风格,原创设计
   ============================================================ */
:root {
  --bg: #05070d;
  --bg-panel: rgba(13, 19, 32, 0.92);
  --bg-card: rgba(18, 26, 43, 0.85);
  --line: rgba(0, 229, 255, 0.18);
  --accent: #00e5ff;
  --accent-dim: #0891b2;
  --warn: #ff3860;
  --gold: #ffd166;
  --text: #dbe7f4;
  --text-dim: #7c8ba1;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-num: "Bahnschrift", "Segoe UI", "PingFang SC", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  user-select: none;
}

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* ---------- 屏幕容器 ---------- */
.screen {
  position: fixed; inset: 0;
  display: none;
  flex-direction: column;
  z-index: 10;
  background: radial-gradient(ellipse at 50% -20%, rgba(0,229,255,0.08), transparent 55%),
              linear-gradient(rgba(5,7,13,0.82), rgba(5,7,13,0.94));
  backdrop-filter: blur(2px);
  overflow-y: auto;
}
.screen.active { display: flex; }
.screen.overlay { background: rgba(5, 7, 13, 0.72); align-items: center; justify-content: center; }

/* ---------- 主菜单 ---------- */
.home-inner {
  margin: auto; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 34px;
  padding: 40px 20px;
}
.logo-block { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.logo-mark { width: 84px; height: 84px; color: var(--accent); filter: drop-shadow(0 0 14px rgba(0,229,255,.55)); }
.logo-text {
  font-size: 56px; letter-spacing: 10px; font-weight: 800;
  color: #fff; font-family: var(--font-num);
}
.logo-text span { color: var(--accent); text-shadow: 0 0 22px rgba(0,229,255,.6); }
.tagline { color: var(--text-dim); letter-spacing: 3px; font-size: 14px; }
.home-nav { display: flex; flex-direction: column; gap: 14px; width: 300px; }
.home-foot { color: var(--text-dim); font-size: 12px; opacity: .75; max-width: 460px; line-height: 1.7; }

/* ---------- 按钮 ---------- */
.btn {
  appearance: none; border: 1px solid var(--line);
  background: var(--bg-card); color: var(--text);
  font-family: var(--font); font-size: 15px; letter-spacing: 2px;
  padding: 12px 22px; border-radius: 6px; cursor: pointer;
  transition: all .15s ease;
}
.btn:hover { border-color: var(--accent); color: #fff; box-shadow: 0 0 16px rgba(0,229,255,.25); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, rgba(0,229,255,.22), rgba(0,229,255,.08)); border-color: rgba(0,229,255,.55); color: #eafcff; }
.btn-big { font-size: 18px; padding: 16px 22px; font-weight: 700; }
.btn-danger:hover { border-color: var(--warn); box-shadow: 0 0 16px rgba(255,56,96,.3); }
.btn-danger.confirm { border-color: var(--warn); color: var(--warn); }
.btn-back { padding: 8px 16px; font-size: 14px; }

/* ---------- 面板头 ---------- */
.panel-head {
  display: flex; align-items: center; gap: 20px;
  padding: 22px 34px; border-bottom: 1px solid var(--line);
  background: rgba(8, 12, 22, 0.6);
  position: sticky; top: 0; z-index: 2;
}
.panel-head h2 { font-size: 21px; letter-spacing: 4px; font-weight: 700; }
.head-hint { margin-left: auto; color: var(--text-dim); font-size: 13px; }

/* ---------- 模式选择 ---------- */
.mode-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 18px; padding: 28px 34px; max-width: 1280px; width: 100%; margin: 0 auto;
}
.mode-card {
  position: relative; text-align: left;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px;
  padding: 20px; cursor: pointer; transition: all .16s ease; overflow: hidden;
  color: var(--text); font-family: var(--font);
}
.mode-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 8px 28px rgba(0,229,255,.18); }
.mode-card .m-icon { width: 44px; height: 44px; color: var(--accent); margin-bottom: 12px; filter: drop-shadow(0 0 8px rgba(0,229,255,.45)); }
.mode-card .m-en { font-family: var(--font-num); font-size: 19px; font-weight: 800; letter-spacing: 2px; color: #fff; }
.mode-card .m-zh { color: var(--accent); font-size: 13px; letter-spacing: 3px; margin: 2px 0 8px; }
.mode-card .m-desc { color: var(--text-dim); font-size: 12.5px; line-height: 1.65; min-height: 3.2em; }
.mode-card .m-best { margin-top: 12px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); }
.mode-card .m-best b { color: var(--gold); font-family: var(--font-num); font-size: 15px; }
.mode-card .m-cat {
  position: absolute; top: 14px; right: 14px;
  font-size: 10.5px; letter-spacing: 2px; color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 20px; padding: 3px 10px;
}

/* 段位徽章 */
.rank-badge {
  display: inline-block; padding: 3px 12px; border-radius: 20px;
  font-size: 12.5px; letter-spacing: 2px; font-weight: 700;
  border: 1px solid currentColor;
}
.rank-0 { color: #b08d57; } /* 青铜 */
.rank-1 { color: #c8d3e0; } /* 白银 */
.rank-2 { color: #ffd166; } /* 黄金 */
.rank-3 { color: #67e8f9; } /* 铂金 */
.rank-4 { color: #7dd3fc; text-shadow: 0 0 10px rgba(125,211,252,.7); } /* 钻石 */
.rank-5 { color: #c084fc; text-shadow: 0 0 10px rgba(192,132,252,.7); } /* 大师 */
.rank-6 { color: #ff5c8a; text-shadow: 0 0 12px rgba(255,92,138,.8); } /* 宗师 */

/* ---------- 设置 ---------- */
.settings-body { padding: 26px 34px 60px; max-width: 760px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 26px; }
.set-group { background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px; padding: 20px 24px; }
.set-group h3 { color: var(--accent); font-size: 14px; letter-spacing: 4px; margin-bottom: 16px; }
.set-row { margin-bottom: 18px; }
.set-row:last-child { margin-bottom: 0; }
.set-row > label { display: block; font-size: 14px; margin-bottom: 8px; color: var(--text); }
.set-row output { color: var(--accent); font-family: var(--font-num); font-weight: 700; margin-left: 6px; }
.set-note { color: var(--text-dim); font-size: 12px; margin-top: 6px; line-height: 1.6; }

input[type="range"] {
  width: 100%; height: 4px; appearance: none; background: rgba(124,139,161,.35); border-radius: 2px; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 10px rgba(0,229,255,.7); cursor: pointer;
}

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button {
  appearance: none; border: none; background: transparent; color: var(--text-dim);
  padding: 8px 18px; cursor: pointer; font-family: var(--font); font-size: 13px; letter-spacing: 1px;
}
.seg button.on { background: rgba(0,229,255,.18); color: #fff; }

.swatches { display: flex; gap: 10px; }
.swatches button {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer;
}
.swatches button.on { border-color: #fff; box-shadow: 0 0 10px rgba(255,255,255,.5); }

.cross-preview {
  margin-top: 6px; height: 90px; border: 1px dashed var(--line); border-radius: 8px;
  position: relative; background:
    radial-gradient(circle at center, rgba(0,229,255,.06), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 19px, rgba(124,139,161,.12) 19px 20px),
    repeating-linear-gradient(90deg, transparent 0 19px, rgba(124,139,161,.12) 19px 20px);
}
.cross-preview .crosshair { position: absolute; }

/* ---------- 数据中心 ---------- */
.stats-body { display: flex; flex-wrap: wrap; gap: 30px; padding: 28px 34px; max-width: 1100px; margin: 0 auto; width: 100%; }
.stats-left, .stats-right { background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px; padding: 22px; }
.stats-left { flex: 0 0 420px; }
.stats-right { flex: 1 1 420px; min-width: 380px; }
.stats-body h3 { color: var(--accent); font-size: 14px; letter-spacing: 4px; margin-bottom: 14px; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.stats-table th { color: var(--text-dim); font-weight: 400; text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: 12px; letter-spacing: 1px; }
.stats-table td { padding: 9px 6px; border-bottom: 1px solid rgba(124,139,161,.12); }
.stats-table td.num { font-family: var(--font-num); color: var(--gold); font-weight: 700; }

/* ---------- 关于 ---------- */
.about-body { padding: 30px 34px; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; line-height: 1.9; color: var(--text); }
.about-body kbd { background: var(--bg-card); border: 1px solid var(--line); border-radius: 4px; padding: 1px 7px; font-size: 12px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.hud-top {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 14px; align-items: stretch;
}
.hud-cell {
  background: rgba(8, 12, 22, 0.62); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 20px; font-family: var(--font-num); letter-spacing: 1px;
  display: flex; align-items: center; justify-content: center;
}
.hud-mode { font-size: 13px; color: var(--text-dim); letter-spacing: 3px; }
.hud-timer { font-size: 30px; font-weight: 800; color: #fff; min-width: 118px; }
.hud-timer.low { color: var(--warn); text-shadow: 0 0 12px rgba(255,56,96,.7); }
.hud-score { font-size: 22px; font-weight: 800; color: var(--accent); min-width: 110px; }
.hud-bottom { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px; }
.hud-bottom .hud-cell { font-size: 13.5px; color: var(--text); }

.streak {
  position: absolute; left: 50%; top: 58%; transform: translateX(-50%);
  font-family: var(--font-num); font-size: 17px; font-weight: 800; letter-spacing: 3px;
  color: var(--gold); text-shadow: 0 0 14px rgba(255,209,102,.8);
}

/* 准星 (由 JS 设置 CSS 变量: --c 颜色 --len 长度 --th 粗细 --gap 间隙) */
.crosshair {
  --c: #7fff00; --len: 6px; --th: 2px; --gap: 3px;
  position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: 6;
}
.crosshair::before, .crosshair::after,
.crosshair .h1, .crosshair .h2 { content: ""; position: absolute; background: var(--c); box-shadow: 0 0 4px rgba(0,0,0,.9); }
.crosshair::before { width: var(--th); height: var(--len); left: calc(var(--th) / -2); top: calc(-1 * var(--gap) - var(--len)); }
.crosshair::after  { width: var(--th); height: var(--len); left: calc(var(--th) / -2); top: var(--gap); }
.crosshair .h1 { height: var(--th); width: var(--len); top: calc(var(--th) / -2); left: calc(-1 * var(--gap) - var(--len)); }
.crosshair .h2 { height: var(--th); width: var(--len); top: calc(var(--th) / -2); left: var(--gap); }
.crosshair .dot { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: var(--c); left: -1.5px; top: -1.5px; }

/* 命中反馈 */
.hitmarker {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0; opacity: 0; z-index: 6;
}
.hitmarker span {
  position: absolute; width: 8px; height: 2px; background: #fff; box-shadow: 0 0 6px rgba(255,255,255,.8);
}
.hitmarker span:nth-child(1) { transform: translate(-11px, -8px) rotate(45deg); }
.hitmarker span:nth-child(2) { transform: translate(3px, -8px) rotate(-45deg); }
.hitmarker span:nth-child(3) { transform: translate(-11px, 6px) rotate(-45deg); }
.hitmarker span:nth-child(4) { transform: translate(3px, 6px) rotate(45deg); }
.hitmarker.pop { animation: hm .14s ease-out; }
@keyframes hm { 0% { opacity: 1; transform: scale(.7); } 100% { opacity: 0; transform: scale(1.25); } }

/* 浮动得分 */
#float-layer { position: absolute; inset: 0; overflow: hidden; }
.float-score {
  position: absolute; font-family: var(--font-num); font-weight: 800; font-size: 15px;
  color: var(--accent); text-shadow: 0 0 8px rgba(0,229,255,.8);
  animation: floatup .7s ease-out forwards; white-space: nowrap;
}
.float-score.neg { color: var(--warn); text-shadow: 0 0 8px rgba(255,56,96,.8); }
@keyframes floatup { 0% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -46px); } }

/* ---------- 倒计时 ---------- */
.countdown {
  position: fixed; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.countdown span {
  font-family: var(--font-num); font-size: 130px; font-weight: 800; color: var(--accent);
  text-shadow: 0 0 40px rgba(0,229,255,.65);
  animation: cd .9s ease-out;
}
@keyframes cd { 0% { transform: scale(1.6); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- 对话框 / 暂停 ---------- */
.dialog {
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 36px 46px; text-align: center; display: flex; flex-direction: column; gap: 13px; min-width: 320px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.dialog h2 { letter-spacing: 6px; margin-bottom: 4px; }

/* ---------- 结算 ---------- */
.results-inner {
  margin: auto; width: min(620px, 92vw); text-align: center;
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 34px 40px; box-shadow: 0 24px 80px rgba(0,0,0,.65);
}
.res-mode { color: var(--text-dim); letter-spacing: 4px; font-size: 14px; }
.res-score-row { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 10px 0 4px; }
.res-score {
  font-family: var(--font-num); font-size: 76px; font-weight: 800; color: #fff;
  text-shadow: 0 0 30px rgba(0,229,255,.45);
}
.res-badges { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.newbest {
  color: var(--gold); font-size: 13px; font-weight: 800; letter-spacing: 2px;
  animation: blink 1s ease-in-out infinite alternate;
}
@keyframes blink { from { opacity: .55; } to { opacity: 1; } }
.res-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 10px; margin: 22px 0;
}
.res-item { background: var(--bg-card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 6px; }
.res-item .v { font-family: var(--font-num); font-size: 21px; font-weight: 800; color: var(--accent); }
.res-item .k { font-size: 11.5px; color: var(--text-dim); margin-top: 4px; letter-spacing: 1px; }
.res-history h3 { font-size: 12.5px; color: var(--text-dim); letter-spacing: 3px; margin-bottom: 8px; text-align: left; }
.res-actions { display: flex; gap: 12px; justify-content: center; margin-top: 22px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%); z-index: 40;
  background: var(--bg-panel); border: 1px solid var(--accent); color: #fff;
  border-radius: 8px; padding: 12px 26px; letter-spacing: 1px; font-size: 14px;
  box-shadow: 0 0 24px rgba(0,229,255,.3);
}

/* 窄屏适配 */
@media (max-width: 640px) {
  .logo-text { font-size: 38px; letter-spacing: 6px; }
  .res-score { font-size: 54px; }
  .panel-head { padding: 16px 18px; }
  .mode-grid, .settings-body, .stats-body { padding-left: 18px; padding-right: 18px; }
}

.player-form, .leaderboard-body {
  width: min(100% - 32px, 680px);
  margin: 32px auto;
  padding: clamp(18px, 4vw, 32px);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.player-form { width: min(100% - 32px, 420px); margin: auto; }
.player-form h2 { margin-bottom: 16px; }
.player-form label { display: block; margin-bottom: 8px; }
.player-form input, .leaderboard-filters select {
  color-scheme: dark;
  color: var(--text);
  background: #121a2b;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 12px;
  font: inherit;
}
.player-form input { width: 100%; }
.player-form p, .leaderboard-body p { margin: 12px 0; color: #a9b8cf; line-height: 1.5; }
.player-status, .leaderboard-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.player-status { justify-content: center; margin-top: 12px; }
.player-status span { color: var(--accent); overflow-wrap: anywhere; }
.leaderboard-filters label { display: grid; gap: 6px; min-width: 0; }
.leaderboard-filters select { max-width: 100%; }
#leaderboard-table td:nth-child(2) { overflow-wrap: anywhere; }
#leaderboard-table tr.current-player { background: rgba(0, 229, 255, .1); }

#screen-player {
  background: radial-gradient(ellipse at 18% 20%, #163648c4, transparent 54%),
              linear-gradient(112deg, #050910e8, #0a121bf0);
}
.entry {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  width: min(1080px, calc(100% - 40px));
  margin: auto;
  padding: 32px 0;
  gap: clamp(24px, 6vw, 96px);
}
.entry-intro { border-left: 3px solid var(--accent); padding-left: clamp(16px, 3vw, 34px); }
.entry-kicker { color: #8ce9f8; font-weight: 750; letter-spacing: .16em; margin-bottom: 12px; }
.entry-intro h1 { font-size: clamp(2rem, 5vw, 4.15rem); line-height: 1.14; letter-spacing: -.04em; }
.entry-intro h1 span { display: block; color: var(--accent); }
.entry-intro p:last-child { margin-top: 18px; color: #bacbda; line-height: 1.6; }
.entry .player-form { width: 100%; padding: clamp(22px, 4vw, 36px); box-shadow: 0 24px 85px #0007; }
.entry .player-form label { font-weight: 750; font-size: 1.25rem; }
.entry .player-form input { min-height: 48px; }
.entry-actions, .score-sync { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.score-sync { color: #b7c9de; justify-content: center; font-size: .875rem; min-height: 1.3rem; }
.squad-title { font-size: clamp(2rem, 6vw, 4.2rem); letter-spacing: -.04em; }
@media (max-width: 700px) {
  .entry { grid-template-columns: 1fr; width: min(470px, calc(100% - 32px)); }
}
