/* ==========================================================================
   山野靶场 Valley Range · 样式表
   主题：深林夜色 + 落日暖光，玻璃质感卡片，适配桌面与手机
   ========================================================================== */

:root {
  --bg: #0a1210;
  --bg-2: #0e1a16;
  --bg-3: #12211c;
  --card: rgba(19, 31, 27, 0.72);
  --card-solid: #13211c;
  --border: rgba(196, 226, 205, 0.13);
  --border-strong: rgba(196, 226, 205, 0.24);
  --text: #e9f1ea;
  --text-dim: #c3d2c8;
  --muted: #8ea396;
  --accent: #e9b96a;
  --accent-soft: rgba(233, 185, 106, 0.16);
  --accent-2: #79d0a6;
  --danger: #e0705c;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --radius-sm: 11px;
  --topbar-h: 62px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC",
    system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background-image:
    radial-gradient(1100px 620px at 78% -8%, rgba(233, 185, 106, 0.13), transparent 62%),
    radial-gradient(900px 520px at 8% 4%, rgba(121, 208, 166, 0.09), transparent 60%),
    linear-gradient(180deg, #0a1210 0%, #0b1512 55%, #080f0d 100%);
  background-attachment: fixed;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: 0.01em; }
p { margin: 0; line-height: 1.7; }
button { font-family: inherit; }
kbd {
  display: inline-block;
  padding: 1px 6px;
  margin: 0 1px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.86em;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  color: var(--text);
}
.muted { color: var(--muted); font-weight: 500; }

/* ------------------------------- 布局 ---------------------------------- */
.app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  background: rgba(10, 18, 16, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.brand-mark {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(150deg, rgba(233, 185, 106, 0.28), rgba(121, 208, 166, 0.18));
  border: 1px solid var(--border-strong);
  color: var(--accent);
}
.brand-mark svg { width: 22px; height: 22px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 16px; letter-spacing: 0.06em; }
.brand-text small { font-size: 10.5px; color: var(--muted); letter-spacing: 0.16em; text-transform: uppercase; }

.topnav { display: flex; gap: 4px; margin-left: 6px; }
.navlink {
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 14px; border-radius: 999px; font-size: 14px; cursor: pointer;
  transition: color .16s, background .16s;
}
.navlink:hover { color: var(--text); background: rgba(255, 255, 255, 0.045); }
.navlink.is-active { color: var(--text); background: var(--accent-soft); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03);
  font-size: 12.5px; color: var(--text-dim); white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px rgba(255,255,255,.05); }
.pill.is-ok .dot { background: var(--accent-2); }
.pill.is-bad .dot { background: var(--danger); }

.main { flex: 1; width: 100%; max-width: 1320px; margin: 0 auto; padding: 26px 20px 34px; }
.screen { display: none; animation: fade .32s ease both; }
.screen.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.footer {
  padding: 16px 20px 26px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.9;
}
.footer-sep { margin: 0 6px; opacity: .5; }

/* ------------------------------- 卡片 ---------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 22px;
}
.card-title { font-size: 15.5px; display: flex; align-items: baseline; gap: 8px; margin-bottom: 14px; }
.card-title small { font-size: 12px; color: var(--muted); font-weight: 500; }
.section-title { font-size: 22px; margin-bottom: 4px; }
.eyebrow { font-size: 12px; letter-spacing: .18em; color: var(--accent); margin-bottom: 10px; text-transform: uppercase; }

/* ------------------------------- 按钮 ---------------------------------- */
.btn {
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s, background .16s, border-color .16s, box-shadow .16s, opacity .16s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); border-color: var(--border-strong); background: rgba(255, 255, 255, 0.09); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(150deg, #f0c477, #d99f45);
  border-color: rgba(255, 226, 170, 0.5);
  color: #241a08;
  box-shadow: 0 8px 22px rgba(233, 185, 106, 0.22);
}
.btn-primary:hover { background: linear-gradient(150deg, #f7cf88, #e0a94f); }
.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-lg { padding: 13px 26px; font-size: 15.5px; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ------------------------------ 首页布局 -------------------------------- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 18px; }
.hero { display: flex; flex-direction: column; }
.hero-title { font-size: clamp(38px, 6vw, 62px); line-height: 1.05; letter-spacing: .04em; }
.hero-sub { margin-top: 10px; font-size: 16px; color: var(--accent); letter-spacing: .06em; }
.hero-desc { margin-top: 16px; color: var(--text-dim); max-width: 62ch; }
.hero-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.tips { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 10px; }
.tips li {
  position: relative; padding-left: 20px; font-size: 13.5px; color: var(--text-dim); line-height: 1.65;
}
.tips li::before {
  content: ""; position: absolute; left: 2px; top: 8px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); opacity: .85;
}

.panel { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field-inline { flex-direction: row; gap: 18px; flex-wrap: wrap; }
.field-label { font-size: 12.5px; color: var(--muted); letter-spacing: .08em; }
.input {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: rgba(0, 0, 0, 0.28);
  color: var(--text); font-size: 14.5px; outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(233, 185, 106, 0.14); }
.input::placeholder { color: #6d8177; }

.chip-group { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-btn {
  border: 1px solid var(--border-strong); background: rgba(255, 255, 255, 0.035);
  color: var(--text-dim); border-radius: 12px; padding: 9px 13px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px; text-align: left; flex: 1 1 92px;
  transition: all .16s;
}
.chip-btn b { font-size: 14px; color: var(--text); }
.chip-btn small { font-size: 11px; color: var(--muted); }
.chip-btn:hover { border-color: var(--border-strong); background: rgba(255, 255, 255, 0.07); }
.chip-btn.is-active {
  border-color: rgba(233, 185, 106, 0.6);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(233, 185, 106, 0.2);
}

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-dim); cursor: pointer; }
.switch input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }

.status-list { display: grid; gap: 8px; padding-top: 4px; border-top: 1px dashed var(--border); margin-top: 2px; }
.status-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.status-row b { color: var(--text-dim); font-weight: 600; }

.strip { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 22px; }
.strip-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 14px; }
.mini-stat { display: flex; flex-direction: column; gap: 3px; }
.mini-stat b { font-size: 22px; color: var(--accent); font-variant-numeric: tabular-nums; }
.mini-stat span { font-size: 12px; color: var(--muted); }
.strip-top { border-left: 1px dashed var(--border); padding-left: 22px; }
.preview-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.preview-list li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.preview-list .rk { width: 20px; color: var(--muted); font-variant-numeric: tabular-nums; }
.preview-list .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-list .sc { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 600; }

/* ------------------------------ 排行榜 ---------------------------------- */
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border: 1px solid var(--border); border-radius: 999px; background: rgba(255, 255, 255, 0.03); }
.seg-btn {
  border: 0; background: transparent; color: var(--muted); padding: 7px 16px; border-radius: 999px;
  font-size: 13.5px; cursor: pointer; transition: all .16s;
}
.seg-btn.is-active { background: var(--accent-soft); color: var(--text); }

.board-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.board-grid-2 { margin-top: 18px; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.table-wrap { max-height: 460px; overflow: auto; border-radius: var(--radius-sm); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  position: sticky; top: 0; z-index: 2;
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12px;
  padding: 9px 10px; background: #10201a; border-bottom: 1px solid var(--border);
}
.table td { padding: 10px; border-bottom: 1px solid rgba(196, 226, 205, 0.07); font-variant-numeric: tabular-nums; }
.table tr:has(td.rank-1) td { background: rgba(233, 185, 106, 0.07); }
.table .rank-cell { width: 46px; color: var(--muted); }
.table .name-cell { color: var(--text); font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .score-cell { color: var(--accent); font-weight: 700; }
.table .empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.badge-medal { font-size: 15px; }

.chart-wrap { position: relative; width: 100%; height: 240px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 14px; }
.stat-item { background: rgba(255, 255, 255, 0.035); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.stat-item b { display: block; font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-item span { font-size: 11.5px; color: var(--muted); }
.stat-item.is-accent b { color: var(--accent); }
.my-best { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); font-size: 13px; color: var(--text-dim); }

/* ------------------------------ 玩法说明 -------------------------------- */
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-top: 8px; }
.help-item { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; }
.help-item h4 { font-size: 14.5px; color: var(--accent); margin-bottom: 8px; }
.help-item p { font-size: 13.5px; color: var(--text-dim); }
.help-foot { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--border); display: grid; gap: 8px; font-size: 13.5px; color: var(--text-dim); }

/* -------------------------------- 游戏 --------------------------------- */
#screen-play.is-active { display: block; }
.stage-wrap {
  position: relative;
  width: 100%;
  height: min(78vh, 760px);
  min-height: 420px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  background: #0a1119;
  cursor: none;
  touch-action: none;
  user-select: none;
}
.stage-wrap.is-mobile { cursor: default; }
#stage { display: block; width: 100%; height: 100%; }

.hud { position: absolute; inset: 0; pointer-events: none; font-variant-numeric: tabular-nums; }
.hud-corner { position: absolute; display: flex; gap: 10px; }
.hud-tl { top: 14px; left: 16px; flex-direction: column; align-items: flex-start; }
.hud-tr { top: 14px; right: 16px; flex-direction: column; align-items: flex-end; }
.hud-bl { bottom: 16px; left: 16px; flex-direction: column; align-items: flex-start; }

.hud-score { display: flex; align-items: baseline; gap: 8px; text-shadow: 0 2px 14px rgba(0, 0, 0, .8); }
.hud-score b { font-size: 38px; letter-spacing: .02em; color: #fff; line-height: 1; }
.hud-score small { font-size: 12px; color: rgba(255, 255, 255, .7); letter-spacing: .1em; }
.hud-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 999px; font-size: 12.5px;
  background: rgba(8, 16, 14, 0.55); border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.85); backdrop-filter: blur(6px);
}
.chip b { color: #fff; }

.lives { display: flex; gap: 6px; }
.life {
  width: 16px; height: 16px; border-radius: 4px;
  background: linear-gradient(150deg, #f2c273, #c98f3a);
  box-shadow: 0 0 10px rgba(233, 185, 106, .5);
}
.life.is-lost { background: rgba(255, 255, 255, 0.14); box-shadow: none; }

.ammo-row { display: flex; align-items: center; gap: 12px; text-shadow: 0 2px 12px rgba(0,0,0,.8); }
.ammo-dots { display: flex; gap: 4px; align-items: flex-end; }
.ammo-dot { width: 6px; height: 18px; border-radius: 3px; background: rgba(255, 255, 255, 0.28); }
.ammo-dot.is-on { background: linear-gradient(180deg, #ffe6b0, #d9a04a); box-shadow: 0 0 8px rgba(233, 185, 106, .55); }
.ammo-text { font-size: 15px; color: #fff; }
.ammo-text b { font-size: 22px; }
.reload-bar { width: 120px; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.16); overflow: hidden; opacity: 0; transition: opacity .2s; }
.reload-bar.is-on { opacity: 1; }
.reload-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #79d0a6, #e9b96a); }
.hud-diff { margin-top: 8px; font-size: 12px; color: rgba(255,255,255,.62); }

.hud-combo {
  position: absolute; left: 50%; top: 62%; transform: translate(-50%, 0) scale(.9);
  font-size: 30px; font-weight: 800; color: #ffd98a; opacity: 0;
  text-shadow: 0 4px 22px rgba(0, 0, 0, .85);
  transition: opacity .2s, transform .2s;
  letter-spacing: .04em; white-space: nowrap;
}
.hud-combo.is-on { opacity: 1; transform: translate(-50%, 0) scale(1); }

.hud-banner {
  position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%);
  font-size: 44px; font-weight: 800; letter-spacing: .1em; color: #fff; opacity: 0;
  text-shadow: 0 6px 30px rgba(0, 0, 0, .9); white-space: nowrap;
}
.hud-banner.is-on { animation: banner 1.7s ease both; }
@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.25); letter-spacing: .3em; }
  22% { opacity: 1; transform: translate(-50%, -50%) scale(1); letter-spacing: .1em; }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.04); }
}
.hud-hint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  font-size: 12.5px; color: rgba(255, 255, 255, .55); white-space: nowrap;
}
.hud-float { position: absolute; inset: 0; overflow: hidden; }
.float-score {
  position: absolute; font-weight: 800; font-size: 19px; color: #ffe0a0;
  text-shadow: 0 2px 12px rgba(0,0,0,.9); animation: floatUp .9s ease-out both; white-space: nowrap;
}
.float-score.is-crit { color: #ff9d6b; font-size: 23px; }
@keyframes floatUp {
  from { opacity: 0; transform: translate(-50%, 6px) scale(.8); }
  25% { opacity: 1; transform: translate(-50%, -6px) scale(1.05); }
  to { opacity: 0; transform: translate(-50%, -46px) scale(1); }
}

.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: rgba(6, 12, 10, 0.68);
  backdrop-filter: blur(6px);
}
.overlay[hidden] { display: none; }
.dialog { max-width: 460px; text-align: center; cursor: default; }
.dialog-title { font-size: 22px; margin-bottom: 10px; }
.dialog-text { color: var(--text-dim); font-size: 14px; }
.dialog-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }

.mobile-controls { position: absolute; right: 14px; bottom: 14px; z-index: 15; display: none; align-items: center; gap: 10px; }
.mobile-controls.is-on { display: flex; }
.fire-btn {
  width: 84px; height: 84px; border-radius: 50%;
  border: 2px solid rgba(233, 185, 106, .55);
  background: radial-gradient(circle at 35% 30%, rgba(233, 185, 106, .35), rgba(233, 185, 106, .12));
  color: #ffe9c2; font-size: 15px; font-weight: 700; cursor: pointer;
  backdrop-filter: blur(6px);
}
.fire-btn:active { transform: scale(.94); }

/* ------------------------------- 结算 ---------------------------------- */
.result { max-width: 860px; margin: 0 auto; }
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.result-score { font-size: clamp(48px, 8vw, 76px); line-height: 1; color: var(--accent); letter-spacing: .02em; }
.result-rank { margin-top: 10px; font-size: 14px; color: var(--text-dim); }
.result-badge {
  min-width: 160px; text-align: right; font-size: 13.5px; color: var(--text-dim);
}
.result-badge .new-best { display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.result .stat-grid { margin-top: 24px; }
.result-note { margin-top: 18px; font-size: 13.5px; color: var(--muted); }

/* ------------------------------- Toast --------------------------------- */
.toast-wrap { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  padding: 10px 18px; border-radius: 999px; font-size: 13.5px;
  background: rgba(16, 26, 22, 0.94); border: 1px solid var(--border-strong);
  color: var(--text); box-shadow: var(--shadow); animation: toastIn .25s ease both;
}
.toast.is-warn { border-color: rgba(224, 112, 92, .5); color: #ffd9d0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ------------------------------ 响应式 --------------------------------- */
@media (max-width: 1080px) {
  .home-grid { grid-template-columns: 1fr; }
  .strip { grid-template-columns: 1fr; }
  .strip-top { border-left: 0; padding-left: 0; border-top: 1px dashed var(--border); padding-top: 16px; }
  .board-grid, .board-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  :root { --topbar-h: 56px; }
  .topnav { display: none; }
  .topbar { padding: 0 14px; gap: 10px; }
  .main { padding: 18px 14px 26px; }
  .card { padding: 18px; border-radius: 15px; }
  .strip-stats { grid-template-columns: repeat(2, 1fr); }
  .stage-wrap { height: 62vh; min-height: 360px; border-radius: 14px; }
  .hud-score b { font-size: 28px; }
  .hud-banner { font-size: 30px; }
  .hud-hint { display: none; }
  .mobile-controls.is-on { display: flex; }
  .result-badge { text-align: left; }
  .hero-actions .btn { flex: 1; }
}
