:root {
  --bg-color: #0d1117;
  --card-bg: rgba(22, 27, 34, 0.8);
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --accent-cyan: #58a6ff;
  --accent-gold: #ffd700;
  --accent-silver: #c0c0c0;
  --accent-bronze: #cd7f32;
  --border-color: #30363d;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

body {
  margin: 0;
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-main);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(88, 166, 255, 0.05) 0%, transparent 20%),
    radial-gradient(circle at 90% 80%, rgba(255, 100, 100, 0.05) 0%, transparent 20%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.container {
  max-width: 1400px;
  /* Wider for charts */
  margin: 0 auto;
  padding: 1rem 1rem;
  width: 100%;
  box-sizing: border-box;
}

/* NAVBAR LAYOUT */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(13, 17, 23, 0.95);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Nav Left: Logo & Title */
.nav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--accent-gold);
}

.nav-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
  background: linear-gradient(135deg, #fff 0%, #aaa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

/* Nav Center: Tabs */
.nav-center {
  display: flex;
  gap: 2rem;
  height: 100%;
}

.nav-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0 0.5rem;
  height: 100%;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}

.nav-tab:hover {
  color: #fff;
}

.nav-tab.active {
  color: #fff;
  border-bottom-color: var(--accent-cyan);
}


/* Nav Tabs Container */
.nav-center {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  /* Enable scroll */
  white-space: nowrap;
  /* Prevent wrap */
  -webkit-overflow-scrolling: touch;
  /* Smooth scroll iOS */
  padding-bottom: 2px;
  /* Avoid scrollbar overlap if any */
  max-width: 100%;
  /* Ensure it doesn't break layout */
}

/* Hide Scrollbar but keep functionality */
.nav-center::-webkit-scrollbar {
  display: none;
}

.nav-center {
  -ms-overflow-style: none;
  /* IE and Edge */
  scrollbar-width: none;
  /* Firefox */
}

/* Nav Right: Status */
.nav-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}


.live-status {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: #000;
  padding: 0;
  border-radius: 4px;
}

.live-indicator {
  width: 6px;
  height: 6px;
  background-color: #00ff88;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(0, 255, 136, 0.9);
  animation: pulse 1s infinite;
}

.live-text {
  display: none;
}

.nav-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.help-icon {
  font-size: 0.8rem;
  width: 16px;
  height: 16px;
  line-height: 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  text-align: center;
  cursor: help;
  display: inline-block;
  color: #aaa;
}

.help-dropdown {
  width: 200px;
  font-family: var(--font-main);
  text-align: center;
  bottom: auto;
  top: 150%;
}

.help-arrow {
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 5px 5px 5px;
  border-style: solid;
  border-color: transparent transparent #1a1a24 transparent;
}

@keyframes pulse {
  0% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.6;
  }
}

/* Mobile Nav */
/* Mobile Nav: Double Decker Layout */
@media (max-width: 768px) {
  .navbar {
    flex-wrap: wrap;
    height: auto;
    padding: 0.5rem 0.5rem;
    /* Reduced padding */
    gap: 0;
    /* Minimized gap */
  }

  /* Row 1: Logo (Left) & Status (Right) */
  .nav-left {
    order: 1;
    gap: 0.5rem;
    /* Reduced gap */
    flex-shrink: 1;
    /* Allow shrinking */
    min-width: 0;
  }

  .nav-right {
    order: 2;
    margin-left: auto;
    /* Push to right */
    gap: 0.2rem;
    /* Reduced gap */
    flex-shrink: 0;
  }

  /* Row 2: Tabs */
  .nav-center {
    order: 3;
    width: 100%;
    justify-content: space-between;
    padding-top: 2px;
    /* Minimal padding */
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    height: 32px;
    /* Compress height */
  }

  .nav-tab {
    font-size: 0.75rem;
    /* Smaller font */
    padding: 0 0.2rem;
    flex: 1;
    justify-content: center;
  }

  /* Adjust elements for mobile */
  .nav-title {
    display: block;
    /* Restore Title */
    font-size: 0.8rem;
    /* Smaller font */
    /* Compact size */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Compact Logo */
  .nav-logo {
    width: 20px;
    /* Smaller logo */
    height: 20px;
  }

  /* Tiny Live Status (Icon Only) */
  .live-status {
    padding: 2px;
    /* Tighter padding */
    background: transparent;
  }

  .live-text {
    display: none;
    /* Hide Text per user request */
  }

  .live-indicator {
    width: 6px;
    /* Smaller dot */
    height: 6px;
    margin: 0;
    /* precise control */
  }

  /* Restore time but keep tiny */
  #last-updated {
    display: block;
    font-size: 0.55rem;
    /* Very small */
    white-space: nowrap;
    margin-right: 2px;
  }
}

/* Status Grid Layout */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-top: 2rem;
  gap: 1rem;
  width: 100%;
}

.status-card {
  width: 100%;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* 2 columns */
    gap: 0.5rem;
    margin-top: 3rem;
    /* Increased margin to prevent overlap */
    width: 100%;
    box-sizing: border-box;
  }

  .status-card {
    min-width: 0 !important;
    /* Force shrinking */
    width: 100% !important;
    max-width: none;
    padding: 0.8rem 0.2rem;
    white-space: nowrap;
    /* Prevent wrapping */
  }

  /* Scale down text inside cards for mobile */
  .status-card div[id$="-level"] {
    font-size: 1.3rem !important;
    overflow: visible;
    /* Was hidden, now visible for wrapping */
    text-overflow: clip;
    /* Remove ellipsis for wrapping */
    white-space: normal !important;
    /* Allow wrap */
    line-height: 1.1;
    height: auto !important;
  }

  .status-card div[id$="-desc"] {
    font-size: 0.6rem !important;
    height: 24px !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Hide description helper text to save space if needed, or keep small */
  .status-card .tooltip-container {
    display: inline-block;
  }
}

/* Status Title Styles (Default) */
.status-title {
  font-size: 0.8rem;
  color: #888;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Mobile Title Reduction */
@media (max-width: 768px) {
  .status-title {
    font-size: 0.5rem !important;
    gap: 2px;
    letter-spacing: 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    display: block;
    /* Flexbox ellipsis workaround */
    /* If display:block is used, we need to center text manually since flex gap/justify won't work same way */
    text-align: center;
  }

  /* Adjust the icon/tooltip positioning if display is block */
  .status-title .tooltip-container {
    display: inline-block;
    vertical-align: middle;
    margin-left: 2px;
  }
}

/* Hindenburg Lamp Board */
.hindenburg-zone {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 91, 91, 0.35);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255, 91, 91, 0.14), transparent 58%),
    linear-gradient(165deg, rgba(8, 11, 22, 0.95), rgba(4, 7, 16, 0.95));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 16px 36px rgba(0, 0, 0, 0.35);
}

.hindenburg-zone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.hindenburg-zone-title {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #ffb3b3;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: 0.85rem;
}

.hindenburg-guide-link {
  border: 1px solid rgba(255, 179, 179, 0.45);
  border-radius: 999px;
  background: rgba(255, 91, 91, 0.12);
  color: #ffdede;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
  padding: 0.12rem 0.5rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.hindenburg-guide-link:hover {
  background: rgba(255, 91, 91, 0.2);
  border-color: rgba(255, 179, 179, 0.7);
  color: #fff;
}

.hindenburg-zone-chips {
  display: flex;
  gap: 0.4rem;
}

.hindenburg-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #c8d2de;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.68rem;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}

.hindenburg-chip-trial {
  color: #ffd8a8;
  border-color: rgba(255, 188, 114, 0.5);
  background: rgba(255, 166, 0, 0.12);
}

.hindenburg-zone-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  margin-bottom: 0.2rem;
}

.hindenburg-lamp-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 120px;
  flex: 0 0 120px;
}

.hindenburg-main-side {
  display: flex;
  flex-direction: column;
  min-width: 260px;
  max-width: 380px;
  width: 100%;
  flex: 1 1 320px;
}

.hindenburg-lamp {
  width: 88px;
  height: 88px;
  position: relative;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.08);
  transition: box-shadow 0.35s ease, background 0.35s ease, border-color 0.35s ease;
}

.hindenburg-lamp::before,
.hindenburg-lamp::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.hindenburg-lamp::before {
  inset: -10px;
  border: 1px solid rgba(172, 198, 228, 0.22);
  box-shadow: 0 0 12px rgba(128, 157, 196, 0.12);
  opacity: 0.55;
}

.hindenburg-lamp::after {
  inset: -18px;
  border: 1px dashed rgba(116, 146, 184, 0.18);
  opacity: 0.42;
}

.hindenburg-lamp.is-off {
  background: radial-gradient(circle at 35% 30%, #353a44 0%, #1a1e26 65%, #11151d 100%);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.65), 0 0 0 rgba(255, 255, 255, 0);
}

.hindenburg-lamp.is-on-mid {
  background: radial-gradient(circle at 35% 30%, #ffe07a 0%, #ffb347 45%, #8a3f00 100%);
  border-color: rgba(255, 191, 95, 0.9);
  box-shadow: 0 0 14px rgba(255, 180, 76, 0.85), 0 0 30px rgba(255, 146, 20, 0.5);
  animation: hindenburgPulseMid 1.9s ease-in-out infinite;
}

.hindenburg-lamp.is-on-high {
  background: radial-gradient(circle at 35% 30%, #ffd0d0 0%, #ff5b5b 45%, #7a0018 100%);
  border-color: rgba(255, 130, 130, 0.95);
  box-shadow: 0 0 16px rgba(255, 92, 92, 0.9), 0 0 36px rgba(255, 0, 70, 0.5);
  animation: hindenburgPulseHigh 1.35s ease-in-out infinite;
}

.hindenburg-lamp.is-on-mid::before,
.hindenburg-lamp.is-on-high::before,
.hindenburg-lamp.is-on-mid::after,
.hindenburg-lamp.is-on-high::after {
  opacity: 0.14;
}

@keyframes hindenburgPulseMid {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 181, 84, 0.75), 0 0 26px rgba(255, 146, 20, 0.42); }
  50% { box-shadow: 0 0 22px rgba(255, 194, 108, 1), 0 0 42px rgba(255, 163, 38, 0.68); }
}

@keyframes hindenburgPulseHigh {
  0%, 100% { box-shadow: 0 0 13px rgba(255, 87, 87, 0.82), 0 0 28px rgba(255, 0, 70, 0.48); }
  50% { box-shadow: 0 0 26px rgba(255, 102, 102, 1), 0 0 50px rgba(255, 38, 94, 0.74); }
}

.hindenburg-lamp-label {
  color: #f1f6fb;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  letter-spacing: 0.08em;
}

.hindenburg-zone-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 0.5rem;
  margin-top: 0;
}

.hindenburg-metric-item {
  min-height: 62px;
  padding: 0.5rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.18rem;
}

.hindenburg-metric-label {
  font-size: 0.63rem;
  color: #8ea2b8;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hindenburg-metric-value {
  font-size: 1.28rem;
  color: #f4f8ff;
  font-family: var(--font-mono);
}

.hindenburg-metric-bar {
  width: 100%;
  height: 5px;
  margin-top: 0.25rem;
  border-radius: 999px;
  background: rgba(143, 163, 190, 0.18);
  overflow: hidden;
}

.hindenburg-metric-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff8f68 0%, #ff5f7d 100%);
  box-shadow: 0 0 8px rgba(255, 114, 114, 0.4);
  transition: width 0.35s ease;
}

.hindenburg-watch-window {
  margin-top: 0.32rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.36rem 0.48rem 0.42rem;
}

.hindenburg-watch-window.is-active {
  border-color: rgba(255, 153, 102, 0.56);
  background: linear-gradient(120deg, rgba(255, 98, 98, 0.12), rgba(255, 169, 74, 0.08));
}

.hindenburg-watch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.28rem;
}

.hindenburg-watch-title {
  color: #8ea5be;
  font-size: 0.61rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hindenburg-watch-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 0.08rem 0.38rem;
  border-radius: 999px;
  border: 1px solid rgba(173, 195, 218, 0.32);
  color: #d8e6f6;
  background: rgba(124, 148, 175, 0.16);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
}

.hindenburg-watch-window.is-active .hindenburg-watch-status {
  border-color: rgba(255, 184, 117, 0.75);
  color: #fff5de;
  background: rgba(255, 139, 68, 0.28);
}

.hindenburg-watch-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(140, 161, 186, 0.2);
  overflow: hidden;
}

.hindenburg-watch-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
  background: linear-gradient(90deg, #8ea5be 0%, #6b829e 100%);
}

.hindenburg-watch-window.is-active .hindenburg-watch-fill {
  background: linear-gradient(90deg, #ff7f5f 0%, #ffb860 100%);
  box-shadow: 0 0 10px rgba(255, 146, 89, 0.48);
}

.hindenburg-watch-text {
  margin-top: 0.24rem;
  color: #b3c5da;
  font-size: 0.63rem;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}

.hindenburg-zone-desc {
  grid-column: 1 / -1;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.5rem 0.6rem;
  color: #c7d5e6;
  background: rgba(9, 13, 26, 0.68);
  font-family: var(--font-mono);
  font-size: 0.73rem;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hindenburg-history-block {
  margin-top: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 0.62rem;
}

.hindenburg-history-header {
  color: #9ab0c7;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  margin-bottom: 0.45rem;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  transition: color 0.2s ease;
}

.hindenburg-history-header:hover {
  color: #c0d3e8;
}

.hindenburg-history-header:focus-visible {
  outline: 1px solid rgba(156, 184, 214, 0.55);
  outline-offset: 2px;
  border-radius: 7px;
}

.hindenburg-history-toggle-icon {
  display: inline-block;
  font-size: 0.66rem;
  transition: transform 0.24s ease;
}

.hindenburg-history-header.is-collapsed .hindenburg-history-toggle-icon {
  transform: rotate(-90deg);
}

.hindenburg-history-content {
  overflow: hidden;
  max-height: 180px;
  opacity: 1;
  transition: max-height 0.32s ease, opacity 0.24s ease;
}

.hindenburg-history-content.collapsed {
  max-height: 0;
  opacity: 0;
}

.hindenburg-history-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.hindenburg-history-item {
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.34rem 0.6rem;
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  align-items: center;
  width: auto;
  min-width: 78px;
  flex: 0 0 auto;
}

.hindenburg-history-item.is-on {
  border-color: rgba(255, 152, 107, 0.58);
  background: rgba(255, 88, 88, 0.11);
}

.hindenburg-history-item.is-off {
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
}

.hindenburg-history-item.is-empty {
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  min-width: 128px;
}

.hindenburg-history-date {
  color: #dbe8f7;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-align: center;
}

.hindenburg-history-state {
  color: #eef4ff;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

@media (max-width: 768px) {
  .hindenburg-zone {
    margin-top: 0.8rem;
    padding: 0.8rem;
  }

  .hindenburg-zone-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .hindenburg-zone-title {
    flex-wrap: wrap;
  }

  .hindenburg-guide-link {
    font-size: 0.58rem;
    padding: 0.11rem 0.42rem;
  }

  .hindenburg-zone-main {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .hindenburg-lamp-stack {
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex: 0 0 auto;
  }

  .hindenburg-main-side {
    min-width: 0;
    max-width: none;
    width: 100%;
    flex: 0 0 auto;
  }

  .hindenburg-lamp {
    width: 66px;
    height: 66px;
  }

  .hindenburg-zone-metrics {
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
  }

  .hindenburg-metric-item {
    min-height: 62px;
    padding: 0.4rem 0.3rem;
  }

  .hindenburg-metric-value {
    font-size: 1.05rem;
  }

  .hindenburg-watch-window {
    margin-top: 0.28rem;
    padding: 0.32rem 0.42rem 0.38rem;
  }

  .hindenburg-watch-status {
    min-width: 58px;
    font-size: 0.58rem;
  }

  .hindenburg-watch-text {
    font-size: 0.58rem;
  }

  .hindenburg-zone-desc {
    font-size: 0.63rem;
    min-height: 34px;
    padding: 0.42rem;
  }

  .hindenburg-history-list { gap: 0.35rem; }

  .hindenburg-history-item { min-width: 70px; padding: 0.3rem 0.48rem; }

  .hindenburg-history-state {
    max-width: 70px;
    font-size: 0.65rem;
  }
}

/* DASHBOARD GRID LAYOUT */
.dashboard-grid {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Responsiveness */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  /* Mobile Chart: Bottom Sheet Modal */
  .chart-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-height: 50vh;
    /* Half screen */
    border-radius: 16px 16px 0 0;
    z-index: 1000;
    border: 1px solid var(--accent-cyan);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
    transform: translateY(110%);
    /* Hidden by default */
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .chart-panel.active {
    transform: translateY(0);
  }

  /* Sticky header for ranking list on mobile */
  .ranking-panel {
    max-height: none;
    overflow-y: visible;
    padding-bottom: 200px;
    /* Space for chart */
  }
}

.panel {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  /* overflow: hidden; Removed to allow tooltips */
  height: 100%;
}

.ranking-panel {
  padding: 1rem;
  /* Make ranking scrollable if too long */
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.chart-panel {
  position: relative;
  /* Desktop defaults */
  min-height: 600px;
  padding: 0;
  border: 1px solid var(--border-color);
  background-color: #000;
}

#tradingview_widget {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

/* TABLE STYLES */
.ranking-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.5rem;
}

.ranking-table th {
  text-align: left;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 0.5rem;
  padding-bottom: 0.5rem;
  font-weight: 600;
  position: sticky;
  top: 0;
  background-color: var(--card-bg);
  /* Opaque for stickiness */
  z-index: 10;
}

.ranking-row {
  cursor: pointer;
  /* Clickable */
  transition: transform 0.2s, background-color 0.2s;
}

.ranking-row:hover,
.ranking-row.selected {
  transform: translateX(4px);
}

.ranking-row.selected td {
  background-color: rgba(88, 166, 255, 0.15);
  border: 1px solid rgba(88, 166, 255, 0.3);
}

.ranking-row td {
  background-color: rgba(255, 255, 255, 0.03);
  padding: 0.8rem 0.5rem;
  border: 1px solid transparent;
  /* Prevent layout shift on select */
}

.ranking-row td:first-child {
  border-radius: 8px 0 0 8px;
  font-weight: bold;
  font-family: var(--font-mono);
  width: 30px;
  text-align: center;
}

.ranking-row td:last-child {
  border-radius: 0 8px 8px 0;
}

.ticker-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ticker-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.count-cell {
  text-align: right;
  width: 100px;
}

.count-val {
  font-family: var(--font-mono);
  font-weight: bold;
  font-size: 1rem;
  color: var(--accent-cyan);
}

.bar-container {
  width: 100%;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), #a2d2ff);
  border-radius: 2px;
  width: 0%;
  transition: width 1s ease-out;
}

/* TICKER ICON */
.ticker-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #fff;
  /* fallback for transparent logos */
  object-fit: contain;
}

/* TOPIC GRID */
.topic-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem;
}

.topic-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.topic-item:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.1);
  transform: translateY(-2px);
}

.topic-word {
  color: var(--text-primary);
  font-weight: 600;
}

.topic-count {
  background: var(--accent-cyan);
  color: #000;
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  font-weight: 800;
}

/* Rank Badges */
.rank-1 td:first-child {
  color: var(--accent-gold);
  text-shadow: 0 0 10px var(--accent-gold);
  font-size: 1.2rem;
}

.rank-2 td:first-child {
  color: silver;
}

.rank-3 td:first-child {
  color: #cd7f32;
}


/* Mood Badges */
.ticker-info {
  display: flex;
  flex-direction: column;
}

.mood-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  width: fit-content;
  margin-top: 2px;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 4px;
}

.mood-badge.bullish {
  background: rgba(0, 255, 136, 0.15);
  color: #00ff88;
  border: 1px solid rgba(0, 255, 136, 0.3);
  box-shadow: 0 0 5px rgba(0, 255, 136, 0.1);
}

.mood-badge.bearish {
  background: rgba(255, 60, 60, 0.15);
  color: #ff3c3c;
  border: 1px solid rgba(255, 60, 60, 0.3);
  box-shadow: 0 0 5px rgba(255, 60, 60, 0.1);
}

.mood-badge.neutral {
  background: rgba(255, 255, 255, 0.05);
  color: #aaa;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Market Overview */
.market-overview {
  background: rgba(0, 20, 40, 0.6);
  border: 1px solid var(--accent-cyan);
  border-left: 4px solid var(--accent-cyan);
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.1);
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.3s ease;
}

.overview-header-controls {
  justify-content: space-between;
  width: 100%;
  flex-wrap: wrap;
}

.overview-title-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.overview-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-cyan);
  margin-left: auto;
}

.overview-btn {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 240, 255, 0.35);
  color: #e0f7ff;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.overview-btn:hover {
  border-color: rgba(0, 240, 255, 0.8);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.25);
}

.overview-btn:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
}

.overview-history-label {
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.market-overview:hover {
  background: rgba(0, 20, 40, 0.8);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
}

.overview-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid rgba(0, 240, 255, 0.2);
  padding-bottom: 4px;
}

.overview-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #e0f7ff;
  margin: 0;
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.3);
}

.overview-blink {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* Real-time Pulse Animations */
@keyframes pulse-green {
  0% {
    text-shadow: 0 0 0 rgba(0, 255, 136, 0.4);
  }

  70% {
    text-shadow: 0 0 10px rgba(0, 255, 136, 0);
  }

  100% {
    text-shadow: 0 0 0 rgba(0, 255, 136, 0);
  }
}

@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 60, 60, 0.7);
    border-color: #fff;
  }

  70% {
    box-shadow: 0 0 0 10px rgba(255, 60, 60, 0);
    border-color: #ff3c3c;
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 60, 60, 0);
  }
}

/* HEATMAP STYLES REMOVED */

footer {
  text-align: center;
  padding: 2rem;
  color: #666;
  font-size: 0.8rem;
  margin-top: auto;
}

footer a {
  color: var(--accent-cyan);
  text-decoration: none;
}

#loading {
  text-align: center;
  padding: 4rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* GAUGE STYLES */
.gauge-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
  gap: 10px;
}

.gauge-container {
  position: relative;
  width: 300px;
  height: 150px;
  /* Half circle */
  /* Remove overflow hidden to let needle glow bleed if needed,
     but keeping it for mask safety usually is better.
     Let's keep text OUTSIDE this container. */
  overflow: visible;
}

.gauge-body {
  width: 300px;
  height: 150px;
  /* Full circle */
  background: conic-gradient(from 270deg at 50% 100%,
      #ff4444 0deg,
      #ff8844 45deg,
      #ffff00 90deg,
      #ccff00 135deg,
      #00ff88 180deg);
  border-radius: 150px 150px 0 0;
  position: absolute;
  top: 0;
  left: 0;
  /* Mask the center to make it an arc */
  mask: radial-gradient(at 50% 100%, transparent 60%, black 61%);
  -webkit-mask: radial-gradient(at 50% 100%, transparent 60%, black 61%);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.gauge-needle {
  position: absolute;
  bottom: 0;
  left: 50%;

  /* SIMPLE SOLID RECTANGLE - NO TRICKS */
  width: 8px;
  height: 135px;
  margin-left: -4px;
  /* Center (half of width) */

  background: #fff;
  background: linear-gradient(to top, #fff 40%, #ddd 100%);

  /* Round Tip */
  border-radius: 4px 4px 0 0;

  /* Rotation Pivot at Bottom */
  transform-origin: bottom center;
  transform: rotate(-90deg);
  transition: transform 1s cubic-bezier(0.4, 0.0, 0.2, 1);

  z-index: 999;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);

  /* Explicitly reset interfering properties */
  border: none;
  padding: 0;
  box-sizing: border-box;
  clip-path: none;
}

/* Static Pin (Added to HTML next) */
.gauge-pin {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 30px;
  height: 30px;
  transform: translate(-50%, 50%);
  /* Start center at bottom edge */

  background-image: linear-gradient(to bottom, #555, #222);
  border: 2px solid #111;
  border-radius: 50%;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
  z-index: 101;
}

.gauge-pin::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background-color: #000;
  border-radius: 50%;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

.gauge-labels {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.gauge-labels span {
  position: absolute;
  font-weight: bold;
  font-size: 0.9rem;
  top: 75%;
  color: #fff;
  text-shadow: 0 0 4px #000;
}

.gauge-labels .fear {
  left: 30px;
  color: #ff4444;
}

.gauge-labels .ongi {
  right: 30px;
  color: #00ff88;
}

.gauge-score-display {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 3.5rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
  line-height: 0.8;
  z-index: 10;
}

.gauge-status-text {
  margin-top: 0.5rem;
  font-size: 1.4rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
}

.ai-comment {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #444;
}

/* BREAKING NEWS TICKER */
#breaking-news-container {
  width: 100%;
  max-width: none;
  background: rgba(10, 10, 18, 0.95);
  border: none;
  border-bottom: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 0;
  height: 48px;
  display: flex;
  align-items: center;
  overflow: hidden;
  position: relative;
  z-index: 2000;
  margin: 0;
}

.news-label {
  background: linear-gradient(135deg, #0056b3 0%, #00a8ff 100%);
  box-shadow: 0 0 10px rgba(0, 168, 255, 0.4);
  color: #fff;
  font-weight: 800;
  padding: 0 1rem;
  height: 100%;
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  white-space: nowrap;
  z-index: 10;
  border-right: 1px solid rgba(0, 0, 0, 0.3);
}

.news-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

#news-marquee {
  white-space: nowrap;
  padding-left: 100%;
  animation: marquee 45s linear infinite;
  color: #c7dbe6;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1.0rem;
  display: inline-block;
  text-shadow: 0 0 2px rgba(0, 200, 255, 0.2);
  letter-spacing: 0.5px;
}

@keyframes marquee {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-100%);
  }
}

/* Tooltip System */
.tooltip-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
  margin-left: 0.5rem;
}

.tooltip-icon {
  width: 18px;
  height: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: #aaa;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.tooltip-icon:hover {
  background: var(--accent-purple);
  color: #fff;
  border-color: var(--accent-purple);
}

.tooltip-text {
  visibility: hidden;
  width: 280px;
  background-color: #1a1a24;
  color: #ddd;
  text-align: left;
  border-radius: 6px;
  padding: 12px;
  position: absolute;
  z-index: 1000;
  bottom: 135%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.85rem;
  line-height: 1.5;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
  font-family: var(--font-base);
  font-weight: normal;
  pointer-events: none;
}

.tooltip-container:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Mobile responsive tooltip (optional: adjust position) */
@media (max-width: 768px) {
  .tooltip-text {
    width: 200px;
    left: -100px;
    transform: none;
  }
}

/* POLYMARKET STYLES - COMPACT */
.polymarket-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.poly-card-link {
  text-decoration: none;
  color: inherit;
  flex: 0 0 calc(20% - 0.8rem);
  min-width: 140px;
  display: flex;
}

@media (max-width: 1400px) {
  .poly-card-link {
    flex: 0 0 calc(25% - 0.75rem);
  }
}

@media (max-width: 1100px) {
  .poly-card-link {
    flex: 0 0 calc(33.33% - 0.67rem);
  }
}

@media (max-width: 768px) {
  .poly-card-link {
    flex: 0 0 calc(50% - 0.5rem);
  }
}

.poly-card {
  background-color: #1a1625;
  border: 1px solid #4a3b69;
  border-radius: 8px;
  padding: 0.8rem;
  /* width: 100%; Removed to allow flex-basis to work */
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s, border-color 0.2s;
  min-height: 140px;
  height: auto;
  box-sizing: border-box;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  /* Ensure nothing spills out */
}

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

.poly-header {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.3;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 2.6em;
  /* fixed height for 2 lines */
}

/* Tooltip override for cleanliness */
@media (max-width: 768px) {
  .tooltip-text {
    display: none !important;
  }
}

.poly-outcome {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #ccc;
  margin-top: auto;
  font-family: var(--font-mono);
}

.poly-volume {
  font-size: 0.75rem;
  color: #888;
  margin-top: 0.5rem;
  text-align: right;
  font-family: var(--font-mono);
}

.outcome-pill {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Trend Indicators */
.trend-up {
  color: #00ff88;
  font-size: 0.6em;
  animation: pulse-green 2s infinite;
}

.trend-down {
  color: #ff4444;
  font-size: 0.6em;
}

.trend-stay {
  color: #666;
  font-size: 0.6em;
}

.trend-new {
  color: #00d4ff;
  font-size: 0.5em;
  font-weight: 800;
  border: 1px solid #00d4ff;
  border-radius: 4px;
  padding: 1px 3px;
  letter-spacing: 0.05em;
  animation: pulse 2s infinite;
}

/* RANKING HEADER & TABS */
.ranking-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1rem;
}

.source-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--border-color);
}

.source-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 16px;
  border-radius: 16px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  /* Removed white-space: nowrap to allow shrink logic, but handled via font-size instead */
  transition: all 0.2s ease;
  flex: 1 1 auto;
  /* Allow shrinking/growing */
  justify-content: center;
  display: flex;
  align-items: center;
}

@media (max-width: 480px) {
  .source-tab {
    padding: 6px 8px;
    /* Very tight padding */
    font-size: 0.65rem;
    /* Smaller font to fit MISSISSIPPI */
    min-width: 0;
    /* Allow flex item to shrink below content size if absolutely needed (though we want to avoid cutting) */
    white-space: nowrap;
    /* Keep nowrap but ensure it fits via size */
  }
}

.source-tab:hover {
  color: var(--text-primary);
}

.source-tab.active {
  background: var(--accent-cyan);
  color: #000;
  box-shadow: 0 0 10px rgba(88, 166, 255, 0.4);
}

.source-tab[data-source="reddit"].active {
  background: #ff4500;
  /* Reddit Orange */
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 69, 0, 0.4);
}

/* Comparative Insight Compact */
.ranking-header {
  position: relative;
  /* Ensure flex container behaviors if needed, though default is flex center */
  gap: 10px;
}

.comparative-toggle-mini {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--accent-gold);
  border-radius: 50%;
  /* Circle or rounded square */
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
}

.comparative-toggle-mini:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.1);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.comparative-toggle-mini.open {
  background: var(--accent-gold);
  color: #000;
}

.comparative-content {
  margin-top: 10px;
  padding: 12px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #fff;
  border-left: 2px solid var(--accent-gold);
  background: rgba(0, 0, 0, 0.3);
  font-family: "JetBrains Mono", monospace;
  animation: slideDown 0.3s ease-out;
  border-radius: 4px;
  width: 100%;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

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

.ranking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  gap: 10px;
  margin-bottom: 10px;
}

.header-help-container {
  position: relative;
  display: inline-block;
  cursor: help;
}

.header-help-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
}

.header-help-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: var(--accent-cyan);
}

.header-help-text {
  visibility: hidden;
  width: 180px;
  background-color: rgba(0, 0, 0, 0.95);
  color: #fff;
  text-align: left;
  border-radius: 6px;
  padding: 10px;
  position: absolute;
  z-index: 100;
  top: 125%;
  right: 0;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.75rem;
  pointer-events: none;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  line-height: 1.4;
  font-family: var(--font-main);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.help-title {
  font-weight: bold;
  margin-bottom: 5px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 3px;
}

.help-row {
  color: #fff !important;
  opacity: 1 !important;
  margin-bottom: 2px;
}

.header-help-container:hover .header-help-text {
  visibility: visible;
  opacity: 1;
}

/* Mobile Tooltip Overlay Styles */
.tooltip-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.tooltip-modal {
  background: #1a1a24;
  border: 1px solid var(--accent-cyan);
  border-radius: 12px;
  padding: 20px;
  max-width: 90%;
  color: #fff;
  font-family: var(--font-main);
  box-shadow: 0 0 20px rgba(0, 168, 255, 0.3);
  position: relative;
  animation: popIn 0.3s ease-out;
}

.tooltip-close {
  margin-top: 15px;
  text-align: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  color: var(--accent-cyan);
}

@keyframes popIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Polymarket Grid */
.polymarket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.polymarket-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  transition: all 0.2s ease;
}

.polymarket-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.poly-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.poly-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.poly-outcomes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.poly-outcome-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px 8px;
  border-radius: 4px;
}

/* Word Cloud Sizing */
#wordcloud-container {
  width: 100%;
  height: 500px;
  /* Increased from default */
  min-height: 400px;
}

#topic-canvas {
  width: 100%;
  height: 100%;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
  .polymarket-grid {
    grid-template-columns: 1fr;
    /* Force 1 column on mobile */
  }

  /* Ensure wordcloud is not too small on mobile */
  #wordcloud-container {
    height: 350px;
    min-height: 300px;
  }
}

/* History Chart Collapse Styles */
.history-header {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 10px;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: color 0.2s;
}

.history-header:hover {
  color: var(--accent-cyan);
}

.history-content {
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0, 1, 0, 1), opacity 0.4s ease;
  max-height: 500px;
  /* Arbitrary large enough height */
  opacity: 1;
}

.history-content.collapsed {
  max-height: 0;
  opacity: 0;
}

#history-toggle-icon {
  font-size: 0.7rem;
}

/* --- SLIDE MENU STYLES --- */
.menu-container {
  display: flex;
  align-items: center;
}

.menu-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 20px;
  padding: 0;
  z-index: 1100;
  /* Above menu */
}

.menu-bar {
  display: block;
  width: 100%;
  height: 3px;
  background-color: var(--text-primary);
  border-radius: 3px;
}

/* Overlay */
.slide-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.slide-menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Slide Menu Panel */
.slide-menu {
  position: fixed;
  top: 0;
  right: -300px;
  /* Hidden */
  width: 280px;
  height: 100%;
  background: rgba(13, 17, 23, 0.98);
  border-left: 1px solid var(--accent-cyan);
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
  z-index: 2001;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  box-sizing: border-box;
}

.slide-menu.active {
  right: 0;
}

.slide-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 1rem;
}

.slide-menu-title {
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--accent-cyan);
}

.slide-menu-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.slide-menu-close:hover {
  color: #fff;
}

.slide-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.slide-menu-item {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 600;
  display: block;
  transition: transform 0.2s, color 0.2s;
}

.slide-menu-item:hover {
  color: var(--accent-cyan);
  transform: translateX(5px);
}

.menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0.5rem 0;
}

.slide-menu-footer {
  margin-top: auto;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  line-height: 1.6;
}

/* ABOUT PAGE STYLES */
.about-panel {
  animation: fadeIn 0.5s ease;
}

.about-content h3 {
  border-left: 3px solid var(--accent-cyan);
  padding-left: 10px;
}

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

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

/* MAGI VIEW */
.magi-panel {
  padding: 1.5rem;
  border: 1px solid rgba(72, 151, 245, 0.45);
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 10% 12%, rgba(56, 189, 248, 0.14), transparent 34%),
    radial-gradient(circle at 92% 88%, rgba(16, 185, 129, 0.12), transparent 30%),
    linear-gradient(165deg, rgba(3, 15, 30, 0.94), rgba(2, 9, 20, 0.94));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02), 0 18px 42px rgba(0, 0, 0, 0.34);
}

.magi-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(transparent 96%, rgba(89, 169, 255, 0.08) 100%);
  background-size: 100% 22px;
  pointer-events: none;
  opacity: 0.55;
}

.magi-header {
  position: relative;
  border-bottom: 1px solid rgba(88, 166, 255, 0.25);
  padding-bottom: 0.95rem;
}

.magi-title {
  margin: 0;
  color: #e6f2ff;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  font-size: 1.35rem;
}

.magi-subtitle {
  margin: 0.45rem 0 0;
  color: #8ea9bf;
  font-size: 0.95rem;
}

.magi-meta-row {
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.magi-meta-pill {
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  color: #d7e4ef;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.07em;
}

.magi-network {
  margin-top: 1.15rem;
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(340px, 1.15fr) minmax(220px, 1fr);
  grid-template-rows: minmax(180px, auto) minmax(280px, auto);
  grid-template-areas:
    ". top ."
    "left core right";
  gap: 1rem;
}

.magi-node-top {
  grid-area: top;
  position: relative;
  z-index: 2;
}

.magi-node-left {
  grid-area: left;
  position: relative;
  z-index: 2;
}

.magi-node-right {
  grid-area: right;
  position: relative;
  z-index: 2;
}

.magi-agent-card {
  position: relative;
  min-height: 170px;
  border-radius: 14px;
  padding: 0.95rem;
  background: linear-gradient(170deg, rgba(24, 45, 74, 0.62) 0%, rgba(6, 13, 26, 0.84) 86%);
  border: 1px solid rgba(151, 192, 241, 0.2);
  overflow: hidden;
  backdrop-filter: blur(2px);
}

.magi-agent-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  opacity: 0.95;
}

.magi-agent-card.melchior::before {
  background: linear-gradient(90deg, #ff8a63, #ff6258);
}

.magi-agent-card.balthasar::before {
  background: linear-gradient(90deg, #59c8ff, #53b8f3);
}

.magi-agent-card.casper::before {
  background: linear-gradient(90deg, #25f0c5, #1ad6aa);
}

.magi-agent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.magi-agent-label {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  color: #dce6ef;
}

.magi-agent-state,
.magi-state-badge,
.magi-vote-item strong {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-family: var(--font-mono);
  font-size: 0.69rem;
  letter-spacing: 0.05em;
  color: #d8e3ec;
  padding: 0.16rem 0.58rem;
  text-transform: uppercase;
}

.magi-agent-state.risk-on,
.magi-state-badge.risk-on,
.magi-vote-item strong.risk-on {
  color: #0dffbe;
  border-color: rgba(13, 255, 190, 0.55);
  background: rgba(13, 255, 190, 0.09);
}

.magi-agent-state.defensive,
.magi-state-badge.defensive,
.magi-vote-item strong.defensive {
  color: #ff9c90;
  border-color: rgba(255, 156, 144, 0.55);
  background: rgba(255, 156, 144, 0.09);
}

.magi-agent-state.neutral,
.magi-state-badge.neutral,
.magi-vote-item strong.neutral {
  color: #cad8e6;
  border-color: rgba(202, 216, 230, 0.4);
  background: rgba(202, 216, 230, 0.08);
}

.magi-agent-answer {
  margin: 0;
  color: #d7e2ee;
  line-height: 1.56;
  font-size: 0.9rem;
  white-space: pre-line;
}

#magi-final-card {
  grid-area: core;
  align-self: center;
}

.magi-final-card {
  position: relative;
  border: 1px solid rgba(88, 166, 255, 0.42);
  border-radius: 18px;
  padding: 1.1rem 1.2rem;
  min-height: 250px;
  background:
    radial-gradient(circle at 60% 35%, rgba(74, 175, 255, 0.15), transparent 52%),
    radial-gradient(circle at 46% 70%, rgba(255, 129, 64, 0.14), transparent 40%),
    rgba(2, 11, 24, 0.93);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.33), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.magi-final-card::before {
  content: "TANUKI";
  position: absolute;
  right: 14px;
  bottom: 6px;
  font-family: var(--font-mono);
  font-size: 2.2rem;
  letter-spacing: 0.16em;
  color: rgba(82, 153, 230, 0.14);
  pointer-events: none;
}

.magi-final-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.magi-final-label {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  color: #adc5d9;
}

.magi-final-heading {
  margin: 0.65rem 0 0;
  color: #f3f8ff;
  font-size: 1.03rem;
  line-height: 1.45;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.magi-final-answer {
  margin: 0.42rem 0 0;
  color: #f1f6fb;
  font-size: 0.96rem;
  line-height: 1.58;
  font-weight: 500;
  white-space: pre-line;
}

.magi-final-reason {
  margin: 0.58rem 0 0;
  color: #b6cce1;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-line;
}

.magi-final-reason:empty {
  display: none;
}

.magi-vote-grid {
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.magi-vote-item {
  border: 1px solid rgba(150, 190, 235, 0.25);
  border-radius: 11px;
  padding: 0.45rem 0.55rem;
  background: rgba(10, 27, 48, 0.56);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.magi-vote-item span {
  color: #98b5ce;
  font-size: 0.67rem;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}

.magi-vote-item strong {
  align-self: flex-start;
}

.magi-consensus-row {
  margin-top: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(120, 170, 225, 0.22);
}

.magi-consensus-label {
  color: #93acc2;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}

.magi-consensus-code {
  color: #9ed0ff;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  border: 1px solid rgba(88, 166, 255, 0.38);
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
}

.magi-final-card.is-risk-on {
  border-color: rgba(0, 255, 136, 0.58);
  box-shadow: 0 0 34px rgba(0, 255, 136, 0.16);
}

.magi-final-card.is-neutral {
  border-color: rgba(113, 153, 197, 0.45);
  box-shadow: 0 0 30px rgba(92, 136, 182, 0.16);
}

.magi-final-card.is-defensive {
  border-color: rgba(255, 120, 120, 0.56);
  box-shadow: 0 0 34px rgba(255, 120, 120, 0.15);
}

.magi-final-tags {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.magi-tag {
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(88, 166, 255, 0.35);
  background: rgba(88, 166, 255, 0.12);
  color: #cfe4ff;
  font-size: 0.74rem;
  font-family: var(--font-mono);
}

.magi-link {
  position: absolute;
  height: 2px;
  background: linear-gradient(90deg, rgba(255, 148, 87, 0), rgba(255, 148, 87, 0.7), rgba(255, 148, 87, 0));
  pointer-events: none;
  opacity: 0.85;
  z-index: 0;
}

.magi-link-top {
  width: 52%;
  height: 2px;
  left: 24%;
  top: 63%;
  transform: none;
}

.magi-link-left {
  width: 33%;
  left: 50%;
  top: 42%;
  transform: rotate(141deg);
  transform-origin: left center;
}

.magi-link-right {
  width: 33%;
  left: 50%;
  top: 42%;
  transform: rotate(39deg);
  transform-origin: left center;
}

@media (max-width: 1180px) {
  .magi-network {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "core"
      "top"
      "left"
      "right";
  }

  .magi-link {
    display: none;
  }

  .magi-final-card {
    min-height: 0;
  }

  .magi-vote-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .magi-panel {
    padding: 1rem;
  }

  .magi-title {
    font-size: 1.12rem;
  }

  .magi-agent-card {
    min-height: 0;
  }

  .magi-final-answer {
    font-size: 1rem;
  }
}

/* MAGI ENHANCED OVERRIDES */
.magi-panel {
  isolation: isolate;
  border-color: rgba(94, 194, 255, 0.55);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 26px 58px rgba(0, 0, 0, 0.42);
}

.magi-panel::after {
  display: none;
  content: none;
  animation: none;
}

.magi-header,
.magi-network {
  position: relative;
  z-index: 2;
}

.magi-title {
  letter-spacing: 0.12em;
  text-shadow: 0 0 18px rgba(87, 188, 255, 0.36);
}

.magi-network {
  gap: 1.1rem;
}

.magi-node-top {
  animation: magiNodeDrift 5.4s ease-in-out infinite;
}

.magi-agent-card {
  min-height: 178px;
  border-color: rgba(157, 196, 240, 0.3);
  background:
    linear-gradient(170deg, rgba(24, 45, 74, 0.66) 0%, rgba(6, 13, 26, 0.9) 88%),
    radial-gradient(circle at 85% 18%, rgba(88, 166, 255, 0.14), transparent 42%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 14px 32px rgba(0, 0, 0, 0.34);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
}

.magi-agent-card::before {
  z-index: 3;
}

.magi-agent-card::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 10px;
  background-image: var(--magi-watermark-image);
  background-repeat: no-repeat;
  background-position: center 58%;
  background-size: min(70%, 185px) auto;
  opacity: 0.1;
  filter: saturate(0.8) contrast(1.08);
  pointer-events: none;
  z-index: 1;
}

.magi-agent-card > * {
  position: relative;
  z-index: 2;
}

.magi-agent-card.balthasar {
  --magi-watermark-image: url("./picture/chatgpt_log.png");
}

.magi-agent-card.casper {
  --magi-watermark-image: url("./picture/tanuki_logo.png");
}

.magi-agent-card.melchior {
  --magi-watermark-image: url("./picture/polymarket_logo.png");
}

.magi-agent-card.balthasar::after {
  opacity: 0.11;
}

.magi-agent-card.casper::after {
  opacity: 0.09;
}

.magi-agent-card.melchior::after {
  opacity: 0.085;
}

.magi-agent-card:hover {
  transform: translateY(-3px);
  border-color: rgba(183, 223, 255, 0.5);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.4), 0 0 16px rgba(88, 166, 255, 0.15);
}

#magi-final-card {
  z-index: 2;
}

.magi-final-card {
  min-height: 270px;
  padding: 1.2rem 1.3rem;
  border-color: rgba(88, 166, 255, 0.52);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.42),
    0 0 26px rgba(88, 166, 255, 0.13),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.magi-final-card::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 56%;
  width: 430px;
  height: 430px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(98, 183, 255, 0.2);
  box-shadow: 0 0 30px rgba(98, 183, 255, 0.1), inset 0 0 32px rgba(98, 183, 255, 0.08);
  pointer-events: none;
  z-index: 0;
  animation: magiCorePulseNeo 5.8s ease-in-out infinite;
}

.magi-final-card>* {
  position: relative;
  z-index: 2;
}

.magi-final-answer {
  font-size: 0.98rem;
  line-height: 1.62;
  text-shadow: 0 0 16px rgba(79, 177, 255, 0.12);
}

.magi-vote-item {
  border-color: rgba(150, 190, 235, 0.32);
  background:
    linear-gradient(155deg, rgba(11, 28, 49, 0.7), rgba(7, 18, 34, 0.66)),
    radial-gradient(circle at 82% 20%, rgba(88, 166, 255, 0.16), transparent 56%);
}

.magi-consensus-code {
  border-color: rgba(88, 166, 255, 0.52);
  background: rgba(10, 35, 64, 0.54);
  box-shadow: 0 0 14px rgba(88, 166, 255, 0.18);
}

.magi-tag {
  border-color: rgba(88, 166, 255, 0.48);
  background: linear-gradient(150deg, rgba(88, 166, 255, 0.22), rgba(88, 166, 255, 0.08));
  box-shadow: inset 0 0 10px rgba(88, 166, 255, 0.14);
}

.magi-link {
  opacity: 0.95;
  filter: drop-shadow(0 0 7px rgba(255, 148, 87, 0.5));
  animation: magiLinkPulseNeo 2.5s ease-in-out infinite;
  z-index: 0;
}

.magi-link-top {
  width: 52%;
  height: 2px;
  left: 24%;
  top: 63%;
  transform: none;
}

.magi-link-left,
.magi-link-right {
  width: 33%;
  left: 50%;
  top: 42%;
  transform-origin: left center;
}

.magi-link-left {
  transform: rotate(141deg);
}

.magi-link-right {
  transform: rotate(39deg);
}

@keyframes magiNodeDrift {
  0% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }

  100% {
    transform: translateY(0);
  }
}

@keyframes magiLinkPulseNeo {
  0% {
    opacity: 0.58;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.58;
  }
}

@keyframes magiCorePulseNeo {
  0% {
    transform: translate(-50%, -50%) scale(0.98);
    opacity: 0.78;
  }

  50% {
    transform: translate(-50%, -50%) scale(1.02);
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -50%) scale(0.98);
    opacity: 0.78;
  }
}

@media (max-width: 1180px) {
  .magi-final-card {
    clip-path: none;
    min-height: 0;
  }

  .magi-final-card::after {
    width: 280px;
    height: 280px;
  }
}

@media (max-width: 900px) {
  .magi-network {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
  }

  #magi-final-card {
    order: 1;
  }

  .magi-node-top {
    order: 2;
    animation: none;
  }

  .magi-node-left {
    order: 3;
  }

  .magi-node-right {
    order: 4;
  }

  .magi-link {
    display: none;
  }

  .magi-final-card::after {
    width: 260px;
    height: 260px;
    top: 50%;
  }
}

@media (max-width: 680px) {
  .magi-panel {
    padding: 0.9rem;
    border-radius: 14px;
  }

  .magi-subtitle {
    font-size: 0.86rem;
    line-height: 1.45;
  }

  .magi-meta-row {
    margin-top: 0.6rem;
    gap: 0.45rem;
  }

  .magi-meta-pill {
    font-size: 0.68rem;
    padding: 0.18rem 0.5rem;
    letter-spacing: 0.05em;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .magi-agent-card {
    clip-path: none;
    min-height: 0;
    border-radius: 12px;
    padding: 0.8rem;
  }

  .magi-agent-card::after {
    background-size: min(62%, 150px) auto;
    opacity: 0.075;
  }

  .magi-agent-label {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
  }

  .magi-agent-answer {
    font-size: 0.84rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .magi-final-card {
    padding: 0.9rem;
    border-radius: 12px;
    clip-path: none;
  }

  .magi-final-heading {
    font-size: 0.92rem;
    line-height: 1.45;
  }

  .magi-final-answer {
    font-size: 0.88rem;
    line-height: 1.55;
  }

  .magi-final-reason {
    font-size: 0.74rem;
    line-height: 1.5;
  }

  .magi-vote-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .magi-vote-item {
    padding: 0.38rem 0.42rem;
    min-width: 0;
  }

  .magi-vote-item span {
    font-size: 0.58rem;
    letter-spacing: 0.06em;
  }

  .magi-vote-item strong {
    font-size: 0.62rem;
    padding: 0.12rem 0.44rem;
  }

  .magi-consensus-row {
    margin-top: 0.6rem;
    padding-top: 0.55rem;
  }

  .magi-consensus-code {
    font-size: 0.78rem;
    padding: 0.16rem 0.45rem;
    letter-spacing: 0.08em;
  }

  .magi-final-tags {
    gap: 0.38rem;
  }

  .magi-tag {
    font-size: 0.66rem;
    padding: 0.14rem 0.42rem;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .magi-panel::after,
  .magi-final-card::after {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .magi-panel::after,
  .magi-node-top,
  .magi-link,
  .magi-final-card::after {
    animation: none;
  }

  .magi-agent-card {
    transition: none;
  }
}

/* --- TRADE RECOMMENDATIONS STYLES --- */
.trade-rec-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

@media (min-width: 768px) {
  .trade-rec-container {
    flex-direction: row;
    gap: 2rem;
  }
}

.trade-card {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
}

.trade-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Bullish Theme */
.bullish-card {
  border-top: 4px solid var(--accent-green);
  background: linear-gradient(180deg, rgba(76, 175, 80, 0.05) 0%, rgba(0, 0, 0, 0) 100%);
}

.bullish-card:hover {
  border-color: var(--accent-green);
  box-shadow: 0 10px 30px rgba(76, 175, 80, 0.1);
}

/* Bearish Theme */
.bearish-card {
  border-top: 4px solid var(--accent-red);
  background: linear-gradient(180deg, rgba(255, 82, 82, 0.05) 0%, rgba(0, 0, 0, 0) 100%);
}

.bearish-card:hover {
  border-color: var(--accent-red);
  box-shadow: 0 10px 30px rgba(255, 82, 82, 0.1);
}

.trade-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.5rem;
}

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

.trade-label {
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: 0.1em;
  font-size: 0.9rem;
  opacity: 0.8;
}

.bullish-card .trade-label {
  color: var(--accent-green);
}

.bearish-card .trade-label {
  color: var(--accent-red);
}

.trade-ticker {
  font-size: 3rem;
  font-weight: 900;
  margin-bottom: 1rem;
  line-height: 1;
  letter-spacing: -1px;
}

.bullish-card .trade-ticker {
  color: #fff;
  text-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
}

.bearish-card .trade-ticker {
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 82, 82, 0.5);
}

.trade-reason {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 2rem;
  min-height: 3em;
}

.trade-confidence {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.confidence-bar {
  height: 100%;
  border-radius: 2px;
  box-shadow: 0 0 10px currentColor;
}


/* Trade View Header */
.trade-view-header {
  margin-bottom: 1rem;
  margin-top: 0;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Subheader for Desc and Model Info */
.trade-view-subheader {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 240, 255, 0.2);
}

.trade-view-desc {
  font-size: 0.95rem;
  color: #aaa;
  font-weight: 400;
  margin-bottom: 0;
  font-family: "JetBrains Mono", sans-serif;
  letter-spacing: 0.05em;
}

.trade-view-model-info {
  font-size: 0.8rem;
  color: var(--text-secondary);
  opacity: 0.7;
  font-weight: normal;
  font-family: var(--font-mono);
  white-space: nowrap;
  align-self: flex-start;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

@media (max-width: 600px) {
  .trade-view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
  }

  .trade-view-model-info {
    margin-left: 0;
    font-size: 0.75rem;
  }
}


/* Trade Analysis Multi-Pick Styles */
.trade-rec-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 1.5rem;
}

.trade-section {
  flex: 1;
  min-width: 300px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.trade-section:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.1);
}

.bullish-header {
  color: var(--accent-green);
  border-bottom: 1px solid rgba(0, 255, 136, 0.2);
  text-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

.bearish-header {
  color: var(--accent-red);
  border-bottom: 1px solid rgba(255, 68, 68, 0.2);
  text-shadow: 0 0 15px rgba(255, 68, 68, 0.3);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  font-size: 1.1rem;
}

.section-icon {
  font-size: 1.4rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.trade-list {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.trade-card-item {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  padding: 1.2rem;
  border-left: 4px solid #555;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
}

.trade-card-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.03) 100%);
  opacity: 0;
  transition: opacity 0.3s;
}

.trade-card-item:hover {
  transform: translateX(6px);
  background: rgba(30, 30, 30, 0.8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.trade-card-item:hover::before {
  opacity: 1;
}

.trade-card-item.bullish-item {
  border-left-color: var(--accent-green);
  border-right: 1px solid rgba(0, 255, 136, 0.1);
  border-top: 1px solid rgba(0, 255, 136, 0.05);
  border-bottom: 1px solid rgba(0, 255, 136, 0.05);
}

.trade-card-item.bearish-item {
  border-left-color: var(--accent-red);
  border-right: 1px solid rgba(255, 68, 68, 0.1);
  border-top: 1px solid rgba(255, 68, 68, 0.05);
  border-bottom: 1px solid rgba(255, 68, 68, 0.05);
}

.item-ticker {
  font-size: 1.6rem;
  font-weight: 900;
  font-family: 'JetBrains Mono', sans-serif;
  margin-bottom: 0.5rem;
  display: block;
  letter-spacing: 0.05em;
}

.bullish-item .item-ticker {
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
}

.bearish-item .item-ticker {
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 68, 68, 0.4);
}

.item-reason {
  font-size: 0.95rem;
  color: #ccc;
  line-height: 1.6;
  font-weight: 400;
}

.trade-placeholder {
  color: #666;
  font-style: italic;
  text-align: center;
  padding: 3rem;
  font-family: 'JetBrains Mono';
  opacity: 0.7;
}

/* Invest Brief */
.invest-brief-panel {
  padding: 1rem;
  max-width: none;
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-x: hidden;
}

#view-invest-brief {
  width: 100%;
  overflow-x: hidden;
}

#view-invest-brief *,
#view-invest-brief *::before,
#view-invest-brief *::after {
  box-sizing: border-box;
}

.invest-brief-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.invest-brief-title {
  margin: 0;
  color: var(--accent-gold);
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.invest-brief-subtitle {
  margin: 0.35rem 0 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.brief-model-name {
  display: inline-flex;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  font-family: 'JetBrains Mono', sans-serif;
  text-transform: uppercase;
}

.brief-model-mode {
  display: inline-flex;
  margin-top: 0.5rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
  font-family: 'JetBrains Mono', sans-serif;
  border: 1px solid rgba(255, 200, 72, 0.35);
  border-radius: 999px;
  padding: 2px 8px;
  text-transform: uppercase;
}

.brief-meta-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.brief-guide-link {
  border: 0;
  background: transparent;
  color: var(--accent-cyan);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  font-family: 'JetBrains Mono', sans-serif;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.85;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.brief-guide-link:hover {
  opacity: 1;
  color: #7ef7ff;
}

.brief-guide-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 12, 20, 0.82);
  backdrop-filter: blur(6px);
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.brief-guide-modal {
  width: min(720px, 94vw);
  max-height: 82vh;
  overflow: auto;
  background: rgba(10, 16, 24, 0.95);
  border-radius: 16px;
  border: 1px solid rgba(0, 240, 255, 0.2);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  padding: 1.1rem 1.25rem 1.2rem;
}

.brief-guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.brief-guide-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--accent-gold);
}

.brief-guide-close {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border 0.2s ease;
}

.brief-guide-close:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.35);
}

.brief-guide-content {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.7;
}

.brief-guide-content h4 {
  margin: 0.85rem 0 0.4rem;
  font-size: 0.85rem;
  color: var(--accent-cyan);
  letter-spacing: 0.04em;
}

.brief-guide-content ul {
  margin: 0.35rem 0 0.6rem;
  padding-left: 1.1rem;
}

.brief-guide-content li {
  margin-bottom: 0.35rem;
}

.brief-guide-content strong {
  color: var(--text-primary);
}

.brief-rule-card {
  margin: 0.45rem 0 0.7rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(0, 240, 255, 0.28);
  border-radius: 10px;
  background: rgba(0, 22, 34, 0.5);
}

.brief-rule-line {
  margin: 0.24rem 0;
  font-family: 'JetBrains Mono', sans-serif;
  font-size: 0.78rem;
  line-height: 1.55;
}

.brief-guide-note {
  margin: 0.8rem 0 0;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.78rem;
  color: var(--text-secondary);
  opacity: 0.85;
}

.hindenburg-guide-overlay {
  z-index: 10060;
}

.hindenburg-guide-modal {
  border-color: rgba(255, 91, 91, 0.3);
  background:
    radial-gradient(130% 140% at 100% 0%, rgba(255, 91, 91, 0.13), transparent 60%),
    rgba(8, 12, 21, 0.96);
}

.hindenburg-guide-header h3 {
  color: #ffb3b3;
}

.hindenburg-guide-content h4 {
  color: #ffb3b3;
}

.brief-toggle {
  display: flex;
  gap: 0.4rem;
  padding: 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.4);
}

.brief-toggle-btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', sans-serif;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.brief-toggle-btn.active {
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.15);
  border-color: rgba(0, 240, 255, 0.45);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}

.brief-summary {
  padding: 0.95rem 1.05rem;
  border-radius: 14px;
  border: 1px solid rgba(0, 240, 255, 0.15);
  background: rgba(5, 15, 25, 0.6);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.brief-headline {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.6;
}

.brief-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.brief-regime {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 215, 0, 0.4);
  color: var(--accent-gold);
  font-family: 'JetBrains Mono', sans-serif;
}

.brief-updated {
  font-family: 'JetBrains Mono', sans-serif;
}

.brief-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.brief-grid-quad .brief-block {
  height: 100%;
}

.brief-block {
  padding: 0.9rem 1.05rem;
  border-radius: 14px;
  border: 1px solid rgba(0, 240, 255, 0.08);
  background: linear-gradient(160deg, rgba(12, 22, 33, 0.75), rgba(0, 0, 0, 0.45));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.brief-section-title {
  margin: 0 0 0.8rem;
  color: var(--accent-cyan);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brief-section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.55), transparent);
  opacity: 0.7;
}

.brief-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.brief-changes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.brief-change-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: 'JetBrains Mono', sans-serif;
  font-size: 0.78rem;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.4);
  justify-content: center;
  width: 100%;
}

.brief-change-chip.up {
  border-color: rgba(0, 255, 136, 0.5);
  color: #00ff88;
}

.brief-change-chip.down {
  border-color: rgba(255, 107, 107, 0.5);
  color: #ff6b6b;
}

.brief-change-chip.new {
  border-color: rgba(0, 240, 255, 0.6);
  color: var(--accent-cyan);
}

.brief-tag {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 240, 255, 0.25);
  color: var(--accent-cyan);
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', sans-serif;
  background: rgba(0, 240, 255, 0.08);
}

.brief-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.brief-list li {
  padding-left: 0.9rem;
  position: relative;
}

.brief-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent-cyan);
}

.brief-calendar {
  border-left: 1px dashed rgba(255, 215, 0, 0.35);
  padding-left: 1rem;
}

.brief-calendar li {
  padding-left: 0.6rem;
}

.brief-calendar li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-gold);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.brief-impact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  margin-right: 0.4rem;
  letter-spacing: 0.04em;
}

.brief-impact.high {
  background: rgba(255, 107, 107, 0.15);
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.5);
}

.brief-impact.mid {
  background: rgba(246, 211, 101, 0.15);
  color: #f6d365;
  border: 1px solid rgba(246, 211, 101, 0.5);
}

.brief-impact.low {
  background: rgba(0, 240, 255, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.4);
}

.brief-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.4);
  color: var(--accent-gold);
  letter-spacing: 0.04em;
}

.brief-badge.evidence {
  color: var(--accent-cyan);
  border-color: rgba(0, 240, 255, 0.45);
  background: rgba(0, 240, 255, 0.12);
}

.brief-badge.bias-bull {
  border-color: rgba(60, 220, 160, 0.6);
  color: #3cdca0;
  background: rgba(60, 220, 160, 0.12);
}

.brief-badge.bias-bear {
  border-color: rgba(255, 90, 90, 0.6);
  color: #ff5a5a;
  background: rgba(255, 90, 90, 0.12);
}


.brief-card-right {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.brief-deadline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.brief-deadline.deadline-urgent {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.6);
  background: rgba(255, 107, 107, 0.12);
}

.brief-deadline.deadline-soon {
  color: #f6d365;
  border-color: rgba(246, 211, 101, 0.6);
  background: rgba(246, 211, 101, 0.12);
}

.brief-deadline.deadline-unknown {
  color: #9aa4b2;
  border-color: rgba(154, 164, 178, 0.5);
  background: rgba(154, 164, 178, 0.12);
}

.brief-deadline.deadline-later {
  color: var(--accent-cyan);
  border-color: rgba(0, 240, 255, 0.4);
  background: rgba(0, 240, 255, 0.08);
}

.brief-watchlist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.85rem;
}

.brief-watch-card {
  border-radius: 14px;
  border: 1px solid rgba(0, 240, 255, 0.15);
  background: linear-gradient(160deg, rgba(14, 24, 36, 0.8), rgba(4, 8, 12, 0.6));
  padding: 0.95rem 1rem;
  display: grid;
  gap: 0.6rem;
  position: relative;
  overflow: hidden;
}

.brief-watch-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.7), rgba(0, 240, 255, 0));
  opacity: 0.6;
}

.brief-watch-card:hover {
  border-color: rgba(0, 240, 255, 0.35);
}

.brief-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.brief-ticker {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.brief-trend {
  font-family: 'JetBrains Mono', sans-serif;
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.brief-trend.up {
  color: #00ff88;
  border-color: rgba(0, 255, 136, 0.4);
}

.brief-trend.down {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.4);
}

.brief-trend.flat {
  color: #f6d365;
  border-color: rgba(246, 211, 101, 0.4);
}

.brief-card-reason {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.brief-card-meta {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.brief-card-meta strong {
  color: var(--accent-gold);
  font-weight: 600;
  margin-right: 0.35rem;
}

.brief-card-history {
  font-family: 'JetBrains Mono', sans-serif;
  font-size: 0.75rem;
  color: var(--text-secondary);
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  padding-top: 0.45rem;
}

.brief-card-history[hidden] {
  display: none !important;
}

.brief-card-history-wrap {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.brief-history-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.brief-card-trend {
  display: inline-flex;
  align-items: center;
}

.brief-history-toggle {
  border: 1px solid rgba(0, 240, 255, 0.35);
  background: rgba(0, 240, 255, 0.08);
  color: var(--accent-cyan);
  font-size: 0.65rem;
  font-family: 'JetBrains Mono', sans-serif;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: border 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.brief-history-toggle:hover {
  border-color: rgba(126, 247, 255, 0.7);
  background: rgba(0, 240, 255, 0.16);
  color: #7ef7ff;
}

.brief-disclaimer {
  margin-top: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.6;
  opacity: 0.8;
}

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

@media (max-width: 600px) {
  .invest-brief-panel {
    padding: 1rem;
  }

  .brief-toggle {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 768px) {
  .invest-brief-panel {
    gap: 1rem;
    padding: 0.9rem 0.85rem;
  }

  .invest-brief-header {
    flex-direction: column;
    align-items: stretch;
  }

  .invest-brief-title {
    font-size: 1.2rem;
  }

  .invest-brief-subtitle {
    font-size: 0.8rem;
  }

  .brief-model-name {
    font-size: 0.65rem;
  }

  .brief-model-mode {
    font-size: 0.6rem;
    padding: 2px 6px;
  }

  .brief-guide-link {
    font-size: 0.65rem;
  }

  .brief-summary {
    padding: 0.75rem 0.85rem;
  }

  .brief-headline {
    font-size: 0.95rem;
  }

  .brief-meta {
    gap: 0.6rem;
    font-size: 0.75rem;
  }

  .brief-toggle-btn {
    flex: 1;
    text-align: center;
  }

  .brief-grid {
    gap: 0.75rem;
  }

  .brief-block {
    padding: 0.75rem 0.85rem;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
  }

  .brief-section-title {
    font-size: 0.9rem;
  }

  .brief-tags {
    gap: 0.4rem;
  }

  .brief-changes {
    gap: 0.45rem;
  }

  .brief-change-chip {
    font-size: 0.7rem;
  }

  .brief-tag {
    font-size: 0.7rem;
  }

  .brief-watchlist {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .brief-watch-card {
    padding: 0.75rem 0.8rem;
    min-width: 0;
  }

  .brief-card-right {
    gap: 0.3rem;
  }

  .brief-deadline {
    font-size: 0.58rem;
  }

  .brief-ticker {
    font-size: 1rem;
  }

  .brief-card-reason {
    font-size: 0.88rem;
  }

  .brief-card-meta {
    font-size: 0.76rem;
  }

  .brief-card-history {
    font-size: 0.7rem;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .brief-history-toggle {
    font-size: 0.6rem;
    padding: 3px 7px;
  }

  .brief-calendar {
    padding-left: 0.8rem;
  }

  .brief-calendar li::before {
    left: 0;
    width: 5px;
    height: 5px;
    top: 0.45rem;
  }

  .brief-disclaimer {
    font-size: 0.7rem;
  }

  .brief-guide-modal {
    width: min(720px, 92vw);
    padding: 0.95rem 1rem 1.05rem;
  }

  .brief-guide-content {
    font-size: 0.82rem;
  }

  .brief-guide-header h3 {
    font-size: 0.95rem;
  }
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: rgba(0, 240, 255, 0.2);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 50%;
  color: #fff;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 9999;
  backdrop-filter: blur(5px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  bottom: 30px;
  /* Slight float up animation */
}

.back-to-top:hover {
  background: var(--accent-cyan);
  color: #000;
  transform: translateY(-5px);
  box-shadow: 0 6px 15px rgba(0, 240, 255, 0.4);
}

@media (max-width: 768px) {
  .back-to-top {
    width: 45px;
    height: 45px;
    bottom: 15px;
    right: 15px;
  }
}
