/*
 * Cockpit-mode overlay (P2).
 *
 * Stacks on top of #cockpit-screen via z-index. The cockpit hub stays in the
 * DOM underneath so the Back button + completion summary can dismiss the
 * overlay and the hub re-appears unchanged.
 *
 * Layout: single centred panel with header (back + title + timer), question
 * card, and either the completion summary or the L6+ placeholder card
 * substituted in place.
 */

#cockpit-mode-overlay.overlay.screen.cockpit-mode-overlay {
  background: rgba(2, 6, 23, 0.94);
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 90;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.cockpit-mode-panel {
  width: min(720px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  padding: 22px 26px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  color: #e2e8f0;
  font-family: 'Inter', system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Header
   ------------------------------------------------------------------ */
.cockpit-mode-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
}

.cockpit-mode-back-btn {
  background: rgba(148, 163, 184, 0.12);
  color: rgba(226, 232, 240, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.cockpit-mode-back-btn:hover {
  background: rgba(148, 163, 184, 0.22);
  color: #f8fafc;
}

.cockpit-mode-header-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cockpit-mode-title {
  margin: 0;
  font-family: 'Orbitron', 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f8fafc;
}
.cockpit-mode-pack-level {
  margin: 0;
  font-size: 12px;
  color: rgba(148, 163, 184, 0.85);
  letter-spacing: 0.02em;
}

.cockpit-mode-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cockpit-mode-progress {
  font-size: 12px;
  font-weight: 600;
  color: rgba(148, 163, 184, 0.95);
  letter-spacing: 0.02em;
}
.cockpit-mode-timer {
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 999px;
  padding: 4px 12px;
  font-family: 'Rajdhani', 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  min-width: 52px;
  text-align: center;
}
.cockpit-mode-timer--soft {
  background: rgba(251, 146, 60, 0.18);
  color: #fdba74;
  border-color: rgba(251, 146, 60, 0.45);
}

/* Question card
   ------------------------------------------------------------------ */
.cockpit-mode-question-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cockpit-mode-question-text {
  margin: 0;
  font-size: 17px;
  line-height: 1.45;
  color: #f1f5f9;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  padding: 16px 18px;
}

.cockpit-mode-choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 560px) {
  .cockpit-mode-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.cockpit-mode-choice-btn {
  text-align: left;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  color: #e2e8f0;
  font-family: inherit;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
}
.cockpit-mode-choice-btn:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.45);
  transform: translateY(-1px);
}
.cockpit-mode-choice-btn:disabled {
  cursor: default;
  opacity: 0.85;
}
.cockpit-mode-choice-btn--correct {
  background: rgba(34, 197, 94, 0.22) !important;
  border-color: rgba(34, 197, 94, 0.6) !important;
  color: #bbf7d0 !important;
}
.cockpit-mode-choice-btn--wrong {
  background: rgba(239, 68, 68, 0.18) !important;
  border-color: rgba(239, 68, 68, 0.55) !important;
  color: #fecaca !important;
}

/* Typed numeric input (P7.5l — Drill + Mini-Challenge)
   ------------------------------------------------------------------ */
.cockpit-mode-typed-input {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cockpit-mode-typed-input.hidden { display: none; }

.cockpit-mode-typed-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.95);
}

.cockpit-mode-typed-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.cockpit-mode-typed-field {
  flex: 1;
  min-width: 0;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  border-radius: 10px;
  color: #f1f5f9;
  font-family: 'Rajdhani', 'Inter', sans-serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  /* The input is type="search" (autofill-suppression hint to iCloud
     Keychain + Chrome). These rules hide the webkit-specific clear ×
     button and search-magnifier decoration so the field still looks
     like a plain text input. */
  -webkit-appearance: none;
  appearance: none;
}
.cockpit-mode-typed-field::-webkit-search-cancel-button,
.cockpit-mode-typed-field::-webkit-search-decoration,
.cockpit-mode-typed-field::-webkit-search-results-button,
.cockpit-mode-typed-field::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}
.cockpit-mode-typed-field:focus {
  border-color: rgba(56, 189, 248, 0.85);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}
.cockpit-mode-typed-field:disabled {
  cursor: default;
  opacity: 0.9;
}
.cockpit-mode-typed-field--correct {
  border-color: rgba(34, 197, 94, 0.7) !important;
  background: rgba(34, 197, 94, 0.12) !important;
  color: #bbf7d0 !important;
}
.cockpit-mode-typed-field--wrong {
  border-color: rgba(239, 68, 68, 0.7) !important;
  background: rgba(239, 68, 68, 0.10) !important;
  color: #fecaca !important;
}

.cockpit-mode-typed-submit {
  background: rgba(56, 189, 248, 0.22);
  color: #bae6fd;
  border: 1px solid rgba(56, 189, 248, 0.55);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0 18px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.cockpit-mode-typed-submit:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.32);
  border-color: rgba(56, 189, 248, 0.8);
}
.cockpit-mode-typed-submit:disabled {
  opacity: 0.55;
  cursor: default;
}

.cockpit-mode-typed-help {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgba(148, 163, 184, 0.75);
}

.cockpit-mode-hint-btn {
  align-self: flex-start;
  background: rgba(250, 204, 21, 0.16);
  color: #fde68a;
  border: 1px solid rgba(250, 204, 21, 0.4);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.cockpit-mode-hint-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.cockpit-mode-hint-text {
  margin: 0;
  font-size: 14px;
  color: #fde68a;
  background: rgba(250, 204, 21, 0.08);
  border-left: 3px solid rgba(250, 204, 21, 0.55);
  padding: 10px 14px;
  border-radius: 6px;
}

/* Explanation panel
   ------------------------------------------------------------------ */
.cockpit-mode-explanation {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cockpit-mode-explanation-outcome {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.cockpit-mode-explanation-outcome--correct,
.cockpit-mode-explanation-outcome--correctAfterHint {
  color: #86efac;
}
.cockpit-mode-explanation-outcome--wrong,
.cockpit-mode-explanation-outcome--timedOut {
  color: #fca5a5;
}
.cockpit-mode-explanation-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: #e2e8f0;
}

.cockpit-mode-next-btn {
  align-self: flex-end;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  color: #0f172a;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(56, 189, 248, 0.28);
}
.cockpit-mode-next-btn:hover {
  filter: brightness(1.05);
}

/* Completion summary
   ------------------------------------------------------------------ */
.cockpit-mode-summary {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  text-align: center;
  padding: 8px 0;
}
.cockpit-mode-summary-title {
  margin: 0;
  font-family: 'Orbitron', 'Inter', sans-serif;
  font-size: 22px;
  color: #f8fafc;
}
.cockpit-mode-summary-stats {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: #e2e8f0;
}
.cockpit-mode-summary-stats strong {
  color: #7dd3fc;
}
.cockpit-mode-summary-note {
  margin: 0;
  font-size: 13px;
  color: rgba(250, 204, 21, 0.9);
  background: rgba(250, 204, 21, 0.08);
  border: 1px solid rgba(250, 204, 21, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  max-width: 460px;
}
.cockpit-mode-summary-back {
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  color: #0f172a;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(56, 189, 248, 0.28);
}

/* Summary actions row (P7.5l) — wraps Done + Retry. */
.cockpit-mode-summary-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.cockpit-mode-summary-retry {
  background: rgba(56, 189, 248, 0.16);
  color: #bae6fd;
  border: 1px solid rgba(56, 189, 248, 0.55);
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 120ms ease;
}
.cockpit-mode-summary-retry:hover {
  background: rgba(56, 189, 248, 0.28);
}
.cockpit-mode-summary-retry.hidden { display: none; }

/* L6+ placeholder card
   ------------------------------------------------------------------ */
.cockpit-mode-placeholder {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  text-align: center;
  padding: 14px 0;
}
.cockpit-mode-placeholder-title {
  margin: 0;
  font-family: 'Orbitron', 'Inter', sans-serif;
  font-size: 20px;
  color: #fde68a;
}
.cockpit-mode-placeholder-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(226, 232, 240, 0.92);
  max-width: 500px;
}
.cockpit-mode-placeholder-back {
  background: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
