/* ========== 全局 ========== */
:root {
  --bg-1: #000000;
  --bg-2: #0a0a0a;
  --bg-3: #111113;
  --primary: #ffffff;
  --primary-2: #bbbbbb;
  --accent: #999999;
  --text: #f2f2f2;
  --text-dim: #c0c0c0;
  --muted: #7a7a7a;
  --border: rgba(255, 255, 255, 0.26);
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-bg-strong: rgba(255, 255, 255, 0.24);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  --radius: 16px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 15px;
  color: var(--text);
  background: #000000;
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

a { color: var(--primary-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.req { color: #ff7676; font-style: normal; }

/* ========== 背景光球 ========== */
.bg-orbs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0;
  animation: none;
}
.orb-1, .orb-2, .orb-3 { display: none; }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -40px) scale(1.1); }
}

/* ========== Hero ========== */
/* ========== Topbar ========== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* 主行：左 / 居中品牌 / 右 */
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-left {
  flex: 0 0 auto;
  position: relative;
}
.topbar-brand {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}
.topbar-logo {
  font-size: 20px;
}
.topbar-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 🔑 密钥按钮 */
.topbar-key-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
  padding: 0;
}
.topbar-key-btn:hover { background: rgba(255,255,255,0.12); }
.topbar-key-btn.has-keys {
  border-color: rgba(100, 220, 120, 0.55);
  box-shadow: 0 0 0 2px rgba(100,220,120,0.15);
}

/* 密钥面板（下拉） */
.topbar-key-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 300;
  background: rgba(14, 14, 18, 0.97);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  padding: 14px;
  width: 280px;
  max-width: calc(100vw - 24px);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 12px 48px rgba(0,0,0,0.6);
}
.topbar-key-panel.hidden { display: none; }
.topbar-key-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.topbar-key-tip {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 8px;
}

/* 进度行（分析期间，默认隐藏） */
.topbar-progress {
  border-top: 1px solid rgba(255,255,255,0.08);
}
.topbar-progress.hidden { display: none; }

/* 进度条区 */
.topbar-progress-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
}
.topbar-progress-bar .progress-float-title {
  font-size: 12px;
  font-weight: 600;
  color: #e0e0e0;
  flex: 0 0 auto;
  white-space: nowrap;
}
.topbar-progress-track {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  overflow: hidden;
  min-width: 40px;
}
.topbar-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #888888, #ffffff, #888888);
  background-size: 200% 100%;
  animation: shift 3s linear infinite;
  transition: width 0.4s ease;
}
.topbar-progress-text {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 100px;
}
.topbar-progress-bar .progress-float-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  padding: 0 2px;
  flex: 0 0 auto;
  transition: color 0.15s, transform 0.2s;
  line-height: 1;
}
.topbar-progress-bar .progress-float-toggle:hover { color: var(--text); }
#progress-card.collapsed .progress-float-toggle { transform: rotate(0deg); }

/* 日志面板（点展开后显示） */
.topbar-log-wrap {
  display: none;
  border-top: 1px solid rgba(255,255,255,0.07);
  max-height: 220px;
  overflow-y: auto;
}
#progress-card:not(.collapsed) + .topbar-log-wrap {
  display: block;
}

/* ========== Container ========== */
.container {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

.card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin: 0 0 18px; font-weight: 700; letter-spacing: -0.3px; }
.card h2 { font-size: 23px; }
.card h3 { font-size: 18px; color: #e8e8e8; }
.card p { color: var(--text-dim); font-size: 14.5px; line-height: 1.65; }

.glass { background: var(--glass-bg); }

/* ========== 快捷游戏发现（随机推荐 + 最近搜索 + 迷你搜索栏）========== */
.quick-games {
  margin-bottom: 20px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quick-games-search {
  display: flex;
  gap: 8px;
}
.quick-games-search input {
  flex: 1;
  min-width: 0;
  padding: 7px 14px;
  font-size: 12.5px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: none;
  font-family: inherit;
  transition: var(--transition);
}
.quick-games-search input:focus { border-color: rgba(255,255,255,0.6); }
.quick-games-search .btn { flex: 0 0 auto; padding: 7px 16px; border-radius: 999px; }
.quick-games-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.quick-games-label {
  flex: 0 0 auto;
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
}
.quick-games-marquee {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent);
}
.quick-games-track {
  display: flex;
  gap: 8px;
  width: max-content;
  animation: quick-games-scroll 32s linear infinite;
}
.quick-games-marquee:hover .quick-games-track,
.quick-games-marquee:active .quick-games-track {
  animation-play-state: paused;
}
@keyframes quick-games-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.quick-games-chips {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.quick-games-chips::-webkit-scrollbar { display: none; }
.quick-game-chip {
  flex: 0 0 auto;
  padding: 5px 12px;
  font-size: 11.5px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  color: #e0e0e0;
}
.quick-game-chip:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}
.quick-game-chip.recent {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.20);
  color: #cccccc;
}
.quick-game-chip.recent:hover { background: rgba(255, 255, 255, 0.22); }

/* ========== 表单 ========== */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field > span {
  font-size: 13px;
  color: #c8c8c8;
  font-weight: 600;
}
.field input, .field select {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}
.field input:focus, .field select:focus {
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.35);
}
.field input::placeholder { color: var(--muted); }

/* ========== 分析参数：Tag 子模块切换 ========== */
.option-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.option-tab-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.option-tab-btn:hover {
  border-color: rgba(255, 255, 255, 0.50);
  color: var(--text);
}
.option-tab-btn.active {
  background: #ffffff;
  border-color: transparent;
  color: #000000;
  font-weight: 700;
  box-shadow: none;
}
.option-tab-panel {
  animation: option-tab-fade-in 0.2s ease;
}
@keyframes option-tab-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== API Keys 高级设置 ========== */
.api-keys {
  margin-top: 24px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  transition: var(--transition);
}
.api-keys[open] {
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.40);
}
.api-keys summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
  user-select: none;
}
.api-keys summary::-webkit-details-marker { display: none; }
.api-keys-title { font-weight: 600; color: #e8e8e8; font-size: 14px; }
.api-keys-hint { color: var(--muted); font-size: 12px; }
.api-keys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.api-keys-grid .field small {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 400;
  font-size: 11px;
}

.env-import {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.20);
  display: grid;
  gap: 10px;
}
.env-import-copy {
  display: grid;
  gap: 4px;
}
.env-import-copy strong {
  font-size: 13px;
  color: #e8e8e8;
}
.env-import-copy span,
.env-import-status {
  font-size: 12px;
  color: var(--muted);
}
.env-import-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ========== API Key 状态徽标 ========== */
.key-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: -2px;
  margin-bottom: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  width: fit-content;
  max-width: 100%;
  word-break: break-all;
}
.key-status .dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.key-status.loaded {
  background: rgba(123, 226, 160, 0.15);
  color: #7be2a0;
  border: 1px solid rgba(123, 226, 160, 0.4);
}
.key-status.loaded .dot { background: #7be2a0; box-shadow: 0 0 6px #7be2a0; }
.key-status.missing {
  background: rgba(255, 134, 134, 0.12);
  color: #ffb3b3;
  border: 1px solid rgba(255, 134, 134, 0.35);
}
.key-status.missing .dot { background: #ffb3b3; }

.actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  color: var(--text);
  min-height: 44px;
}
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; min-height: 36px; }
.btn-primary {
  background: #ffffff;
  color: #000000;
  border-color: transparent;
  box-shadow: none;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(255,255,255,0.20); background: #eeeeee; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-primary:active { transform: translateY(0); box-shadow: none; background: #d8d8d8; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }
.btn-ghost:active { background: rgba(255, 255, 255, 0.05); }

/* ========== Spinner ========== */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 进度 ========== */
@keyframes shift { to { background-position: -200% 0; } }

/* 计时器行（追加到进度条内部） */
.progress-timer-wrap {
  padding: 0 14px 6px;
}
.progress-timer {
  font-size: 11px;
  color: #888;
  font-variant-numeric: tabular-nums;
}

.progress-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: rgba(180, 180, 180, 0.5);
  line-height: 1.5;
}
.log {
  list-style: none;
  margin: 0;
  padding: 10px 14px;
  font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", "Fira Code", Consolas, monospace;
  font-size: 12px;
}
.log li {
  padding: 2px 0;
  color: var(--text-dim);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.log li.success { color: #7be2a0; }
.log li.error { color: #ff8585; }

/* ========== 摘要卡片 ========== */
.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.summary-card { text-align: center; padding: 24px; margin: 0; }
.summary-num {
  font-size: 36px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
}
.summary-label { margin-top: 6px; font-size: 14px; color: var(--text-dim); }

/* ========== 图表 ========== */
.chart {
  width: 100%;
  height: 360px;
}

/* ========== 自定义时间范围 ========== */
.custom-range { margin-top: -8px; margin-bottom: 4px; }
.custom-range.hidden { display: none; }
.muted-field {
  opacity: 0.45;
}
.muted-field span {
  color: var(--muted);
}

/* ========== 整体口碑占比卡片 ========== */
.sentiment-summary-body {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.chart-donut { flex: 0 0 260px; height: 260px; min-width: 220px; }
#market-perception-card {
  margin-bottom: 18px;
}
.market-perception-layout {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: stretch;
}
.market-perception-layout.recent-only .market-perception-side {
  flex: 1 1 100%;
  min-width: 0;
}
.market-perception-main {
  flex: 1 1 420px;
  min-width: 280px;
}
.market-perception-overall {
  margin: 6px 0 14px;
  line-height: 1.65;
  color: #d8d8d8;
  font-size: 15px;
  font-weight: 600;
}
.market-perception-cols {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.market-perception-col {
  flex: 1 1 200px;
  min-width: 200px;
}
.market-perception-col h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-dim);
}
.market-perception-col ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.market-perception-col li {
  position: relative;
  padding-left: 18px;
  line-height: 1.6;
  font-size: 14px;
  color: var(--text-dim);
  word-break: break-word;
}
.market-perception-col li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.market-perception-col.positive li::before { background: #4ade80; }
.market-perception-col.negative li::before { background: #f87171; }
.market-perception-col li.empty {
  color: rgba(180, 180, 180, 0.5);
  font-style: italic;
}
.market-perception-col li.empty::before { background: rgba(180, 180, 180, 0.4); }
.market-perception-side {
  flex: 0 0 260px;
  min-width: 220px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 12px;
  padding: 14px 16px;
}
.market-perception-side h4 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text-dim);
}
#recent-reputation-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#recent-reputation-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}
.rr-label {
  color: var(--text-dim);
  font-weight: 600;
}
.rr-ratio {
  font-size: 14px;
  font-weight: 700;
}
.rr-ratio.good {
  color: #6ee7a0;
}
.rr-ratio.bad {
  color: #f47174;
}
.rr-ratio.mixed {
  color: #e0c46c;
}
.rr-count {
  font-size: 12px;
  color: rgba(180, 180, 180, 0.65);
}
.rr-empty {
  font-size: 12px;
  font-style: italic;
  color: rgba(180, 180, 180, 0.5);
}
.recent-reputation-hint {
  margin: 10px 0 0;
  font-size: 11px;
  color: rgba(180, 180, 180, 0.5);
}
.market-perception-region {
  margin-top: 18px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.market-perception-region h4 {
  margin: 0;
  font-size: 14px;
  color: var(--text-dim);
}
.region-overview-row {
  display: flex;
  gap: 20px;
  align-items: stretch;
  flex-wrap: wrap;
}
.region-bars-block {
  flex: 1 1 320px;
  min-width: 260px;
}
.region-online-stat {
  flex: 0 0 240px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  padding: 14px 16px;
  background: rgba(200, 200, 200, 0.1);
  border: 1px solid rgba(200, 200, 200, 0.25);
  border-radius: 10px;
}
.region-online-label {
  font-size: 12px;
  color: var(--text-dim);
}
.region-online-value {
  font-size: 24px;
  font-weight: 700;
  color: #6ee7a0;
  line-height: 1.2;
}
.region-online-hint {
  font-size: 11px;
  color: rgba(180, 180, 180, 0.5);
  line-height: 1.5;
}
.region-curve-block {
  width: 100%;
}
.region-curve-block h5 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-dim);
}
.region-curve-body {
  width: 100%;
}
.region-activity-chart {
  width: 100%;
  height: 280px;
}
.region-curve-empty {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  font-size: 12px;
  line-height: 1.7;
  color: rgba(180, 180, 180, 0.55);
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 10px;
}
.region-ai-insight {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 10px;
}
.region-ai-insight h5 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #ddd;
}
.region-ai-summary {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.7;
  color: #d4d4d4;
}
.region-country-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.region-country-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
}
.region-country-name {
  font-weight: 700;
  color: #e0e0e0;
}
.region-country-ratio {
  font-weight: 600;
  color: rgba(180, 180, 180, 0.85);
}
.region-country-note {
  flex-basis: 100%;
  font-size: 11px;
  color: rgba(180, 180, 180, 0.55);
}
.region-ai-hint {
  margin: 0;
  font-size: 11px;
  color: rgba(180, 180, 180, 0.45);
  line-height: 1.5;
}
.region-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.region-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.region-bar-label {
  flex: 0 0 44px;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
}
.region-bar-track {
  flex: 1;
  height: 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.20);
  overflow: hidden;
}
.region-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.3s ease;
}
.region-bar-value {
  flex: 0 0 44px;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  color: rgba(180, 180, 180, 0.85);
}
.region-lang-block,
.region-lang-block-hist {
  width: 100%;
}
.region-lang-block h5,
.region-lang-block-hist h5 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: #ccc;
}

/* 语言分布 + 气泡图并排 */
.lang-persona-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.lang-persona-row .region-lang-bars {
  flex: 1 1 200px;
  min-width: 140px;
}

/* 玩家画像气泡图 */
.persona-bubble-chart {
  flex: 0 0 260px;
  min-width: 200px;
}
.persona-bubble-chart.hidden { display: none; }
.persona-bubble-title {
  font-size: 12px;
  font-weight: 700;
  color: #aaa;
  margin-bottom: 4px;
  letter-spacing: .03em;
}
.persona-bubble-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-bottom: 6px;
}
.persona-bubble-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #888;
}
.persona-bubble-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.persona-bubble-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
}

.region-lang-bars {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
/* 简中行高亮 */
.lang-bar-highlight .region-bar-label {
  color: #ffffff;
  font-weight: 700;
}
.lang-bar-highlight .region-bar-value {
  color: #ffffff;
}
/* 语言条标签宽度比区域条更宽 */
.region-lang-bars .region-bar-label {
  flex: 0 0 100px;
  font-size: 12px;
}
.region-analysis-conclusion {
  margin: 12px 0 0;
  font-size: 14px;
  color: #ccc;
  line-height: 1.65;
}
.region-analysis-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: rgba(200, 200, 200, 0.45);
  line-height: 1.55;
}
/* ========== 玩家画像标签 ========== */
.persona-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 4px;
}
.persona-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.07);
  color: #e8e8e8;
  transition: background 0.15s;
}
.persona-tag:hover {
  background: rgba(255, 255, 255, 0.14);
}
.persona-tag-type {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.65);
  text-transform: uppercase;
}
/* Type-specific accent borders */
.persona-tag--demographic { border-color: rgba(255, 255, 255, 0.35); }
.persona-tag--behavior    { border-color: rgba(200, 200, 200, 0.30); }
.persona-tag--preference  { border-color: rgba(180, 180, 180, 0.28); }
.persona-tag--platform    { border-color: rgba(160, 160, 160, 0.25); }
.persona-tag--social      { border-color: rgba(200, 200, 200, 0.28); }

/* ── AI 分析深度选择器 ─────────────────────────────────────── */
.ai-modules-field {
  margin-top: 14px;
}

.analysis-tier-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.analysis-tier-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 18px 7px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
  min-width: 88px;
  text-align: center;
}

.analysis-tier-chip input[type="radio"] {
  display: none;
}

.analysis-tier-chip .tier-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  transition: color 0.15s;
  line-height: 1.3;
}

.analysis-tier-chip .tier-desc {
  font-size: 11px;
  color: var(--muted);
  transition: color 0.15s;
  line-height: 1.2;
}

.analysis-tier-chip:hover .tier-name { color: var(--text); }
.analysis-tier-chip:hover .tier-desc { color: var(--text-dim); }
.analysis-tier-chip:hover { border-color: rgba(255, 255, 255, 0.30); background: rgba(255, 255, 255, 0.07); }

.analysis-tier-chip:has(input:checked) {
  border-color: rgba(255, 255, 255, 0.50);
  background: rgba(255, 255, 255, 0.11);
}
.analysis-tier-chip:has(input:checked) .tier-name { color: #f0f0f0; }
.analysis-tier-chip:has(input:checked) .tier-desc { color: #b0b0b0; }

/* 历史记录档位徽标 */
.history-tier-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.10);
  color: #c8c8c8;
  border: 1px solid rgba(255, 255, 255, 0.18);
  margin-right: 4px;
}

.sentiment-summary-text {
  flex: 1;
  min-width: 240px;
}
.sentiment-summary-text p {
  margin: 0 0 14px;
  line-height: 1.7;
  color: var(--text-dim);
  font-size: 15px;
}
.sentiment-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-dim);
}
.legend-item b { color: #f3f4ff; font-size: 16px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot-positive { background: #aaaaaa; }
.dot-negative { background: #888888; }

/* ========== 表格 ========== */
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.card-head h3 { margin: 0; }
.card-head small { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.head-actions input[type="search"] {
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  min-width: 200px;
}
.head-actions input[type="search"]:focus { border-color: var(--primary); }

.table-wrap { overflow-x: auto; }
.review-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.review-table th, .review-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.review-table th {
  color: var(--text-dim);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.2);
  position: sticky; top: 0;
}
.review-table tr:hover td { background: rgba(255, 255, 255, 0.03); }
.review-table .col-num { width: 50px; color: var(--muted); }
.review-table .col-author { width: 140px; }
.review-table .col-category { width: 180px; }
.review-table .col-keyword { width: 220px; }
.cat-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #e8e8e8;
  border: 1px solid rgba(255, 255, 255, 0.30);
  font-size: 12px;
  margin: 2px 4px 2px 0;
}
.kw-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.10);
  color: #e0e0e0;
  font-size: 12px;
  margin: 2px 4px 2px 0;
}
.review-text {
  max-width: 480px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.hint {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.7;
  margin: 4px 0 0;
}

/* ========== 顶部 Tab 导航 ========== */
.tabs-nav {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 10px;
  position: relative;
  z-index: 1;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs-nav::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 10px 22px;
  border-radius: 14px 14px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.30);
  border-bottom: none;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  flex: 0 0 auto;
  white-space: nowrap;
}
.tab-btn:hover {
  color: #f3f4ff;
  background: rgba(255, 255, 255, 0.18);
}
.tab-btn.active {
  color: #f3f4ff;
  background: rgba(255, 255, 255, 0.32);
  box-shadow: 0 -2px 16px rgba(255, 255, 255, 0.25);
}
.tab-page.hidden { display: none; }

/* ========== 热门游戏页 ========== */
.popular-search-bar {
  display: flex;
  gap: 10px;
  margin: 14px 0;
}
.popular-search-bar input {
  flex: 1;
}

/* 搜索栏左侧：筛选本次搜索范围（全部 / 游戏本体 / DLC）的下拉框 */
.search-kind-select {
  flex: 0 0 auto;
  align-self: stretch;
  padding: 0 10px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}
.search-kind-select:focus { border-color: var(--primary); }
.search-kind-select option { color: #1a1230; }
.popular-search-bar .search-kind-select { border-radius: 12px; }
.popular-game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 10px;
}
.popular-empty {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 18px 0;
}
.popular-section {
  margin-top: 22px;
}
.popular-section h3 {
  margin: 0 0 12px;
  font-size: 17px;
}
.game-card {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.22);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.game-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.50);
  box-shadow: 0 10px 28px rgba(255, 255, 255, 0.25);
}
.game-card .game-thumb {
  width: 100%;
  height: 100px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.25);
  display: block;
}
.game-card .game-info {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.game-card .game-name {
  font-size: 14px;
  font-weight: 600;
  color: #f3f4ff;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.game-card .game-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
}
.game-card .game-appid {
  font-family: "SFMono-Regular", Consolas, monospace;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 2px 8px;
}
.game-kind-badge {
  display: inline-block;
  padding: 1px 7px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #d0d0d0;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
}
.game-card .game-price {
  color: #e0e0e0;
}
.game-card .game-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}
.game-card .game-actions .btn {
  font-size: 12px;
  padding: 6px 8px;
  min-height: 32px;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  box-sizing: border-box;
}
.game-card .game-actions a.btn:visited {
  color: var(--text);
}

/* ========== 货币切换 ========== */
.topbar-currency {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.topbar-currency-label {
  font-size: 16px;
}
.topbar-currency select {
  background: #1e1f2e;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #b8b8b8;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
  max-width: 140px;
}
.topbar-currency select option {
  background: #1e1f2e;
  color: #b8b8b8;
}
.topbar-currency select:hover {
  border-color: rgba(255, 255, 255, 0.50);
}

/* ========== 完整榜单：分类标签 / 控件 / 分页 / 列表视图 ========== */
.popular-ext-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.popular-ext-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.popular-ext-tab {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.popular-ext-tab:hover {
  border-color: rgba(255, 255, 255, 0.50);
  color: var(--text);
}
.popular-ext-tab.active {
  background: #ffffff;
  border-color: transparent;
  color: #000000;
  font-weight: 600;
}
.popular-ext-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.popular-ext-control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
}
.popular-ext-control select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: var(--text);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 13px;
  cursor: pointer;
}
.popular-ext-view-toggle {
  display: flex;
  gap: 6px;
}
.popular-ext-view-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.popular-ext-view-btn:hover {
  border-color: rgba(255, 255, 255, 0.50);
  color: var(--text);
}
.popular-ext-view-btn.active {
  background: #ffffff;
  border-color: transparent;
  color: #000000;
  font-weight: 600;
}
.popular-ext-loading {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 24px 0;
  grid-column: 1 / -1;
}
.popular-ext-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-dim);
}
.popular-ext-pagination .btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 列表视图 */
.popular-game-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.game-list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.20);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.game-list-row:hover {
  border-color: rgba(255, 255, 255, 0.50);
  background: rgba(255, 255, 255, 0.22);
}
.game-list-thumb {
  width: 96px;
  height: 45px;
  object-fit: cover;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  flex: 0 0 auto;
}
.game-list-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.game-list-name {
  font-size: 14px;
  font-weight: 600;
  color: #f3f4ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-list-appid {
  font-size: 11px;
  font-family: "SFMono-Regular", Consolas, monospace;
  color: var(--text-dim);
}
.game-list-row .game-price {
  flex: 0 0 auto;
  font-size: 13px;
  color: #e0e0e0;
  white-space: nowrap;
}
.game-list-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}
.game-list-actions .btn {
  font-size: 12px;
  padding: 6px 10px;
  white-space: nowrap;
}

/* ========== 历史分析 Tab ========== */
.history-badge {
  display: inline-block;
  background: #ffffff;
  color: #000000;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  padding: 1px 5px;
  line-height: 16px;
  vertical-align: middle;
  margin-left: 4px;
}
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.history-card {
  display: flex;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.22);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}
.history-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.50);
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.20);
}
.history-card-poster {
  width: 100px;
  height: auto;
  object-fit: cover;
  flex: 0 0 auto;
  background: rgba(0, 0, 0, 0.3);
}
.history-card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
}
.history-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #f3f4ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
}
.history-card-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.history-mode-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.20);
  border: 1px solid rgba(255, 255, 255, 0.40);
  color: #d0d0d0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  white-space: nowrap;
}
.history-provider-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-dim);
  border-radius: 999px;
  font-size: 11px;
  padding: 2px 9px;
  white-space: nowrap;
}
.history-card-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 80, 80, 0.3);
  color: rgba(255, 100, 100, 0.8);
  border-radius: 999px;
  width: 22px;
  height: 22px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.history-card:hover .history-card-delete {
  opacity: 1;
}

/* ========== 游戏详情弹窗 ========== */
.game-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px env(safe-area-inset-bottom, 0);
  overflow-y: auto;
}
.game-detail-modal {
  position: relative;
  background: linear-gradient(160deg, #111111 0%, #1a1a1a 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 20px;
  width: 100%;
  max-width: 640px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: modal-in 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.game-detail-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-dim);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  font-size: 14px;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.game-detail-close:hover { background: rgba(255, 80, 80, 0.25); color: #fff; }
.game-detail-hero {
  display: flex;
  gap: 0;
  position: relative;
}
.game-detail-poster {
  width: 240px;
  height: 112px;
  object-fit: cover;
  display: block;
  flex: 0 0 auto;
}
.game-detail-hero-info {
  flex: 1 1 auto;
  padding: 14px 50px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.2);
}
.game-detail-name {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
  color: #f3f4ff;
}
.game-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.game-detail-badge {
  background: rgba(255, 255, 255, 0.20);
  border: 1px solid rgba(255, 255, 255, 0.38);
  color: #d0d0d0;
  border-radius: 999px;
  font-size: 11px;
  padding: 2px 9px;
}
.game-detail-price-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.game-detail-price {
  color: #e0e0e0;
  font-size: 16px;
  font-weight: 700;
}
.game-detail-original-price {
  font-size: 12px;
  color: var(--muted);
  text-decoration: line-through;
}
.game-detail-discount {
  background: #16a34a;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 6px;
}
.game-detail-body {
  padding: 18px 20px 20px;
}
.game-detail-desc {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-dim);
  margin: 0 0 16px;
}
.game-detail-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  margin-bottom: 16px;
}
.game-detail-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.game-detail-meta-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.game-detail-meta-value {
  font-size: 13px;
  color: var(--text);
}
.game-detail-screenshots {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
  padding-bottom: 4px;
}
.game-detail-screenshot {
  height: 80px;
  width: auto;
  border-radius: 8px;
  flex: 0 0 auto;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.3);
}
.game-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.game-detail-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(10, 10, 10, 0.85);
  font-size: 14px;
  color: var(--text-dim);
  border-radius: 20px;
  z-index: 3;
}

/* 历史详情弹窗扩展 */
.history-detail-modal {
  max-width: 860px;
  max-height: 90dvh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
.history-detail-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 20px 24px 0;
  flex-shrink: 0;
}
.history-detail-poster {
  width: 184px;
  height: 86px;
  object-fit: cover;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  flex: 0 0 auto;
}
/* History detail report cards */
#history-detail-body {
  padding: 0 24px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
#history-detail-body .card {
  margin: 0;
  padding: 18px 20px;
}
#history-detail-body .card h3 {
  margin: 0 0 12px;
  font-size: 16px;
}
.history-reanalyze-corner-btn {
  position: absolute;
  top: 12px;
  right: 54px; /* 14px gap + 32px close btn + 8px gap */
  z-index: 3;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.40);
  color: #b8b8b8;
  border-radius: 999px;
  height: 32px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}
.history-reanalyze-corner-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  color: #fff;
}

/* ========== Footer ========== */
.footer {
  text-align: center;
  padding: 30px 20px;
  color: var(--muted);
  font-size: 13px;
  position: relative;
  z-index: 1;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 20, 0.97);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  z-index: 100;
  animation: toast-in 0.3s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes toast-in-mobile {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
  .quick-games {
    padding: 8px 10px;
    gap: 6px;
  }
  .quick-games-row {
    gap: 6px;
  }
  .quick-games-label {
    font-size: 11px;
  }
  .quick-game-chip {
    font-size: 11px;
    padding: 4px 10px;
  }
  .topbar-inner {
    padding: 8px 14px;
    gap: 10px;
  }
  .topbar-logo {
    font-size: 20px;
  }
  .topbar-title {
    font-size: 15px;
  }
  .topbar-progress {
    gap: 8px;
  }
  .topbar-progress-text {
    display: none;
  }
  .container {
    padding: 0 14px 40px;
  }
  .tabs-nav {
    padding: 0 14px;
    gap: 8px;
  }
  .tab-btn {
    padding: 10px 14px;
    font-size: 14px;
    border-radius: 12px 12px 0 0;
  }
  .card {
    padding: 18px 16px;
    border-radius: 14px;
    margin-bottom: 16px;
  }
  h1 { font-size: 28px; }
  .grid-2,
  .api-keys-grid,
  .summary {
    grid-template-columns: 1fr;
  }
  .summary {
    gap: 12px;
  }
  .summary-card {
    padding: 18px 16px;
  }
  .summary-num {
    font-size: 30px;
  }
  .field input,
  .field select,
  .head-actions input[type="search"],
  .popular-search-bar input,
  .popular-search-bar button,
  .btn {
    font-size: 16px;
  }
  .actions {
    flex-direction: column;
  }
  .actions .btn {
    width: 100%;
  }
  .api-keys {
    padding: 12px;
  }
  .api-keys summary {
    gap: 6px;
  }
  .env-import-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .env-import-actions .btn {
    width: 100%;
  }
  .chart {
    height: 250px;
  }
  .chart-donut {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    height: 220px;
  }
  .sentiment-summary-body,
  .market-perception-layout,
  .market-perception-cols,
  .popular-search-bar {
    flex-direction: column;
  }
  .market-perception-main,
  .market-perception-col,
  .market-perception-side,
  .sentiment-summary-text {
    min-width: 0;
    flex-basis: auto;
    width: 100%;
  }
  .market-perception-side {
    padding: 12px 14px;
  }
  .market-perception-region {
    padding: 12px 14px;
  }
  .region-overview-row {
    flex-direction: column;
  }
  .region-bars-block,
  .region-online-stat,
  .region-curve-block {
    flex-basis: auto;
    min-width: 0;
    width: 100%;
  }
  .region-activity-chart {
    height: 220px;
  }
  .region-bar-label,
  .region-bar-value {
    flex-basis: 38px;
  }
  .card-head {
    align-items: stretch;
  }
  .head-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .head-actions input[type="search"] {
    min-width: 0;
    width: 100%;
    padding: 10px 12px;
  }
  .head-actions .btn {
    width: 100%;
  }
  .popular-game-grid {
    grid-template-columns: 1fr;
  }
  .game-card .game-meta {
    flex-direction: column;
    align-items: stretch;
  }
  .game-card .game-actions {
    grid-template-columns: 1fr 1fr;
  }
  .game-card .game-actions .btn {
    width: 100%;
    font-size: 11px;
    padding: 6px 4px;
  }
  .review-text { max-width: 100%; }
  /* 历史分析 + 游戏详情弹窗：移动端 */
  .history-grid {
    grid-template-columns: 1fr;
  }
  .history-card-poster {
    width: 80px;
  }
  .game-detail-overlay {
    padding: 12px 0 0;
    align-items: flex-end;
  }
  .game-detail-modal {
    border-radius: 20px 20px 0 0;
    max-width: 100%;
    max-height: 92dvh;
    overflow-y: auto;
  }
  .game-detail-hero {
    flex-direction: column;
  }
  .game-detail-poster {
    width: 100%;
    height: 160px;
  }
  .game-detail-hero-info {
    padding: 12px 48px 12px 14px;
  }
  .game-detail-meta-grid {
    grid-template-columns: 1fr;
  }
  .history-detail-modal {
    border-radius: 20px 20px 0 0;
    max-height: 92dvh;
    overflow-y: auto;
  }
  .history-detail-head {
    padding: 16px 16px 0;
    gap: 12px;
  }
  .history-detail-poster {
    width: 120px;
    height: 56px;
  }
  #history-detail-body {
    padding: 0 16px 6px;
    gap: 10px;
  }
  #history-detail-body .card {
    padding: 14px 16px;
  }
  .history-reanalyze-corner-btn {
    right: 52px;
    width: 32px;
    padding: 0;
    justify-content: center;
  }
  .reanalyze-label {
    display: none;
  }
  .market-perception-layout {
    flex-direction: column;
  }
  .market-perception-side {
    flex: 1 1 auto;
    min-width: 0;
  }
  .footer {
    padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0));
  }
  .toast {
    left: 14px;
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0));
    transform: none;
    width: auto;
    border-radius: 16px;
    text-align: center;
    animation: toast-in-mobile 0.3s ease;
  }
}

/* ─── AI 预测 Tab ──────────────────────────────────────────── */
#predict-description {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  resize: vertical;
  line-height: 1.6;
}
#predict-description:focus { outline: none; border-color: rgba(255,255,255,0.4); }

.predict-upload-area {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.predict-upload-hint { font-size: 13px; color: var(--muted); flex: 1; }
.predict-file-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.08); border-radius: 6px;
  padding: 4px 9px; font-size: 12px; margin: 3px 4px 3px 0;
}
.predict-file-chip.chip-error { background: rgba(244,67,54,0.15); border: 1px solid rgba(244,67,54,0.4); }

/* Quota bar */
.predict-quota-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0 6px; margin-bottom: 4px;
}
.predict-quota-label { font-size: 13px; white-space: nowrap; min-width: 180px; }
.predict-quota-track {
  flex: 1; height: 6px; background: rgba(255,255,255,0.1);
  border-radius: 3px; overflow: hidden;
}
.predict-quota-fill { height: 100%; border-radius: 3px; transition: width 0.3s, background 0.3s; }

/* Form header row */
.predict-form-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px; margin-bottom: 10px;
}
.predict-form-header h3 { margin: 0; font-size: 15px; }
.predict-form-actions { display: flex; gap: 8px; }

/* Char counter */
.predict-char-counter-row {
  display: flex; align-items: center; gap: 8px; margin-top: 5px;
}
.predict-char-counter { font-size: 12px; color: var(--muted); white-space: nowrap; }
.predict-char-track {
  flex: 1; height: 4px; background: rgba(255,255,255,0.1);
  border-radius: 2px; overflow: hidden;
}
.predict-char-bar { height: 100%; width: 0; border-radius: 2px; background: #5b8cdd; transition: width 0.15s, background 0.15s; }

/* Upload zones */
.predict-upload-sections { display: flex; flex-direction: column; gap: 12px; margin: 10px 0; }
.predict-upload-zone {
  border: 1px dashed rgba(255,255,255,0.18); border-radius: 10px;
  padding: 12px 14px; background: rgba(255,255,255,0.03);
}
.predict-zone-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap;
}
.predict-zone-label { font-size: 13px; font-weight: 600; }
.predict-zone-accept { font-size: 11px; color: var(--muted); flex: 1; }
.predict-zone-badge {
  font-size: 11px; background: rgba(255,152,0,0.2); color: #ffb74d;
  border-radius: 4px; padding: 1px 6px; border: 1px solid rgba(255,152,0,0.3);
}
.predict-zone-btn {
  font-size: 12px; padding: 4px 11px; border-radius: 6px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18);
  color: var(--text); cursor: pointer; transition: background 0.15s;
}
.predict-zone-btn:hover { background: rgba(255,255,255,0.14); }
.predict-zone-list { display: flex; flex-wrap: wrap; gap: 4px; min-height: 0; }

/* Total size bar */
.predict-size-row {
  display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; font-size: 13px;
}
.predict-size-track {
  flex: 1; height: 5px; background: rgba(255,255,255,0.1);
  border-radius: 3px; overflow: hidden;
}
.predict-size-fill { height: 100%; width: 0; border-radius: 3px; background: #5b8cdd; transition: width 0.2s, background 0.2s; }
.predict-size-warn { font-size: 12px; color: #f44336; font-weight: 600; }

/* Errors panel */
.predict-errors {
  background: rgba(244,67,54,0.1); border: 1px solid rgba(244,67,54,0.3);
  border-radius: 8px; padding: 8px 12px; margin: 8px 0;
}
.predict-error-item { font-size: 13px; color: #ef9a9a; padding: 2px 0; }

/* Audience grid */
.predict-audience-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 12px;
}
@media (max-width: 600px) { .predict-audience-grid { grid-template-columns: 1fr; } }

/* Scores */
.predict-scores-layout { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.predict-scores-layout > div:first-child { flex: 0 0 220px; }
.predict-scores-layout > div:last-child  { flex: 1 1 260px; }
.predict-score-row {
  display: grid; grid-template-columns: 80px 1fr 36px; gap: 4px 8px;
  align-items: center; margin-bottom: 8px;
}
.predict-score-label { font-size: 13px; font-weight: 600; }
.predict-score-bar-wrap { background: rgba(255,255,255,0.1); border-radius: 4px; height: 8px; overflow: hidden; }
.predict-score-bar { height: 100%; border-radius: 4px; transition: width 0.4s; }
.predict-score-num  { font-size: 14px; font-weight: 700; text-align: right; }
.predict-score-comment { grid-column: 1 / -1; font-size: 12px; color: var(--muted); padding-left: 2px; }

/* Competitor cards */
.predict-competitor-card {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.predict-competitor-card:last-child { border-bottom: none; }
.predict-competitor-rank { font-size: 18px; font-weight: 700; color: var(--muted); min-width: 28px; line-height: 1.3; }
.predict-competitor-name { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.predict-competitor-meta { margin-bottom: 3px; }
.predict-competitor-badge {
  font-size: 11px; background: rgba(91,140,221,0.2); color: #90b8f8;
  border-radius: 4px; padding: 1px 6px; border: 1px solid rgba(91,140,221,0.3);
}
.predict-competitor-perf { font-size: 13px; margin-bottom: 3px; }
.predict-competitor-sim  { font-size: 12px; }

/* Sales */
.predict-sales-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 600px) { .predict-sales-row { grid-template-columns: 1fr; } }
#predict-sales-summary { font-size: 14px; margin-bottom: 10px; color: var(--muted); }

/* Preview modal */
.predict-preview-modal {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.predict-preview-inner {
  background: var(--card-bg, #1e2640); border-radius: 14px;
  padding: 22px 24px; max-width: 560px; width: 100%;
  max-height: 80vh; overflow-y: auto;
  box-shadow: 0 12px 48px rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.1);
}
.predict-preview-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.predict-preview-header h3 { margin: 0; font-size: 15px; }
.predict-preview-close {
  background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1;
}
.predict-preview-close:hover { color: var(--text); }

/* AI 诊断提示条：AI 未运行/失败/部分失败时显式告知用户原因，不再静默跳模板 */
.ai-diag-banner {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.6;
  border: 1px solid transparent;
}
.ai-diag-banner.ai-diag-error {
  color: #ffd2d2;
  background: rgba(255, 92, 122, 0.12);
  border-color: rgba(255, 92, 122, 0.45);
}
.ai-diag-banner.ai-diag-warn {
  color: #ffe2b0;
  background: rgba(255, 159, 67, 0.12);
  border-color: rgba(255, 159, 67, 0.45);
}
