/* =====================================================================
   SOURCE COURT: TACTICAL COMMAND CENTER STYLES
   ===================================================================== */

:root {
  --bg: #050814;
  --surface: #0f172a;
  --surface-hover: #1e293b;
  --panel: rgba(15, 23, 42, 0.85);
  
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.25);
  
  --gold: #d4af37;
  --gold-soft: #fce79c;
  --text: #f8fafc;
  --muted: #94a3b8;
  
  --admit: #10b981; /* Emerald Neon */
  --dismiss: #ef4444; /* Crimson Neon */
  --ink: #050814;
  
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(212, 175, 55, 0.15);
  
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 4px;
  
  --display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --body: Georgia, "Times New Roman", serif; /* Serif for academic reading */
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
}

/* Highly Optimized Background - ZERO LAG */
body {
  margin: 0;
  font-family: var(--display);
  color: var(--text);
  background-color: var(--bg);
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  letter-spacing: 0.02em;
}

button, input {
  font: inherit;
}

button {
  cursor: pointer;
}

input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 12px;
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease;
}

input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

.app-shell {
  min-height: 100vh;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.screen {
  min-height: calc(100vh - 40px);
  display: grid;
  gap: 24px;
}

/* =====================================================================
   PANELS & CONTAINERS (FLAT, NO BLURS)
   ===================================================================== */
.topbar, .panel, .case-card, .criteria-card, .mode-card, .persona-card, 
.summary-card, .toast, .modal-card, .score-breakdown, .badge-card, 
.hero-main, .hero-side, .career-banner, .bench-brief, .power-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 16px 24px;
  position: sticky;
  top: 20px;
  z-index: 30;
  border-bottom: 2px solid var(--gold); /* Distinct tactical underline */
}

.brand-lockup {
  display: grid;
  gap: 4px;
}

.eyebrow {
  font-family: var(--display);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.15em;
  font-size: 0.75rem;
  color: var(--gold);
}

.brand-title {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* =====================================================================
   TAGS & METERS
   ===================================================================== */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag, .career-pill, .score-pill {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.score-pill { color: var(--gold); border-color: rgba(212, 175, 55, 0.3); background: rgba(212, 175, 55, 0.05); }

/* Career Meter */
.meter {
  position: relative;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  margin: 10px 0;
}

.meter-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
  transition: width 0.4s ease;
}

/* =====================================================================
   GRIDS & LAYOUTS
   ===================================================================== */
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 24px;
}

.home-grid, .court-grid, .verdict-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 24px;
}

.hero-main {
  min-height: 300px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-left: 4px solid var(--gold);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(5, 8, 20, 0.95));
}

.hero-side {
  padding: 24px;
  display: grid;
  align-content: start;
  gap: 20px;
}

.panel { padding: 24px; }
.panel-title { font-size: 1.25rem; font-weight: bold; margin-bottom: 8px; margin-top: 4px; }

/* Interactive Cards (Personas & Modes) */
.mode-grid, .persona-grid, .criteria-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.mode-card, .persona-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  border-left: 3px solid var(--line-strong);
}

.mode-card h3, .persona-card h3 {
  margin: 0 0 5px 0;
  font-size: 1.1rem;
  color: var(--text);
}

.mode-card:hover, .persona-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: var(--shadow-glow);
  background: var(--surface-hover);
}

.persona-card.selected {
  border-left-color: var(--gold);
  background: rgba(212, 175, 55, 0.05);
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.2);
}

/* =====================================================================
   BUTTONS
   ===================================================================== */
.button-row { display: flex; gap: 12px; margin-top: 20px; }
.single-button-row { display: grid; gap: 12px; }

.button {
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  text-align: center;
}

.button.primary {
  background: var(--gold);
  color: var(--ink);
}

.button.primary:hover {
  background: #ebd575;
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
  transform: translateY(-2px);
}

.button.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-strong);
}

.button.secondary:hover {
  background: var(--surface-hover);
  border-color: var(--gold);
  color: var(--gold);
}

.button.ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  padding: 8px 12px;
  font-size: 0.8rem;
}

.button.ghost:hover { color: var(--text); }

/* =====================================================================
   COURTROOM SPECIFICS (CASE FILES)
   ===================================================================== */
.case-card {
  padding: 30px;
  background: var(--surface);
  border-top: 4px solid var(--gold);
}

.metadata-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 20px;
  margin: 20px 0;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.meta-key { color: var(--gold); font-size: 0.8rem; text-transform: uppercase; font-weight: bold; letter-spacing: 0.1em; }
.meta-val { color: var(--text); font-weight: 500;}

/* Serif Font for Excerpts */
.excerpt-box {
  font-family: var(--body);
  font-size: 1.25rem;
  line-height: 1.8;
  color: #e2e8f0;
  border-left: 3px solid var(--gold);
  padding-left: 20px;
  font-style: italic;
  margin-top: 20px;
}

/* =====================================================================
   EVIDENCE GATHERING (CROSS EXAM)
   ===================================================================== */
.note-grid {
  display: grid;
  gap: 12px;
}

.note-button {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: var(--radius-md);
  text-align: left;
  transition: all 0.2s ease;
  color: var(--text);
}

.note-button:hover:not(:disabled) {
  border-color: var(--muted);
  background: var(--surface-hover);
}

.note-button.active {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.08);
}

.note-button strong { display: block; color: var(--gold); margin-bottom: 4px; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 0.1em;}

/* =====================================================================
   RULINGS & VERDICTS
   ===================================================================== */
.ruling-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.ruling-button {
  background: var(--surface);
  border: 2px solid var(--line-strong);
  padding: 20px;
  border-radius: var(--radius-md);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.ruling-button strong { font-size: 1.2rem; text-transform: uppercase; letter-spacing: 0.1em; }

.ruling-button[data-verdict="true"]:hover {
  border-color: var(--admit);
  background: rgba(16, 185, 129, 0.1);
  color: var(--admit);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
  transform: translateY(-4px);
}

.ruling-button[data-verdict="false"]:hover {
  border-color: var(--dismiss);
  background: rgba(239, 68, 68, 0.1);
  color: var(--dismiss);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
  transform: translateY(-4px);
}

.stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 30px;
  border-radius: 8px;
  border: 4px solid currentColor;
  transform: rotate(-3deg);
  font-size: 2.5rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 20px 0;
}

.stamp.good { color: var(--admit); text-shadow: 0 0 15px rgba(16, 185, 129, 0.4); box-shadow: inset 0 0 15px rgba(16, 185, 129, 0.2);}
.stamp.bad { color: var(--dismiss); text-shadow: 0 0 15px rgba(239, 68, 68, 0.4); box-shadow: inset 0 0 15px rgba(239, 68, 68, 0.2);}

/* Strike Chips */
.strike-row { display: inline-flex; gap: 8px; }
.strike-chip {
  width: 24px; height: 24px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.1);
}
.strike-chip.lost {
  background: var(--dismiss);
  border-color: var(--dismiss);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

/* =====================================================================
   MODALS & RESPONSIVE
   ===================================================================== */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 8, 20, 0.9);
  z-index: 60;
  padding: 20px;
}

.modal-card {
  width: min(800px, 100%);
  border-radius: var(--radius-lg);
  padding: 30px;
  display: grid;
  gap: 20px;
}

@media (max-width: 900px) {
  .hero-grid, .home-grid, .court-grid, .verdict-grid {
    grid-template-columns: 1fr;
  }
  .app-shell { padding: 10px; }
  .mode-grid, .persona-grid { grid-template-columns: 1fr; }
  .ruling-grid { grid-template-columns: 1fr; }
}
/* =====================================================================
   ERROR NOTIFICATIONS
   ===================================================================== */
.toast {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  background: rgba(239, 68, 68, 0.95) !important;
  border: 2px solid #f87171 !important;
  color: #fff !important;
  padding: 20px 30px !important;
  border-radius: var(--radius-md) !important;
  font-size: 1.2rem !important;
  font-weight: bold !important;
  text-align: center !important;
  z-index: 9999 !important;
  box-shadow: 0 10px 40px rgba(239, 68, 68, 0.5) !important;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), shake 0.4s ease 0.3s;
}

@keyframes popIn {
  from { opacity: 0; transform: translate(-50%, -40%) scale(0.8); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translate(-50%, -50%); }
  25% { transform: translate(calc(-50% - 10px), -50%); }
  50% { transform: translate(calc(-50% + 10px), -50%); }
  75% { transform: translate(calc(-50% - 10px), -50%); }
}
/* Prevent invisible elements from blocking button clicks */
#live-region, 
.sr-only, 
.toast {
  pointer-events: none !important;
}

/* Ensure buttons and anything inside them are always clickable */
button, 
[data-action] {
  cursor: pointer;
  pointer-events: auto !important;
}

button *, 
[data-action] * {
  pointer-events: none; /* Stops text/emojis from stealing the click */
}
