/* Base Reset & Vars */
:root {
  --bg-color: #f8fafc;
  --text-color: #1e293b;
  --header-bg: #ffffff;
  --accent-color: #2563eb;
  --chat-bg: #eff6ff;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --header-height: 60px;

  /* Feature: Dynamic Font Scale */
  --base-font-scale: 1.0;
}

html {
  /* Scale the root size. 16px * scale */
  font-size: calc(16px * var(--base-font-scale));
}

[data-theme="dark"] {
  --bg-color: #0B0E11;
  /* Rich Black */
  --text-color: #E6EDF3;
  /* Primary Text (Off-white) */
  --header-bg: #0B0E11;
  /* Match BG for seamless look */
  --accent-color: #3b82f6;
  /* Keep blue for now, or match specific request if needed */
  --chat-bg: #0B0E11;
  --card-bg: #161B22;
  /* Deep Navy/Grey */
  /* Deep Navy/Grey */
  --border-color: rgba(255, 255, 255, 0.1);
  /* Subtle Divider */
  --secondary-text: #8B949E;
  /* Muted Grey */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  /* overflow: hidden;  REMOVED: Let styling be handled by containers */
  min-height: 100vh;
  /* Use rem for sizing now */
  font-size: 1rem;
  overflow: hidden;
  /* Fix: Prevent body scroll, use app-root */
}

/* iOS Zoom Fix - Force 16px on inputs */
input,
select,
textarea {
  font-size: 16px !important;
}

/* App Structure */
.app-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  /* Fix: Fixed height */
  overflow: hidden;
  /* Fix: No scroll on root */
}

/* Header */
/* Header: Stacked Layout (Mobile "X" Style) */
/* Header: Minimal Layout v9.0 */
.app-header {
  height: 56px;
  min-height: 56px;
  padding: 0 16px;
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  position: relative;
}

/* Left: Logo & Name */
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-circle {
  width: 32px;
  height: 32px;
  background: var(--bg-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 1px solid var(--border-color);
}

.app-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-color);
  letter-spacing: -0.5px;
}

/* Right: Controls */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:active {
  transform: scale(0.95);
  background: var(--bg-color);
}

.analyst-badge {
  height: 32px;
  padding: 0 12px;
  background: rgba(37, 99, 235, 0.1);
  /* Blue tint */
  color: var(--accent-color);
  border-radius: 16px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
}

/* Navigation Tabs Container (Separate) */
.nav-tabs-container {
  display: flex;
  width: 100%;
  height: 44px;
  /* Standard tab height */
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.nav-tab-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--secondary-text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: color 0.2s;
}

.nav-tab-item.active {
  color: var(--accent-color);
}

/* Tab Indicator (Animated) */
.tab-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background-color: var(--accent-color);
  width: 50%;
  /* Default for 2 tabs */
  transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
  z-index: 102;
  transform: translateX(0);
}

/* Hide ugly wrapper styling */
.persona-select {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0;
}

.persona-select select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  /* No border */
  background: transparent;
  color: var(--text-color);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

/* Filter Button */
.filter-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  /* Circular */
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-color);
  font-size: 0.9rem;
  transition: all 0.2s;
}

.filter-btn:hover {
  background-color: var(--chat-bg);
  color: var(--accent-color);
}

/* FILTER MODAL */
.filter-modal {
  display: none;
  /* Hidden by default */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  justify-content: center;
  align-items: flex-end;
  /* Mobile Bottom Sheet vibe */
}

.filter-modal.active {
  display: flex;
}

.filter-content {
  background: var(--card-bg);
  width: 100%;
  max-width: 500px;
  border-radius: 20px 20px 0 0;
  padding: 1.5rem;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
  color: var(--text-color);
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.filter-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.close-filter {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-color);
}

.filter-group {
  margin-bottom: 1.5rem;
}

.filter-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--secondary-text);
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-chip {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-chip.selected {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.apply-filters-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

/* Hide ugly wrapper styling if present */
.persona-select {
  background: transparent;
  border: none;
  padding: 0;
  /* Removed cylindrical background */
}

.persona-select select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  /* No border for clean look */
  background: transparent;
  /* No background */
  color: var(--text-color);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  /* remove native arrow if desired, or keep */
  -webkit-appearance: none;
}

/* Add custom icon helper if needed, but for now just text/emoji */

/* Filter Button */
.filter-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  /* Circular */
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-color);
  font-size: 0.9rem;
  transition: all 0.2s;
}

.filter-btn:hover {
  background-color: var(--chat-bg);
  color: var(--accent-color);
}

.app-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-logo {
  font-size: 1.5rem;
}

.app-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.app-subtitle {
  font-size: 0.75rem;
  color: var(--text-color);
  opacity: 0.7;
}

.theme-toggle {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
}

/* SWIPE UI CONTAINER */
.swipe-container {
  display: flex;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  /* Flexbox Fill Logic */
  height: 100%;
  /* Fix: Fill remaining space */
  flex: 1;
  /* Take remaining vertical space */
  width: 100vw;
}

.swipe-container::-webkit-scrollbar {
  display: none;
}

/* PANELS */
.panel {
  min-width: 100vw;
  height: 100%;
  scroll-snap-align: start;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 1rem;
}

/* NEWSROOM (Left Panel) */
.newsroom-panel {
  background-color: var(--bg-color);
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.feed-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 2rem;
}

/* Banter Card */
.banter-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  /* More professional? or 12px? User said "professional-grade" */
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  /* Subtle shadow */
  transition: all 0.2s ease;
  cursor: pointer;
  /* Card is the trigger */
  position: relative;
  display: flex;
  flex-direction: column;
}

.banter-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--accent-color);
}

.card-footer {
  display: flex;
  justify-content: flex-start;
  /* Left Align */
  gap: 1.5rem;
  /* Symmetry */
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.card-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  /* Slightly larger targets */
  color: var(--secondary-text);
  padding: 0.5rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-action-btn:hover {
  color: var(--accent-color);
  background-color: rgba(0, 0, 0, 0.03);
  /* Subtle hover bg */
  border-radius: 50%;
}

.banter-card:active {
  transform: scale(0.98);
}

.card-tag {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent-color);
  margin-bottom: 0.5rem;
  display: block;
}

/* News Feed & Cards */
.banter-card {
  background-color: var(--card-bg);
  /* Fix: Dynamic BG */
  color: var(--text-color);
  /* Fix: Dynamic Text */
  border-radius: 12px;
  padding: 0.8rem;
  border: 1px solid var(--border-color);
  /* Definition */
  /* Tightening */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  /* Punchy Compact Height */
  min-height: 140px;
  height: auto;
  /* Allow expansion for content */
  min-width: 0;
}

.banter-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  border-color: var(--accent-color);
}

.card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-color);
  /* Fix: Primary White in Dark Mode */
  margin-bottom: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Iconic Type Colors */
.card-title:contains("⚠️") {
  color: #dc3545;
}

.card-content {
  font-size: 0.85rem;
  color: var(--secondary-text);
  line-height: 1.4;
  margin-bottom: 0.4rem;
  flex-grow: 1;
  /* Remove Truncation */
  overflow: visible;
  display: block;
}

.deep-dive-btn {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--chat-bg);
  color: var(--accent-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.2s;
}

.deep-dive-btn:hover {
  background-color: var(--border-color);
}

/* ASSISTANT (Right Panel) */
.chat-panel {
  background-color: var(--bg-color);
  padding: 0;
  /* Full width chat */
  position: relative;
  display: flex;
  /* Fix: Flex layout for chat */
  flex-direction: column;
  height: 100%;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  padding-bottom: 2rem;
  /* Space for input + visual breathing room */
}

/* Fix: Message Actions Cutoff */
.message-actions {
  padding-bottom: 0.5rem;
}

/* Messages */
.message {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
  /* Full width container, no constraints */
  max-width: 100%;
  animation: fadeIn 0.3s ease;
}

.message.user {
  /* PURGE: No Bubble, Flat Text, Green Border */
  align-self: flex-start;
  background-color: transparent;
  color: var(--text-color);
  border-radius: 0;
  padding: 0 0 0 1rem;
  /* Only left padding for space from border */
  border-left: 3px solid #28a745;
  /* Green */
  margin-bottom: 1.5rem;
  /* More space between flat messages */
  width: 100%;
  /* Full width for log style */
}

.message.assistant {
  align-self: flex-start;
  background-color: transparent;
  border: none;
  border-radius: 0;
  padding: 0 0 0 1rem;
  /* Only left padding */
  border-left: 3px solid #007bff;
  /* Blue */
  margin-left: 0;
  margin-bottom: 1.5rem;
  width: 100%;
}

/* Minimalist Message Actions (Match Card Footer) */
.message-actions {
  display: flex;
  justify-content: flex-start;
  /* Left Align */
  gap: 1.5rem;
  /* Symmetry */
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  /* Subtle divider (dark mode compatible) */
  opacity: 1;
  /* Reset opacity */
  width: 100%;
  /* Full width of bubble */
}

/* Specific adjustment for Light Mode border if not covered by var */
[data-theme="light"] .message-actions {
  border-top: 1px solid #e2e8f0;
}

.action-btn {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  transition: all 0.2s;
}

.action-btn:hover {
  opacity: 1;
  color: var(--accent-color);
}

/* Header Styling */
.message-role {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
  color: var(--accent-color);
  display: flex;
  align-items: center;
  gap: 4px;
}

.message-meta {
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
  opacity: 0.8;
  display: flex;
  gap: 0.5rem;
}

/* Input Area */
.chat-input-area {
  /* Fix: Use Flexbox Flow instead of Absolute Overlay */
  position: relative;
  /* bottom: 0; Removed */
  /* left: 0; Removed */
  width: 100%;
  padding: 1rem;
  padding-bottom: env(safe-area-inset-bottom, 20px);
  /* Add safe area */
  background-color: var(--header-bg);
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 500;
  flex-shrink: 0;
  /* Don't shrink input */
}

.chat-form {
  display: flex;
  gap: 0.5rem;
}

.chat-input {
  flex: 1;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 0.75rem 1rem;
  resize: none;
  font-family: inherit;
  background-color: var(--bg-color);
  color: var(--text-color);
}

.send-btn {
  background-color: var(--accent-color);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Font Controls */
.font-controls {
  display: flex;
  gap: 5px;
  margin-right: 10px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: 4px;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 0.8rem;
}

/* Bullet Fix: Flush Indentation */
.message-content ul,
.message-content ol {
  margin-left: 0;
  padding-left: 1.2rem;
  /* Ensure bullets are visible inside bubble */
}

/* Follow Up styling */
.follow-up-pill:hover {
  background-color: var(--border-color);
}

/* Feed Card Markdown Styles */
.card-content ul,
.card-content ol {
  margin-left: 0;
  padding-left: 1.2rem;
  /* Clean indentation */
}

.card-content li {
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
  /* Readable */
}

.card-content p {
  margin: 0 0 0.5rem 0;
  /* Remove top margin */
}

/* MOBILE TABS FIX (Transform Logic) */
.tab-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background-color: var(--accent-color);
  width: 50%;
  /* Fixed 50% width */
  transition: transform 0.3s ease;
  /* Slide using transform */
  /* Remove 'left' transition if it exists elsewhere */
}

/* Active states handled by JS setting transform: translateX(0) or (100%) */

/* MARKDOWN TABLE STYLES (Pro Grade) */
.message-content table,
.chat-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
  background-color: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  /* For radius */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message-content th,
.chat-table th {
  background-color: #f5f5f5 !important;
  /* Light grey shading for headers */
  font-weight: 700;
  text-align: left;
  padding: 10px 12px;
  color: var(--accent-color);
  border-bottom: 2px solid var(--border-color);
  font-style: normal !important;
}

.message-content td,
.chat-table td {
  background-color: transparent !important;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-color);
  font-style: normal !important;
}

.message-content tr:last-child td {
  border-bottom: none;
}

.message-content tr:nth-child(even),
.chat-table tr:nth-child(even) {
  background-color: transparent !important;
}

/* TABLET/IPAD FIX: Keep Mobile Stack up to 1024px */
@media (min-width: 1025px) {

  /* Desktop: 20/80 Split (No Swipe) */
  .swipe-container {
    display: flex;
    overflow-x: hidden;
    scroll-snap-type: none;
  }

  .newsroom-panel {
    flex: 0 0 35%;
    min-width: 0;
    width: 35%;
    border-right: 1px solid var(--border-color);
  }

  .chat-panel {
    flex: 1;
    /* 65% */
    min-width: 0;
    width: auto;
  }

  .panel {
    min-width: 0;
    scroll-snap-align: none;
  }
}

/* Starter Chips */
.starter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.chip-btn {
  background: var(--bg-color);
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
}

.chip-btn:hover {
  background: var(--accent-color);
  color: white;
}

/* Auto-Expand Input */
.chat-input {
  max-height: 120px;
  overflow-y: auto;
  min-height: 46px;
}

/* Modernizations v3.0 */

/* 1. Starter Chips (Zero State) */
.starter-chips-scroll {
  display: flex;
  overflow-x: auto;
  gap: 0.75rem;
  padding: 0.5rem 0.2rem;
  /* minimal padding */
  margin-bottom: 0.5rem;
  white-space: nowrap;
  -ms-overflow-style: none;
  /* Hide scrollbar */
  scrollbar-width: none;
  opacity: 0;
  height: 0;
  transition: opacity 0.3s ease, height 0.3s ease;
  /* Smooth toggle */
  pointer-events: none;
  /* Disable when hidden */
}

/* Chips Visible State */
.starter-chips-scroll.visible {
  opacity: 1;
  height: auto;
  min-height: 40px;
  pointer-events: auto;
}

.starter-chips-scroll::-webkit-scrollbar {
  display: none;
}

.chip-pill {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--accent-color);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.chip-pill:hover,
.chip-pill:active {
  background: var(--accent-color);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
}

/* 2. Chat Input Area Revamp (Keyboard Avoidance handled by viewport meta + sticky) */
.chat-input-area {
  /* Using new viewport logic, sticky might be better if parent scrolls, but absolute bottom is standard for this layout */
  /* Ensure z-index is high */
  z-index: 500;
  background: rgba(var(--header-bg-rgb), 0.95);
  /* If variables allowed, otherwise keep solid */
  background-color: var(--header-bg);
  transition: padding-bottom 0.2s;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  /* iOS Safe Area */
}

/* Auto-expanding handled by JS, but ensure max-height */
.chat-input {
  max-height: 120px;
  overflow-y: auto;
  transition: height 0.1s ease;
}

/* 3. Send Button States */
.send-btn:disabled {
  background-color: var(--border-color);
  color: var(--secondary-text);
  cursor: not-allowed;
  opacity: 0.6;
}

.send-btn.active {
  background-color: var(--accent-color);
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
  animation: pulse-blue 2s infinite;
}

@keyframes pulse-blue {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
  }

  70% {
    transform: scale(1.0);
    box-shadow: 0 0 0 6px rgba(37, 99, 235, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

/* PERSONA TOGGLES */
.persona-toggles {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.persona-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--secondary-text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.persona-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.persona-btn.active {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
  font-weight: 600;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

/* Persona Dropdown */
.persona-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(30, 41, 59, 0.7);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
  margin-right: 0.5rem;
  text-align: center;
}

.persona-select:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--accent-color);
}

.persona-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* Dark mode adjust */
[data-theme="dark"] .persona-select {
  background: rgba(15, 23, 42, 0.8);
}

/* --- UI POLISH (DEC 2025) --- */

/* 1. Typography Standards */
.message-content {
  font-size: 15px !important;
  line-height: 1.6;
}

.message-content li {
  font-size: 15px;
  margin-bottom: 0.5rem;
}

/* 2. Clean Tables (Minimalist) */
.message-content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 15px;
}

.message-content thead {
  border-bottom: 2px solid #555;
  /* Solid separator */
  font-weight: bold;
}

/* --- PHASE 10: ONBOARDING --- */
#onboarding-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.onboarding-step {
  width: 100%;
  max-width: 400px;
  text-align: center;
  animation: fadeIn 0.3s ease-out;
}

.welcome-content h1 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.welcome-content .subtitle {
  color: var(--secondary-text);
  margin-bottom: 2rem;
}

.app-logo-large {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.features-list {
  text-align: left;
  margin-bottom: 2rem;
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.feature-item {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.feature-item:last-child {
  margin-bottom: 0;
}

.primary-btn {
  width: 100%;
  padding: 1rem;
  background: var(--accent-color);
  color: #000;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 1rem;
}

.secondary-btn {
  background: transparent;
  color: var(--secondary-text);
  border: none;
  padding: 1rem;
  cursor: pointer;
}

/* Interests Grid */
.team-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  margin: 2rem 0;
}

.team-select-btn {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.team-select-btn.selected {
  border-color: var(--accent-color);
  background: rgba(var(--accent-rgb), 0.1);
}

.team-select-btn img {
  width: 32px;
  height: 32px;
}

/* Tutorial */
.tut-slide {
  text-align: center;
  padding: 2rem 0;
}

.tut-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.tut-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.dots {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.dot {
  width: 8px;
  height: 8px;
  background: var(--border-color);
  border-radius: 50%;
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Help Center */
#help-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--accent-color);
  color: #000;
  font-size: 1.5rem;
  font-weight: bold;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  z-index: 1000;
}

#help-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10001;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.help-card {
  background: var(--card-bg);
  width: 100%;
  max-width: 500px;
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
}

.help-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.help-header h2 {
  margin: 0;
}

.help-header button {
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1.5rem;
  cursor: pointer;
}

details {
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

summary {
  font-weight: bold;
  cursor: pointer;
  list-style: none;
  padding: 0.5rem 0;
}

summary::-webkit-details-marker {
  display: none;
}

.message-content th {
  padding: 10px;
  text-align: left;
  font-weight: 700;
  background-color: transparent !important;
  font-style: normal !important;
}

.message-content td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  background-color: transparent !important;
  font-style: normal !important;
}

/* Totals Row */
.message-content tr:last-child {
  font-weight: bold;
  border-top: 2px solid var(--border-color);
}

/* Stop Button Styling */
.stop-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  /* Square matched to send button size */
  background-color: #ef4444;
  color: white;
  border: 1px solid #dc2626;
  /* Darker border for visibility */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
  /* Glowing shadow to be very noticeable */
}

.stop-btn i {
  font-size: 1.2rem;
  /* Larger icon */
}

.stop-btn:hover {
  background-color: #dc2626;
  transform: scale(0.95);
}

/* --- WORKSTREAM C: VISUAL MAPPING STYLES --- */

/* 1. NARRATIVE MODE (Category A: Bottlers, Comebacks, Drama) */
.banter-card.card-narrative {
  border: 1px solid #ef4444;
  /* Red */
  background: radial-gradient(circle at top right, rgba(239, 68, 68, 0.08), transparent 60%);
  position: relative;
  overflow: hidden;
}

.banter-card.card-narrative:hover {
  border-color: #fca5a5;
  box-shadow: 0 8px 30px rgba(239, 68, 68, 0.15);
  transform: translateY(-2px) scale(1.01);
}

.banter-card.card-narrative .card-tag {
  color: #ef4444;
  font-weight: 800;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* 2. INTEL MODE (Category B: xG, Value, Stats) */
.banter-card.card-intel {
  border: 1px solid #3b82f6;
  /* Blue */
  background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.08), transparent 60%),
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(59, 130, 246, 0.02) 10px, rgba(59, 130, 246, 0.02) 20px);
  /* Tech lines */
}

.banter-card.card-intel:hover {
  border-color: #60a5fa;
  box-shadow: 0 8px 30px rgba(59, 130, 246, 0.15);
  transform: translateY(-2px) scale(1.01);
}

.banter-card.card-intel .card-tag {
  color: #3b82f6;
  font-family: 'Courier New', monospace;
  font-weight: 700;
}

/* 4. DOJO PICKS HEADER */
.dojo-picks-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--secondary-text);
  margin: 1rem 0 0.5rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dojo-picks-label::before {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  background: var(--accent-color);
  border-radius: 50%;
}

/* --- TASK 2: SUGGESTION LOOPS --- */
.suggestion-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
  padding: 0 0.5rem;
}

.suggestion-icon {
  font-size: 1.1rem;
}

.suggestion-title {
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--secondary-text);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 2rem;
  padding: 0 0.2rem;
}

@media (max-width: 600px) {
  .suggestion-grid {
    grid-template-columns: 1fr;
  }
}

.suggestion-card {
  padding: 12px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-family: inherit;
  color: var(--text-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.suggestion-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  border-color: var(--accent-color);
}

.suggestion-card:active {
  transform: translateY(0);
}

.suggestion-emoji {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.suggestion-text {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}

/* Type variations */
.suggestion-expand:hover {
  background: linear-gradient(135deg, var(--card-bg) 0%, rgba(59, 130, 246, 0.05) 100%);
  border-color: #3b82f6;
}

.suggestion-deepen:hover {
  background: linear-gradient(135deg, var(--card-bg) 0%, rgba(236, 72, 153, 0.05) 100%);
  border-color: #ec4899;
}

.suggestion-relate:hover {
  background: linear-gradient(135deg, var(--card-bg) 0%, rgba(16, 185, 129, 0.05) 100%);
  border-color: #10b981;
}

/* --- MATCH REPORT & TACTICAL PREVIEW STYLES --- */
.match-report,
.tactical-preview {
  font-size: 16px;
  /* Better readability */
  padding: 20px 16px;
  /* Room to breathe */
  line-height: 1.6;
  background: var(--card-bg);
  border-radius: 8px;
  margin-top: 10px;
}

.odds-display {
  font-size: 1.25rem;
  font-weight: 700;
  color: #22c55e;
  /* Bright green */
  padding: 4px 8px;
  background: rgba(34, 197, 94, 0.1);
  /* Light green bg */
  border-radius: 6px;
  display: inline-block;
}

.value-badge {
  background: #22c55e;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  margin-left: 6px;
}

.betting-angle {
  padding: 12px;
  margin: 10px 0;
  border-left: 3px solid #22c55e;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 6px;
}

/* Progressive Disclosure (Details/Summary) */
details.modern-disclosure {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin: 10px 0;
  overflow: hidden;
}

details.modern-disclosure summary {
  padding: 12px;
  background: var(--chat-bg);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

details.modern-disclosure summary::-webkit-details-marker {
  display: none;
}

details.modern-disclosure summary::after {
  content: "↓";
  font-size: 1.2rem;
}

details.modern-disclosure[open] summary::after {
  content: "↑";
}

details.modern-disclosure .details-content {
  padding: 12px;
  border-top: 1px solid var(--border-color);
}

/* Tablet (768px+) */
@media (min-width: 768px) {

  .match-report,
  .tactical-preview {
    font-size: 15px;
    padding: 16px;
  }
}

/* --- PHASE 8 UI POLISH ADDITIONS --- */

/* 1. Offline Banner */
.connection-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: auto;
  min-height: 0;
  background: #f59e0b;
  /* Amber-500 */
  color: white;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 2000;
  padding: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  max-height: 0;
}

.connection-banner.visible {
  padding: 8px;
  max-height: 50px;
}

.connection-banner.online {
  background: #10b981;
  /* Emerald-500 */
}

/* 2. Loading Spinners */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  border-radius: inherit;
}

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

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

/* --- PHASE 9: UI POLISH (Search, Filters, Tables) --- */

/* 1. Professional Search Input */
.search-container {
  position: relative;
  width: 100%;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-color);
  /* Light gray in light mode */
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0 12px;
  transition: all 0.2s;
  height: 48px;
}

.search-input-wrapper:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-icon {
  font-size: 16px;
  opacity: 0.5;
  margin-right: 10px;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--text-color);
  outline: none;
  height: 100%;
}

.clear-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e5e7eb;
  border: none;
  color: #666;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.clear-btn:active {
  background: #d1d5db;
}

/* Search Suggestions */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  max-height: 250px;
  overflow-y: auto;
  z-index: 2000;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  display: none;
  /* Hidden by default */
}

.search-suggestions.visible {
  display: block;
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-color);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:active {
  background: var(--bg-color);
}

/* 2. Active Filters Bar */
.active-filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--card-bg);
  /* Match card bg */
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  overflow-x: auto;
}

.filter-chip-active {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--accent-color);
  color: white;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.filter-chip-active button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 10px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.button-clear-all {
  font-size: 0.85rem;
  color: var(--secondary-text);
  background: none;
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
}

/* 3. Table Styling Improvements (No Black Headers) */
.markdown-body table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1rem 0;
  font-size: 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-bg);
  overflow: hidden;
}

.markdown-body th {
  background-color: transparent !important;
  font-weight: 700;
  text-align: left;
  padding: 12px;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-color);
}

[data-theme="dark"] .markdown-body th {
  background-color: transparent !important;
}

.markdown-body td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-color);
}

.markdown-body tr:last-child td {
  border-bottom: none;
}

/* 4. No Results State */
.no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  opacity: 0.7;
}

.no-results-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.markdown-body {
  background-color: transparent !important;
  font-style: normal !important;
  /* Force no italics in markdown blocks */
}

.markdown-body * {
  font-style: normal !important;
  /* Force no italics on everything in bubble */
}

/* 3. Pull to Refresh */
.pull-indicator {
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-color);
  transition: height 0.2s;
}

/* Thinking Dots Animation */
.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(37, 99, 235, 0.1);
  border-radius: 12px;
  color: var(--accent-color);
  font-size: 1.2rem;
  line-height: 1;
}

.thinking-dots span {
  animation: thinking 1.4s infinite;
  opacity: 0;
}

.thinking-dots span:nth-child(1) {
  animation-delay: 0s;
}

.thinking-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes thinking {
  0% {
    opacity: 0;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

.thinking-mode {
  font-weight: 500;
  color: var(--secondary-text);
  padding: 10px;
}

.thinking-pulse {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-color);
  border-radius: 50%;
  animation: pulse-blink 1.4s infinite both;
}

.pulse-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.pulse-dot:nth-child(3) {
  animation-delay: 0.4s;
}

.pulse-text {
  font-size: 0.9rem;
  color: var(--secondary-text);
  margin-left: 4px;
}

@keyframes pulse-blink {

  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }

  40% {
    opacity: 1;
    transform: scale(1.1);
  }
}

.pull-arrow {
  transition: transform 0.2s;
}

.pull-arrow.rotate {
  transform: rotate(180deg);
}