/* ============================================================
   Hexworth Cyber Arena — Theme & Layout
   Visual: Dark navy + neon cyan + Kibana/Deus Ex feel
   ============================================================ */

/* --- Custom Properties --- */
:root {
  --bg-primary: #0A0E1A;
  --bg-secondary: #111827;
  --bg-panel: #1A1F2E;
  --bg-card: #1E2536;
  --bg-hover: #252D40;

  --accent-cyan: #00F0FF;
  --accent-orange: #F59E0B;
  --accent-green: #10B981;
  --accent-red: #EF4444;
  --accent-purple: #8B5CF6;

  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --border-subtle: #1E293B;
  --border-active: #00F0FF;

  --glow-cyan: 0 0 12px rgba(0, 240, 255, 0.3);
  --glow-orange: 0 0 12px rgba(245, 158, 11, 0.3);
  --glow-green: 0 0 12px rgba(16, 185, 129, 0.3);
  --glow-red: 0 0 12px rgba(239, 68, 68, 0.3);

  --font-title: 'Orbitron', monospace, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

/* --- Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-title);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.mono {
  font-family: var(--font-mono);
}

/* --- Layout: Lobby Screen --- */
.lobby-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.lobby-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 3rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.lobby-card h1 {
  font-size: 1.5rem;
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
}

.lobby-card .subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

/* --- Inputs --- */
.input-field {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1.25rem;
  text-align: center;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: border-color var(--transition-fast);
}

.input-field:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
}

.input-field::placeholder {
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: normal;
  font-size: 1rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-title);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  border-color: var(--accent-cyan);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: var(--glow-cyan);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(0, 240, 255, 0.1);
}

.btn-danger {
  background: var(--accent-red);
  color: var(--text-primary);
  border-color: var(--accent-red);
}

.btn-full {
  width: 100%;
}

/* --- Layout: Game Board --- */
.game-container {
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 280px 1fr 300px;
  grid-template-areas:
    "topbar  topbar   topbar"
    "left    center   right"
    "bottom  bottom   bottom";
  height: 100vh;
  gap: 1px;
  background: var(--border-subtle);
  position: relative;
}

/* --- Top Bar --- */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-logo {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--accent-cyan);
  font-weight: 700;
}

.topbar-scenario {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.topbar-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
}

.topbar-stat .label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.topbar-stat .value {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: default;
}

.role-badge .bonus {
  color: var(--accent-green);
  font-family: var(--font-mono);
  font-size: 0.625rem;
}

/* --- Left Panel: Threat Chain --- */
.panel-left {
  grid-area: left;
  background: var(--bg-panel);
  padding: 1.25rem;
  overflow-y: auto;
}

.panel-title {
  font-family: var(--font-title);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.chain-track {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chain-stage {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chain-stage:hover {
  background: var(--bg-hover);
}

.chain-stage.active {
  border-color: var(--accent-orange);
  box-shadow: var(--glow-orange);
}

.chain-stage.contained {
  border-color: var(--accent-green);
}

.chain-stage.resolved {
  border-color: var(--accent-green);
  opacity: 0.7;
}

.chain-stage.not-in-scenario {
  opacity: 0.3;
  cursor: default;
}

.stage-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.stage-icon.hidden { background: var(--bg-secondary); color: var(--text-muted); }
.stage-icon.revealed { background: rgba(245, 158, 11, 0.2); color: var(--accent-orange); }
.stage-icon.contained_temp { background: rgba(245, 158, 11, 0.2); color: var(--accent-orange); }
.stage-icon.contained { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }
.stage-icon.resolved { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }

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

.stage-name {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-status {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Center Panel: Actions --- */
.panel-center {
  grid-area: center;
  background: var(--bg-primary);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.action-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
}

.action-tab {
  flex: 1;
  padding: 0.625rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  color: var(--text-secondary);
  font-family: var(--font-title);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.action-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.action-tab.active-tab {
  border-bottom-color: transparent;
}

.action-tab[data-type="detection"].active-tab {
  color: #3B82F6;
  border-color: #3B82F6;
  border-bottom-color: transparent;
  background: var(--bg-primary);
}

.action-tab[data-type="containment"].active-tab {
  color: var(--accent-orange);
  border-color: var(--accent-orange);
  border-bottom-color: transparent;
  background: var(--bg-primary);
}

.action-tab[data-type="recovery"].active-tab {
  color: var(--accent-green);
  border-color: var(--accent-green);
  border-bottom-color: transparent;
  background: var(--bg-primary);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  grid-auto-rows: min-content;
  gap: 0.75rem;
  flex: 1;
  align-content: start;
  overflow-y: auto;
}

/* --- Action Cards --- */
.action-card {
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.action-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.action-card[data-type="detection"]::before { background: #3B82F6; }
.action-card[data-type="containment"]::before { background: var(--accent-orange); }
.action-card[data-type="recovery"]::before { background: var(--accent-green); }

.action-card:hover:not(.disabled) {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.action-card.selected {
  border-color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
}

.action-card.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.action-card.disabled .card-lore-btn {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}

.action-card .card-art {
  width: 100%;
  flex: 1;
  min-height: 0;
  max-height: 100px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

/* Lore info button on action cards */
.card-lore-btn {
  position: absolute;
  top: 0.375rem;
  right: 0.375rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 1px solid var(--accent-cyan);
  background: rgba(10, 14, 26, 0.8);
  color: var(--accent-cyan);
  font-size: 0.75rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  z-index: 10;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.card-lore-btn:hover {
  background: rgba(0, 240, 255, 0.3);
  transform: scale(1.15);
}

.action-card .card-name {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.action-card .card-type-badge {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}

.action-card[data-type="detection"] .card-type-badge { color: #3B82F6; }
.action-card[data-type="containment"] .card-type-badge { color: var(--accent-orange); }
.action-card[data-type="recovery"] .card-type-badge { color: var(--accent-green); }

.action-card .card-stats {
  display: flex;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.action-card .card-stats .stat-label {
  color: var(--text-muted);
  font-size: 0.625rem;
}

/* Cooldown overlay */
.action-card .cooldown-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 26, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.cooldown-overlay .cooldown-text {
  font-family: var(--font-title);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-orange);
}

.cooldown-overlay .cooldown-rounds {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  color: var(--accent-orange);
}

/* Blocked overlay */
.action-card .blocked-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 26, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.blocked-overlay .blocked-text {
  font-family: var(--font-title);
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--accent-red);
}

/* Confirm bar */
.confirm-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  margin-top: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.confirm-bar .selected-action-name {
  font-family: var(--font-title);
  font-size: 0.875rem;
  color: var(--accent-cyan);
}

.confirm-bar .no-selection {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* --- Right Panel: System Status --- */
.panel-right {
  grid-area: right;
  background: var(--bg-panel);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
}

/* Asset bars */
.asset-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.asset-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.asset-label {
  width: 70px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.asset-bar-track {
  flex: 1;
  height: 16px;
  background: var(--bg-secondary);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.asset-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width var(--transition-normal);
}

.asset-bar-fill.healthy { background: var(--accent-green); }
.asset-bar-fill.warning { background: var(--accent-orange); }
.asset-bar-fill.critical { background: var(--accent-red); }
.asset-bar-fill.dead {
  background: var(--accent-red);
  animation: pulse-red 1s infinite;
}

@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.asset-value {
  width: 36px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Inject panel */
.inject-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.inject-card {
  padding: 0.625rem;
  background: var(--bg-card);
  border-left: 3px solid var(--accent-red);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.inject-card .inject-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent-orange);
}

.inject-card .inject-effect {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
}

.inject-card .inject-duration {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* --- Bottom Panel: Incident Feed --- */
.panel-bottom {
  grid-area: bottom;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: 0.75rem 1.5rem;
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.feed-entry {
  font-size: 0.8125rem;
  line-height: 1.4;
}

.feed-entry .feed-tag {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.5rem;
}

.feed-tag.system { color: var(--accent-cyan); }
.feed-tag.team { color: var(--accent-green); }
.feed-tag.result { color: var(--accent-orange); }
.feed-tag.intel { color: var(--accent-purple); }

.feed-entry .feed-text {
  color: var(--text-secondary);
}

/* --- Resolution Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 26, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 560px;
  width: 90%;
  max-height: 98vh;
  overflow: hidden;
  box-shadow: var(--glow-cyan);
}

.modal-content h2 {
  font-size: 1.125rem;
  color: var(--accent-cyan);
  text-align: center;
  margin-bottom: 1.5rem;
}

.score-breakdown {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 2;
  margin-bottom: 1.5rem;
}

.score-breakdown .score-row {
  display: flex;
  justify-content: space-between;
}

.score-breakdown .score-label {
  color: var(--text-secondary);
}

.score-breakdown .score-value {
  color: var(--text-primary);
}

.score-breakdown .score-value.positive { color: var(--accent-green); }
.score-breakdown .score-value.negative { color: var(--accent-red); }

.score-breakdown .score-divider {
  border-top: 1px solid var(--border-subtle);
  margin: 0.25rem 0;
}

.score-breakdown .score-total {
  font-weight: 700;
  font-size: 1rem;
}

.outcome-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  text-align: center;
}

.outcome-badge.auto_success,
.outcome-badge.full_success { background: rgba(16, 185, 129, 0.15); border: 1px solid var(--accent-green); }
.outcome-badge.partial_success { background: rgba(245, 158, 11, 0.15); border: 1px solid var(--accent-orange); }
.outcome-badge.fail,
.outcome-badge.auto_fail { background: rgba(239, 68, 68, 0.15); border: 1px solid var(--accent-red); }

.outcome-badge .zone-label {
  font-family: var(--font-title);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.outcome-badge .outcome-label {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
}

.dice-display {
  text-align: center;
  margin-bottom: 1.5rem;
}

.dice-display .dice-value {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.dice-display .dice-modifier {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.changes-list {
  list-style: none;
  margin-bottom: 1.5rem;
}

.changes-list li {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding: 0.25rem 0;
  padding-left: 1rem;
  position: relative;
}

.changes-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  transform: translateY(-50%);
}

.changes-list li.damage::before { background: var(--accent-red); }
.changes-list li.status-change::before { background: var(--accent-orange); }
.changes-list li.cooldown::before { background: var(--text-muted); }
.changes-list li.budget::before { background: var(--accent-cyan); }
.changes-list li.inject::before { background: var(--accent-purple); }
.changes-list li.heal::before { background: var(--accent-green); }

.intel-section {
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent-purple);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 1.5rem;
}

.intel-section .intel-title {
  font-family: var(--font-title);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-purple);
  margin-bottom: 0.375rem;
}

.intel-section .intel-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* --- Warning Modal (Are You Sure?) --- */
.warning-modal .modal-content {
  border-color: var(--accent-orange);
  box-shadow: var(--glow-orange);
  max-width: 400px;
}

.warning-modal h2 {
  color: var(--accent-orange);
}

.warning-modal .warning-text {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 1.5rem;
}

.warning-modal .btn-row {
  display: flex;
  gap: 0.75rem;
}

/* --- Lore Modal --- */
.lore-modal-content {
  max-width: 380px;
  text-align: center;
  position: relative;
  padding-top: 1.5rem;
}

.lore-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: color var(--transition-fast);
}

.lore-close:hover {
  color: var(--text-primary);
}

.lore-art {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin: 0 auto 1rem;
  display: block;
  border: 1px solid var(--border-subtle);
}

.lore-modal-content h2 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.lore-flavor {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.lore-stats {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.75rem;
}

.lore-stat-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
}

.lore-stat-row .stat-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.lore-stat-row span:last-child {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-cyan);
}

/* --- Briefing Screen --- */
.briefing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.briefing-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 3rem;
  max-width: 600px;
  width: 100%;
}

.briefing-card h1 {
  font-size: 1.25rem;
  color: var(--accent-cyan);
  margin-bottom: 0.375rem;
}

.briefing-card .scenario-name {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.briefing-card .stakes-list {
  list-style: none;
  margin-bottom: 1.5rem;
}

.briefing-card .stakes-list li {
  padding: 0.375rem 0;
  padding-left: 1.25rem;
  position: relative;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.briefing-card .stakes-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: var(--accent-orange);
  border-radius: 50%;
}

.briefing-card .lore-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 2rem;
  border-left: 3px solid var(--accent-cyan);
  padding-left: 1rem;
}

.briefing-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
  justify-content: center;
}

.briefing-stat {
  text-align: center;
}

.briefing-stat .stat-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.briefing-stat .stat-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* --- Pacing Selector (Briefing Screen) --- */
.pacing-selector {
  margin-bottom: 1.5rem;
}

.pacing-label {
  display: block;
  font-family: var(--font-title);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.625rem;
}

.pacing-options {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.pacing-btn {
  flex: 1;
  padding: 0.625rem 0.75rem;
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.pacing-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.pacing-btn.active {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.1);
  color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
}

.pacing-description {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
  min-height: 1.4em;
}

.pacing-estimate {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* --- Timer Critical Animation --- */
.timer-critical {
  animation: timer-pulse 1s ease-in-out infinite;
}

@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --- End Screen --- */
.end-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.end-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 3rem;
  max-width: 600px;
  width: 100%;
  text-align: center;
}

.end-card.win {
  border-color: var(--accent-green);
  box-shadow: var(--glow-green);
}

.end-card.loss {
  border-color: var(--accent-red);
  box-shadow: var(--glow-red);
}

.end-card h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.end-card.win h1 { color: var(--accent-green); }
.end-card.loss h1 { color: var(--accent-red); }

/* --- Instructor Mode Overlay --- */
.instructor-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  text-align: center;
  padding: 0.25rem;
  font-family: var(--font-title);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  z-index: 9999;
  display: none;
}

.instructor-mode .instructor-banner {
  display: block;
}

.instructor-mode .game-container {
  margin-top: 24px;
}

/* Instructor-only visible elements */
.instructor-only {
  display: none;
}

.instructor-mode .instructor-only {
  display: block;
}

/* --- Utility --- */
.hidden { display: none !important; }
.text-cyan { color: var(--accent-cyan); }
.text-orange { color: var(--accent-orange); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }

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

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================================
   Public View — Collapsed Widget
   ============================================================ */

.public-view-collapsed {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-top: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.public-view-collapsed:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-hover);
}

.pv-ticker-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.pv-ticker {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.pv-company-name {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pv-price-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.pv-price {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pv-change {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
}

.pv-change.positive { color: var(--accent-green); }
.pv-change.negative { color: var(--accent-red); }
.pv-change.neutral { color: var(--text-muted); }

.pv-rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.375rem;
}

.pv-rating-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.pv-rating-badge {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
}

.pv-rating-badge.rating-high {
  color: var(--accent-green);
  border-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
}

.pv-rating-badge.rating-mid {
  color: var(--accent-orange);
  border-color: var(--accent-orange);
  background: rgba(245, 158, 11, 0.1);
}

.pv-rating-badge.rating-low {
  color: var(--accent-red);
  border-color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
}

.pv-expand-hint {
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.25rem;
}

/* ============================================================
   Public View — Expanded Overlay
   ============================================================ */

.public-view-overlay .modal-content {
  max-width: 720px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.pv-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.pv-header-left h2 {
  font-size: 1.125rem;
  color: var(--accent-cyan);
  margin-bottom: 0.125rem;
  text-align: left;
}

.pv-header-left .pv-sector {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.pv-header-right {
  text-align: right;
}

.pv-header-right .pv-rating-label-lg {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.25rem;
}

.pv-header-right .pv-rating-badge-lg {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
}

/* Stock price section */
.pv-stock-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.pv-stock-price-display {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.pv-stock-price-lg {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pv-stock-change-lg {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
}

.pv-sparkline-container {
  width: 100%;
  height: 80px;
  position: relative;
}

.pv-sparkline-container canvas {
  width: 100%;
  height: 100%;
}

/* 6-stat grid */
.pv-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.625rem;
  margin-bottom: 1.25rem;
}

.pv-stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.625rem;
  text-align: center;
}

.pv-stat-card .pv-stat-value {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.pv-stat-card .pv-stat-label {
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

/* News feed */
.pv-news-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-bottom: 1.25rem;
  max-height: 180px;
  overflow-y: auto;
}

.pv-news-title {
  font-family: var(--font-title);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--border-subtle);
}

.pv-news-entry {
  padding: 0.375rem 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  border-bottom: 1px solid rgba(30, 41, 59, 0.5);
}

.pv-news-entry:last-child {
  border-bottom: none;
}

.pv-news-round {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--text-muted);
  margin-right: 0.5rem;
}

.pv-news-entry.neutral .pv-news-text { color: var(--text-secondary); }
.pv-news-entry.negative .pv-news-text { color: var(--accent-orange); }
.pv-news-entry.positive .pv-news-text { color: var(--accent-green); }
.pv-news-entry.critical .pv-news-text { color: var(--accent-red); font-weight: 600; }

/* Allies & Enemies columns */
.pv-intel-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.pv-intel-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.pv-intel-box .pv-intel-title {
  font-family: var(--font-title);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--border-subtle);
}

.pv-ally-item, .pv-enemy-item {
  padding: 0.25rem 0;
  font-size: 0.75rem;
}

.pv-ally-name, .pv-enemy-name {
  font-weight: 600;
  color: var(--text-primary);
}

.pv-ally-role, .pv-enemy-detail {
  font-size: 0.625rem;
  color: var(--text-muted);
}

.pv-enemy-unknown {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.75rem;
}

/* Regulatory exposure */
.pv-regulatory {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.pv-regulatory .pv-reg-title {
  font-family: var(--font-title);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--border-subtle);
}

.pv-reg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.375rem;
}

.pv-reg-item {
  font-size: 0.75rem;
}

.pv-reg-label {
  color: var(--text-muted);
  font-size: 0.625rem;
}

.pv-reg-value {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* End modal enhancements — large modal, buttons always visible */
#end-modal .modal-content {
  max-width: 860px;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 2rem;
}

#end-modal .modal-content h2 {
  margin-bottom: 0.375rem;
}

#end-modal .mb-2 {
  margin-bottom: 0.5rem;
}

#end-report {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.end-grade-section {
  text-align: center;
  margin-bottom: 0.75rem;
}

.end-grade-letter {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 700;
  padding: 0.25rem 1rem;
  border-radius: var(--radius-md);
  border: 2px solid;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.end-grade-narrative {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
  max-width: 500px;
  margin: 0 auto;
}

.end-breakdown {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.375rem 1.5rem;
  font-size: 0.8125rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.end-breakdown .eb-label {
  color: var(--text-secondary);
  white-space: nowrap;
}

.end-breakdown .eb-value {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

/* End modal stats row — wrap on narrow widths */
#end-modal .briefing-stats {
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
}

/* ============================================================
   Post-Incident Report (End Modal)
   ============================================================ */

.end-report {
  margin-bottom: 0.75rem;
}

.end-report-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  margin-bottom: 0.75rem;
}

.end-report-title {
  font-family: var(--font-title);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--border-subtle);
}

.end-report-section .root-cause-text {
  font-size: 0.8125rem;
  color: var(--accent-orange);
  line-height: 1.5;
}

.end-hindsight-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.end-hindsight-item {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding: 0.25rem 0;
  padding-left: 1rem;
  position: relative;
  line-height: 1.4;
}

.end-hindsight-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
}

.end-timeline-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 200px;
  overflow-y: auto;
}

.end-timeline-entry {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 0.5rem;
  padding: 0.3rem 0;
  font-size: 0.75rem;
  border-bottom: 1px solid rgba(30, 41, 59, 0.4);
  align-items: baseline;
}

.end-timeline-entry:last-child {
  border-bottom: none;
}

.end-timeline-round {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
}

.end-timeline-action {
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.end-timeline-outcome {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  white-space: nowrap;
}

.end-timeline-outcome.success { color: var(--accent-green); }
.end-timeline-outcome.partial { color: var(--accent-orange); }
.end-timeline-outcome.fail { color: var(--accent-red); }
.end-timeline-outcome.skipped { color: var(--text-muted); }
