/* 猜猜你在哪 - 样式（深色主题） */
:root {
  --bg: #0e1524;
  --panel: #16203a;
  --panel-2: #1b2a4a;
  --card: #2c4270;
  --card-hi: #3a558c;
  --line: #26345333;
  --text: #e8edf7;
  --muted: #93a1bd;
  --accent: #f5a524;
  --accent-hi: #ffb84d;
  --cyan: #67e8f9;
  --green: #34d399;
  --red: #f87171;
  --radius: 14px;
}
* { 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;
  font-size: 15px;
  line-height: 1.6;
}
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
a { color: var(--cyan); }
[hidden] { display: none !important; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: 10px;
  padding: 10px 22px; font-size: 15px; font-weight: 600;
  white-space: nowrap;
  transition: transform .08s, background .15s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: #201400; }
.btn.primary:hover { background: var(--accent-hi); }
.btn.primary:disabled { background: #4b4335; color: #8d8371; cursor: not-allowed; }
.btn.ghost { background: #ffffff14; color: var(--text); border: 1px solid #ffffff22; }
.btn.ghost:hover { background: #ffffff24; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: #ffffff14; color: var(--text);
}
.icon-btn:hover { background: #ffffff26; }
.icon-btn svg { width: 16px; height: 16px; }
kbd {
  background: #ffffff1a; border-radius: 5px; padding: 1px 7px;
  font-size: 12px; border: 1px solid #ffffff2e;
}

/* ---------- 首页 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; max-width: 1080px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(160deg, #f5a524, #e0731b);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.logo svg { width: 24px; height: 24px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 18px; }
.brand-text span { font-size: 12px; color: var(--muted); }

.home-main { max-width: 1080px; margin: 0 auto; padding: 6px 22px 40px; }
.hero { text-align: center; padding: 30px 0 26px; }
.hero h1 { font-size: 34px; letter-spacing: 2px; }
.hero p { color: var(--muted); margin-top: 8px; }

.mode-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  margin: 10px 0 30px;
}
.mode-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--card); color: var(--text);
  border: 0; border-radius: var(--radius); padding: 30px 20px;
  transition: background .15s, transform .1s;
}
.mode-card:hover { background: var(--card-hi); transform: translateY(-2px); }
.mode-card:active { transform: scale(.99); }
.mode-icon {
  width: 52px; height: 52px; border-radius: 50%;
  background: #ffffff17; display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.mode-icon svg { width: 27px; height: 27px; }
.mode-name { font-size: 21px; font-weight: 700; }
.mode-desc { font-size: 13px; color: #c6d2ea; min-height: 2.6em; }
.mode-meta { font-size: 12px; color: #ffffff88; }

.howto { margin-bottom: 30px; }
.howto h2, .panel h2 { font-size: 19px; margin-bottom: 14px; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.steps li {
  background: var(--panel); border-radius: var(--radius);
  padding: 16px 18px; font-size: 13.5px; color: var(--muted);
  display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 10px;
}
.steps li strong { grid-column: 2; color: var(--text); font-size: 15px; }
.steps li { align-items: center; }
.steps li .step-icon {
  grid-row: 1 / span 2; width: 40px; height: 40px; border-radius: 10px;
  background: #f5a52422; color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.step-icon svg { width: 20px; height: 20px; }

.panel {
  background: var(--panel); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 22px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head h2 { margin-bottom: 0; }
.seg { display: flex; background: #ffffff10; border-radius: 9px; padding: 3px; }
.seg-btn {
  border: 0; background: transparent; color: var(--muted);
  padding: 5px 16px; border-radius: 7px; font-size: 13.5px; font-weight: 600;
}
.seg-btn.active { background: var(--accent); color: #201400; }

.lb-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.lb-table th, .lb-table td { padding: 8px 10px; text-align: left; }
.lb-table th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.lb-table tr.me td { color: var(--accent); }
.lb-rank-1 { color: #fbbf24; }
.lb-rank-2 { color: #cbd5e1; }
.lb-rank-3 { color: #d8a25e; }
.empty { color: var(--muted); font-size: 13.5px; padding: 8px 0; }

.history-box table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.history-box th, .history-box td { padding: 6px 10px; text-align: left; }
.history-box th { color: var(--muted); font-weight: 500; font-size: 12.5px; }

.foot { text-align: center; color: #6c7a97; font-size: 12px; padding: 18px 0 26px; }

/* ---------- 对局 ---------- */
#view-game { position: fixed; inset: 0; background: #000; z-index: 50; }
#pano { position: absolute; inset: 0; }
#pano iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

#pano-loading {
  position: absolute; inset: 0; z-index: 30;
  background: #0b101d; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; color: var(--muted);
}
.spin {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid #ffffff22; border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: stretch; justify-content: space-between;
  padding: 10px 14px; pointer-events: none;
  background: linear-gradient(#0b101dcc, #0b101d00);
}
.hud-block {
  background: var(--accent); color: #201400; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 18px; min-width: 120px; line-height: 1.3;
}
.hud-block.right { flex-direction: row; gap: 10px; align-items: baseline; }
.hud-label { font-size: 12px; font-weight: 600; opacity: .85; }
.hud-value { font-size: 16px; font-weight: 800; }
.hud-value.score { font-size: 22px; }
.hud-timer {
  background: #0b101dd9; border: 2px solid var(--accent); color: #fff;
  border-radius: 24px; padding: 5px 22px; font-size: 20px; font-weight: 800;
  font-variant-numeric: tabular-nums; align-self: center;
}
.hud-timer.warn { border-color: var(--red); color: var(--red); animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: .55; } }

#world-tip {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%);
  z-index: 21; display: flex; align-items: center; gap: 10px;
  background: #0b101de6; border: 1px solid #ffffff26; border-radius: 12px;
  padding: 8px 14px; font-size: 13px; color: #dbe4f5; max-width: min(720px, 92vw);
}
#world-tip span { flex: 1; }
#world-tip .icon-btn { flex: none; }

#reveal-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 24;
  display: flex; justify-content: center; gap: 34px;
  background: #0b101de8; padding: 12px 16px;
}
.rv-item { display: flex; flex-direction: column; align-items: center; line-height: 1.3; }
.rv-label { font-size: 12px; color: var(--muted); }
.rv-value { font-size: 22px; font-weight: 800; }
.rv-value.dist { color: var(--cyan); }
.rv-value.score { color: var(--accent); }
#rv-name { font-size: 16px; }

#map-wrap {
  position: absolute; right: 14px; bottom: 14px; z-index: 22;
  width: 380px; height: 300px;
  background: var(--panel); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 8px 30px #00000066;
  transition: width .22s, height .22s;
}
#map-wrap.big { width: 620px; height: 470px; }
#map-wrap.reveal { width: min(92vw, 980px); height: min(58vh, 560px); }
#map-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; background: #0b101dd9; font-size: 12.5px; color: #dbe4f5;
}
#gmap { flex: 1; position: relative; background: #aadaff; }
#gmap .leaflet-container { width: 100%; height: 100%; }

#btn-confirm {
  margin: 8px 10px 10px; padding: 11px 0; border: 0; border-radius: 10px;
  background: var(--accent); color: #201400; font-size: 15px; font-weight: 700;
}
#btn-confirm:hover:not(:disabled) { background: var(--accent-hi); }
#btn-confirm:disabled { background: #ffffff14; color: #ffffff55; cursor: not-allowed; }

#reveal-actions {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 24; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
#reveal-actions .btn { min-width: 150px; justify-content: center; font-size: 16px; }
#reveal-actions .btn.ghost { background: #16203af5; border-color: #ffffff30; }
.kbd-hint { font-size: 12px; color: #b7c2d8; background: #0b101dcc; border-radius: 6px; padding: 2px 10px; }

#btn-restore {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 24; min-width: 170px; justify-content: center; font-size: 16px;
}

.pin-label {
  background: #0b101de0; color: #fff; border-radius: 8px;
  padding: 3px 9px; font-size: 12px; white-space: nowrap;
  border: 1px solid #ffffff33; transform: translate(-50%, -130%);
  position: absolute; pointer-events: none;
}

/* ---------- 结算 ---------- */
#view-result {
  position: fixed; inset: 0; z-index: 60; background: #0b101df2;
  display: flex; align-items: center; justify-content: center; padding: 18px;
  overflow: auto;
}
.result-card {
  background: var(--panel); border-radius: 18px; padding: 30px 34px;
  width: min(560px, 94vw); text-align: center;
}
.result-card h2 { font-size: 22px; }
.result-total { margin: 10px 0 2px; }
#result-score { font-size: 54px; font-weight: 900; color: var(--accent); }
.result-sub { color: var(--muted); font-size: 18px; margin-left: 6px; }
.result-comment { color: var(--cyan); font-size: 15px; min-height: 1.6em; }
#result-rows { list-style: none; margin: 16px 0; text-align: left; }
#result-rows li {
  display: grid; grid-template-columns: 24px 1fr auto auto; gap: 10px;
  align-items: center; padding: 8px 6px; border-bottom: 1px solid #ffffff10;
  font-size: 13.5px;
}
#result-rows .r-idx { color: var(--muted); }
#result-rows .r-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#result-rows .r-dist { color: var(--cyan); font-variant-numeric: tabular-nums; }
#result-rows .r-score { color: var(--accent); font-weight: 700; width: 3.6em; text-align: right; }
.save-row { display: flex; gap: 10px; margin: 8px 0; }
.save-row input {
  flex: 1; background: #ffffff10; border: 1px solid #ffffff2a; border-radius: 10px;
  color: var(--text); padding: 10px 14px; font-size: 14px; outline: none;
}
.save-row input:focus { border-color: var(--accent); }
.save-result { color: var(--green); font-size: 14px; min-height: 1.5em; }
.result-actions { display: flex; gap: 12px; justify-content: center; margin-top: 14px; }
.result-actions .btn { min-width: 140px; justify-content: center; }

/* ---------- 弹窗 / 提示 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 80; background: #05070cc9;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-card {
  background: var(--panel); border-radius: 16px; padding: 24px 26px;
  width: min(520px, 94vw); max-height: 90vh; overflow: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field input {
  width: 100%; background: #ffffff10; border: 1px solid #ffffff2a; border-radius: 10px;
  color: var(--text); padding: 10px 13px; font-size: 14px; outline: none;
}
.field input:focus { border-color: var(--accent); }
.field small { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; line-height: 1.6; }
.field small code { background: #ffffff14; padding: 0 5px; border-radius: 4px; }
.modal-actions { display: flex; justify-content: flex-end; }

#btn-game-home {
  position: absolute; top: 64px; left: 14px; z-index: 20;
  width: 40px; height: 40px; border-radius: 12px;
  background: #0b101dd9; color: var(--text);
  border: 1px solid #ffffff26;
  display: flex; align-items: center; justify-content: center;
}
#btn-game-home:hover { background: #1b2a4ae6; }
#btn-game-home svg { width: 20px; height: 20px; }

.modal-card.slim { width: min(340px, 90vw); text-align: center; }
.modal-card.slim h3 { margin-bottom: 6px; }

#toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 99; background: #0b101df0; border: 1px solid #ffffff2e;
  color: var(--text); border-radius: 10px; padding: 10px 18px; font-size: 14px;
  max-width: 86vw; box-shadow: 0 6px 24px #00000066;
}
#toast.ok { border-color: var(--green); }
#toast.err { border-color: var(--red); }

/* ---------- 复盘回看 ---------- */
#view-replay { position: fixed; inset: 0; background: #000; z-index: 55; }
#rp-pano { position: absolute; inset: 0; }
#rp-pano iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
#rp-loading {
  position: absolute; inset: 0; z-index: 30; background: #0b101de0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: var(--muted);
}
#rp-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 24;
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 20px; background: #0b101de8; padding: 10px 16px;
}
#rp-top .rp-chip {
  background: var(--accent); color: #201400; border-radius: 10px;
  padding: 3px 14px; font-size: 13px; font-weight: 700;
}
#rp-top .rp-item { font-size: 14px; color: var(--muted); }
#rp-top .rp-item b { color: var(--text); font-size: 16px; margin-left: 4px; }
#rp-top .rp-cyan { color: var(--cyan) !important; }
#rp-top .rp-org { color: var(--accent) !important; }
#rp-mapwrap {
  position: absolute; right: 14px; bottom: 64px; z-index: 22;
  width: min(560px, 92vw); height: min(46vh, 420px);
  background: var(--panel); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 8px 30px #00000066;
}
#rp-map { position: absolute; inset: 0; }
#rp-ctrl {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  z-index: 24; display: flex; gap: 8px;
  background: #0b101dcc; border: 1px solid #ffffff22; border-radius: 12px; padding: 8px;
}

/* ---------- 移动端 ---------- */
@media (max-width: 760px) {
  .hero h1 { font-size: 26px; }
  .mode-grid { grid-template-columns: 1fr; gap: 12px; }
  .steps { grid-template-columns: 1fr; }
  .home-main { padding: 4px 14px 30px; }
  #hud { padding: 8px; }
  .hud-block { min-width: 92px; padding: 4px 10px; }
  .hud-value { font-size: 14px; }
  .hud-timer { font-size: 16px; padding: 3px 14px; }
  #map-wrap { width: calc(100vw - 20px); height: 260px; right: 10px; bottom: 10px; }
  #map-wrap.big { width: calc(100vw - 20px); height: min(62vh, 460px); }
  #map-wrap.reveal { width: calc(100vw - 20px); height: min(52vh, 420px); }
  #reveal-bar { gap: 16px; padding: 9px 10px; }
  .rv-value { font-size: 17px; }
  #rv-name { font-size: 13px; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .result-card { padding: 22px 18px; }
}
/* 首页窄屏表格 */
@media (max-width: 760px) {
  .lb-table th:nth-child(3), .lb-table td:nth-child(3),
  .history-box th:nth-child(3), .history-box td:nth-child(3) { display: none; }
}
