/* Fed Chair: The War Room - Styles */

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

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  font-family: 'IBM Plex Sans', -apple-system, sans-serif;
  background: #0a0f1a;
  min-height: 100vh;
  min-height: -webkit-fill-available;

  /* Font system */
  --font-ui: 'IBM Plex Sans', -apple-system, sans-serif;
  --font-data: 'IBM Plex Mono', monospace;
  --font-prose: 'Source Sans 3', 'IBM Plex Sans', sans-serif;

  /* Type scale (mobile-first) */
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 14px;
  --text-lg: 17px;
  --text-xl: 22px;
  --text-2xl: 28px;

  /* Line heights */
  --leading-tight: 1.3;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;
}

@media (min-width: 640px) {
  body {
    --text-xs: 12px;
    --text-sm: 13px;
    --text-base: 15px;
    --text-lg: 19px;
    --text-xl: 25px;
    --text-2xl: 34px;
  }
}

@media (min-width: 768px) {
  body {
    --text-xs: 13px;
    --text-sm: 15px;
    --text-base: 17px;
    --text-lg: 21px;
    --text-xl: 28px;
    --text-2xl: 40px;
  }
}

.font-mono {
  font-family: 'IBM Plex Mono', monospace;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: rgba(17, 24, 39, 0.5);
}

::-webkit-scrollbar-thumb {
  background: rgba(75, 85, 99, 0.5);
  border-radius: 2px;
}

/* Animations */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.statement-loading {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes loadingBar {
  0% { width: 0%; }
  100% { width: 100%; }
}

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

.animate-slideIn {
  animation: slideIn 0.3s ease-out forwards;
}

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

.animate-d1 {
  animation: slideInDelay 0.3s ease-out 0.1s forwards;
  opacity: 0;
}

.animate-d2 {
  animation: slideInDelay 0.3s ease-out 0.2s forwards;
  opacity: 0;
}

.animate-d3 {
  animation: slideInDelay 0.3s ease-out 0.3s forwards;
  opacity: 0;
}

@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-33.33%); }
}

.ticker-scroll {
  animation: tickerScroll 12s linear infinite;
}

@keyframes gradeReveal {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.grade-reveal {
  animation: gradeReveal 0.5s ease-out forwards;
}

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

/* Button Base */
button {
  min-height: 44px;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

/* Responsive Grids */
.grid-responsive {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

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

.grid-aftermath {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 768px) {
  .grid-aftermath {
    grid-template-columns: 2fr 1fr;
  }
}

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

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

@media (min-width: 1024px) {
  .grid-markets {
    grid-template-columns: repeat(6, 1fr);
  }
}

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

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

.rate-btn-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (min-width: 480px) {
  .rate-btn-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Briefing sub-nav */
.grid-briefing-nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.grid-briefing-nav::-webkit-scrollbar {
  display: none;
}

/* Briefing district cards */
.grid-briefing-districts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

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

/* Staff projections grid */
.grid-staff-projections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

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

/* Mobile typography and layout adjustments */
@media (max-width: 639px) {
  /* Briefing horizontal padding */
  .briefing-container {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  /* Briefing sub-nav buttons */
  .grid-briefing-nav button {
    padding: 10px 16px !important;
    font-size: 11px !important;
  }

  /* Staff Forecast cards */
  .staff-forecast-card {
    padding: 24px !important;
  }

  /* Statement builder category labels */
  .statement-category-label {
    font-size: var(--text-sm) !important;
  }

  /* Market values — prevent crowding on small screens */
  .market-value {
    font-size: 18px !important;
  }
}

/* Tablet typography adjustments */
@media (min-width: 640px) and (max-width: 1023px) {
  /* Market values — prevent crowding on tablet */
  .market-value {
    font-size: 20px !important;
  }
}

/* Game-over stats: 2 columns on narrow screens */
@media (max-width: 639px) {
  .grid-final-stats {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Probability bar fill animation */
@keyframes barFill {
  0% { width: 0%; }
  100% { width: var(--target-width); }
}

.animate-bar-fill {
  animation: barFill 0.6s ease-out forwards;
}

/* Title shimmer animation */
@keyframes titleShimmer {
  0% {
    background-position: 0% center;
  }
  100% {
    background-position: 100% center;
  }
}

.title-shimmer {
  background: linear-gradient(
    90deg,
    #c9a84c 0%,
    #c9a84c 30%,
    #ffe066 40%,
    #FFD700 50%,
    #ffe066 60%,
    #c9a84c 70%,
    #c9a84c 100%
  );
  background-size: 200% 100%;
  background-position: 0% center;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #c9a84c;
  animation: titleShimmer 4s ease-in-out forwards;
}

/* Learn Mode term highlighting */
.learn-term {
  display: inline;
  border-bottom: 1px dashed var(--color-gold, #D97706);
  cursor: pointer;
  color: inherit;
}

.learn-term-active {
  border-bottom-color: #F59E0B;
  background: rgba(217, 119, 6, 0.08);
  border-radius: 2px;
}

/* Inside buttons: remove underline and cursor override so button feels clickable */
button .learn-term {
  border-bottom: none;
  cursor: inherit;
}

/* Tooltip rendered via portal with position: fixed — positioning handled inline */
.learn-tooltip {
  background: #1a1f2e;
  border: 1px solid var(--color-gold, #D97706);
  border-radius: 6px;
  padding: 12px 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

.learn-tooltip-title {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-gold, #D97706);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.learn-tooltip-plain {
  font-size: 12px;
  line-height: 1.5;
  color: #E5E7EB;
  margin: 0 0 6px 0;
}

.learn-tooltip-context {
  font-size: 11px;
  line-height: 1.5;
  color: #9CA3AF;
  margin: 0;
  font-style: italic;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 6px;
}

/* LEARN toggle — matches NEW button sizing */
.learn-toggle {
  padding: 8px 14px;
  border-radius: 4px;
  border: 1px solid rgba(75, 85, 99, 0.4);
  background: rgba(75, 85, 99, 0.2);
  color: #9ca3af;
  font-size: var(--text-sm);
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.learn-toggle.active {
  border-color: var(--color-gold, #D97706);
  color: var(--color-gold, #D97706);
  background: rgba(217, 119, 6, 0.08);
}

/* Mode Select grid */
.grid-mode-select {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  max-width: 700px;
  margin: 0 auto;
}

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

