/* ==========================================================================
   币圈人生模拟器 v3.0.0 — 曜金黑曜石终端 × 鲑粉羊皮研报 高定视觉样式系统
   Design Standard: Buy-Side Financial Terminal × Heirloom Numismatic Art
   ========================================================================== */

:root {
  --bg-root: #07090e;
  --bg-card: #0e121b;
  --bg-elevated: #141a26;
  --bg-subtle: #1b2334;
  --border-line: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --specular-top: rgba(255, 255, 255, 0.065);
  --card-shadow: 0 12px 30px -14px rgba(0, 0, 0, 0.72), inset 0 1px 0 var(--specular-top);
  --text-primary: #eef2f8;
  --text-secondary: #9aa6ba;
  --text-muted: #667389;
  --accent-gold: #f59e0b;
  --accent-gold-strong: #fbbf24;
  --accent-gold-bg: rgba(245, 158, 11, 0.13);
  --accent-gold-border: rgba(245, 158, 11, 0.36);
  --accent-blue: #38bdf8;
  --accent-blue-bg: rgba(56, 189, 248, 0.12);
  --up-color: #10b981;
  --up-bg: rgba(16, 185, 129, 0.12);
  --down-color: #ef4444;
  --down-bg: rgba(239, 68, 68, 0.12);
  --warn-color: #f97316;
  --warn-bg: rgba(249, 115, 22, 0.13);
  --ur-color: #fbbf24;
  --ssr-color: #f43f5e;
  --sr-color: #a855f7;
  --r-color: #38bdf8;
  --n-color: #94a3b8;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="light"] {
  --bg-root: #f5f1e8;
  --bg-card: #fffefc;
  --bg-elevated: #f8f5ee;
  --bg-subtle: #ede7dc;
  --border-line: rgba(22, 27, 38, 0.1);
  --border-strong: rgba(22, 27, 38, 0.2);
  --specular-top: rgba(255, 255, 255, 0.9);
  --card-shadow: 0 6px 20px -10px rgba(28, 25, 20, 0.12), inset 0 1px 0 var(--specular-top);
  --text-primary: #151922;
  --text-secondary: #485264;
  --text-muted: #768094;
  --accent-gold: #9a580e;
  --accent-gold-strong: #b45309;
  --accent-gold-bg: rgba(180, 83, 9, 0.09);
  --accent-gold-border: rgba(154, 88, 14, 0.32);
  --accent-blue: #0369a1;
  --accent-blue-bg: rgba(3, 105, 161, 0.09);
  --up-color: #059669;
  --up-bg: rgba(5, 150, 105, 0.1);
  --down-color: #dc2626;
  --down-bg: rgba(220, 38, 38, 0.1);
  --warn-color: #c2410c;
  --warn-bg: rgba(194, 65, 12, 0.1);
  --ur-color: #b45309;
  --ssr-color: #be123c;
  --sr-color: #7e22ce;
  --r-color: #0369a1;
  --n-color: #475569;
}

[data-color-scheme="cn"] {
  --up-color: #ef4444;
  --up-bg: rgba(239, 68, 68, 0.12);
  --down-color: #10b981;
  --down-bg: rgba(16, 185, 129, 0.12);
}

[data-theme="light"][data-color-scheme="cn"] {
  --up-color: #dc2626;
  --up-bg: rgba(220, 38, 38, 0.1);
  --down-color: #059669;
  --down-bg: rgba(5, 150, 105, 0.1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-root);
  background-image:
    radial-gradient(ellipse 80% 45% at 50% -8%, rgba(245, 158, 11, 0.07), transparent 65%),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(to right, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 100% 100%, 28px 28px, 28px 28px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.56;
  min-height: 100dvh;
  overflow-x: hidden;
  scroll-padding-bottom: calc(92px + var(--safe-bottom));
  -webkit-font-smoothing: antialiased;
}

[data-theme="light"] body,
html[data-theme="light"] {
  background-image:
    radial-gradient(ellipse 80% 40% at 50% -10%, rgba(180, 83, 9, 0.06), transparent 65%),
    linear-gradient(to bottom, rgba(20, 24, 33, 0.022) 1px, transparent 1px),
    linear-gradient(to right, rgba(20, 24, 33, 0.022) 1px, transparent 1px);
}

.num, .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ==================== App Shell ==================== */
.app-shell {
  width: 100%;
  max-width: 560px;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
}

@media (min-width: 960px) {
  .app-shell {
    max-width: 860px;
    border-left: 1px solid var(--border-line);
    border-right: 1px solid var(--border-line);
    background: color-mix(in srgb, var(--bg-root) 92%, transparent);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.35);
  }
}

/* ==================== Top Sticky Precision Header ==================== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: calc(8px + var(--safe-top)) 12px 8px;
  background: color-mix(in srgb, var(--bg-root) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--accent-gold-bg), transparent);
  border: 1px solid var(--accent-gold-border);
  color: var(--accent-gold);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.brand-text-wrap {
  min-width: 0;
}

.brand-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.chip-btn {
  appearance: none;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-sm);
  padding: 4px 7px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  min-height: 29px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
  gap: 4px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.chip-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.chip-btn:active {
  transform: scale(0.97);
}

/* ==================== Main Stage & Bottom Nav ==================== */
.main-stage {
  flex: 1;
  padding: 12px 13px calc(94px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 560px;
  z-index: 50;
  background: color-mix(in srgb, var(--bg-card) 93%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-line);
  padding: 5px 8px calc(6px + var(--safe-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

@media (min-width: 960px) {
  .bottom-nav {
    max-width: 860px;
  }
}

.nav-item {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 5px 4px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-item.active {
  color: var(--accent-gold);
  background: var(--accent-gold-bg);
  border-color: var(--accent-gold-border);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 800;
}

.nav-counter-pill {
  padding: 0 5px;
  border-radius: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
}

.nav-item.active .nav-counter-pill {
  background: transparent;
  border-color: transparent;
}

.nav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ==================== Machined Cards & Hero Prologue ==================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--card-shadow);
}

.card-elevated {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
}

.hero-prologue {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 18%, rgba(245, 158, 11, 0.16), transparent 48%),
    radial-gradient(circle at 12% 85%, rgba(56, 189, 248, 0.09), transparent 45%),
    linear-gradient(165deg, color-mix(in srgb, var(--accent-gold) 8%, var(--bg-card)), var(--bg-card) 68%);
  border: 1px solid var(--accent-gold-border);
  border-radius: var(--radius-lg);
  padding: 16px 15px;
  box-shadow: var(--card-shadow);
}

.hero-art-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.prologue-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-gold);
  background: var(--accent-gold-bg);
  border: 1px solid var(--accent-gold-border);
  padding: 3px 9px;
  border-radius: 5px;
}

.hero-astrolabe {
  width: 68px;
  height: 68px;
  flex-shrink: 0;
}

.prologue-lead {
  font-size: 19.5px;
  font-weight: 800;
  line-height: 1.4;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.prologue-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.62;
}

.hero-metrics-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-line);
}

.hero-metric-item {
  background: color-mix(in srgb, var(--bg-elevated) 78%, transparent);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-sm);
  padding: 7px 8px;
}

.hero-metric-label {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
}

.hero-metric-val {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}

/* ==================== Section Headers ==================== */
.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.sec-title {
  font-size: 14px;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.01em;
}

.sec-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ==================== Origin Character Cards with Medallions ==================== */
.origin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
}

@media (min-width: 660px) {
  .origin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.origin-card {
  appearance: none;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 12px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.1s ease;
}

.origin-card:hover {
  border-color: var(--border-strong);
}

.origin-card.selected {
  border-color: var(--accent-gold);
  background: linear-gradient(155deg, color-mix(in srgb, var(--accent-gold) 11%, var(--bg-elevated)), var(--bg-elevated) 70%);
  box-shadow: 0 0 0 1px var(--accent-gold-border);
}

.origin-head-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.origin-medallion {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--accent-gold);
}

.origin-card.selected .origin-medallion {
  border-color: var(--accent-gold);
  background: var(--accent-gold-bg);
}

.origin-title-col {
  flex: 1;
  min-width: 0;
}

.origin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.origin-name {
  font-weight: 800;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.origin-badge {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent-gold);
  background: var(--accent-gold-bg);
  border: 1px solid var(--accent-gold-border);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.origin-mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  color: var(--text-muted);
}

.origin-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

.origin-perk {
  font-size: 11.5px;
  color: var(--up-color);
  font-family: var(--font-mono);
  padding-top: 5px;
  border-top: 1px dashed var(--border-line);
}

/* ==================== Mode Selector & Buttons ==================== */
.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.mode-pill {
  appearance: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-sm);
  padding: 9px 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  font-family: var(--font-sans);
}

.mode-pill small {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  font-family: var(--font-mono);
}

.mode-pill.selected {
  border-color: var(--accent-gold);
  color: var(--text-primary);
  background: var(--accent-gold-bg);
}

.btn-primary {
  appearance: none;
  width: 100%;
  min-height: 48px;
  background: linear-gradient(180deg, var(--accent-gold-strong), var(--accent-gold));
  color: #0b0e14;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  padding: 12px 16px;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 18px -6px rgba(245, 158, 11, 0.45);
  transition: transform 0.08s ease, filter 0.15s ease;
}

[data-theme="light"] .btn-primary {
  color: #ffffff;
  background: linear-gradient(180deg, #b45309, #92400e);
}

.btn-primary:hover {
  filter: brightness(1.04);
}

.btn-primary:active {
  transform: scale(0.99);
}

.btn-secondary {
  appearance: none;
  min-height: 44px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 10px 12px;
  font-family: var(--font-sans);
}

.btn-secondary:hover {
  border-color: var(--accent-gold);
}

/* ==================== Career HUD + Minted Realm Progression ==================== */
.hud-card {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.hud-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.hud-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hud-nw-block {
  min-width: 0;
  flex: 1;
}

.hud-networth {
  font-size: 25px;
  font-weight: 900;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.hud-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
}

/* Minted Wealth Realm Emblem Pill */
.realm-badge-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, var(--accent-gold-bg), var(--bg-elevated));
  border: 1px solid var(--accent-gold-border);
  flex-shrink: 0;
}

.realm-crest-svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.realm-badge-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.realm-code {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 900;
  color: var(--accent-gold);
  line-height: 1.1;
}

.realm-name {
  font-size: 10.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Realm Ladder Progress Bar */
.realm-progress-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
}

.realm-progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-gold-strong));
  border-radius: 999px;
  transition: width 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-fill.realm-fill {
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-gold));
}

/* 5-Stat Precision Strip with Micro Progress Bars */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.stat-cell {
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-sm);
  padding: 5px 5px 6px;
  text-align: center;
}

.stat-name {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
}

.stat-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 800;
  display: block;
  margin: 1px 0 3px;
}

.stat-mini-bar {
  width: 100%;
  height: 3px;
  background: var(--bg-subtle);
  border-radius: 99px;
  overflow: hidden;
}

.stat-mini-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent-gold);
}

.stat-mini-fill.low {
  background: var(--down-color);
}

.stat-mini-fill.high {
  background: var(--up-color);
}

/* Streak / Hubris / Perk Pills Row */
.hud-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.hud-mini-tag {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
  color: var(--text-secondary);
}

.hud-mini-tag.gold {
  color: var(--accent-gold);
  border-color: var(--accent-gold-border);
  background: var(--accent-gold-bg);
}

.hud-mini-tag.warn {
  color: var(--warn-color);
  border-color: color-mix(in srgb, var(--warn-color) 40%, transparent);
  background: var(--warn-bg);
}

.hud-mini-tag.shield {
  color: var(--accent-blue);
  border-color: color-mix(in srgb, var(--accent-blue) 38%, transparent);
  background: var(--accent-blue-bg);
}

.hud-mini-tag.zen {
  color: var(--up-color);
  border-color: color-mix(in srgb, var(--up-color) 38%, transparent);
  background: var(--up-bg);
}

/* ==================== 5 Crypto Infrastructure & Side-Track Modules ==================== */
.infra-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

@media (min-width: 480px) {
  .infra-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .infra-card.zen-card {
    grid-column: 1 / -1;
  }
}

.infra-card {
  min-width: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 7px;
}

.infra-card.zen-card {
  border-color: color-mix(in srgb, var(--up-color) 32%, var(--border-line));
  background: linear-gradient(145deg, color-mix(in srgb, var(--up-color) 6%, var(--bg-elevated)), var(--bg-elevated) 72%);
}

.infra-card.maxed {
  border-color: var(--accent-gold-border);
}

.infra-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.infra-title-group {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.infra-icon-box {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--accent-gold);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.infra-name {
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.infra-tier-label {
  font-size: 11px;
  color: var(--accent-gold);
  font-family: var(--font-mono);
}

.infra-pips {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.infra-pip {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-line);
}

.infra-pip.on {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
}

.infra-effect {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.42;
}

.infra-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 5px;
  border-top: 1px solid var(--border-line);
}

.infra-up-btn {
  appearance: none;
  flex: 1;
  min-height: 31px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-gold-border);
  background: var(--accent-gold-bg);
  color: var(--accent-gold);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
}

.infra-up-btn:disabled {
  opacity: 0.45;
  border-color: var(--border-line);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: not-allowed;
}

.infra-down-btn {
  appearance: none;
  min-height: 31px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  padding: 4px 7px;
}

/* ==================== Unified 8-Way Action Grid & Conditional Contract Desk ==================== */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.preset-btn {
  appearance: none;
  min-width: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 10px 10px;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  min-height: 68px;
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.08s ease;
}

.preset-btn:hover {
  border-color: var(--border-strong);
}

.preset-btn.selected {
  border-color: var(--accent-gold);
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent-gold) 12%, var(--bg-elevated)), var(--bg-elevated) 75%);
  box-shadow: 0 0 0 1px var(--accent-gold-border);
}

.preset-btn.futures-card.selected {
  border-color: var(--warn-color);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn-color) 45%, transparent);
}

.preset-btn.chill-card.selected {
  border-color: var(--up-color);
  background: linear-gradient(150deg, color-mix(in srgb, var(--up-color) 11%, var(--bg-elevated)), var(--bg-elevated) 75%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--up-color) 40%, transparent);
}

.preset-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
}

.preset-btn strong {
  display: block;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-cat-tag {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  color: var(--text-muted);
}

.preset-cat-tag.warn {
  color: var(--warn-color);
  border-color: color-mix(in srgb, var(--warn-color) 38%, transparent);
}

.preset-cat-tag.chill {
  color: var(--up-color);
  border-color: color-mix(in srgb, var(--up-color) 35%, transparent);
}

.preset-cat-tag.mainjob {
  color: var(--accent-blue);
  border-color: color-mix(in srgb, var(--accent-blue) 35%, transparent);
}

.preset-btn span {
  display: block;
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* Conditional Contract Desk (only visible when futures selected) */
.contract-desk {
  background: var(--bg-elevated);
  border: 1px solid color-mix(in srgb, var(--warn-color) 42%, var(--border-line));
  border-radius: var(--radius-md);
  padding: 11px 12px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.contract-desk-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.dir-btn {
  appearance: none;
  min-height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-line);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  padding: 6px 8px;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.dir-btn.dir-long.selected {
  border-color: var(--up-color);
  color: var(--up-color);
  background: var(--up-bg);
}

.dir-btn.dir-short.selected {
  border-color: var(--down-color);
  color: var(--down-color);
  background: var(--down-bg);
}

.dir-btn.target-btn.selected {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  background: var(--accent-gold-bg);
}

.dir-btn small {
  display: block;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 10px;
  opacity: 0.85;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lev-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.lev-btn {
  appearance: none;
  min-height: 38px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.lev-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.lev-btn.selected {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  background: var(--accent-gold-bg);
}

.lev-btn.danger.selected {
  border-color: var(--down-color);
  color: var(--down-color);
  background: var(--down-bg);
}

/* ==================== Event Scene Art Header, Ambush Dossier & Choices ==================== */
.scene-art-banner {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-line);
  background: var(--bg-elevated);
  padding: 10px 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.scene-art-banner.ambush-theme {
  border-color: color-mix(in srgb, var(--warn-color) 48%, transparent);
  background: linear-gradient(135deg, var(--warn-bg), var(--bg-elevated) 72%);
}

.scene-art-svg {
  width: 58px;
  height: 44px;
  flex-shrink: 0;
}

.event-header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.badge-date {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--accent-gold);
  border: 1px solid var(--border-line);
}

.badge-track {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-line);
}

.event-title {
  font-size: 17.5px;
  font-weight: 800;
  line-height: 1.38;
  margin: 0 0 10px;
}

.event-scene {
  font-size: 14.5px;
  line-height: 1.68;
  color: var(--text-primary);
  margin: 0 0 12px;
  padding: 12px 13px;
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent-gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.audit-clue-box {
  margin: 0 0 12px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--accent-blue-bg);
  border: 1px solid color-mix(in srgb, var(--accent-blue) 35%, transparent);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-primary);
}

.audit-clue-box strong {
  color: var(--accent-blue);
  font-family: var(--font-mono);
}

.audit-clue-box.noise {
  background: var(--warn-bg);
  border-color: color-mix(in srgb, var(--warn-color) 35%, transparent);
}

.audit-clue-box.noise strong {
  color: var(--warn-color);
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.choice-btn {
  appearance: none;
  width: 100%;
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px 13px;
  color: var(--text-primary);
  cursor: pointer;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-sans);
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.08s ease;
}

.choice-btn:hover {
  border-color: var(--accent-gold);
  background: color-mix(in srgb, var(--accent-gold) 5%, var(--bg-elevated));
}

.choice-btn:active {
  transform: scale(0.99);
}

.choice-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-gold);
  background: var(--accent-gold-bg);
  border: 1px solid var(--accent-gold-border);
  padding: 1px 6px;
  border-radius: 4px;
}

.choice-label {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.46;
}

/* ==================== Milestone Awakening Cards (Talent Phase) ==================== */
.talent-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.talent-card {
  appearance: none;
  width: 100%;
  text-align: left;
  background: linear-gradient(155deg, var(--accent-gold-bg), var(--bg-elevated) 60%);
  border: 1px solid var(--accent-gold-border);
  border-radius: var(--radius-md);
  padding: 13px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-sans);
  transition: transform 0.1s ease, border-color 0.15s ease;
}

.talent-card:hover {
  border-color: var(--accent-gold-strong);
  transform: translateY(-1px);
}

.talent-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--accent-gold);
}

.talent-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.talent-bonus {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--up-color);
  margin-top: 2px;
}

/* ==================== Breakthrough Celebration Strip ==================== */
.breakthrough-strip {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--accent-gold-bg), transparent);
  border: 1px solid var(--accent-gold);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  animation: pulseGold 1.8s ease-out 1;
}

@keyframes pulseGold {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
  100% { box-shadow: 0 0 0 14px rgba(245, 158, 11, 0); }
}

/* ==================== Precision Canvas Chart Container ==================== */
.chart-wrap {
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 10px 11px;
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.chart-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.chart-readout {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text-muted);
}

.kline-canvas {
  width: 100%;
  height: 215px;
  display: block;
  touch-action: pan-y;
}

/* ==================== Outcome & PnL Banner ==================== */
.pnl-banner {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.pnl-up {
  background: var(--up-bg);
  color: var(--up-color);
  border: 1px solid color-mix(in srgb, var(--up-color) 35%, transparent);
}

.pnl-down {
  background: var(--down-bg);
  color: var(--down-color);
  border: 1px solid color-mix(in srgb, var(--down-color) 35%, transparent);
}

.up-text { color: var(--up-color); }
.down-text { color: var(--down-color); }

/* ==================== Heirloom Collectible Ending Certificate ==================== */
.ending-poster {
  position: relative;
  background:
    radial-gradient(circle at 92% 8%, rgba(245, 158, 11, 0.16), transparent 45%),
    linear-gradient(165deg, color-mix(in srgb, var(--accent-gold) 11%, var(--bg-card)), var(--bg-card) 58%);
  border: 1px solid var(--accent-gold-border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  box-shadow: var(--card-shadow);
}

.ending-poster::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(245, 158, 11, 0.14);
  border-radius: calc(var(--radius-lg) - 4px);
  pointer-events: none;
}

.rarity-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.rarity-UR { background: rgba(251, 191, 36, 0.18); color: var(--ur-color); border: 1px solid var(--ur-color); }
.rarity-SSR { background: rgba(244, 63, 94, 0.16); color: var(--ssr-color); border: 1px solid var(--ssr-color); }
.rarity-SR { background: rgba(168, 85, 247, 0.16); color: var(--sr-color); border: 1px solid var(--sr-color); }
.rarity-R { background: rgba(56, 189, 248, 0.15); color: var(--r-color); border: 1px solid var(--r-color); }
.rarity-N { background: rgba(148, 163, 184, 0.15); color: var(--n-color); border: 1px solid var(--n-color); }

.ending-title {
  font-size: 21px;
  font-weight: 900;
  margin: 10px 0 4px;
  line-height: 1.3;
}

.ending-subtitle {
  font-size: 13.5px;
  color: var(--accent-gold);
  margin: 0 0 12px;
  font-weight: 700;
}

.ending-desc {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  margin: 0 0 14px;
}

.ending-quote {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent-gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 0 0 14px;
}

/* ==================== Filters, Event Cards & 108 Endings Grid ==================== */
.filter-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }

.filter-chip {
  appearance: none;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  min-height: 32px;
}

.filter-chip.active {
  background: var(--accent-gold-bg);
  color: var(--accent-gold);
  border-color: var(--accent-gold);
  font-weight: 700;
}

.list-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.event-row-card {
  appearance: none;
  width: 100%;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 12px 13px;
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-sans);
  box-shadow: var(--card-shadow);
  transition: border-color 0.15s ease;
}

.event-row-card:hover {
  border-color: var(--accent-gold-border);
}

.ending-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (min-width: 640px) {
  .ending-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.ending-tile {
  appearance: none;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 11px;
  color: var(--text-primary);
  cursor: pointer;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--font-sans);
  box-shadow: var(--card-shadow);
  transition: border-color 0.14s ease, transform 0.1s ease;
}

.ending-tile:hover {
  border-color: var(--accent-gold-border);
}

.ending-tile.locked {
  opacity: 0.62;
  background: color-mix(in srgb, var(--bg-card) 60%, var(--bg-root));
  box-shadow: none;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.select-input {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: var(--font-sans);
  min-height: 40px;
}

.toast {
  position: fixed;
  top: calc(58px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-gold);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  max-width: calc(100vw - 28px);
  text-align: center;
}

/* ==================== Ledger Drawer & Parallel What-If ==================== */
.drawer-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  margin-bottom: 11px;
  overflow: hidden;
}

.drawer-summary {
  padding: 9px 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.drawer-summary::-webkit-details-marker { display: none; }

.drawer-body {
  padding: 10px 12px;
  border-top: 1px solid var(--border-line);
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ledger-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.ledger-row span:first-child {
  font-family: var(--font-sans);
  color: var(--text-secondary);
}

.whatif-card {
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-line);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.whatif-card.chosen {
  border-color: var(--accent-gold);
}

/* ==================== WeChat Share Poster Modal ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 7, 12, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
}

.modal-inner {
  width: 100%;
  max-width: 400px;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.poster-img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  display: block;
  border: 1px solid var(--border-line);
}
