/* vkt Click 样式：点击板 + 数值面板 + 统一壳。
   深色是主场景（屏幕体检一般就在暗处点两下），浅色跟随系统。 */

:root {
  --bg: #0F1115;
  --surface: #171A20;
  --surface-2: #1E222A;
  --text: #EDEFF3;
  --muted: #9AA3B2;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #E0A458;
  --accent-soft: rgba(224, 164, 88, 0.16);
  --accent-line: rgba(224, 164, 88, 0.45);
  --accent-ink: #241705;
  --cool: #7FA6C9;
  --slow: #6D7686;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}

body.theme-light {
  --bg: #F5F1E8;
  --surface: #FFFFFF;
  --surface-2: #F0EAE0;
  --text: #1E2127;
  --muted: #5E6672;
  --line: rgba(0, 0, 0, 0.10);
  --accent: #8A5A12;
  --accent-soft: rgba(138, 90, 18, 0.12);
  --accent-line: rgba(138, 90, 18, 0.35);
  --accent-ink: #FFF8EA;
  --cool: #2F6C97;
  --slow: #5E6672;
  --shadow: 0 18px 48px rgba(40, 34, 24, 0.16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans", "Noto Sans", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

[hidden], .hidden { display: none !important; }

/* ---------- 顶栏 ---------- */

#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
  background: linear-gradient(to bottom, var(--bg) 72%, transparent);
  z-index: 10;
}

.app-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.pill {
  margin-left: auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  min-width: 34px;
  text-align: center;
}

.nav-btn, .icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(23, 26, 32, 0.6);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  flex: 0 0 auto;
}

body.theme-light .nav-btn,
body.theme-light .icon-btn { background: rgba(255, 255, 255, 0.7); }

.nav-btn:active, .icon-btn:active { transform: scale(0.96); }

/* ---------- 主区 ---------- */

#stage {
  width: min(680px, 100%);
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 62px) 14px
           calc(env(safe-area-inset-bottom, 0px) + 36px);
}

.pad-wrap { margin-bottom: 14px; }

#pad {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 220px;
  max-height: 44vh;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 90% at 50% 42%, var(--accent-soft), transparent 68%),
    var(--surface);
  overflow: hidden;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}

#pad:focus-visible {
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 6px var(--accent-soft);
}

#pad.is-pressed {
  border-color: rgba(224, 164, 88, 0.55);
}

.pad-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.5;
  mask-image: radial-gradient(80% 80% at 50% 50%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(80% 80% at 50% 50%, #000 30%, transparent 100%);
}

.pad-cross {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0.55;
}

.pad-cross::before, .pad-cross::after {
  content: "";
  position: absolute;
  background: var(--accent);
}

.pad-cross::before { left: 50%; top: 0; width: 2px; height: 100%; margin-left: -1px; }
.pad-cross::after { top: 50%; left: 0; height: 2px; width: 100%; margin-top: -1px; }

.ripples { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.ripple {
  position: absolute;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  box-shadow: 0 0 18px 2px var(--accent-soft);
  animation: ripple 0.62s ease-out forwards;
  pointer-events: none;
}

@keyframes ripple {
  from { transform: scale(0.18); opacity: 0.95; }
  to { transform: scale(1.75); opacity: 0; }
}

.pad-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 18px;
  pointer-events: none;
}

.pad-hint {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.pad-sub {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.live-status {
  min-height: 20px;
  margin: 10px 0 0;
  text-align: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* ---------- 卡片 ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 14px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.card-title { margin: 0; font-size: 14px; font-weight: 600; }
.card-hint { font-size: 12px; color: var(--muted); white-space: nowrap; }
.empty { margin: 6px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- 条形图 ---------- */

.chart {
  position: relative;
  height: 132px;
  padding: 22px 2px 2px;
}

.chart-ref {
  position: absolute;
  left: 0;
  right: 0;
  /* 与 500ms 柱子对齐：内容区高 = 100% - 24px（上 22 / 下 2），其中心 = 50% - 10px */
  bottom: calc(50% - 10px);
  border-top: 1px dashed var(--accent-line);
  pointer-events: none;
  z-index: 2;            /* 参照线压在柱子上，才看得出哪根超过了 500ms */
}

.chart-note {
  margin: 6px 2px 0;
  font-size: 11px;
  color: var(--muted);
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 100%;
  position: relative;
  z-index: 1;
}

.bar {
  flex: 1 1 0;
  min-width: 4px;
  height: 3px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(to top, var(--accent), #F3C98A);
  transition: height 0.22s ease;
}

.bar.standard { background: linear-gradient(to top, #C99B55, #E8CB96); }
.bar.slow { background: linear-gradient(to top, var(--slow), #9AA5B4); }
.bar.clamped { opacity: 0.75; }

/* 浅色主题下把柱子整体压深一档，白底上仍有足够对比 */
body.theme-light .bar { background: linear-gradient(to top, #8A5A12, #C08A3A); }
body.theme-light .bar.standard { background: linear-gradient(to top, #A06A1E, #C9954F); }
body.theme-light .bar.slow { background: linear-gradient(to top, #5E6672, #9AA3B2); }

/* ---------- 数值面板 ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px 12px;
}

.stat-k { font-size: 12px; color: var(--muted); }
.stat-v {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sources-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sources { display: flex; flex-wrap: wrap; gap: 6px; }

.source {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  font-variant-numeric: tabular-nums;
}

/* ---------- 结论卡 ---------- */

.verdict {
  background:
    linear-gradient(150deg, var(--accent-soft), transparent 62%),
    var(--surface);
  border-color: rgba(224, 164, 88, 0.28);
}

.eyebrow {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.verdict-title { margin: 0 0 8px; font-size: 19px; }
.verdict-body { margin: 0 0 10px; font-size: 14px; line-height: 1.65; }

.note {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.note.center { text-align: center; }

/* ---------- 按钮 ---------- */

.actions { margin: 4px 0 14px; }

.btn {
  appearance: none;
  font: inherit;
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.btn:active { transform: scale(0.99); }
.btn.ghost { background: transparent; }

/* ---------- 遮罩与抽屉 ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.48);
  z-index: 20;
}

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(560px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow);
  padding: 0 20px calc(env(safe-area-inset-bottom, 0px) + 20px);
  z-index: 21;
  animation: rise 0.22s ease both;
}

@keyframes rise {
  from { transform: translate(-50%, 18px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.sheet-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 10px;
  background: var(--surface);
  z-index: 1;
}

.sheet-head h2 { margin: 0; font-size: 17px; }

.field { padding: 14px 0; border-top: 1px solid var(--line); }
.field:first-child { border-top: 0; }

.field-label {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.lang-row { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  appearance: none;
  font: inherit;
  font-size: 13px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.chip.active {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 600;
}

/* ---------- 菜单 ---------- */

.menu-list {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  transform: translateX(-50%);
  width: min(420px, calc(100% - 24px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 22;
  animation: rise 0.18s ease both;
}

.menu-item {
  appearance: none;
  font: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.menu-item:active { background: var(--surface-2); }
.menu-ico { width: 22px; text-align: center; }
.menu-txt { font-size: 15px; }

/* ---------- 内容页 ---------- */

.page-view {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 30;
  display: flex;
  flex-direction: column;
}

.page-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 12px;
  border-bottom: 1px solid var(--line);
}

.page-head-pad { width: 38px; }
.page-title { flex: 1; font-size: 16px; }

.page-body {
  overflow-y: auto;
  padding: 20px 20px calc(env(safe-area-inset-bottom, 0px) + 40px);
}

.doc-block { max-width: 620px; margin: 0 auto; }
.doc-p { margin: 0 0 14px; font-size: 14.5px; line-height: 1.75; color: var(--text); }
.doc-list { margin: 0 0 14px; padding-left: 20px; }
.doc-list li { margin-bottom: 10px; font-size: 14.5px; line-height: 1.7; }
.doc-note { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.doc-h { margin: 26px 0 10px; font-size: 15px; }
.doc-row { display: flex; gap: 10px; margin: 6px 0 12px; font-size: 14px; }
.doc-k { color: var(--muted); min-width: 64px; }
.doc-link { color: var(--accent); text-decoration: none; word-break: break-all; }
.page-placeholder { color: var(--muted); text-align: center; padding-top: 30vh; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 40;
  max-width: 86vw;
  text-align: center;
}

/* ---------- 大屏与动效降级 ---------- */

@media (min-width: 560px) {
  #pad { max-height: 320px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .ripple { animation: none !important; opacity: 0.7; transform: scale(0.5); }
}
