/* ===============================
   Capacity Lite — Day Mode Styles
   =============================== */

:root{
  /* ===============================
     Airbus baseline (DEFAULT)
     =============================== */

  --text: #1e2430;
  --muted: rgba(30,36,48,.65);
  --muted2: rgba(30,36,48,.45);
  --line: rgba(30,36,48,.18);

  /* Airbus surfaces */
  --surface-panel:  #b4bccb;
  --surface-card:   #a3abb8;
  --surface-milled: #8e97a6;
  --surface-screen: #353a42;
  --surface-bg:     #7f8fa3;

  /* Geometry */
  --radius-s: 6px;
  --radius-xs: 4px;

  /* Button / control accents */
  --do-bg:       #dde3ec;
  --plan-bg:     #dde3ec;
  --delegate-bg: #dde3ec;
  --defer-bg:    #dde3ec;
  --clarify-bg:  #dde3ec;
  --drop-bg:     #dde3ec;

  /* Machined button physics (GLOBAL) */
  --btn-edge: rgba(0,0,0,.35);
  --btn-shadow-out: rgba(0,0,0,.30);
  --btn-shadow-in: rgba(0,0,0,.65);
  --btn-highlight: rgba(255,255,255,.40);

  --shadow: 0 12px 30px rgba(20,30,60,.12);
}

/* -----------------------------
   BOEING COCKPIT COLOUR SCHEME
   ----------------------------- */
[data-theme="boeing"]{
  /* Boeing — richer, warmer, denser */
  --text: #2b2622;
  --muted: rgba(43,38,34,.65);
  --muted2: rgba(43,38,34,.45);
  --line: rgba(43,38,34,.22);

  --surface-panel:  #b6a48a;   /* richer tan */
  --surface-card:   #9f8c73;   /* plate */
  --surface-milled: #776657;   /* cavity */
  /* screen intentionally NOT overridden */
  --surface-bg:     #8a7a68;   /* just darker than milled */
}

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial;
  color: var(--text);
  background: var(--surface-bg);
}

.shell{
  display:grid;
  grid-template-columns: 340px 1fr 320px;
  gap:8px;
  padding:8px;
}

.panel{
  padding:18px;
  background: transparent;
  /* border: 1px solid rgba(20,30,60,.06); */
  box-shadow:
    /* outer lift */
    0 10px 24px rgba(0,0,0,.28),
    0 2px 6px rgba(0,0,0,.18),

    /* micro-bevel (inner edge) */
    inset 1px 1px 0 rgba(255,255,255,.18),
    inset -1px -1px 0 rgba(0,0,0,.22);
  border-radius: var(--radius-s);
  overflow: visible;
}

.panel{
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.panel{
  background: var(--surface-panel);
}



.panel-title{
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;

  color: #ffffff;

  margin: 0 0 12px 0;

  pointer-events: none;   /* title is informational only */
  user-select: none;
}

/* Panel titles that introduce a new milled section */
.card + .panel-title,
.actionBay + .panel-title,
#eventStream + .panel-title{
  margin-top: 22px;
}

.primaryTask{
  margin-top: 0px;
}

.card{
  background: var(--card-soft);
  box-shadow: 0 8px 20px rgba(20,30,60,.08);
  padding:14px;
  margin-top:14px;
  border-radius: var(--radius-xs);
}
.panel.left .card{
  background: rgba(0,0,0,.06);
  border-radius: 14px;
  overflow: visible;
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,.35),
    inset 0 -1px 0 rgba(255,255,255,.12),
    0 0 0 .5px rgba(0,0,0,.22);
}

/* ===============================
   Primary Task Track (Dot)
   =============================== */

.track{
  position: relative;
  height: 200px;

  /* Dark graphite surface */
  background: var(--surface-screen);

  border-radius: var(--radius-xs);

  box-shadow:
    inset 3px 3px 6px rgba(0,0,0,.65),
    inset -2px -2px 3px rgba(255,255,255,.10),
    0 0 0 .5px rgba(0,0,0,.50);
}

.track::after{
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  pointer-events: none;

  /* Hollow cross */
  background:
    linear-gradient(#2cff5a, #2cff5a) center/1px 100% no-repeat,
    linear-gradient(#2cff5a, #2cff5a) center/100% 1px no-repeat;

  opacity: 0.45;
}
/* Inset surround for dot pitch */
.track::before{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xs);
  z-index: -1;

  box-shadow:
    inset 0 2px 4px rgba(0,0,0,.35),
    inset 0 -1px 0 rgba(255,255,255,.12),
    0 0 0 .5px rgba(0,0,0,.22);
}

.trackDot{
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;

  background: #2cff5a; /* neon green */

  box-shadow:
    0 0 6px rgba(44,255,90,.65),
    0 0 12px rgba(44,255,90,.35);

  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

/* ===============================
   Machined Button – Shared Physics
   =============================== */

.btn-machined{
  box-shadow:
    3px 3px 4px var(--btn-shadow-out),
    inset -1px -1px 2px var(--btn-shadow-in),
    inset 2px 2px 2px var(--btn-highlight);
  transition:
    box-shadow .12s ease,
    transform .12s ease,
    filter .12s ease;
}

.btn,
.btn-machined,
.actionBtn,
.diamondBtn{
  border-radius: var(--radius-xs);
}

.btn-machined:hover{
  transform: translateY(-0.5px);
  filter: brightness(0.98);
}

.btn-machined:active{
  transform: translateY(1px);
  box-shadow:
    inset -1px -1px 2px var(--btn-shadow-in),
    inset 1px 1px 1.5px var(--btn-highlight);
}

.actionBtn{
  display: block;
  width: 100%;
  border: none;
  background: #dde3ec;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius-xs);
  margin-bottom: 8px;
  color: rgba(28,36,48,.85);
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: 11px 14px;

  /* MACHINED BUTTON PHYSICS */
  box-shadow:
    3px 3px 4px var(--btn-shadow-out),
    inset -1px -1px 2px var(--btn-shadow-in),
    inset 2px 2px 2px var(--btn-highlight);

  transition:
    box-shadow .12s ease,
    transform .12s ease,
    filter .12s ease;
}

.actionBtn:hover{
  transform: translateY(-0.5px);
  filter: brightness(0.98);
}

.actionBtn:active{
  transform: translateY(1px);
  box-shadow:
    inset -1px -1px 2px var(--btn-shadow-in),
    inset 1px 1px 1.5px var(--btn-highlight);
}

.actionBtn:disabled,
.actionBtn.disabled{
  opacity: 0.55;
  filter: none;
  pointer-events: none;
}

.actionBtn:last-child{
  margin-bottom: 0;
}

/* ACTIONS – visual grouping (no DOM change yet) */
.panel.right{
  position: relative;
  display: flex;
  flex-direction: column;
}


.btn{
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  background: #dde3ec;
  font-weight: 800;
}

button,
.btn{
  border: none;
  appearance: none;
  -webkit-appearance: none;
  background-clip: padding-box;
}

.btn:disabled{
  opacity: 0.6;
  filter: none;
  pointer-events: none;
}

/* System controls — slightly lighter/smaller than action buttons */
.panel.left .btn{
  padding: 6px 8px;        /* narrower horizontally */
  font-weight: 700;
  font-size: 12px;         /* small reduction */
  border-radius: var(--radius-xs);
  overflow: hidden;
  white-space: nowrap;
}

.actionGrid{
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

/* ===============================
   Directional Control — Diamond Buttons
   (25% larger, no transform scaling)
   =============================== */

.controlDiamondPad{
  position: relative;
  width: 120px;
  height: 120px;
  margin: 24px auto 24px;
}

/* Inset surround that follows the buttons */
.controlDiamondPad::before{
  content: "";
  position: absolute;
  inset: 0;
  transform: rotate(45deg) scale(0.92);
  border-radius: 6px;
  z-index: 0;

  box-shadow:
    inset 0 2px 4px rgba(0,0,0,.35),
    inset 0 -1px 0 rgba(255,255,255,.12),
    0 0 0 .5px rgba(0,0,0,.22);
}

.diamondBtn{
  position: absolute;
  width: 46px;
  height: 46px;
  background: #8a9098;
  border: 1px solid rgba(0,0,0,.35);
  border-radius: 6px;
  transform: rotate(45deg);
  cursor: pointer;
  box-shadow:
    4px 4px 8px rgba(0,0,0,.30),
    inset -2px -2px 3px rgba(0,0,0,.35),
    inset 2px 2px 0 rgba(255,255,255,.22);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.diamondBtn:active{
  box-shadow:
    inset -3px -3px 5px rgba(0,0,0,.45),
    inset 1px 1px 0 rgba(255,255,255,.18);
  transform: translateY(1px) rotate(45deg);
}

/* Diamond layout */
.diamondBtn.up{
  top: 0;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
}

.diamondBtn.down{
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
}

.diamondBtn.left{
  left: 0;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

.diamondBtn.right{
  right: 0;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

/* Arrow glyph */
.diamondBtn .arrow{
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 11px solid rgba(255,255,255,.9);
  transform: rotate(-45deg);
}

/* Arrow orientation */
.diamondBtn.up .arrow{
  transform: rotate(-45deg);
}

.diamondBtn.right .arrow{
  transform: rotate(45deg);
}

.diamondBtn.down .arrow{
  transform: rotate(135deg);
}

.diamondBtn.left .arrow{
  transform: rotate(-135deg);
}

/* ===============================
   Machined Group Outline
   =============================== */



/* Milled action bay inside right panel */
.panel.right{
  position: relative;
}


/* ACTIONS — real milled bay */
.actionBay{
  margin-top: 2px;
  padding: 10px 10px;   /* ↑ vertical padding increased by ~15% */
  border-radius: 14px;

  background: rgba(0,0,0,.06);

  box-shadow:
    inset 0 2px 4px rgba(0,0,0,.35),
    inset 0 -1px 0 rgba(255,255,255,.12),
    0 0 0 .5px rgba(0,0,0,.22);
}
.actionBay.invalid{
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,.35),
    inset 0 -1px 0 rgba(255,255,255,.12),
    0 0 0 1px rgba(255,82,82,.85),
    0 0 10px rgba(255,82,82,.35);
}
/* EVENTS — milled cavity */
#eventStream{
  margin-top: 14px;
  padding: 14px 12px;

  border-radius: 14px;

  background: var(--surface-screen);

  box-shadow:
    inset 3px 3px 6px rgba(0,0,0,.65),
    inset -2px -2px 3px rgba(255,255,255,.10),
    0 0 0 .5px rgba(0,0,0,.50);
}
#eventStream{
  height: 640px;        /* match computer screen */
overflow-y: auto;    /* internal scrolling */
}
/* ===============================
   Computer Screen (Instrument)
   =============================== */

.computerScreen{
  margin-top: 0px;
  padding: 14px 12px;

  height: 312px;              /* fixed instrument aperture */
  overflow-y: auto;

  background: var(--surface-screen);
  border-radius: 14px;

  box-shadow:
    inset 3px 3px 6px rgba(0,0,0,.65),
    inset -2px -2px 3px rgba(255,255,255,.10),
    0 0 0 .5px rgba(0,0,0,.50);
}
.computerScreen .terminal{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #2cff5a;
  white-space: pre-wrap;
}

#computerInput{
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
  z-index: -1;
}

/* =========================
   Event cards – readability
   ========================= */

/* =========================
   Event cards – outline only
   ========================= */

.event {
  background: rgba(255,255,255,0.04); /* lighter than screen */
  color: #ffffff;
  border-radius: 6px;
  padding: 7px 9px;
  margin-bottom: 6px;

  border: 1px solid rgba(255,255,255,0.38);
  box-shadow: none;
}

.event.selected {
  border: 1px solid #2cff5a;
  box-shadow: 0 0 6px rgba(44,255,90,.55);
}

.eventText {
  color: #ffffff;
  font-size: 12px;
  line-height: 1.25;
  margin-bottom: 4px;
}

.eventMeta{
  display: flex;
  align-items: center;
  gap: 8px;              /* ↓ was too large */
  flex-wrap: wrap;    /* ← THIS ALLOWS THE WRAP */
  font-size: 11px;
  color: rgba(255,255,255,.85);
}

.eventMeta .badge{
  color: #9cff9c; /* subtle green-screen feel */
}

.eventTop {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  margin-bottom: 4px;
}

.eventTop .badge {
  padding: 1px 6px;
  font-size: 10.5px;
  border-radius: 5px;
  white-space: nowrap;
}

.eventTop .title {
  flex: 1;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  color: #ffffff;

  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Allow event cards to shrink inside grid (iPad fix) */
.event,
.eventTop,
.eventText,
.eventMeta {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
}

.badge {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
}

.progress {
  background: rgba(255,255,255,0.12);
  height: 6px;
  border-radius: 4px;
  overflow: hidden;
}

.progressFill {
  height: 100%;
  border-radius: 4px 0 0 4px;

  /* same emissive logic as performance bars */
  background: linear-gradient(
    to right,
    #4caf50 0%,
    #4caf50 65%,
    #ffb300 82%,
    #e53935 100%
  );

  /* inner shadow – BLACK, not coloured */
  box-shadow:
    inset 0 1px 2px rgba(0,0,0,.35),
    inset 0 -1px 1px rgba(255,255,255,.18);

  transition: width 0.15s linear;
}
.event.invalid{
  border-color: #ff5252;
  box-shadow: 0 0 6px rgba(255,82,82,.6);
}

.actionBtn.disabled,
.actionBtn:disabled{
  opacity: 0.45;
  box-shadow:
    inset 1px 1px 2px rgba(0,0,0,.35),
    inset -1px -1px 1px rgba(255,255,255,.25);
  filter: grayscale(40%);
  cursor: not-allowed;
}

.emptyStream{
  background: transparent;
  box-shadow: none;
  padding-top: 14px;   /* lifts it slightly */
}

.emptyText{
  color: #3cff6a;              /* neon green */
  font-family: "Futura", system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;

  /* subtle CRT / green-screen feel */
  text-shadow:
    0 0 6px rgba(60,255,106,.35),
    0 0 12px rgba(60,255,106,.15);
}

/* ===============================
   Performance Gauges (New)
   =============================== */

.performanceStrip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.perfBar {
  position: relative;
  width: 280px; /* same width as old stability aperture */
  height: 10px;
  border-radius: 6px;
  background: #2e2a21; /* dark background for contrast */
    box-shadow:
    inset 2px 2px 4px rgba(0,0,0,.65),
    inset -1px -1px 2px rgba(255,255,255,.18),
    0 0 0 .5px rgba(0,0,0,.45);
  overflow: hidden;
}

.perfFill {
  height: 100%;
  background-color: #2cff5a; /* neon green */
  border-radius: 6px 0 0 6px;

  /* TRUE inner shadow (black-based) */
  box-shadow:
    inset 0 2px 3px rgba(0,0,0,.55),   /* top recess */
    inset 0 -1px 1px rgba(255,255,255,.18); /* faint bottom catch */

  width: 4%; /* minimum visible */
  transition: width 0.2s ease;
}

/* Performance gauge blocks */
.perfBlock{
  display: flex;
  flex-direction: column;
  gap: 4px;           /* label → bar spacing */
}

/* Performance block: reclaim the removed title's vertical space */
.perfCard{
  margin-top: 24px; /* was 14px via .card */
}

/* Space between DOT and TRIAGE */
.performanceStrip{
  gap: 12px;          /* vertical separation */
}

/* Small cockpit-style labels */
.perfLabel{
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffffff;
}

/* Hide Performance title to save vertical space */
.performanceTitle,
.panel-title.performance {
  display: none;
}

/* ===============================
   COMPUTER SCREEN STATES (CLEAN)
   =============================== */

/* Base screen stays static */
.computerScreen{
  position: relative;
}

/* Inner emissive layer (used for pulse + success/error fills) */
.computerScreen::after{
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 10px;
  pointer-events: none;
  opacity: 0;
}

/* =====================================================
   COMPUTER SCREEN — FINAL, SINGLE SOURCE OF TRUTH
   ===================================================== */

/* Base screen — never flashes border */
.computerScreen{
  position: relative;
  background: var(--surface-screen);
}

/* Inner emissive fill layer (attention only) */
.computerScreen::after{
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 10px;
  pointer-events: none;
  opacity: 0;
}

/* ATTENTION — strong pulsing green fill */
.computerScreen.flash::after{
  animation: screenPulse 1s ease-in-out infinite;
}

@keyframes screenPulse{
  0%{
    opacity: .25;
    background: rgba(44,255,90,.25);
  }
  50%{
    opacity: .95;
    background: rgba(44,255,90,.65);
  }
  100%{
    opacity: .25;
    background: rgba(44,255,90,.25);
  }
}

/* RESULT TEXT (SUCCESS / FAILURE ONLY) */
.computerScreen .result{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  font-family: "Courier New", Courier, monospace;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: .15em;

  opacity: 0;
  pointer-events: none;
}

/* SUCCESS */
.computerScreen.success::after{
  opacity: 0; /* stop pulse */
}
.computerScreen.success .result{
  color: #2cff5a;
  opacity: 1;
}

/* FAILURE */
.computerScreen.error::after{
  opacity: 0; /* stop pulse */
}
.computerScreen.error .result{
  color: #ff3b30;
  opacity: 1;
}

/* ===============================
   GAME OVER OVERLAY
   =============================== */

/* ===============================
   GAME OVER — POSITIVE REVEAL
   =============================== */

.gameOver{
  position: fixed;
  inset: 0;
  z-index: 9999;

  /* lighter veil – anticipation, not shutdown */
  background: rgba(0,0,0,.35);

  display: flex;
  align-items: center;
  justify-content: center;
}

.gameOver.hidden{
  display: none;
}

.gameOverInner{
  background: #1cff4a;          /* neon green reveal */
  color: #0f141a;               /* dark graphite text */

  padding: 30px 42px;
  border-radius: 6px;

  text-align: center;

  box-shadow:
    0 0 0 2px rgba(0,0,0,.18),
    0 26px 60px rgba(0,0,0,.45);
}

.gameOverTitle{
  font-size: 28px;
  font-weight: 900;
  letter-spacing: .18em;
  margin-bottom: 6px;
}

.gameOverSub{
  font-size: 13px;
  opacity: .85;
}

/* RESULTS emphasis */
.resultsText {
  color: #1cff4a; /* neon green */
}

.resultsText b {
  color: #ffffff; /* white highlights */
}

/* ==============================
   iPad landscape fit (≤1024px)
   ============================== */
@media (max-width: 1024px) {

  /* Hard stop horizontal overflow */
  html, body {
    overflow-x: hidden;
  }

  /* Main app container (if present) */
  .app,
  .appContainer,
  .layout {
    max-width: 100vw;
  }

  /* Primary multi-column layout */
  .mainGrid,
  .gameGrid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  /* Event stream + system panel */
  .eventStream,
  #eventStream {
    max-width: 100%;
  }

  /* Action buttons: tighten spacing */
  .actionGrid {
    gap: 6px;
  }

  .actionBtn {
    padding: 10px 8px;
    font-size: 12px;
  }

  /* Cards */
  .card {
    padding: 10px;
  }

  /* Reduce any wide fixed elements */
  canvas,
  svg {
    max-width: 100%;
    height: auto;
  }
}

@media (max-width: 1024px) {
  body {
    transform: scale(0.95);
    transform-origin: top center;
  }
}

/* Prevent horizontal bleed on iPad */
html, body {
  overflow-x: hidden;
}

/* Prevent double-tap zoom and pinch while game is active */
body.game-active {
  touch-action: manipulation;
  overscroll-behavior: contain;
}

/* Prevent text/image selection inside the game */
body.game-active * {
  -webkit-user-select: none;
  user-select: none;
}