/* ============================================================================
   css/stage.css — 75% Widescreen Game Stage + 25% Mission Card Sidebar (v6.1)
   Explicitly enforces grid-template-rows and min-height so #gameCanvas
   NEVER collapses to 0px height inside flex/iframe containers.
   ============================================================================ */
.middle-workspace {
  flex: 1 1 0%;
  min-height: 360px;
  display: grid;
  grid-template-columns: minmax(0, 2.65fr) minmax(275px, 1.05fr);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  background: #070b18;
}

.stage-theater {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 360px;
  background: #050814;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: center;
  border-right: 2px solid rgba(56, 189, 248, 0.35);
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.stage-hud-left {
  position: absolute;
  top: 10px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: none;
  z-index: 10;
}

.hud-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.hud-chip {
  background: rgba(11, 16, 33, 0.86);
  border: 1px solid rgba(56, 189, 248, 0.4);
  backdrop-filter: blur(6px);
  padding: 4px 8px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #e2e8f0;
}

.hud-chip strong { color: var(--accent-cyan); }

.playtest-banner {
  position: absolute;
  top: 44px;
  left: 12px;
  max-width: 72%;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.94), rgba(6, 182, 212, 0.94));
  color: #04131a;
  font-weight: 800;
  font-size: 11.5px;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.25s;
}

.playtest-banner.play-active {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
  color: #0b1021;
}

.stage-pad-right {
  position: absolute;
  bottom: 10px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  background: rgba(11, 16, 33, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.32);
  padding: 5px 8px;
  border-radius: 10px;
  z-index: 11;
}

.pad-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pad-group-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  color: #fde047;
  margin-right: 2px;
}

.key-cap {
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-bottom-width: 3px;
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 800;
  padding: 4px 7px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
}

.key-cap.wired { border-color: var(--accent-emerald); color: #6ee7b7; }
.key-cap.attack-p { border-color: #f43f5e; color: #fda4af; }
.key-cap:active, .key-cap.pressed {
  transform: translateY(2px);
  background: var(--accent-cyan);
  color: #080c1a;
}

.mission-sidebar {
  background: linear-gradient(180deg, #131e3b 0%, #0b1224 100%);
  border-left: 2px solid rgba(56, 189, 248, 0.45);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  overflow-y: auto;
  min-height: 0;
}

.mission-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.mission-badge {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #080c1a;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 900;
  padding: 4px 11px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 10px rgba(251, 191, 36, 0.3);
}
.mission-phase-tag { font-size: 12px; font-weight: 800; color: #7dd3fc; }
.mission-title { font-size: 18px; font-weight: 900; color: #ffffff; line-height: 1.24; letter-spacing: -0.2px; }
.mission-goal-box {
  background: rgba(16, 185, 129, 0.16);
  border: 1.5px solid rgba(52, 211, 153, 0.65);
  border-radius: 10px;
  padding: 11px 13px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.14);
}
.mission-box-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.7px;
  color: var(--accent-gold);
  margin-bottom: 5px;
  text-transform: uppercase;
}
.mission-goal-text { font-size: 14.5px; line-height: 1.45; color: #f0fdf4; font-weight: 700; }
.mission-tutorial-box {
  background: rgba(8, 15, 32, 0.9);
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  border-radius: 10px;
  padding: 11px 13px;
}
.mission-tutorial-body { font-size: 13.5px; line-height: 1.5; color: #e2e8f0; }
.mission-tutorial-body code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.14);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}
.mission-kai-coach {
  background: rgba(251, 191, 36, 0.14);
  border-left: 4px solid var(--accent-gold);
  border-radius: 8px;
  padding: 10px 12px;
}
.kai-coach-header { font-size: 11px; font-weight: 900; color: #fde047; margin-bottom: 4px; letter-spacing: 0.5px; }
.kai-coach-text { font-size: 13px; font-style: italic; font-weight: 600; color: #fef9c3; line-height: 1.42; }
