/* ==========================================================================
   STUDIO VAGUS // FLAGSHIP-01 — TACTICAL SIMULATOR STYLESHEET (games.css)
   Pure Vanilla CSS · Zero CDN · Zero Horizontal Scroll (375px safe) · RTL
   ========================================================================== */

/* --- 1. PAGE LAYOUT & CONTAINER --- */
.simulator-page-container {
  width: 100%;
  max-width: var(--max-content-width, 1240px);
  margin-inline: auto;
  padding-inline: 1.25rem;
  padding-block: 2rem 5rem;
  overflow-x: clip;
}

/* --- 2. DAILY MISSION BANNER --- */
.sim-daily-banner {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.12) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: var(--border-radius-md, 14px);
  padding: 1.5rem;
  margin-block-end: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.sim-daily-col-info {
  flex: 1;
  min-width: 0;
}

.sim-daily-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-block-end: 0.5rem;
  flex-wrap: wrap;
}

.sim-daily-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-bright, #ffffff);
  margin-block-end: 0.35rem;
}

.sim-daily-desc {
  font-size: 0.9rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.5;
}

.sim-daily-col-action {
  flex-shrink: 0;
}

/* --- 3. COMMAND PROGRESS & CLEARANCE PANEL --- */
.sim-progress-deck {
  background: var(--bg-panel, rgba(15, 23, 42, 0.88));
  border: 1px solid var(--border-cyan, rgba(56, 189, 248, 0.28));
  border-radius: var(--border-radius-lg, 20px);
  padding: 1.75rem;
  margin-block-end: 3rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.sim-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-block-end: 1.5rem;
  flex-wrap: wrap;
}

.sim-rank-box {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sim-rank-badge-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.15);
  border: 2px solid var(--accent-amber, #fbbf24);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}

.sim-rank-caption {
  font-size: 0.72rem;
  color: var(--text-dim, #64748b);
  letter-spacing: 0.08em;
  font-weight: 700;
}

.sim-rank-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--accent-amber, #fbbf24);
}

.sim-metrics-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sim-metric-pill {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sim-metric-icon {
  font-size: 1.15rem;
}

.sim-metric-data {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.sim-metric-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-bright, #ffffff);
}

.sim-metric-label {
  font-size: 0.68rem;
  color: var(--text-dim, #64748b);
}

/* XP Bar */
.sim-xp-bar-wrap {
  margin-block-end: 1.5rem;
}

.sim-xp-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
  margin-block-end: 0.45rem;
  font-weight: 600;
}

.sim-xp-track {
  width: 100%;
  height: 8px;
  background: rgba(30, 41, 59, 0.8);
  border-radius: 999px;
  overflow: hidden;
}

.sim-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan, #38bdf8), var(--accent-amber, #fbbf24));
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* Compartment Honors Row */
.sim-achievements-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-block-start: 1rem;
  border-block-start: 1px dashed rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

.sim-achieve-tag {
  font-size: 0.72rem;
  color: var(--text-dim, #64748b);
  letter-spacing: 0.05em;
  font-weight: 700;
}

.sim-badges-list {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sim-badge-item {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid var(--border-cyan, rgba(56, 189, 248, 0.3));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: help;
}

.sim-badge-item.locked {
  filter: grayscale(1) opacity(0.35);
  border-color: rgba(255, 255, 255, 0.1);
}

.sim-badge-item:not(.locked) {
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.sim-badge-item:hover {
  transform: translateY(-2px);
}

/* Clearance Certificate Box */
.sim-clearance-box {
  margin-block-start: 1.5rem;
  padding: 1.25rem;
  background: radial-gradient(circle at center, rgba(251, 191, 36, 0.18) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 2px solid var(--accent-amber, #fbbf24);
  border-radius: var(--border-radius-md, 14px);
  text-align: center;
  animation: clearancePulse 2.5s infinite alternate;
}

@keyframes clearancePulse {
  0% { box-shadow: 0 0 15px rgba(251, 191, 36, 0.2); }
  100% { box-shadow: 0 0 35px rgba(251, 191, 36, 0.5); }
}

.sim-clearance-cert {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.sim-clearance-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-align: start;
}

.sim-cert-icon {
  font-size: 2.2rem;
}

.sim-cert-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent-amber, #fbbf24);
}

.sim-cert-sub {
  font-size: 0.82rem;
  color: var(--text-muted, #94a3b8);
}

.sim-cert-key {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.6);
  padding: 0.6rem 1.5rem;
  border-radius: 6px;
  border: 1px dashed var(--accent-amber, #fbbf24);
}

.sim-cert-btn {
  margin-block-start: 0.5rem;
}

.sim-progress-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-block-start: 1.25rem;
  padding-block-start: 0.75rem;
  border-block-start: 1px solid rgba(255, 255, 255, 0.05);
  flex-wrap: wrap;
}

.btn-text-dim {
  background: none;
  border: none;
  color: var(--text-dim, #64748b);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: color 0.2s ease;
}

.btn-text-dim:hover {
  color: var(--text-main, #f8fafc);
}

.btn-text-dim.text-danger:hover {
  color: var(--accent-rose, #f43f5e);
}

/* --- 4. 4 SIMULATION MODULES GRID --- */
.sim-modules-section {
  margin-block-end: 4rem;
}

.sim-games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1.5rem;
  margin-block-start: 2rem;
}

.sim-game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel, rgba(15, 23, 42, 0.88));
  border: 1px solid var(--border-cyan, rgba(56, 189, 248, 0.28));
  border-radius: var(--border-radius-md, 14px);
  padding: 1.5rem;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.sim-game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.sim-card-accent {
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 3px;
}

.sim-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-block-end: 0.75rem;
}

.sim-game-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.sim-daily-indicator {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  color: #000;
  background: var(--accent-amber, #fbbf24);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

.sim-daily-indicator.active {
  display: inline-block;
}

.sim-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-bright, #ffffff);
  margin-block-end: 0.6rem;
  line-height: 1.3;
}

.sim-card-desc {
  font-size: 0.86rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.55;
  margin-block-end: 1.25rem;
  flex-grow: 1;
}

.sim-card-meta {
  margin-block-end: 1.25rem;
  padding-block: 0.75rem;
  border-block: 1px solid rgba(255, 255, 255, 0.06);
}

.sim-level-selector {
  display: flex;
  gap: 0.4rem;
  margin-block-end: 0.6rem;
}

.sim-lvl-btn {
  flex: 1;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #94a3b8);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.35rem 0.2rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
}

.sim-lvl-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.sim-lvl-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan, #38bdf8);
  color: var(--accent-cyan, #38bdf8);
  font-weight: 700;
}

.sim-card-score {
  font-size: 0.72rem;
  color: var(--text-dim, #64748b);
  text-align: end;
}

.sim-launch-btn {
  width: 100%;
  justify-content: center;
}

/* --- 5. CREW QUARTERS ROSTER COLLECTION --- */
.sim-crew-quarters {
  background: var(--bg-panel, rgba(15, 23, 42, 0.88));
  border: 1px solid var(--border-cyan, rgba(56, 189, 248, 0.28));
  border-radius: var(--border-radius-lg, 20px);
  padding: 2rem;
  margin-block-end: 4rem;
}

.sim-quarters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-block-end: 1.75rem;
  flex-wrap: wrap;
}

.sim-quarters-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
  margin-block: 0.35rem 0.2rem;
}

.sim-quarters-sub {
  font-size: 0.88rem;
  color: var(--text-muted, #94a3b8);
}

.sim-quarters-count {
  font-size: 0.95rem;
  font-weight: 800;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid var(--accent-cyan, #38bdf8);
  color: var(--accent-cyan, #38bdf8);
  flex-shrink: 0;
}

.sim-roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.9rem;
}

.sim-officer-chip {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-md, 14px);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.sim-officer-chip:hover {
  transform: translateY(-3px);
  border-color: var(--border-cyan, rgba(56, 189, 248, 0.5));
  background: rgba(30, 41, 59, 0.85);
}

.sim-chip-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.15);
  margin-block-end: 0.5rem;
  background: #0f172a;
}

.sim-chip-placeholder {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-dim, #64748b);
  margin-block-end: 0.5rem;
  background: rgba(15, 23, 42, 0.5);
}

.sim-chip-callsign {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-bright, #ffffff);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sim-chip-deck {
  font-size: 0.65rem;
  color: var(--text-dim, #64748b);
  margin-block-start: 0.15rem;
}

.sim-officer-chip.locked {
  filter: grayscale(1);
  opacity: 0.45;
}

.sim-officer-chip.locked .sim-chip-callsign {
  color: var(--text-dim, #64748b);
}

/* --- 6. GAME ARENA OVERLAY MODAL --- */
.sim-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.sim-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(8px);
}

.sim-arena-window {
  position: relative;
  z-index: 1001;
  width: 100%;
  max-width: 820px;
  max-height: 94vh;
  background: var(--bg-panel-solid, #0f172a);
  border: 1px solid var(--border-cyan-glow, rgba(56, 189, 248, 0.55));
  border-radius: var(--border-radius-lg, 20px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
}

.sim-arena-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: rgba(15, 23, 42, 0.95);
  border-block-end: 1px solid rgba(255, 255, 255, 0.08);
  gap: 1rem;
}

.sim-arena-title-block {
  min-width: 0;
}

.sim-arena-badge {
  font-size: 0.7rem;
  color: var(--accent-cyan, #38bdf8);
  font-weight: 700;
}

.sim-arena-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #ffffff;
  margin-block-start: 0.15rem;
}

.sim-arena-meta-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.sim-arena-stat {
  font-size: 0.82rem;
  padding: 0.35rem 0.7rem;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #ffffff;
}

.sim-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--accent-rose, #f43f5e);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sim-close-btn:hover {
  background: var(--accent-rose, #f43f5e);
  color: #ffffff;
}

.sim-arena-objective {
  flex-shrink: 0;
  padding: 0.6rem 1.5rem;
  background: rgba(56, 189, 248, 0.08);
  border-block-end: 1px solid rgba(56, 189, 248, 0.15);
  font-size: 0.78rem;
  color: var(--accent-cyan, #38bdf8);
  font-weight: 600;
}

.sim-arena-surface {
  padding: 1.5rem;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
  display: block;
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.6) 0%, rgba(2, 6, 23, 0.95) 100%);
}

.sim-arena-footer {
  flex-shrink: 0;
  padding: 0.85rem 1.5rem;
  background: rgba(15, 23, 42, 0.95);
  border-block-start: 1px solid rgba(255, 255, 255, 0.06);
}

.sim-lesson-tip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.4;
}

.sim-lesson-icon {
  font-size: 1.2rem;
  color: var(--accent-amber, #fbbf24);
  flex-shrink: 0;
}

/* --- 7. MINI-GAME 1: DATA REACTOR PIPELINE --- */
.reactor-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
}

.reactor-grid {
  display: grid;
  gap: 6px;
  background: rgba(15, 23, 42, 0.85);
  padding: 10px;
  border-radius: var(--border-radius-md, 14px);
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6);
}

.pipe-tile {
  width: 64px;
  height: 64px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  user-select: none;
}

@media (max-width: 480px) {
  .pipe-tile {
    width: 52px;
    height: 52px;
  }
}

.pipe-tile:hover {
  border-color: var(--accent-cyan, #38bdf8);
  background: rgba(56, 189, 248, 0.15);
}

.pipe-tile.powered {
  border-color: var(--accent-cyan, #38bdf8);
  box-shadow: inset 0 0 12px rgba(56, 189, 248, 0.4);
}

.pipe-tile.is-start {
  border-color: var(--accent-emerald, #10b981);
  background: rgba(16, 185, 129, 0.12);
}

.pipe-tile.is-end {
  border-color: var(--accent-amber, #fbbf24);
  background: rgba(251, 191, 36, 0.12);
}

.pipe-svg {
  width: 80%;
  height: 80%;
  stroke: rgba(255, 255, 255, 0.4);
  stroke-width: 14;
  stroke-linecap: round;
  fill: none;
  transition: stroke 0.25s ease;
}

.pipe-tile.powered .pipe-svg {
  stroke: var(--accent-cyan, #38bdf8);
  filter: drop-shadow(0 0 4px var(--accent-cyan, #38bdf8));
}

.pipe-tile.is-start .pipe-svg {
  stroke: var(--accent-emerald, #10b981);
}

.pipe-tile.is-end.powered .pipe-svg {
  stroke: var(--accent-amber, #fbbf24);
  filter: drop-shadow(0 0 6px var(--accent-amber, #fbbf24));
}

.reactor-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* --- 8. MINI-GAME 2: DEEP SPACE RADAR --- */
.radar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
}

.radar-scope-container {
  flex-shrink: 0;
  max-width: 100%;
  position: relative;
  width: 290px;
  height: 290px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.12) 0%, rgba(15, 23, 42, 0.95) 75%);
  border: 2px solid var(--deck-03-science, #2dd4bf);
  box-shadow: 0 0 25px rgba(45, 212, 191, 0.25);
  overflow: hidden;
}

.radar-sweep-line {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50%;
  height: 2px;
  background: linear-gradient(90deg, var(--deck-03-science, #2dd4bf), transparent);
  transform-origin: 0% 0%;
  animation: radarSweep 4s linear infinite;
}

@keyframes radarSweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.radar-grid-rings {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px dashed rgba(45, 212, 191, 0.2);
  background-image: radial-gradient(circle, transparent 30%, rgba(45, 212, 191, 0.15) 30%, transparent 31%, transparent 60%, rgba(45, 212, 191, 0.15) 60%, transparent 61%);
  pointer-events: none;
}

.radar-blip-btn {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(45, 212, 191, 0.25);
  border: 1px solid var(--deck-03-science, #2dd4bf);
  color: #fff;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: transform 0.2s ease, background 0.2s ease;
  z-index: 2;
  box-shadow: 0 0 8px rgba(45, 212, 191, 0.4);
}

.radar-blip-btn:hover, .radar-blip-btn.selected {
  transform: translate(-50%, -50%) scale(1.25);
  background: var(--deck-03-science, #2dd4bf);
  color: #020617;
  box-shadow: 0 0 16px rgba(45, 212, 191, 0.8);
}

.radar-signal-inspector {
  width: 100%;
  max-width: 540px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(45, 212, 191, 0.35);
  border-radius: var(--border-radius-md, 14px);
  padding: 1.25rem;
}

.radar-inspector-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--deck-03-science, #2dd4bf);
  margin-block-end: 0.5rem;
}

.radar-signal-text {
  font-size: 0.92rem;
  color: #ffffff;
  line-height: 1.5;
  margin-block-end: 0.75rem;
}

.radar-signal-creds {
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
  background: rgba(0, 0, 0, 0.4);
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  margin-block-end: 1rem;
}

.radar-action-row {
  display: flex;
  gap: 0.75rem;
}

/* --- 9. MINI-GAME 3: TACTICAL WARP PRE-MORTEM --- */
.warp-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  max-width: 640px;
}

.warp-gauges-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.warp-gauge-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
}

.warp-gauge-title {
  font-size: 0.7rem;
  color: var(--text-dim, #64748b);
  margin-block-end: 0.25rem;
}

.warp-gauge-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
}

.warp-threat-box {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.4);
  border-radius: var(--border-radius-md, 14px);
  padding: 1.25rem;
}

.warp-threat-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-rose, #f43f5e);
  margin-block-end: 0.45rem;
}

.warp-threat-desc {
  font-size: 0.95rem;
  color: #ffffff;
  line-height: 1.5;
}

.warp-maneuvers-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.warp-maneuver-btn {
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--border-radius-md, 14px);
  padding: 1rem 1.25rem;
  text-align: start;
  cursor: pointer;
  transition: all 0.2s ease;
}

.warp-maneuver-btn:hover {
  background: rgba(251, 146, 60, 0.15);
  border-color: var(--deck-04-tactical, #fb923c);
  transform: translateX(4px);
}

.warp-maneuver-officer {
  font-size: 0.72rem;
  color: var(--deck-04-tactical, #fb923c);
  font-weight: 700;
  margin-block-end: 0.35rem;
}

.warp-maneuver-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
  margin-block-end: 0.25rem;
}

.warp-maneuver-effect {
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
}

/* --- 10. MINI-GAME 4: BLACK BOX DECRYPTION --- */
.blackbox-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
  max-width: 480px;
}

.bb-board {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  background: rgba(15, 23, 42, 0.9);
  padding: 1rem;
  border-radius: var(--border-radius-md, 14px);
  border: 1px solid rgba(192, 132, 252, 0.3);
}

.bb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.bb-row.active {
  border-color: var(--deck-05-inspection, #c084fc);
  background: rgba(192, 132, 252, 0.1);
}

.bb-slots-group {
  display: flex;
  gap: 0.5rem;
}

.bb-slot {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  cursor: pointer;
}

.bb-pins-group {
  display: grid;
  grid-template-columns: repeat(2, 12px);
  gap: 4px;
}

.bb-pin {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}

.bb-pin.exact {
  background: var(--accent-emerald, #10b981);
  box-shadow: 0 0 6px var(--accent-emerald, #10b981);
}

.bb-pin.match {
  background: var(--accent-amber, #fbbf24);
  box-shadow: 0 0 6px var(--accent-amber, #fbbf24);
}

.bb-palette {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.bb-palette-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(192, 132, 252, 0.4);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bb-palette-btn:hover {
  background: var(--deck-05-inspection, #c084fc);
  color: #020617;
  transform: translateY(-2px);
}

/* --- 11. DEBRIEFING / RESULTS WINDOW --- */
.sim-debrief-window {
  position: relative;
  z-index: 1001;
  width: 100%;
  max-width: 580px;
  background: var(--bg-panel-solid, #0f172a);
  border: 1px solid var(--border-cyan, rgba(56, 189, 248, 0.4));
  border-radius: var(--border-radius-lg, 20px);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.sim-debrief-head {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sim-debrief-icon {
  font-size: 2.8rem;
  flex-shrink: 0;
}

.sim-debrief-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
}

.sim-debrief-xp {
  font-size: 0.88rem;
  color: var(--accent-emerald, #10b981);
  font-weight: 700;
  margin-block-start: 0.2rem;
}

.sim-report-dossier {
  background: rgba(2, 6, 23, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-md, 14px);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.sim-report-tag {
  font-size: 0.68rem;
  color: var(--accent-cyan, #38bdf8);
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-block-end: 0.2rem;
}

.sim-report-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sim-report-label {
  font-size: 0.72rem;
  color: var(--text-dim, #64748b);
  font-weight: 700;
}

.sim-report-text {
  font-size: 0.86rem;
  color: var(--text-main, #f8fafc);
  line-height: 1.45;
}

.sim-unlock-notice {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid var(--accent-amber, #fbbf24);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.84rem;
  color: var(--accent-amber, #fbbf24);
  font-weight: 700;
}

.sim-debrief-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sim-debrief-actions .btn {
  flex: 1;
  justify-content: center;
  min-width: 140px;
}

/* --- 12. RETRO CRT TERMINAL EASTER EGG --- */
.sim-crt-terminal {
  position: relative;
  z-index: 1001;
  width: 100%;
  max-width: 620px;
  background: #020b08;
  border: 2px solid #10b981;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.4);
  color: #10b981;
}

.sim-crt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  border-block-end: 1px solid rgba(16, 185, 129, 0.3);
  padding-block-end: 0.5rem;
  margin-block-end: 1rem;
}

.sim-crt-screen {
  min-height: 220px;
  font-size: 0.85rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.sim-crt-footer {
  margin-block-start: 1rem;
  padding-block-start: 0.5rem;
  border-block-start: 1px solid rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.72rem;
  opacity: 0.8;
}

/* --- 13. OFFICER DOSSIER DETAIL MODAL --- */
.sim-dossier-window {
  position: relative;
  z-index: 1001;
  width: 100%;
  max-width: 520px;
  background: var(--bg-panel-solid, #0f172a);
  border: 1px solid var(--border-cyan, rgba(56, 189, 248, 0.4));
  border-radius: var(--border-radius-lg, 20px);
  padding: 1.75rem;
}

.sim-dossier-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-block-end: 1.25rem;
}

.sim-dossier-badge {
  font-size: 0.72rem;
  color: var(--accent-cyan, #38bdf8);
  font-weight: 700;
}

.sim-dossier-content {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.sim-dossier-avatar-wrap {
  flex-shrink: 0;
}

.sim-dossier-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-cyan, #38bdf8);
  background: #020617;
}

.sim-dossier-info {
  min-width: 0;
}

.sim-dossier-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
}

.sim-dossier-callsign {
  font-size: 0.8rem;
  color: var(--accent-amber, #fbbf24);
  font-weight: 700;
  margin-block: 0.2rem 0.4rem;
}

.sim-dossier-role {
  font-size: 0.82rem;
  color: var(--text-muted, #94a3b8);
  margin-block-end: 0.75rem;
}

.sim-dossier-quote {
  font-size: 0.78rem;
  color: #e2e8f0;
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.4);
  border-inline-start: 2px solid var(--accent-cyan, #38bdf8);
  padding: 0.5rem 0.75rem;
  border-radius: 0 6px 6px 0;
}

/* --- 14. EMERGENCY RED ALERT OVERLAY --- */
.sim-red-alert {
  animation: redAlertPulse 1s infinite alternate;
}

@keyframes redAlertPulse {
  0% { box-shadow: inset 0 0 30px rgba(244, 63, 94, 0.3); }
  100% { box-shadow: inset 0 0 90px rgba(244, 63, 94, 0.7); }
}

/* --- 15. ACCESSIBILITY: REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
  .simulator-page-container *, .sim-modal-overlay *, .sim-red-alert {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
  .radar-sweep-line {
    animation: none;
    transform: rotate(45deg);
  }
  .sim-clearance-box {
    animation: none;
  }
  .sim-red-alert {
    animation: none;
    box-shadow: inset 0 0 40px rgba(244, 63, 94, 0.5);
  }
  .sim-game-card:hover, .sim-officer-chip:hover {
    transform: none;
  }
}

/* --- 16. MOBILE 375PX RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 480px) {
  .sim-arena-window { max-height: calc(100dvh - 2rem); }
  .sim-arena-header { flex-wrap: wrap; padding: 0.75rem; gap: 0.5rem; }
  .sim-arena-surface { padding: 0.75rem; }
  .sim-arena-objective, .sim-arena-footer { padding: 0.6rem 0.75rem; }
  .radar-scope-container { width: 240px; height: 240px; }
  .simulator-page-container {
    padding-inline: 0.85rem;
  }
  .sim-daily-banner {
    flex-direction: column;
    align-items: stretch;
  }
  .sim-daily-col-action .btn {
    width: 100%;
    justify-content: center;
  }
  .sim-progress-header {
    flex-direction: column;
    align-items: stretch;
  }
  .sim-metrics-bar {
    justify-content: space-between;
  }
  .sim-metric-pill {
    padding: 0.35rem 0.65rem;
  }
  .sim-games-grid {
    grid-template-columns: 1fr;
  }
  .sim-dossier-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .sim-dossier-quote {
    text-align: start;
  }
}

/* Native buttons preserve keyboard access for pipes and officer cards. */
.pipe-tile, .sim-officer-chip { font: inherit; color: inherit; }
.pipe-tile:focus-visible, .sim-officer-chip:focus-visible { outline: 2px solid var(--accent-cyan, #38bdf8); outline-offset: 3px; }

/* Stage E: every difficulty and translated header stays inside its card. */
.sim-game-card { min-width: 0; }
.sim-level-selector { flex-wrap: wrap; }
.sim-lvl-btn {
  flex: 1 1 100%;
  min-width: 0;
  padding: .5rem .6rem;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  font-family: var(--font-sans);
  font-size: .85rem;
  line-height: 1.4;
  min-height: 44px;
}
.sim-card-top { flex-wrap: wrap; gap: .5rem; align-items: flex-start; min-height: 3.25rem; }
.sim-game-badge { min-width: 0; word-break: normal; overflow-wrap: normal; line-height: 1.5; font-size: .78rem; }
.sim-daily-indicator { flex-shrink: 0; white-space: nowrap; font-size: .75rem; box-shadow: none; }
.sim-rank-caption, .sim-card-score, .sim-crt-footer, .btn-text-dim { font-size: .85rem; color: #b8c5d6; }
.btn-text-dim { min-height: 44px; text-decoration: underline; text-underline-offset: .2em; }
.sim-crt-footer { opacity: 1; }
html[lang="he"] :is(.sim-game-badge, .sim-daily-indicator, .sim-rank-caption, .sim-lvl-btn, .sim-crt-terminal) { letter-spacing: normal; font-family: 'Heebo', system-ui, sans-serif; }

.sim-collection-count { grid-column: 1 / -1; color: #cbd5e1; font-size: .9rem; }
.sim-collection-more { grid-column: 1 / -1; min-width: 0; }
.sim-collection-more > summary { cursor: pointer; min-height: 44px; padding: .65rem .8rem; border: 1px solid var(--border-cyan); border-radius: .5rem; color: #e2e8f0; background: #0f172a; font-size: .9rem; }
.sim-collection-more > summary:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 3px; }
.sim-collection-more > .sim-roster-grid { margin-top: 1rem; }

/* Stage F: language-aware prose, visible feedback and one modal scroll flow. */
.mono-prose {
  font-family: var(--font-mono);
  word-break: normal;
  overflow-wrap: normal;
  direction: inherit;
  unicode-bidi: normal;
}
.sim-arena-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.sim-arena-scroll .sim-arena-surface { overflow: visible; }
.sim-arena-footer { position: static; }
.sim-close-btn { width: 44px; height: 44px; flex-shrink: 0; }
.reactor-flow-status { min-height: 1.5em; margin: 0; line-height: 1.5; text-align: center; }
.flow-interrupted { animation: flow-shake 180ms ease-in-out; }
@keyframes flow-shake {
  25%, 75% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
}
@media (prefers-reduced-motion: reduce) {
  .flow-interrupted { animation: none !important; }
}
@media (max-width: 480px) {
  .sim-debrief-window { padding: 1rem; max-height: calc(100dvh - 2rem); overflow-y: auto; }
  .sim-debrief-actions { flex-direction: column; align-items: stretch; }
  .sim-debrief-actions .btn { flex: 0 0 auto; width: 100%; min-width: 0; white-space: normal; line-height: 1.4; }
}

/* Stage F2: readable controls and a separate Admiral crown. */
.sim-lvl-btn,
html[lang="he"] .sim-lvl-btn {
  font-feature-settings: "calt" 0;
  letter-spacing: 0;
}
.sim-crown-card { margin-block-start: 1rem; max-inline-size: 240px; }
.sim-crown-card .sim-officer-chip { inline-size: 100%; border-color: #fbbf24; }
.radar-action-row,
.bb-action-row { display: flex; gap: .75rem; inline-size: 100%; min-width: 0; }
.radar-action-row .btn,
.bb-action-row .btn {
  flex: 1 1 0;
  min-width: 0;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  line-height: 1.4;
}
.radar-action-row .btn > span,
.bb-action-row .btn > span,
.sim-debrief-actions .btn > span { min-width: 0; white-space: normal; }
.warp-maneuvers-list,
.warp-maneuver-btn { min-width: 0; max-inline-size: 100%; }
.warp-maneuver-btn { white-space: normal; word-break: normal; overflow-wrap: normal; }
@media (max-width: 480px) {
  .radar-action-row,
  .bb-action-row { flex-wrap: wrap; }
  .radar-action-row .btn,
  .bb-action-row .btn { flex: 1 1 100%; }
  .warp-maneuver-btn { inline-size: 100%; }
}
