/* ===== SPLASH SCREEN ===== */

.splash-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-xxl) var(--screen-padding) var(--space-lg);
  height: 100%;
}

.splash-demo-area {
  width: 240px;
  height: 320px;
  border-radius: var(--radius-card);
  background: var(--bg-surface);
  overflow: hidden;
  position: relative;
  margin-bottom: var(--space-xl);
  flex-shrink: 0;
}

.splash-demo-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
}

.splash-demo-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.splash-tagline {
  text-align: center;
  margin-bottom: var(--space-xl);
  padding: 0 var(--space-base);
}

.splash-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: auto;
}

.splash-skip {
  text-align: center;
  margin-top: var(--space-md);
}

/* ===== HOME SCREEN v2 ===== */

/* P1-1: Ambient background glow — cyan top-left, purple right, green bottom */
@keyframes shimmerSweep {
  0%   { transform: translateX(-100%); opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateX(400%); opacity: 0; }
}

@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 0 0 1px var(--glass-border) inset; }
  50%       { box-shadow: 0 0 0 1px rgba(74,163,255,0.22) inset, 0 0 18px rgba(74,163,255,0.08); }
}

/* Breathing glow for upload dropzone */
@keyframes dropzoneBreathe {
  0%, 100% {
    border-color: rgba(0,212,255,0.18);
    box-shadow: 0 0 12px rgba(0,212,255,0.06);
  }
  50% {
    border-color: rgba(0,212,255,0.50);
    box-shadow: 0 0 22px rgba(0,212,255,0.18);
  }
}

/* Icon floating micro-animation */
@keyframes iconFloat {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-2px); }
}

.home-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.home-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 10% 12%, rgba(0,229,255,0.07) 0%, transparent 48%),
    radial-gradient(ellipse at 88% 28%, rgba(124,77,255,0.06) 0%, transparent 42%),
    radial-gradient(ellipse at 50% 92%, rgba(0,230,118,0.05) 0%, transparent 38%);
  pointer-events: none;
  z-index: 0;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--screen-padding) var(--space-md);
  flex-shrink: 0;
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--text-85), var(--accent));
  box-shadow: 0 0 18px var(--accent-glass-glow-strong);
}

.home-header-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.home-header-actions {
  display: flex;
  gap: var(--space-sm);
}

.home-icon-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: var(--radius-button);
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0.65;
  transition: background var(--ease-micro), opacity var(--ease-micro);
  backdrop-filter: blur(10px);
}

.home-icon-btn:active {
  background: var(--glass-fill-light);
  opacity: 1;
}

.home-icon-btn svg {
  width: 16px;
  height: 16px;
}

.home-icon-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.home-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 var(--screen-padding) var(--space-lg);
  position: relative;
  z-index: 1;
}

/* ── Scan Panel ── */

.scan-panel {
  position: relative;
  border-radius: var(--radius-card);
  background: var(--glass-fill-faint);
  border: 1px solid var(--glass-border);
  box-shadow: 0 18px 55px rgba(0,0,0,0.45);
  overflow: hidden;
  padding: 18px 16px 16px;
}

.scan-panel-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, var(--accent-glass-glow), transparent 70%);
  opacity: 0.4;
  pointer-events: none;
}

.scan-panel-grid,
.scan-panel-scanline {
  display: none;
}

.scan-panel-header {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scan-panel-title {
  font-size: 18px;
  font-weight: 850;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  min-height: 44px;  /* Reserve 2 lines to prevent jump between zh/en */
}

.scan-panel-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.35;
  min-height: 32px;
}

/* Capability chips — LLM product feel */
.scan-caps-row {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.scan-cap-chip {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(0,212,255,0.18);
  background: rgba(0,212,255,0.05);
  color: var(--accent-text-soft);
  cursor: default;
  opacity: 0.75;
}

/* ── Dropzone ── */

.scan-dropzone {
  position: relative;
  z-index: 2;
  margin-top: 10px;
  border-radius: var(--radius-card);
  padding: 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: background var(--ease-micro);
}

.scan-dropzone:active {
  background: var(--glass-bg-heavy);
}

.scan-dropzone-frame {
  position: relative;
  border-radius: 14px;
  padding: 14px 14px;
  background: var(--glass-fill-faint);
  border: 1px solid rgba(0,212,255,0.18);
  display: flex;
  align-items: center;
  gap: 14px;
  overflow: hidden;
  min-height: 100px;  /* Consistent height across zh/en to prevent layout jump */
  animation: dropzoneBreathe 2.4s ease-in-out infinite;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

/* Drag-over state: border fully illuminates */
.scan-dropzone.is-dragover .scan-dropzone-frame {
  border-color: rgba(0,212,255,0.9);
  box-shadow: 0 0 0 2px rgba(0,212,255,0.25), 0 0 32px rgba(0,212,255,0.2);
  animation-play-state: paused;
}

/* P1-2: CTA shimmer sweep */
.scan-dropzone-frame::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 30%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  animation: shimmerSweep 4s ease-in-out infinite;
  pointer-events: none;
}

.scan-corner { display: none; }
.sc1, .sc2, .sc3, .sc4 { display: none; }

.scan-dropzone-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent-glass-bg-medium);
  border: 1px solid var(--accent-glass-border);
  color: var(--accent-text-soft);
  flex-shrink: 0;
  animation: iconFloat 3s ease-in-out infinite;
}

.scan-dropzone-icon svg {
  width: 20px;
  height: 20px;
}

.scan-dropzone-headline {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

.scan-dropzone-hint {
  font-size: 12px;
  color: var(--text-45);  /* Brighter than --text-muted to avoid "disabled" look */
  margin-top: 4px;
}

.scan-dropzone-micro {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-40);  /* Slightly brighter */
  text-align: center;
}

/* ── Scan Actions ── */

.scan-actions {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.scan-action {
  height: 44px;
  border-radius: var(--radius-button);
  border: 1px solid var(--glass-border-subtle);
  background: var(--glass-fill-faint);
  color: var(--text-55);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  backdrop-filter: blur(10px);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--ease-micro);
}

.scan-action:active {
  background: var(--glass-fill-active);
}

.scan-action svg {
  width: 18px;
  height: 18px;
  opacity: 0.6;
}

.scan-action-solid {
  background: var(--accent-glass-border);
  border-color: var(--accent-glass-border-vivid);
  box-shadow: 0 0 0 1px var(--accent-glass-bg-medium) inset;
  color: var(--accent-text-soft);
}

.scan-action-solid svg {
  color: var(--accent);
}

/* ── Last Result Mini-card ── */

.scan-last-result {
  position: relative;
  z-index: 2;
  margin-top: 14px;
}

.scan-last-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 10px;
}

.scan-last-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-72);
}

.scan-last-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, var(--text-85), rgba(74,163,255,0.95));
  box-shadow: 0 0 18px var(--accent-glass-glow-strong);
}

.scan-last-link {
  font-size: 12px;
  color: var(--accent-text-soft);
  background: transparent;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
}

.scan-last-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px;
  border-radius: 18px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  box-shadow: 0 0 0 1px var(--glass-fill-faint) inset;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}


/* P1-3: Neon border color-coded by last action type */
.scan-last-card:has(.is-buy),
.scan-last-card:has(.is-enter),
.scan-last-card:has(.is-add) {
  border-color: var(--action-buy-border);
  box-shadow: 0 0 0 1px var(--action-buy-bg) inset, 0 0 20px rgba(61,255,181,0.06);
}
.scan-last-card:has(.is-sell),
.scan-last-card:has(.is-exit) {
  border-color: var(--action-sell-border);
  box-shadow: 0 0 0 1px var(--action-sell-bg) inset, 0 0 20px rgba(255,77,109,0.06);
}
.scan-last-card:has(.is-wait),
.scan-last-card:has(.is-hold) {
  border-color: var(--action-wait-border);
  box-shadow: 0 0 0 1px var(--action-wait-bg) inset, 0 0 20px rgba(74,163,255,0.06);
}
.scan-last-card:has(.is-reduce) {
  border-color: var(--action-reduce-border);
  box-shadow: 0 0 0 1px var(--action-reduce-bg) inset, 0 0 20px rgba(255,177,74,0.06);
}
.scan-last-card:has(.is-hedge) {
  border-color: var(--action-hedge-border);
  box-shadow: 0 0 0 1px var(--action-hedge-bg) inset, 0 0 20px rgba(124,77,255,0.06);
}

.scan-last-card:active {
  transform: scale(0.99);
  border-color: var(--accent-glass-border);
  box-shadow: 0 0 0 1px var(--accent-glass-glow-subtle) inset, 0 0 24px var(--action-wait-bg);
}

.scan-last-top {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  min-width: 0;
}

.scan-last-action {
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.10em;
  color: var(--text-78);
}

.scan-last-action.is-wait {
  color: var(--action-wait-from);
}

.scan-last-action.is-buy {
  color: var(--action-buy-from);
}

.scan-last-action.is-sell {
  color: var(--action-sell-from);
}

.scan-last-action.is-reduce {
  color: var(--action-reduce-from);
}

.scan-last-action.is-hedge {
  color: var(--action-hedge-from);
}

.scan-last-action.is-neutral {
  color: var(--text-64);
}

.scan-last-symbol-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
}

.scan-last-pill {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--glass-fill-active);
  background: var(--glass-fill-light);
  color: var(--text-72);
}

.scan-last-pill-symbol {
  max-width: calc(100% - 72px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scan-last-pill-tf {
  border-color: var(--accent-glass-border);
  background: var(--action-wait-bg);
  color: var(--accent-text-glow);
}

.scan-last-one {
  font-size: 13px;
  line-height: 1.30;
  color: var(--text-72);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.scan-last-tripwire {
  width: 100%;
  font-size: 11px;
  line-height: 1.3;
  color: rgba(255,180,140,0.92);
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--bearish-glass-bg-subtle);
  border-left: 2px solid rgba(255,130,100,0.7);
  border-top: 1px solid var(--bearish-glass-border-subtle);
  border-right: 1px solid var(--bearish-glass-border-subtle);
  border-bottom: 1px solid var(--bearish-glass-border-subtle);
  overflow: hidden;
}

/* Structured tripwire: condition line (price) */
.scan-last-tw-condition {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,140,100,0.95);
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Structured tripwire: action line */
.scan-last-tw-action {
  font-size: 10px;
  color: rgba(255,180,140,0.70);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.scan-last-foot {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.scan-last-time {
  font-size: 12px;
  color: var(--text-42);
}

.scan-last-cta {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-text-soft);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent-glass-glow-strong);
  background: var(--accent-glass-glow-subtle);
  white-space: nowrap;
}

/* ── Quick Prefs ── */

.scan-quick-prefs {
  position: relative;
  z-index: 2;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--glass-border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Collapsed summary: single-line chips */
.scan-prefs-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.scan-prefs-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.scan-pref-chip {
  color: var(--text-85);
  font-weight: 600;
}

.scan-pref-sep {
  color: var(--text-25);
  font-size: 10px;
}

.scan-prefs-toggle {
  font-size: 12px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.scan-prefs-toggle:active {
  opacity: 0.7;
}

.prefs-arrow {
  font-size: 10px;
  margin-left: 2px;
}

/* Expanded detail panel */
.scan-prefs-detail {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scan-prefs-detail[hidden] {
  display: none;
}

.scan-prefs-label {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  font-weight: 600;
}

.scan-prefs-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.scan-seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  background: var(--glass-fill-faint);
  max-width: 100%;
  overflow: hidden;
}

.scan-seg-sm .scan-seg-btn {
  min-width: 0;
}

.scan-seg-btn {
  min-width: 0;
  flex: 1 1 0;
  height: 32px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255,255,255,0.60);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: background var(--ease-micro), border-color var(--ease-micro), color var(--ease-micro), box-shadow var(--ease-micro);
  padding: 0 10px;
  white-space: nowrap;
  touch-action: manipulation;
}

.scan-seg-btn.active {
  background: var(--accent-glass-bg-strong);
  border-color: var(--accent-glass-border-strong);
  color: var(--accent-text-bright);
  box-shadow: 0 0 16px var(--accent-glass-bg-medium);
}

.scan-seg-btn:active {
  opacity: 0.8;
}

/* ── Try Row ── */

.scan-try-row {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.scan-try-btn {
  flex: 1;
  height: 42px;
  border-radius: var(--radius-card);
  border: 1px solid var(--glass-fill-active);
  background: var(--glass-fill-light);
  color: rgba(255,255,255,0.86);
  font-weight: 750;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--ease-micro), transform var(--ease-micro), box-shadow var(--ease-micro);
}

.scan-try-btn:active {
  background: var(--glass-fill-active);
}

.scan-try-btn.scan-try-primary {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  height: 46px;
  flex: 1.5;
  border-color: var(--accent);
}

.scan-try-btn.scan-try-primary:active {
  transform: scale(0.97);
  background: #3478E5;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.35);
}

.scan-try-ghost {
  background: transparent;
  color: rgba(255,255,255,0.65);
  border-color: var(--glass-border);
  opacity: 0.6;
  font-size: 12px;
  flex: 1;
}

.scan-try-spark {
  color: rgba(255,210,111,0.95);
  margin-right: 6px;
  text-shadow: 0 0 18px rgba(255,210,111,0.18);
}

.scan-try-hint {
  position: relative;
  z-index: 2;
  text-align: center;
  font-size: 11px;
  color: var(--text-28);
  margin-top: 6px;
}

/* ── Recent Section v2 ── */

.recent-section {
  margin-top: var(--space-lg);
}

.recent-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.recent-section-head .section-label {
  margin-bottom: 0;
}

.recent-view-all {
  font-size: 12px;
  color: var(--accent-text-soft);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
}

.recent-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--glass-border-subtle);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: background var(--ease-micro);
  touch-action: manipulation;
}

.recent-card:active {
  background: var(--bg-surface-raised);
}

.recent-card-left {
  flex-shrink: 0;
}

.recent-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-small);
  background: var(--bg-surface-raised);
  overflow: hidden;
}

.recent-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recent-card-mid {
  flex: 1;
  min-width: 0;
}

.recent-card-top {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: 2px;
}

.recent-ticker {
  font-weight: 700;
  font-size: 15px;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.recent-tf {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.recent-one-liner {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.recent-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.recent-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.recent-card-action {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* ===== RECOGNITION SCREEN ===== */

.recognition-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.recognition-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--screen-padding) var(--space-lg);
}

.recognition-thumb-wrapper {
  position: relative;
  width: 100%;
  height: 180px;
  border-radius: var(--radius-card);
  overflow: hidden;
  margin-bottom: var(--space-lg);
}

.recognition-thumb-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.8);
}

.detected-section {
  margin-bottom: var(--space-lg);
}

.preference-section {
  margin-bottom: var(--space-lg);
}

.preference-section .pref-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.position-details-section {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 300ms ease-out, opacity 200ms ease-out;
}

.position-details-section.visible {
  max-height: 400px;
  opacity: 1;
}

/* Quick Analyze Button */
.quick-analyze-btn {
  width: 100%;
  padding: 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-button);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 150ms ease, opacity 150ms ease;
  margin-bottom: var(--space-md);
  touch-action: manipulation;
}

.quick-analyze-btn:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.quick-analyze-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Advanced Settings Toggle */
.advanced-settings-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 150ms ease;
  margin-bottom: var(--space-md);
}

.advanced-settings-toggle:active {
  color: var(--text-primary);
}

.advanced-settings-toggle .chevron {
  display: inline-block;
  transition: transform 200ms ease;
}

.advanced-settings-toggle.expanded .chevron {
  transform: rotate(180deg);
}

/* Advanced Settings Content */
.advanced-settings-content {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 300ms ease-out, opacity 200ms ease-out;
}

.advanced-settings-content.visible {
  max-height: 1200px;
  opacity: 1;
}

/* Preferences summary card (shown when advanced settings collapsed) */
.pref-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  padding: 8px 12px;
  margin-top: 8px;
  border-radius: var(--radius-small);
  background: var(--glass-fill);
  border: 1px solid var(--glass-border-subtle);
  cursor: pointer;
}

.pref-summary:active {
  opacity: 0.7;
}

.pref-summary-label {
  font-size: 11px;
  color: var(--text-35);
  margin-right: 4px;
}

.pref-summary-chip {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.pref-summary-sep {
  font-size: 11px;
  color: var(--text-35);
}

/* Low Confidence Warning */
.low-confidence-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: var(--space-sm);
  border-radius: var(--radius-card);
  background: var(--caution-glass-bg);
  border: 1px solid var(--caution-glass-border);
  color: #f59e0b;
  font-size: 13px;
  font-weight: 500;
}

.low-confidence-warning .icon {
  flex-shrink: 0;
}

.chip.needs-confirm {
  border-color: #f59e0b;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.35) inset;
}

.needs-confirm-card {
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  border: 1px solid var(--caution-glass-border);
  border-radius: var(--radius-card);
  background: var(--caution-glass-bg);
}

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

.needs-confirm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 13px;
}

.needs-confirm-item input {
  accent-color: #f59e0b;
}

.needs-confirm-meta {
  margin-left: auto;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.input-hint {
  display: none;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.input-hint.visible {
  display: block;
}

.input-hint.error {
  color: #ff8f8f;
}

.text-input.input-error {
  border-color: rgba(255, 82, 82, 0.65);
}

.slider-container {
  padding: 0 var(--space-xs);
}

.slider-value-label {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  margin-bottom: var(--space-sm);
}

.slider-track {
  position: relative;
  height: 6px;
  background: var(--bg-surface-raised);
  border-radius: var(--radius-pill, 999px);
  touch-action: none;
  cursor: pointer;
}

.slider-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill, 999px);
  pointer-events: none;
}

.slider-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(68, 138, 255, 0.5), 0 2px 4px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.slider-ticks {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.slider-tick {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 1px;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.recognition-actions {
  padding: var(--space-base) var(--screen-padding);
  flex-shrink: 0;
}

/* ===== LOADING SCREEN ===== */

.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-xl) var(--screen-padding);
  height: 100%;
}

.loading-chart {
  position: relative;
  width: 100%;
  max-height: 220px;
  border-radius: var(--radius-card);
  overflow: hidden;
  margin-bottom: var(--space-xl);
  animation: pulse 2s ease-in-out infinite;
}

/* Scanning line overlay */
.loading-chart::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: loadingScan 2s ease-in-out infinite;
}

@keyframes loadingScan {
  0% { top: 0; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

.loading-chart img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.loading-stepper {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 var(--space-base);
  width: 100%;
}

.loading-step {
  display: flex;
  align-items: stretch;
  gap: var(--space-md);
  position: relative;
}

.step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.step-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 300ms ease, border-color 300ms ease;
  position: relative;
}

.step-dot.active {
  border-color: var(--accent);
  background: var(--accent);
}

.step-dot.active::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: stepPulse 1.5s ease-out infinite;
}

@keyframes stepPulse {
  0% { transform: scale(0.8); opacity: 0.6; }
  100% { transform: scale(1.4); opacity: 0; }
}

.step-dot.done {
  border-color: var(--bullish);
  background: var(--bullish);
}

.step-dot.done svg {
  width: 12px;
  height: 12px;
  color: #000;
}

.step-line {
  width: 2px;
  flex: 1;
  min-height: 12px;
  background: var(--text-muted);
  transition: background 300ms ease;
}

.step-line.done {
  background: var(--bullish);
}

.step-text {
  padding: 2px 0 30px;
  font-size: 15px;
  color: var(--text-muted);
  transition: color 300ms ease;
  line-height: 20px;
}

.step-text.active {
  color: var(--text-primary);
}

.step-text.done {
  color: var(--text-secondary);
}

.loading-timeout {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-xl);
  text-align: center;
}

.loading-timeout.visible {
  display: flex;
}

/* ===== SHARE / POSTER STUDIO ===== */

.share-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-primary);
}

/* Poster preview area — fills available space */
.share-poster-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--screen-padding);
  overflow: hidden;
  min-height: 0;
}

/* Poster frame — aspect-ratio driven sizing */
.share-poster {
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-level3);
}

.share-poster[data-ratio="story_9_16"] {
  height: 100%;
  aspect-ratio: 9 / 16;
  max-width: 100%;
}

.share-poster[data-ratio="square_1_1"] {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 100%;
}

.share-poster[data-ratio="twitter_16_9"] {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 100%;
}

/* ── Poster Card ── */

.poster-card {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  padding: var(--space-md);
  overflow: hidden;
}

/* Main content wrapper — centers vertically */
.poster-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.poster-glow-top,
.poster-grid-bg,
.poster-scanline {
  display: none;
}

/* Header: action verb + ticker + confidence ring */
.poster-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  position: relative;
  z-index: 1;
}

.poster-action-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}

.poster-action-verb {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1;
}

.poster-symbol {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Confidence ring — SVG-based for html2canvas compatibility */
.poster-conf {
  width: 36px;
  height: 36px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.poster-conf-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.poster-conf span {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

/* One-liner */
.poster-one-liner {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* Tripwire */
.poster-tripwire {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bearish-glass-bg);
  border: 1px solid var(--bearish-glass-border);
  border-radius: var(--radius-small);
  margin-bottom: var(--space-md);
  position: relative;
  z-index: 1;
}

.poster-tripwire svg {
  flex-shrink: 0;
  color: #EF5350;
}

.poster-tripwire span {
  font-size: 11px;
  line-height: 16px;
  color: #EF5350;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Level chips */
.poster-levels {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
  position: relative;
  z-index: 1;
}

.poster-level {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-xs);
  border-radius: var(--radius-small);
  border: 1px solid var(--glass-fill-active);
  background: var(--glass-fill-faint);
  overflow: hidden;
}

.poster-level-label {
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.poster-level-price {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.poster-level-stop .poster-level-price {
  color: #EF5350;
}

.poster-level-target .poster-level-price {
  color: #66BB6A;
}

/* Plans A / B */
.poster-plans {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  position: relative;
  z-index: 1;
}

.poster-plan {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
}

.poster-plan-tag {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-minimal);
  background: var(--accent-glass-bg-strong);
  color: #448AFF;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.poster-plan-tag-b {
  background: var(--glass-border-subtle);
  color: var(--text-secondary);
}

.poster-plan-body {
  min-width: 0;
}

.poster-plan-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1px;
}

.poster-plan-trigger {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Footer — sits at bottom since poster-main takes flex:1 */
.poster-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-md);
  border-top: 1px solid var(--glass-border-subtle);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.poster-brand {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.poster-disc {
  font-size: 10px;
  color: var(--text-muted);
}

/* ── Ratio-adaptive hiding ── */

/* 16:9 is very compact — hide plans & tripwire, shrink one-liner */
.share-poster[data-ratio="twitter_16_9"] .poster-plans {
  display: none;
}

.share-poster[data-ratio="twitter_16_9"] .poster-tripwire {
  display: none;
}

.share-poster[data-ratio="twitter_16_9"] .poster-one-liner {
  -webkit-line-clamp: 1;
  margin-bottom: var(--space-sm);
}

.share-poster[data-ratio="twitter_16_9"] .poster-card {
  padding: var(--space-base);
}

/* ── Export-quality scaling (offscreen clone gets .poster-export class) ── */
/* Scale up fonts & spacing so the card fills the 1080px+ canvas nicely. */

.poster-export .poster-card {
  padding: 48px 40px;
}

.poster-export .poster-header {
  margin-bottom: 28px;
}

.poster-export .poster-action-verb {
  font-size: 48px;
}

.poster-export .poster-symbol {
  font-size: 32px;
}

.poster-export .poster-conf {
  width: 72px;
  height: 72px;
}

.poster-export .poster-conf-ring circle {
  stroke-width: 5;
}

.poster-export .poster-conf span {
  font-size: 28px;
}

.poster-export .poster-one-liner {
  font-size: 28px;
  line-height: 40px;
  -webkit-line-clamp: 3;
  margin-bottom: 28px;
}

.poster-export .poster-tripwire {
  padding: 16px 20px;
  margin-bottom: 28px;
  border-radius: 12px;
  gap: 12px;
}

.poster-export .poster-tripwire svg {
  width: 20px;
  height: 20px;
}

.poster-export .poster-tripwire span {
  font-size: 22px;
  line-height: 30px;
  white-space: normal;
}

.poster-export .poster-levels {
  gap: 12px;
  margin-bottom: 32px;
}

.poster-export .poster-level {
  padding: 16px 12px;
  border-radius: 12px;
  gap: 6px;
}

.poster-export .poster-level-label {
  font-size: 16px;
  letter-spacing: 0.5px;
}

.poster-export .poster-level-price {
  font-size: 24px;
}

.poster-export .poster-plans {
  gap: 16px;
}

.poster-export .poster-plan {
  gap: 12px;
}

.poster-export .poster-plan-tag {
  width: 36px;
  height: 36px;
  font-size: 18px;
  border-radius: 8px;
  margin-top: 2px;
}

.poster-export .poster-plan-name {
  font-size: 26px;
  margin-bottom: 4px;
}

.poster-export .poster-plan-trigger {
  font-size: 22px;
  line-height: 30px;
  -webkit-line-clamp: 2;
}

.poster-export .poster-footer {
  padding-top: 24px;
}

.poster-export .poster-brand {
  font-size: 24px;
}

.poster-export .poster-disc {
  font-size: 18px;
}


/* ── Bottom controls ── */

.share-bottom {
  padding: var(--space-md) var(--screen-padding) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  flex-shrink: 0;
}

.share-ratio-row {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}

.share-ratio-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-raised);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--ease-micro), color var(--ease-micro), background var(--ease-micro);
  touch-action: manipulation;
}

.share-ratio-chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glass-bg-medium);
}

.share-ratio-chip:active {
  transform: scale(0.96);
}

/* Constrain icon in share CTA */
.share-bottom .btn-primary svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ===== HISTORY SCREEN ===== */

.history-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.history-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--screen-padding) var(--space-lg);
}

/* ── C1: Filter Bar ── */
.hist-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px var(--screen-padding) 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
  border-bottom: 1px solid var(--glass-border-subtle);
}

.hist-filter-bar::-webkit-scrollbar { display: none; }

.hist-filter-group {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.hist-filter-sep {
  width: 1px;
  height: 16px;
  background: var(--glass-border);
  flex-shrink: 0;
  align-self: center;
}

.hist-filter-chip {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: transparent;
  color: var(--text-45);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--ease-micro), color var(--ease-micro), border-color var(--ease-micro);
}

.hist-filter-chip.active {
  background: var(--accent-glass-bg);
  border-color: var(--accent-glass-border);
  color: var(--accent-text-soft);
}

.hist-filter-chip.verdict-buy.active {
  background: rgba(0,229,204,0.10);
  border-color: rgba(0,229,204,0.35);
  color: var(--action-buy-from);
}

.hist-filter-chip.verdict-sell.active {
  background: rgba(239,83,80,0.10);
  border-color: rgba(239,83,80,0.35);
  color: var(--action-sell-from);
}

.hist-filter-chip.verdict-wait.active {
  background: rgba(100,181,246,0.10);
  border-color: rgba(100,181,246,0.35);
  color: var(--action-wait-from);
}

.hist-filter-empty {
  text-align: center;
  padding: 48px var(--screen-padding);
  font-size: 13px;
  color: var(--text-35);
}

/* ── C2: Confidence Bar ── */
.confidence-bar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.confidence-segs {
  display: flex;
  gap: 2px;
}

.confidence-seg {
  width: 10px;
  height: 6px;
  border-radius: 2px;
  background: var(--glass-fill-active);
}

.confidence-bar.strong .confidence-seg { background: rgba(0,229,204,0.75); }

.confidence-bar.moderate .confidence-seg:nth-child(1),
.confidence-bar.moderate .confidence-seg:nth-child(2) { background: rgba(255,183,77,0.75); }
.confidence-bar.moderate .confidence-seg:nth-child(3) { background: var(--glass-fill-active); }

.confidence-bar.weak .confidence-seg:nth-child(1) { background: rgba(239,83,80,0.65); }
.confidence-bar.weak .confidence-seg:nth-child(2),
.confidence-bar.weak .confidence-seg:nth-child(3) { background: var(--glass-fill-active); }

.confidence-label {
  font-size: 9px;
  color: rgba(255,255,255,0.30);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.history-group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-50);
  margin: 18px 0 10px;
}

.history-group-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--action-wait-bg);
  box-shadow: 0 0 8px var(--accent-glass-glow-strong);
  flex-shrink: 0;
}

.history-group-label:first-child {
  margin-top: var(--space-md);
}

.history-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--glass-bg);
  border-radius: 16px;
  border: 1px solid var(--glass-border-subtle);
  backdrop-filter: blur(8px);
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
}

.history-item:active {
  transform: scale(0.99);
  border-color: var(--action-wait-bg);
  box-shadow: 0 0 16px var(--accent-glass-glow-subtle);
}

.history-thumb {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  background: var(--glass-fill-light);
  border: 1px solid var(--glass-border-subtle);
  overflow: hidden;
  flex-shrink: 0;
}

.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.history-info-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.history-ticker {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-88);
}

.history-tf {
  font-size: 11px;
  color: var(--text-45);
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--glass-fill-light);
}

/* Action pill — unified color system */
.hist-action-pill {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.hist-pill-buy {
  background: var(--action-buy-bg);
  color: rgba(61,255,181,0.92);
  border: 1px solid var(--action-buy-border);
}
.hist-pill-sell {
  background: var(--action-sell-bg);
  color: rgba(255,77,109,0.92);
  border: 1px solid var(--action-sell-border);
}
.hist-pill-reduce {
  background: var(--action-reduce-bg);
  color: rgba(255,177,74,0.92);
  border: 1px solid var(--action-reduce-border);
}
.hist-pill-hedge {
  background: var(--action-hedge-bg);
  color: rgba(124,77,255,0.92);
  border: 1px solid var(--action-hedge-border);
}
.hist-pill-wait {
  background: var(--action-wait-bg);
  color: rgba(74,163,255,0.85);
  border: 1px solid var(--action-wait-bg);
}

.history-headline {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-55);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.history-headline-mismatch {
  opacity: 0.5;
  font-style: italic;
}

.history-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-time {
  font-size: 11px;
  color: var(--text-35);
}

/* Stats Summary */
.stats-summary {
  display: flex;
  gap: var(--space-sm);
  margin: var(--space-md) 0 var(--space-lg);
  overflow-x: auto;
}

.stats-summary::-webkit-scrollbar { display: none; }

.stat-card {
  flex: 1;
  min-width: 110px;
  background: var(--bg-surface);
  border: 1px solid #FFFFFF08;
  border-radius: var(--radius-card);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.stat-card-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.stat-card-value.success {
  color: var(--bullish);
}

/* What Happened Badge */
.what-happened-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.what-happened-badge.tracking {
  background: var(--accent-glass-bg-strong);
  color: #448AFF;
}

.what-happened-badge.triggered {
  background: rgba(255, 167, 38, 0.15);
  color: #FFA726;
}

.what-happened-badge.target_hit {
  background: rgba(102, 187, 106, 0.15);
  color: #66BB6A;
}

.what-happened-badge.stopped {
  background: rgba(239, 83, 80, 0.15);
  color: #EF5350;
}

.what-happened-badge.expired {
  background: rgba(158, 158, 158, 0.15);
  color: #9E9E9E;
}

.what-happened-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.history-quality-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.history-quality-badge.failed {
  background: rgba(239, 83, 80, 0.16);
  color: #EF5350;
  border: 1px solid rgba(239, 83, 80, 0.4);
}

.history-quality-badge.repaired {
  background: rgba(255, 183, 77, 0.16);
  color: #FFB74D;
  border: 1px solid rgba(255, 183, 77, 0.4);
}

/* History Item Details */
.history-item.expanded {
  cursor: default;
}

.history-details {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid #FFFFFF08;
  display: none;
}

.history-item.expanded .history-details {
  display: block;
}

.history-details-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
  font-size: 13px;
}

.history-details-label {
  color: var(--text-secondary);
}

.history-details-value {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-weight: 600;
}

.history-details-value.positive {
  color: var(--bullish);
}

.history-details-value.negative {
  color: var(--bearish);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-xxl) var(--space-lg);
  gap: var(--space-md);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
}

.empty-state h2 {
  color: var(--text-secondary);
}

.empty-state p {
  color: var(--text-muted);
  font-size: 13px;
}

.empty-state .btn-secondary {
  margin-top: var(--space-md);
  width: auto;
  padding: 0 24px;
}

/* ===== ERROR STATES ===== */

.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
  gap: var(--space-md);
}

.error-state svg {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
}

.error-state.timeout svg {
  color: var(--caution);
}

.error-state h2 {
  font-size: 18px;
  font-weight: 600;
}

.error-state p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 18px;
}

.error-state .btn-primary {
  width: auto;
  padding: 0 32px;
  margin-top: var(--space-sm);
}

/* ===== INFO BAR ===== */

.info-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-surface-raised);
  font-size: 13px;
  color: var(--text-secondary);
  border-radius: var(--radius-small);
  margin-bottom: var(--space-md);
}

.info-bar svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--accent);
}

/* ===== RESULT V2 SCREEN ===== */

/* Action color CSS custom properties */
:root {
  --rv2-enter: #00E5CC;
  --rv2-reduce: #FFB74D;
  --rv2-wait: #64B5F6;
  --rv2-exit: #EF5350;
  --rv2-add: #CE93D8;
  --rv2-hedge: #7C4DFF;
}

/* P1-1: Ambient glow on result screen */
.rv2-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-primary);
  position: relative;
}

.rv2-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 80% 8%, rgba(124,77,255,0.06) 0%, transparent 42%),
    radial-gradient(ellipse at 15% 85%, rgba(0,229,255,0.05) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

.rv2-nav {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px var(--screen-padding);
  background: var(--bg-primary);
}

.rv2-nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.rv2-warning-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #FFA726;
  border: 2px solid var(--bg-primary);
  cursor: pointer;
  padding: 0;
  animation: rv2-dot-pulse 2s ease-in-out infinite;
}

@keyframes rv2-dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.rv2-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.rv2-scroll::-webkit-scrollbar { display: none; }

/* Scroll fade edges */
.rv2-scroll::before,
.rv2-scroll::after {
  content: '';
  position: sticky;
  display: block;
  z-index: 20;
  pointer-events: none;
  flex-shrink: 0;
}
.rv2-scroll::before {
  top: 0;
  height: 0;
  background: linear-gradient(var(--bg-primary), transparent);
}
.rv2-scroll::after {
  bottom: 0;
  height: 8px;
  background: linear-gradient(transparent, var(--bg-primary));
}

.rv2-card {
  padding: 4px var(--screen-padding) 0;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 350ms cubic-bezier(0.16, 1, 0.3, 1), opacity 250ms ease;
}

.rv2-card.visible {
  transform: translateY(0);
  opacity: 1;
}

/* Header */
.rv2-header {
  margin-bottom: var(--space-base);
}

/* Dramatic entrance for result header */
.rv2-card.visible .rv2-header {
  animation: rv2HeaderReveal 500ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes rv2HeaderReveal {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.rv2-action-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.rv2-action-verb {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 2px;
  line-height: 1;
}

/* Action verb solid colors */
.rv2-action-verb.is-buy,
.rv2-action-verb.is-enter,
.rv2-action-verb.is-add {
  color: var(--action-buy-from);
}

.rv2-action-verb.is-sell,
.rv2-action-verb.is-exit {
  color: var(--action-sell-from);
}

.rv2-action-verb.is-wait,
.rv2-action-verb.is-hold {
  color: var(--action-wait-from);
}

.rv2-action-verb.is-reduce {
  color: var(--action-reduce-from);
}

.rv2-action-verb.is-hedge {
  color: var(--action-hedge-from);
}

.rv2-symbol {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Stance directional badge (wait + bullish/bearish only) */
.rv2-stance-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  white-space: nowrap;
  align-self: center;
}

.rv2-stance-badge.bullish {
  color: #3DFFB5;
  background: rgba(61, 255, 181, 0.10);
  border: 1px solid rgba(61, 255, 181, 0.25);
}

.rv2-stance-badge.bearish {
  color: #FF6B6B;
  background: rgba(255, 107, 107, 0.10);
  border: 1px solid rgba(255, 107, 107, 0.25);
}

.rv2-timeframe-badge,
.rv2-horizon-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: var(--glass-border);
  color: var(--text-secondary);
}

.rv2-horizon-badge {
  text-transform: uppercase;
  background: rgba(100, 181, 246, 0.12);
  color: #64B5F6;
}

/* Header tag capsules (own line below action row) */
.rv2-header-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

/* P1-4: Header tag chips — tinted background from currentColor */
.rv2-header-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: color-mix(in srgb, currentColor 12%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07);
  white-space: nowrap;
}

.rv2-header-tag-more {
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--glass-border-subtle);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

/* Tune history nav strip */
.rv2-tune-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  margin-bottom: 4px;
}
.rv2-tune-arrow {
  background: none;
  border: 1px solid var(--glass-border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
}
.rv2-tune-arrow:disabled {
  opacity: 0.25;
  cursor: default;
}
.rv2-tune-arrow:not(:disabled):active {
  background: var(--glass-border-subtle);
}
.rv2-tune-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rv2-tune-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  justify-content: center;
}
.rv2-tune-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--glass-border-subtle);
  transition: background 0.2s;
}
.rv2-tune-dot.active {
  background: var(--accent, #00E5CC);
}

/* One-liner */
.rv2-one-liner {
  font-size: 15px;
  line-height: 22px;
  color: var(--text-primary);
  margin-bottom: var(--space-base);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rv2-one-liner.expandable {
  cursor: pointer;
  user-select: none;
}

.rv2-one-liner.expanded {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

/* Tripwire */
.rv2-tripwire {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bearish-glass-bg);
  border: 1px solid var(--bearish-glass-border);
  border-radius: var(--radius-small);
  margin-bottom: var(--space-base);
}

.rv2-tripwire-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: #EF5350;
  margin-top: 1px;
}

.rv2-tripwire-icon svg {
  width: 16px;
  height: 16px;
}

.rv2-tripwire-text {
  font-size: 13px;
  line-height: 18px;
  color: #EF5350;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rv2-tripwire-text.expanded {
  display: block;
  overflow: visible;
}

.rv2-tripwire.expandable {
  cursor: pointer;
  user-select: none;
}

.rv2-tripwire.expandable::after {
  content: '▾';
  font-size: 11px;
  color: #EF5350;
  opacity: 0.7;
  flex-shrink: 0;
  margin-top: 1px;
  transition: transform 0.2s;
  align-self: flex-start;
}

.rv2-tripwire.expandable.expanded::after {
  transform: rotate(180deg);
}

/* Quality state (failure/repaired) */
.rv2-quality {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: var(--space-base);
  padding: 8px 10px;
  border-radius: var(--radius-small);
  border: 1px solid var(--glass-fill-active);
  background: var(--glass-border-subtle);
}

.rv2-quality-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.rv2-quality-reason {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.rv2-quality-info {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--glass-fill-active);
  background: var(--glass-fill-light);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  margin-top: 1px;
}

.rv2-quality-info svg {
  width: 12px;
  height: 12px;
}

.rv2-quality-hint {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.rv2-quality-failed {
  border-color: rgba(239, 83, 80, 0.45);
  background: rgba(239, 83, 80, 0.08);
}

.rv2-quality-failed .rv2-quality-label {
  color: #EF5350;
}

.rv2-quality-repaired {
  border-color: rgba(255, 183, 77, 0.45);
  background: rgba(255, 183, 77, 0.09);
}

.rv2-quality-repaired .rv2-quality-label {
  color: #FFB74D;
}

/* D2: System status bar — replaces verbose "系统已校正" block for repaired state */
.rv2-status-bar {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--space-base);
  padding: 7px 10px;
  border-radius: var(--radius-small);
  border-left: 2px solid rgba(123,97,255,0.7);
  background: rgba(123,97,255,0.08);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
}

.rv2-status-bar-check {
  font-weight: 700;
  color: #9B8CFF;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

.rv2-status-bar-msg {
  color: var(--text-secondary);
  word-break: break-word;
}

/* Level Chips */
.rv2-levels {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-base);
}

.rv2-level-chip {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-sm) var(--space-xs);
  border-radius: var(--radius-small);
  border: 1px solid var(--glass-fill-active);
  background: var(--bg-surface);
  transition: box-shadow 600ms ease, transform 100ms ease;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.rv2-level-chip:active {
  transform: scale(0.96);
}

/* Copy hint appears briefly after tap */
.rv2-level-copy-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  background: rgba(0,212,255,0.15);
  color: rgba(0,212,255,0.9);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease;
}

.rv2-level-chip.copied .rv2-level-copy-hint {
  opacity: 1;
}

/* Inline copy icon (top-right of chip, only on hover/touch) */
.rv2-level-copy-icon {
  position: absolute;
  top: 4px;
  right: 4px;
  opacity: 0;
  transition: opacity 200ms ease;
  color: var(--text-secondary);
  width: 10px;
  height: 10px;
}

.rv2-level-chip:hover .rv2-level-copy-icon {
  opacity: 0.5;
}

.rv2-level-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
}

.rv2-level-price {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.rv2-level-primary {
  border-color: rgba(100, 181, 246, 0.35);
  box-shadow: 0 0 12px rgba(100, 181, 246, 0.08);
}

.rv2-level-stop {
  border-color: rgba(239, 83, 80, 0.30);
  box-shadow: 0 0 12px rgba(239, 83, 80, 0.08);
}

.rv2-level-target {
  border-color: rgba(102, 187, 106, 0.30);
  box-shadow: 0 0 12px rgba(102, 187, 106, 0.08);
}

.rv2-level-stop .rv2-level-price {
  color: #EF5350;
}

.rv2-level-target .rv2-level-price {
  color: #66BB6A;
}

/* Plan Label */
.rv2-plan-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-35);
  margin-top: var(--space-md);
  margin-bottom: 8px;
}

/* Plan Switch */
.rv2-plan-switch {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.rv2-plan-tab {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-small);
  border: 1px solid var(--glass-fill-active);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
  touch-action: manipulation;
}

.rv2-plan-tab.active {
  color: var(--text-primary);
  background: var(--glass-border-subtle);
}

/* Plan Summary (left bar + fade-in) */
.rv2-plan-summary {
  padding: var(--space-sm) 0 var(--space-sm) var(--space-md);
  margin-bottom: var(--space-sm);
  border-left: 3px solid transparent;
  transition: border-left-color 200ms ease;
}

.rv2-summary-fade {
  animation: rv2SummaryFadeIn 250ms ease-out;
}

@keyframes rv2SummaryFadeIn {
  0% { opacity: 0; transform: translateY(3px); }
  100% { opacity: 1; transform: translateY(0); }
}

.rv2-plan-line1 {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rv2-plan-line2 {
  font-size: 13px;
  line-height: 18px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Tags Row */
.rv2-tags-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-base);
  flex-wrap: wrap;
}

/* P1-4: Tag chips with color-coded severity backgrounds */
.rv2-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  border: 1px solid;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07);
}

/* Tag severity color-coding via data-severity attribute */
.rv2-tag[data-severity="error"] {
  background: rgba(239,83,80,0.10);
  border-color: rgba(239,83,80,0.28);
  color: #EF5350;
}
.rv2-tag[data-severity="warn"] {
  background: rgba(255,167,38,0.10);
  border-color: rgba(255,167,38,0.28);
  color: #FFA726;
}
.rv2-tag[data-severity="info"] {
  background: rgba(120,144,156,0.10);
  border-color: rgba(120,144,156,0.20);
  color: #90A4AE;
}

.rv2-tag-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.rv2-tag-icon svg {
  width: 12px;
  height: 12px;
}

.rv2-tag-more {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--glass-border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

/* Coach Card */
.rv2-coach {
  background: linear-gradient(135deg, var(--accent-glass-bg), var(--bg-surface));
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-card);
  padding: var(--space-md);
  margin-bottom: var(--space-base);
}

.rv2-coach-question {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.rv2-coach-options {
  display: flex;
  flex-direction: row;
  gap: var(--space-sm);
}

.rv2-coach-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-small);
  border: 1px solid var(--glass-fill-active);
  background: var(--glass-fill-light);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
  touch-action: manipulation;
  gap: 3px;
}

.rv2-coach-btn:active {
  background: var(--glass-fill-active);
  transform: scale(0.98);
}

.rv2-coach-btn-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  text-align: center;
}

/* Subtitle / effect line: left-aligned under the label */
.rv2-coach-btn-effect {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.3;
  text-align: left;
}

/* Debug hidden by default (dev-mode: long-press disclaimer to reveal) */
.rv2-debug-hidden {
  display: none !important;
}

.rv2-coach-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.rv2-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: rv2-spin 0.8s linear infinite;
}

@keyframes rv2-spin {
  to { transform: rotate(360deg); }
}

/* CTA Row */
.rv2-cta-row {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  padding-top: var(--space-sm);
}

.rv2-cta-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-radius: var(--radius-small);
  border: 1px solid var(--glass-fill-active);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
  touch-action: manipulation;
}

.rv2-cta-btn:active {
  background: var(--glass-border);
  transform: scale(0.98);
}

.rv2-cta-btn svg {
  width: 18px;
  height: 18px;
}

/* Below the fold sections */
.rv2-below-fold {
  border-top: 1px solid var(--glass-border-subtle);
  padding-top: var(--space-lg);
}

.rv2-section {
  border-bottom: 1px solid var(--glass-border-subtle);
  border-top: none;
  padding: var(--space-sm) 0;
}

.rv2-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.rv2-section-header .expandable-chevron {
  transition: transform 200ms ease;
}

.rv2-section.open .rv2-section-header .expandable-chevron {
  transform: rotate(180deg);
}

.rv2-section-body {
  display: none;
  padding-bottom: var(--space-md);
}

.rv2-section.open .rv2-section-body {
  display: block;
}

.rv2-exec-step {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.rv2-exec-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--glass-border);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.rv2-exec-step-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}

.rv2-exec-detail {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-primary);
}

.rv2-invalidation {
  font-size: 13px;
  color: #EF5350;
  padding: var(--space-sm) 0;
  margin-top: var(--space-sm);
  border-top: 1px solid var(--glass-border-subtle);
}

.rv2-reversal {
  font-size: 13px;
  color: #66BB6A;
  padding: var(--space-sm) 0;
}

.rv2-plan-detail-trigger {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

/* Evidence */
.rv2-evidence-item {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  padding: var(--space-sm) 0;
}

.rv2-evidence-marker {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.rv2-evidence-marker.pro { background: #66BB6A; }
.rv2-evidence-marker.con { background: #EF5350; }

.rv2-evidence-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.rv2-evidence-detail {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 17px;
}

/* Disclaimer */
.rv2-disclaimer {
  font-size: 11px;
  line-height: 16px;
  color: var(--text-muted);
  padding: var(--space-md) 0;
}

/* Debug */
.rv2-debug-pre {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 14px;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
}

/* Why This Decision — rationale signals */
.rv2-chain-signal {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.rv2-chain-signal:last-child {
  border-bottom: none;
}
.rv2-chain-signal-dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent, #6366f1);
  margin-top: 7px;
}

/* Sheet / Bottom Sheet */
.rv2-sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.rv2-sheet {
  width: 100%;
  max-width: 420px;
  max-height: 60vh;
  background: var(--bg-surface);
  border-radius: 16px 16px 0 0;
  padding: var(--space-sm) var(--screen-padding) var(--space-xl);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.rv2-sheet-body {
  padding-top: var(--space-md);
}

.rv2-sheet-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.rv2-sheet-tag {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--glass-border-subtle);
  font-size: 14px;
  font-weight: 500;
  /* P1-4: Colored left accent bar via currentColor */
  padding-left: var(--space-sm);
  border-left: 2px solid color-mix(in srgb, currentColor 40%, transparent);
}

.rv2-tag-severity {
  margin-left: auto;
  font-size: 11px;
  text-transform: uppercase;
  opacity: 0.6;
}

.rv2-partial-item {
  font-size: 14px;
  color: var(--text-secondary);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--glass-border-subtle);
}

/* Glow pulse animation for diff highlights */
.rv2-glow-pulse {
  animation: rv2GlowPulse 600ms ease-out 1;
}

@keyframes rv2GlowPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(68, 138, 255, 0.6);
  }
  50% {
    box-shadow: 0 0 12px 4px rgba(68, 138, 255, 0.4);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(68, 138, 255, 0);
  }
}

/* Trade horizon chips (recognition screen) */
.rv2-horizon-chips {
  display: flex;
  gap: var(--space-sm);
}

.rv2-horizon-chips .chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glass-bg-medium);
}

.horizon-conflict-hint {
  font-size: 12px;
  color: #FFA726;
  margin-top: 6px;
  display: none;
}

.horizon-conflict-hint.visible {
  display: block;
}

.preference-section.hidden {
  display: none;
}

/* ── Mobile Safe-Area Fixes ── */
/* Applies to real touch devices; eliminates the 44px simulated-status-bar gap */
html.touch-device .app-container {
  top: 0 !important;
  bottom: 0 !important;
}
html.touch-device.standalone-mode .home-header {
  padding-top: calc(var(--space-sm) + env(safe-area-inset-top, 0px));
}
html.touch-device.standalone-mode .nav-bar {
  padding-top: calc(var(--space-sm) + env(safe-area-inset-top, 0px));
  height: calc(48px + env(safe-area-inset-top, 0px));
  box-sizing: border-box;
}
html.touch-device.standalone-mode .rv2-nav {
  padding-top: calc(4px + env(safe-area-inset-top, 0px));
}

@media (max-width: 499px), (hover: none) and (pointer: coarse) {
  .app-container {
    top: 0 !important;
    bottom: 0 !important;
  }
  /* Push screen headers below the OS status bar */
  html.standalone-mode .home-header {
    padding-top: calc(var(--space-sm) + env(safe-area-inset-top, 0px));
  }
  html.standalone-mode .nav-bar {
    padding-top: calc(var(--space-sm) + env(safe-area-inset-top, 0px));
    height: calc(48px + env(safe-area-inset-top, 0px));
    box-sizing: border-box;
  }
  html.standalone-mode .rv2-nav {
    padding-top: calc(4px + env(safe-area-inset-top, 0px));
  }
}

/* ===== SETTINGS SCREEN ===== */

.settings-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-base);
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px var(--screen-padding);
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border-subtle);
}

.settings-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.settings-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px var(--screen-padding) 32px;
}

.settings-section {
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-subtle);
}

.settings-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.settings-section-desc {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.settings-field {
  margin-bottom: 12px;
}

.settings-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
}

.settings-seg {
  display: flex;
  gap: 0;
  background: var(--bg-base);
  border-radius: 8px;
  padding: 2px;
  border: 1px solid var(--border-subtle);
}

.settings-seg-btn {
  flex: 1;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.settings-seg-btn.active {
  background: var(--accent-primary);
  color: #000;
  font-weight: 600;
}

.settings-key-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.settings-input {
  flex: 1;
  padding: 10px 12px;
  font-size: 13px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: 'IBM Plex Mono', monospace;
}

.settings-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.settings-eye-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-tertiary);
  cursor: pointer;
}

.settings-eye-btn svg {
  width: 16px;
  height: 16px;
}

.settings-help-link {
  font-size: 11px;
  color: var(--accent-primary);
  text-decoration: none;
  margin-top: 4px;
  display: inline-block;
}

.settings-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.settings-btn {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
}

.settings-btn-primary {
  background: var(--accent-primary);
  color: #000;
}

.settings-btn-test {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.settings-btn-danger {
  background: transparent;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 400;
}

.settings-note {
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.settings-note p {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.5;
  margin: 0;
}

/* ===== ACCOUNT SCREEN ===== */

.account-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-base);
}

.account-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px var(--screen-padding);
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border-subtle);
}

.account-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.account-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px var(--screen-padding) 32px;
}

.account-loading {
  text-align: center;
  color: var(--text-tertiary);
  padding: 40px 0;
}

.account-guest {
  text-align: center;
  padding: 40px 16px;
}

.account-guest-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--text-tertiary);
}

.account-guest-icon svg {
  width: 48px;
  height: 48px;
}

.account-guest-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.account-tier-card {
  padding: 20px 16px;
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-subtle);
  margin-bottom: 16px;
  text-align: center;
}

.account-tier-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.account-tier-badge.tier-free {
  background: rgba(100, 181, 246, 0.15);
  color: #64B5F6;
}

.account-tier-badge.tier-byok {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.account-tier-badge.tier-prepaid {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.account-tier-desc {
  font-size: 12px;
  color: var(--text-tertiary);
}

.account-usage {
  padding: 16px;
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.account-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.account-usage-bar {
  height: 6px;
  background: var(--bg-base);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.account-usage-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 3px;
  transition: width 0.3s;
}

.account-usage-text {
  font-size: 12px;
  color: var(--text-tertiary);
}

.account-prepaid-remaining {
  font-size: 12px;
  color: var(--accent-primary);
  margin-top: 4px;
}

.account-packs {
  margin-bottom: 16px;
}

.account-pack-card {
  padding: 12px;
  background: var(--bg-surface);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.account-pack-type {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.account-pack-credits {
  font-size: 13px;
  color: var(--accent-primary);
  font-family: 'IBM Plex Mono', monospace;
}

.account-pack-expires {
  font-size: 11px;
  color: var(--text-tertiary);
}

.account-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}

.account-btn {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
}

.account-btn-primary {
  background: var(--accent-primary);
  color: #000;
}

.account-btn-settings {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.account-btn-logout {
  background: transparent;
  color: var(--text-tertiary);
  font-weight: 400;
}

.account-error {
  text-align: center;
  color: #EF5350;
  padding: 20px;
}

/* ===== AUTH SCREEN ===== */

.auth-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-base);
}

.auth-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px var(--screen-padding);
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border-subtle);
}

.auth-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.auth-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px var(--screen-padding);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
}

.auth-brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-primary);
}

.auth-brand-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.auth-form {
  width: 100%;
  max-width: 320px;
}

.auth-field {
  margin-bottom: 16px;
}

.auth-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
}

.auth-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-primary);
  box-sizing: border-box;
}

.auth-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.auth-error {
  padding: 10px 12px;
  background: rgba(239, 83, 80, 0.1);
  border: 1px solid rgba(239, 83, 80, 0.3);
  border-radius: 8px;
  color: #EF5350;
  font-size: 13px;
  margin-bottom: 12px;
}

.auth-btn {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
}

.auth-btn-primary {
  background: var(--accent-primary);
  color: #000;
  margin-bottom: 8px;
}

.auth-btn-social {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin: 20px 0;
  color: var(--text-tertiary);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.auth-social {
  width: 100%;
  max-width: 320px;
}

.auth-switch {
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-tertiary);
  display: flex;
  gap: 4px;
  align-items: center;
}

.auth-switch-btn {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
