/* ============================================================
   US Senate AI Simulator — Styles
   美国参议院 AI 模拟器 — 样式表
   ============================================================ */

/* === CSS 自定义属性（全局颜色主题变量） === */
:root {
  /* 背景色系列：从深到浅 */
  --bg-dark: #0a0e1a;        /* 页面最深背景色 */
  --bg-panel: #111827;       /* 面板背景色 */
  --bg-card: #1e293b;        /* 卡片背景色 */
  --border: #2d3748;         /* 通用边框颜色 */

  /* 文字颜色：主要、次要、弱化 */
  --text-primary: #e2e8f0;   /* 主要文字，最亮 */
  --text-secondary: #94a3b8; /* 次要文字 */
  --text-muted: #64748b;     /* 弱化/辅助文字 */

  /* 党派颜色 */
  --red-party: #ef4444;      /* 共和党红色 */
  --blue-party: #3b82f6;     /* 民主党蓝色 */
  --independent: #a855f7;    /* 独立派紫色 */

  /* 投票状态颜色 */
  --yea-green: #22c55e;      /* 赞成票绿色 */
  --nay-red: #ef4444;        /* 反对票红色（与州态势反对色统一） */
  --present-yellow: #eab308; /* 出席/弃权黄色 */

  /* 特殊强调色 */
  --whisper-amber: #f59e0b;  /* 密谈/耳语琥珀色 */
  --accent-gold: #fbbf24;    /* 金色强调 */
  --accent-cyan: #06b6d4;    /* 青色强调（主操作色） */

  /* 发光效果（半透明） */
  --glow-blue: rgba(59, 130, 246, 0.3);  /* 蓝色光晕 */
  --glow-red: rgba(239, 68, 68, 0.3);    /* 红色光晕 */
}

/* 全局重置：清除默认外边距、内边距，使用border-box盒模型 */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* 页面基础样式 */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background 0.5s ease;
}

body[data-stage="OPENING"] {
  background: radial-gradient(circle at 20% 10%, #15264a, #0a0e1a 55%);
}
body[data-stage="DEBATE"] {
  background: radial-gradient(circle at 20% 10%, #3a2512, #0a0e1a 55%);
}
body[data-stage="VOTING"] {
  background: radial-gradient(circle at 20% 10%, #112331, #020617 55%);
}

/* ---- TOP OVERVIEW BAR ---- */

#overview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  background: linear-gradient(135deg, #1a1f3a, #0f172a);
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-shrink: 0;
}

#topic-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-gold);
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#stage-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--accent-cyan);
  color: #000;
}

/* 拔河进度条 — 内嵌到顶栏中间 */
#vote-bar-inline {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#vote-bar-inline.last-ten {
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.55);
  border-color: rgba(251, 191, 36, 0.8);
}

body.suspense-mode #vote-bar-inline.last-ten {
  box-shadow: 0 0 24px rgba(251, 191, 36, 0.9);
  animation: suspensePulse 1.2s ease-in-out infinite;
}

.tug-of-war {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 500px;
}

.tug-side {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 60px;
}

.tug-side.tug-yea { justify-content: flex-end; }
.tug-side.tug-nay { justify-content: flex-start; }

.tug-emoji { font-size: 1rem; }

.tug-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.tug-yea .tug-label { color: var(--blue-party); }
.tug-nay .tug-label { color: var(--nay-red); }

.tug-count {
  font-size: 1.1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.tug-yea .tug-count { color: var(--blue-party); }
.tug-nay .tug-count { color: var(--nay-red); }

.tug-track {
  flex: 1;
  position: relative;
  height: 28px;
}

.tug-rope {
  position: relative;
  width: 100%;
  height: 12px;
  top: 8px;
  background: repeating-linear-gradient(
    90deg, #4a5568 0px, #4a5568 8px, #2d3748 8px, #2d3748 12px
  );
  border-radius: 6px;
  overflow: visible;
  display: flex;
}

.tug-fill-yea {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-party), #60a5fa);
  border-radius: 6px 0 0 6px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px var(--glow-blue);
}

.tug-fill-nay {
  height: 100%;
  background: linear-gradient(270deg, var(--nay-red), #f87171);
  border-radius: 0 6px 6px 0;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px var(--glow-red);
  margin-left: auto;
}

.tug-flag {
  position: absolute;
  top: -6px;
  font-size: 1.2rem;
  transition: left 1s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
  filter: drop-shadow(0 0 4px rgba(255,255,255,0.5));
}

.tug-center-mark {
  position: absolute;
  left: 50%;
  top: 4px;
  width: 2px;
  height: 20px;
  background: var(--text-muted);
  opacity: 0.4;
  transform: translateX(-50%);
}

.tug-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 2px;
  font-style: italic;
}

@keyframes tugPull {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

.tug-rope.pulling {
  animation: tugPull 0.3s ease;
}

@keyframes suspensePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.metrics {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.metric-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

#causal-feed {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.75) rgba(15, 23, 42, 0.35);
  padding: 6px 24px 8px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(10, 14, 26, 0.95));
  border-bottom: 1px solid var(--border);
  min-height: 48px;
}

#causal-feed::-webkit-scrollbar {
  width: 3px;
  height: 3px;
}

#causal-feed::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.35);
}

#causal-feed::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.75);
  border-radius: 6px;
}

.causal-card {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
  max-width: 360px;
  padding: 7px 10px;
  border-radius: 8px;
  border-left: 3px solid #64748b;
  background: rgba(30, 41, 59, 0.92);
  animation: causalSlideIn 0.22s ease;
}

.causal-card .title {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.causal-card .detail {
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.causal-card.support { border-left-color: var(--yea-green); }
.causal-card.oppose { border-left-color: var(--nay-red); }
.causal-card.neutral { border-left-color: var(--accent-cyan); }

@keyframes causalSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- MAIN LAYOUT ---- */

#main-container {
  display: grid;
  grid-template-columns: 1fr 400px;
  grid-template-rows: 1fr 380px;
  flex: 1;
  min-height: 0;
  gap: 1px;
  background: var(--border);
}

/* ---- LEFT UPPER: DEBATE AREA ---- */

#debate-area {
  background: var(--bg-panel);
  overflow: hidden;
  padding: 0;
  grid-column: 1;
  position: relative;
  display: flex;
  flex-direction: column;
}

#speeches-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 8px;
}

.speech-entry {
  display: flex;
  gap: 12px;
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: var(--bg-card);
  border-left: 3px solid var(--border);
  animation: slideIn 0.3s ease;
}

.speech-entry.active {
  box-shadow: 0 0 12px var(--glow-blue);
}

.speech-entry.presider,
.speech-entry.user {
  border-left-color: #94a3b8;
  background: linear-gradient(135deg, #1e293b, #172033);
}

.speech-entry.democratic { border-left-color: var(--blue-party); }
.speech-entry.republican { border-left-color: var(--red-party); }
.speech-entry.independent { border-left-color: var(--independent); }

.speech-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
}

.speech-avatar.democratic { background: var(--glow-blue); color: var(--blue-party); }
.speech-avatar.republican { background: var(--glow-red); color: var(--red-party); }
.speech-avatar.presider,
.speech-avatar.user { background: rgba(148, 163, 184, 0.25); color: #cbd5e1; }

.speech-content {
  flex: 1;
  min-width: 0;
}

.speech-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.speech-stance {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  border: 1px solid transparent;
}
.speech-stance.stance-support {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.28);
}
.speech-stance.stance-oppose {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.28);
}
.speech-stance.stance-neutral {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.16);
  border-color: rgba(148, 163, 184, 0.26);
}

.speech-role {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-style: italic;
}

.speech-text {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.speech-mention {
  color: #fbbf24;
  font-weight: 700;
  background: rgba(251, 191, 36, 0.14);
  border-radius: 4px;
  padding: 0 2px;
}

.speech-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ---- LEFT LOWER: SENATE CHAMBER ---- */

#chamber-area {
  background: var(--bg-panel);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  grid-column: 1;
}

#chamber-visuals {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;

  min-height: 300px;
}

#state-heat-panel {
  flex: 0 0 30%;
  width: 30%;
  min-width: 260px;
  padding: 2px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.heatmap-frame {
  width: 100%;
  min-height: 238px;
  max-height: 238px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#state-heatmap {
  width: 100%;
  height: 100%;
  max-height: 238px;
  display: block;
  margin: 0 auto;
}

#state-heatmap path.state-path {
  stroke: rgba(15, 23, 42, 0.7);
  stroke-width: 1;
  stroke-linejoin: round;
  cursor: pointer;
  transition: fill 0.2s, stroke 0.15s, stroke-width 0.15s;
}
#state-heatmap path.state-path:hover {
  stroke: #fbbf24;
  stroke-width: 2;
  filter: brightness(1.25);
}

.panel-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin: 2px 0 6px;
}
#state-heat-panel .panel-title,
#relationship-network .panel-title {
  width: 100%;
  text-align: center;
}

.heat-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.legend-dot.heat-support { background: #22c55e; }
.legend-dot.heat-oppose { background: #ef4444; }
.legend-dot.heat-swing { background: #475569; }


#chamber-area h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* 席位图容器 — 增高到280px */
#senate-seats {
  position: relative;
  width: 40%;
  max-width: none;
  min-width: 340px;
  height: 300px;
  flex: 0 0 40%;
  margin: 0 auto;
}

/* 单个座位 — SVG人形图标尺寸 */
.seat {
  position: absolute;
  width: 14px;
  height: 18px;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.3s ease, left 0.6s ease, top 0.6s ease;
}

.seat:hover {
  transform: scale(1.8);
  z-index: 10;
}

.seat.speaking {
  z-index: 20;
  filter: drop-shadow(0 0 8px var(--accent-gold));
}

.seat.democratic { color: var(--blue-party); }
.seat.republican { color: var(--red-party); }
.seat.independent { color: var(--independent); }

.seat.key-senator svg { filter: drop-shadow(0 0 4px var(--accent-gold)); }

.seat.voted-yea svg path { fill: var(--yea-green) !important; }
.seat.voted-nay svg path { fill: var(--nay-red) !important; }
.seat.voted-present svg path { fill: var(--present-yellow) !important; }
.seat.voted-yea, .seat.voted-nay, .seat.voted-present {
  transform: scale(1.25);
  z-index: 3;
}

.seat-tooltip {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 0.8rem;
  max-width: 250px;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  pointer-events: none;
  display: none;
}

.seat-tooltip.visible { display: block; }

.tooltip-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.tooltip-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* ---- CHAMBER LEGEND ---- */

#chamber-legend {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
}

.legend-dot.democratic { background: var(--blue-party); }
.legend-dot.republican { background: var(--red-party); }
.legend-dot.independent { background: var(--independent); }
.legend-dot.key-senator-dot { background: var(--bg-card); border: 2px solid var(--accent-gold); box-shadow: 0 0 4px var(--accent-gold); }
.legend-dot.voted-yea-dot { background: var(--yea-green); }
.legend-dot.voted-nay-dot { background: var(--nay-red); }
.legend-dot.voted-present-dot { background: var(--present-yellow); }

/* ---- RIGHT PANEL: Three independent sections ---- */

#right-panel {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--bg-panel);
  grid-column: 2;
  grid-row: 1 / 3;
}

#news-area {
  max-height: 320px;
  overflow-y: auto;
  flex-shrink: 0;
  padding: 12px;
}

#news-area h3,
#crowd-area h3,
#whisper-area h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#crowd-area {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  padding: 8px;
}

#whisper-area {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  padding: 8px;
}

.news-card {
  background: var(--bg-card);
  border-radius: 6px;
  padding: 8px;
  border-left: 3px solid var(--text-muted);
  font-size: 0.8rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  text-align: left;
  gap: 8px;
}

.news-card.pro { border-left-color: var(--yea-green); }
.news-card.con { border-left-color: var(--nay-red); }
.news-card.neutral { border-left-color: var(--accent-cyan); }

.news-source {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0;
  text-align: left;
}

.news-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
  overflow: hidden;
}

.news-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}

.news-icon-fallback {
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.news-body {
  flex: 1;
  min-width: 0;
}

.news-title {
  font-weight: 600;
  margin-bottom: 2px;
  font-size: 0.75rem;
}

.news-stance {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
}

.news-stance.pro { background: rgba(34,197,94,0.2); color: var(--yea-green); }
.news-stance.con { background: rgba(239,68,68,0.2); color: var(--nay-red); }
.news-stance.neutral { background: rgba(6,182,212,0.2); color: var(--accent-cyan); }

a.news-card {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
a.news-card:hover {
  background: var(--border);
  transform: translateY(-1px);
  transition: all 0.2s;
}


.crowd-comment {
  padding: 6px 10px;
  margin-bottom: 4px;
  border-radius: 6px;
  font-size: 0.8rem;
  background: var(--bg-card);
  animation: fadeIn 0.3s ease;
}

.crowd-comment .commenter {
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--accent-cyan);
}

.crowd-mood-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.66rem;
  color: #0f172a;
  background: #fbbf24;
  margin-right: 4px;
  vertical-align: middle;
}

.crowd-comment.mood-shift {
  background: linear-gradient(135deg, #1e293b, #1a2038);
  border-left: 2px solid var(--independent);
  font-style: italic;
  color: var(--text-muted);
}

.whisper-entry {
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 6px;
  background: linear-gradient(135deg, #1f1a0e, #1e293b);
  border-left: 3px solid var(--whisper-amber);
  font-size: 0.8rem;
  animation: whisperSlide 0.4s ease;
}

.whisper-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.whisper-parties {
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--whisper-amber);
}

.whisper-status {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
}

.whisper-status.probing { background: rgba(245,158,11,0.2); color: var(--whisper-amber); }
.whisper-status.pressuring { background: rgba(239,68,68,0.2); color: var(--nay-red); }
.whisper-status.negotiating { background: rgba(34,197,94,0.2); color: var(--yea-green); }
.whisper-status.accepted { background: rgba(34,197,94,0.3); color: var(--yea-green); }
.whisper-status.rejected { background: rgba(239,68,68,0.3); color: var(--nay-red); }
.whisper-status.undecided { background: rgba(148,163,184,0.2); color: var(--text-secondary); }

.whisper-summary {
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.4;
}

.whisper-icon {
  display: inline-block;
  animation: blink 1.5s infinite;
  margin-right: 4px;
}

/* ---- BOTTOM INPUT BAR ---- */

#input-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 24px;
  background: linear-gradient(135deg, #1a1f3a, #0f172a);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  width: 100%;
}

#topic-input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

#topic-input:focus {
  border-color: var(--accent-cyan);
}

#topic-input::placeholder {
  color: var(--text-muted);
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary:hover { background: #22d3ee; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- RATE LIMIT DISPLAY ---- */

.rate-limit-display {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.rate-limit-display.warning {
  color: var(--whisper-amber);
  border-color: var(--whisper-amber);
  background: rgba(245, 158, 11, 0.1);
}

.rate-limit-display.exhausted {
  color: var(--nay-red);
  border-color: var(--nay-red);
  background: rgba(239, 68, 68, 0.1);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); color: var(--text-primary); }

/* ---- PODIUM (演讲桌) ---- */

#podium {
  position: absolute;
  bottom: 10px;
  z-index: 3;
}

/* ---- DANMAKU BUTTON ACTIVE STATE ---- */

#danmaku-btn.active {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
}

/* ---- NEWS GRID LAYOUT ---- */

#news-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

/* ---- ANIMATIONS ---- */

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes whisperSlide {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes seatGlow {
  0% { box-shadow: 0 0 2px currentColor; }
  50% { box-shadow: 0 0 10px currentColor; }
  100% { box-shadow: 0 0 2px currentColor; }
}

.seat.voting {
  animation: seatGlow 1s infinite;
}

@keyframes rollCallFlash {
  0% { filter: drop-shadow(0 0 0 rgba(251, 191, 36, 0)); transform: scale(1); }
  35% { filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.95)); transform: scale(1.6); }
  100% { filter: drop-shadow(0 0 3px rgba(251, 191, 36, 0.3)); transform: scale(1.25); }
}

.seat.rollcall-flash {
  animation: rollCallFlash 0.48s ease;
}

/* ---- TYPEWRITER EFFECT ---- */
.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--accent-gold);
  animation: typing 0.05s steps(1);
}

/* ---- LOADING STATE ---- */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--text-muted);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-panel); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- LANGUAGE TOGGLE (inline in input bar) ---- */
#lang-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
}

.lang-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn.active {
  background: var(--accent-cyan);
  color: #000;
}

/* ---- DANMAKU (弹幕) ---- */

#danmaku-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
  overflow: hidden;
}

#danmaku-container.hidden {
  display: none;
}

.danmaku-item {
  position: absolute;
  white-space: nowrap;
  font-size: 1rem;
  font-weight: 600;
  opacity: 0.75;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
  animation: danmakuFloat 8s linear forwards;
}

@keyframes danmakuFloat {
  from { transform: translateX(100vw); }
  to { transform: translateX(-100%); }
}

/* ---- WHISPER LINES ---- */

.whisper-line {
  fill: none;
  stroke: var(--whisper-amber);
  stroke-width: 2;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: whisperDash 1.5s ease forwards;
  opacity: 0.6;
}

@keyframes whisperDash {
  to { stroke-dashoffset: 0; }
}

/* ---- AVATAR STYLES ---- */

.speech-avatar-img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid transparent;
}

.speech-avatar-img.democratic { border-color: var(--blue-party); }
.speech-avatar-img.republican { border-color: var(--red-party); }
.speech-avatar-img.independent { border-color: var(--independent); }
.speech-avatar-img.presider,
.speech-avatar-img.user { border-color: #94a3b8; }

.inline-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 4px;
}

.danmaku-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 4px;
}

/* ---- NEWS LOADING OVERLAY ---- */

.news-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(3px);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
}

.news-loading-overlay.hidden {
  display: none;
}

.news-loading-card {
  min-width: 320px;
  max-width: 520px;
  background: linear-gradient(135deg, #0f172a, #1f2937);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.news-loading-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid rgba(148, 163, 184, 0.25);
  border-top-color: var(--accent-cyan);
  margin: 0 auto 14px;
  animation: spin 0.9s linear infinite;
}

#news-loading-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 8px;
}

#news-loading-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.45;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  #main-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  #chamber-visuals {
    flex-direction: column;
  }
  #state-heat-panel {
    width: 100%;
    min-width: 0;
  }
  #senate-seats {
    width: 100%;
    min-width: 0;
  }
  #relationship-network {
    width: 100%;
    min-width: 0;
  }
  #overview-bar { flex-wrap: wrap; }
  #input-bar { flex-wrap: wrap; }
}

/* ---- MODAL OVERLAY ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.history-modal-card {
  width: 680px;
  max-width: 95vw;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 12px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.modal-search {
  padding: 12px 24px;
}

.history-toolbar {
  display: flex;
  gap: 8px;
}

.modal-search input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
}

#history-sort-select {
  width: 140px;
  padding: 10px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.84rem;
}

.modal-search input:focus {
  border-color: var(--accent-cyan);
}

/* ---- HISTORY LIST ---- */

.history-list {
  overflow-y: auto;
  padding: 0 24px 18px;
  flex: 1;
  min-height: 200px;
  max-height: 55vh;
}

.history-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
  font-size: 0.9rem;
}

.history-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
  font-size: 0.9rem;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: var(--bg-card);
  border-left: 3px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.history-item:hover {
  background: var(--border);
  transform: translateX(4px);
}

.history-item.passed {
  border-left-color: var(--yea-green);
}

.history-item.failed {
  border-left-color: var(--nay-red);
}

.history-item-info {
  flex: 1;
  min-width: 0;
}

.history-item-topic {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-item-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.history-item-badge {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.history-item-badge.passed {
  background: rgba(34, 197, 94, 0.2);
  color: var(--yea-green);
}

.history-item-badge.failed {
  background: rgba(239, 68, 68, 0.2);
  color: var(--nay-red);
}

.history-item-tally {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ---- CACHE HIT MODAL ---- */

.cache-hit-card {
  width: 420px;
  max-width: 90vw;
  padding: 28px 24px;
  text-align: center;
}

.cache-hit-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.cache-hit-message {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.cache-hit-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ---- REPLAY PROGRESS BAR ---- */

.replay-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 24px;
  background: linear-gradient(135deg, #1a2a1a, #0f172a);
  border-bottom: 1px solid var(--yea-green);
  font-size: 0.85rem;
  color: var(--yea-green);
}

.replay-banner .replay-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.replay-banner .replay-topic {
  flex: 1;
  color: var(--accent-gold);
  font-weight: 600;
}

.replay-banner .replay-close {
  background: none;
  border: 1px solid var(--yea-green);
  color: var(--yea-green);
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.replay-banner .replay-close:hover {
  background: rgba(34, 197, 94, 0.2);
}

/* ---- SKELETON / STREAMING SPEECH ---- */

@keyframes skeletonPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.speech-entry.skeleton {
  border-left-color: var(--text-muted);
}

.speech-entry.skeleton .speech-text {
  color: var(--text-muted);
  font-style: italic;
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

.speech-entry.streaming .speech-text {
  border-right: 2px solid var(--accent-gold);
  animation: none;
}

.speech-entry.streaming .speech-text.stream-done {
  border-right: none;
}

/* ---- ROLE SELECTION MODAL ---- */

.role-select-card {
  width: 560px;
  max-width: 95vw;
  padding: 32px 28px;
  text-align: center;
}

.role-select-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 8px;
}

.role-select-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.role-cards {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-bottom: 20px;
}

.role-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 18px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  min-width: 140px;
}

.role-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.2);
}

.role-icon {
  font-size: 2rem;
}

.role-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.role-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.role-card.role-senator:hover { border-color: var(--blue-party); }
.role-card.role-crowd:hover { border-color: var(--independent); }

.role-skip {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: underline;
  transition: color 0.2s;
}

.role-skip:hover {
  color: var(--text-primary);
}

/* ---- USER SPEECH MODAL ---- */

.user-speech-card {
  width: 480px;
  max-width: 95vw;
  padding: 28px 24px;
  text-align: center;
}

.user-speech-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 10px;
}

.user-speech-countdown {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-cyan);
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}

.user-speech-options {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  text-align: left;
}

.user-speech-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
}

.user-speech-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.9rem;
  resize: vertical;
  outline: none;
  margin-bottom: 14px;
  font-family: inherit;
}

.user-speech-input:focus {
  border-color: var(--accent-cyan);
}

.user-speech-counter {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-align: right;
}

.user-speech-counter.over-limit {
  color: var(--nay-red);
  font-weight: 700;
}

.user-speech-limit-tip {
  min-height: 1.1rem;
  margin-top: 4px;
  font-size: 0.76rem;
  color: var(--nay-red);
}

.user-speech-submit {
  width: 100%;
}

/* ---- AUDIENCE VOTE MODAL ---- */

.audience-vote-card {
  width: 400px;
  max-width: 90vw;
  padding: 32px 24px;
  text-align: center;
}

.audience-vote-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 6px;
}

.audience-vote-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.audience-vote-countdown {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent-cyan);
  margin-bottom: 20px;
  font-variant-numeric: tabular-nums;
}

.audience-vote-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.btn-vote {
  padding: 18px 40px;
  border: none;
  border-radius: 12px;
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 2px;
}

.btn-vote-yea {
  background: linear-gradient(135deg, var(--yea-green), #16a34a);
  color: #fff;
}

.btn-vote-yea:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
}

.btn-vote-nay {
  background: linear-gradient(135deg, var(--nay-red), #dc2626);
  color: #fff;
}

.btn-vote-nay:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(249, 115, 22, 0.4);
}

/* ---- RELATIONSHIP NETWORK ---- */

#relationship-network {
  width: 30%;
  min-width: 250px;
  flex-shrink: 0;
  padding: 2px 4px;
  transition: opacity 0.5s ease;
}

#relationship-network.hidden {
  display: none;
}

#relationship-svg {
  width: 100%;
  height: 300px;
  display: block;
}

.relationship-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.rel-nav-btn {
  min-width: 28px;
  padding: 2px 8px;
}

.relationship-explain {
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  min-height: 18px;
  text-align: center;
}

.rel-edge {
  fill: none;
  transition: stroke-width 0.3s, opacity 0.3s;
}

.rel-edge.ally { stroke: var(--yea-green); }
.rel-edge.opponent { stroke: var(--nay-red); }
.rel-edge.negotiating { stroke: var(--present-yellow); }

@keyframes edgePulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.rel-edge.pulsing {
  animation: edgePulse 1s ease-in-out infinite;
}

.rel-edge.latest {
  opacity: 1;
  stroke-width: 4.5;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.35));
  animation: edgePulse 0.65s ease-in-out 3;
}

.rel-node {
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.rel-node.latest {
  transform-box: fill-box;
  transform-origin: center;
  animation: relationshipNodePop 0.8s ease 2;
}

.rel-node-label {
  font-size: 8px;
  fill: var(--text-secondary);
  text-anchor: middle;
  pointer-events: none;
}

.rel-node-label.latest {
  fill: #f8fafc;
  animation: edgePulse 0.8s ease 2;
}

.rel-edge.dimmed { opacity: 0.15; }
.rel-node.dimmed { opacity: 0.35; }

@keyframes relationshipNodePop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.16); }
}

/* ---- FINAL RESULT MODAL ---- */
.final-result-card {
  width: min(560px, 90vw);
  text-align: center;
  padding: 30px 24px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: linear-gradient(145deg, #0f172a, #111827);
}
.final-result-badge {
  font-size: 0.85rem;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.final-result-title {
  font-size: clamp(2rem, 5vw, 3.1rem);
  font-weight: 900;
  line-height: 1.12;
  color: var(--accent-gold);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.final-result-title.pass { color: var(--yea-green); }
.final-result-title.fail { color: var(--nay-red); }
.final-result-tally {
  font-size: clamp(1rem, 2vw, 1.3rem);
  color: var(--text-primary);
  margin-bottom: 20px;
  font-variant-numeric: tabular-nums;
}
.final-result-close {
  min-width: 130px;
}

/* ---- B7: SITE LOGO ---- */
.site-logo {
  height: 42px;
  margin-right: 8px;
  flex-shrink: 0;
}

/* ---- B5: INPUT WRAPPER (rate limit badge inside input) ---- */
.input-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
}

.input-wrapper #topic-input {
  width: 100%;
  padding-right: 110px;
}

.input-wrapper .rate-limit-display {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  padding: 2px 8px;
  pointer-events: none;
}

/* ---- A12: TOPIC SUGGESTIONS ---- */
#topic-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 120;
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.98);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  max-height: 188px;
  overflow-y: auto;
}

#topic-suggestions.visible {
  display: flex;
}

.topic-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.topic-tag:hover {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
}

/* ---- B4: ABOUT MODAL ---- */
.about-card {
  width: 480px;
  max-width: 90vw;
}

.about-body {
  padding: 18px 24px 24px;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.about-body p {
  margin-bottom: 12px;
}

.about-body strong {
  color: var(--accent-gold);
}

.about-contact {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.about-contact a {
  color: var(--accent-cyan);
  text-decoration: none;
}

.about-contact a:hover {
  text-decoration: underline;
}

.about-switches {
  display: flex;
  gap: 10px;
  margin: 14px 0 8px;
}

.about-switches .btn {
  min-width: 92px;
}

/* ---- B6: SFX BUTTON ACTIVE STATE ---- */
#sfx-btn.active {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
}

/* ---- A5: WHISPER TYPING INDICATOR ---- */
.whisper-typing {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 6px;
  background: linear-gradient(135deg, #1f1a0e, #1e293b);
  border-left: 3px solid var(--whisper-amber);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.whisper-typing-dots {
  display: inline-flex;
  gap: 3px;
}

.whisper-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--whisper-amber);
  animation: whisperDotPulse 1.2s ease-in-out infinite;
}

.whisper-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.whisper-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes whisperDotPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ---- A6: STANCE FLIP EFFECTS ---- */
@keyframes stanceFlip {
  0% { filter: brightness(1); transform: scale(1); }
  30% { filter: brightness(2.5) drop-shadow(0 0 12px #fbbf24); transform: scale(2); }
  100% { filter: brightness(1); transform: scale(1); }
}

.seat.stance-flip-flash {
  animation: stanceFlip 1.2s ease;
  z-index: 25;
}

/* Stance flip toast banner */
.stance-flip-toast {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 1px solid var(--accent-gold);
  border-radius: 0 0 12px 12px;
  padding: 10px 24px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-gold);
  z-index: 300;
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.3);
  animation: toastSlideIn 0.4s ease forwards;
  white-space: nowrap;
}

@keyframes toastSlideIn {
  from { transform: translateX(-50%) translateY(-100%); }
  to { transform: translateX(-50%) translateY(0); }
}

/* ---- A9: SEAT EMOTION EMOJI ---- */
.seat-emotion {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  pointer-events: none;
  z-index: 15;
  animation: emotionFade 5s ease forwards;
}

@keyframes emotionFade {
  0% { opacity: 0; transform: translateX(-50%) translateY(4px); }
  10% { opacity: 1; transform: translateX(-50%) translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---- A3: NEWS SLIDE-IN ANIMATION ---- */
@keyframes newsSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.news-card.slide-in {
  animation: newsSlideIn 0.4s ease;
}

/* ---- F10: RECONNECT BANNER ---- */
.reconnect-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10001;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  text-align: center;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: transform 0.3s ease;
}
.reconnect-banner.hidden {
  transform: translateY(-100%);
  pointer-events: none;
}
.reconnect-banner .reconnect-retry-btn {
  background: #000;
  color: #f59e0b;
  border: none;
  border-radius: 4px;
  padding: 2px 10px;
  margin-left: 8px;
  cursor: pointer;
  font-size: 0.8rem;
}

/* ---- F7: ACHIEVEMENT BADGES ---- */
.achievement-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
}
.achievement-badge {
  background: linear-gradient(135deg, #2a2a3e, #3a3a50);
  border: 1px solid #ffd700;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.82rem;
  color: #ffd700;
  opacity: 0;
  animation: badgeAppear 0.5s ease forwards;
  display: flex;
  align-items: center;
  gap: 6px;
}
.achievement-badge .badge-icon {
  font-size: 1.1rem;
}
@keyframes badgeAppear {
  0% { opacity: 0; transform: scale(0.5); }
  60% { transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

/* ---- F8: FAIL PULSE OVERLAY ---- */
.fail-pulse-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  pointer-events: none;
  background: rgba(239, 68, 68, 0.15);
  animation: failPulse 0.5s ease 3;
}
@keyframes failPulse {
  0% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---- F9: SENATOR DETAIL MODAL ---- */
.senator-detail-card {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  max-width: 420px;
  width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}
.senator-detail-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.senator-detail-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--accent-gold);
}
.senator-detail-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.senator-detail-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-gold);
}
.senator-detail-meta {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 4px;
}
.senator-detail-bio {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}
.senator-detail-radar-wrap {
  display: flex;
  justify-content: center;
  margin: 12px 0;
}
.senator-detail-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}
.senator-metrics-title {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}
.senator-metric-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.35);
  font-size: 0.76rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.senator-metric-item.is-active {
  border-color: rgba(245, 158, 11, 0.9);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.28), 0 6px 16px rgba(245, 158, 11, 0.16);
  background: rgba(245, 158, 11, 0.08);
}
.senator-metric-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.senator-metric-label {
  color: var(--text-secondary);
}
.senator-metric-value {
  color: var(--text-primary);
  font-weight: 700;
}
.senator-metric-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
}
.senator-metric-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}
.senator-metric-fill.low {
  background: linear-gradient(90deg, #10b981, #34d399);
}
.senator-metric-fill.mid {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}
.senator-metric-fill.high {
  background: linear-gradient(90deg, #ef4444, #f87171);
}
@media (max-width: 560px) {
  .senator-detail-metrics {
    grid-template-columns: 1fr;
  }
}
.senator-detail-history {
  margin-top: 12px;
}
.senator-detail-history h4 {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.senator-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-primary);
}
.senator-history-item .history-topic {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 8px;
}
.senator-history-item .history-vote {
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
}
.history-vote.vote-yea { background: rgba(34, 197, 94, 0.2); color: var(--yea-green); }
.history-vote.vote-nay { background: rgba(249, 115, 22, 0.2); color: var(--nay-red); }
.history-vote.vote-present { background: rgba(234, 179, 8, 0.2); color: var(--present-yellow); }

.state-senators-card {
  background: linear-gradient(135deg, #151a2f, #1b2440);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  width: min(520px, 92vw);
  max-height: 72vh;
  overflow-y: auto;
}
.state-senators-card h3 {
  margin: 0 0 12px;
  color: var(--accent-gold);
  font-size: 1rem;
}
.state-senators-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.state-senator-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: rgba(15, 23, 42, 0.35);
}
.state-senator-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.35);
  flex: 0 0 36px;
}
.state-senator-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.state-senator-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--accent-gold);
  background: rgba(30, 41, 59, 0.7);
}
.state-senator-name {
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.25;
}
@media (max-width: 640px) {
  .state-senators-list {
    grid-template-columns: 1fr;
  }
}

/* ---- F1: CONFRONTATION EXCHANGE SPEECH TYPE ---- */
.speech-entry .speech-type-badge.confrontation_exchange {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

/* ===== News Ticker ===== */
.news-ticker {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.85);
  border-top: 2px solid #ef4444;
  overflow: hidden;
  height: 32px;
  min-height: 32px;
  position: relative;
  z-index: 10;
  margin: 0;
  flex-shrink: 0;
}
.ticker-label {
  background: #ef4444;
  color: #fff;
  font-weight: 700;
  font-size: 0.7rem;
  padding: 0 10px;
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.08em;
}
.ticker-track {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.ticker-content {
  display: flex;
  gap: 40px;
  white-space: nowrap;
  width: max-content;
  will-change: transform;
  animation: ticker-scroll var(--ticker-duration, 22s) linear infinite;
}
.ticker-content .ticker-item {
  font-size: 0.75rem;
  color: #e2e8f0;
  white-space: nowrap;
}
.ticker-content .ticker-item.scandal {
  color: #ef4444;
  font-weight: 600;
}
.ticker-content .ticker-item.impact {
  color: #facc15;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(250, 204, 21, 0.35);
}
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ===== Anger Visualization ===== */
.seat.angry-low {
  box-shadow: 0 0 6px 1px rgba(239, 68, 68, 0.3);
}
.seat.angry-mid {
  box-shadow: 0 0 10px 2px rgba(239, 68, 68, 0.5);
  filter: brightness(1.1);
}
.seat.angry-high {
  box-shadow: 0 0 14px 4px rgba(239, 68, 68, 0.7);
  filter: brightness(1.2);
  animation: anger-pulse 1s ease-in-out infinite alternate;
}
@keyframes anger-pulse {
  from { box-shadow: 0 0 14px 4px rgba(239, 68, 68, 0.7); }
  to { box-shadow: 0 0 20px 6px rgba(239, 68, 68, 0.9); }
}
