/* Additions to app.css and academy.css (Academy's stylesheets, unchanged), for what the assessment needs and they do not have. */
:root {
  --surface-solid: #0f3150; /* where content scrolls underneath: sticky bars */
  --line: rgba(76, 201, 255, 0.15);
  --line-strong: rgba(76, 201, 255, 0.25);
  --row-line: rgba(255, 255, 255, 0.07);
  --ok-soft: rgba(61, 220, 151, 0.12);
  --warn-soft: rgba(255, 193, 7, 0.12);
  --danger-soft: rgba(255, 80, 80, 0.12);
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  /* Names the exercises use */
  --green: var(--ok);
  --bad: var(--danger);
  --console: #0c2238;
  --console-line: #24506f;
  --console-ink: #d7eaf5;
  --console-dim: #86a9c0;
}

[hidden] { display: none !important; }
p { margin: 0 0 0.75rem; }
.stack { display: grid; gap: 14px; }
.stack > * { min-width: 0; margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lbl { display: block; margin-bottom: 4px; color: var(--text-faint); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.small { font-size: 0.85rem; }
.flush { padding: 0; }
.mono-text { font-family: var(--mono); font-size: 0.82rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
button.link { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.alert.warn { background: rgba(255, 193, 7, 0.12); border: 1px solid rgba(255, 193, 7, 0.35); color: var(--warn); }
.alert:last-child { margin-bottom: 0; }
.stack > .alert { margin-bottom: 0; }

/* A panel has its own stacking context (backdrop-filter), so an open Select has to lift the whole panel over the next one */
.panel:has(.select.open) { position: relative; z-index: 40; }

/* Fields outside .form-field: notes on the stage, inputs in the exercises */
.stage textarea, .stage input[type='text'], .stage input[type='number'], .stage input:not([type]), .stage select {
  width: 100%; min-height: 40px; padding: 0.45rem 0.7rem;
  border: 1px solid rgba(76, 201, 255, 0.25); border-radius: 8px;
  background: rgba(0, 0, 0, 0.3); color: #fff;
  font: inherit; color-scheme: dark;
}
.stage textarea { display: block; resize: vertical; }
.stage select option { background: #0c2238; }
.stage input:focus, .stage select:focus, .stage textarea:focus { border-color: rgba(76, 201, 255, 0.6); outline: none; }
input[type='radio'], input[type='checkbox'], input[type='range'] { accent-color: var(--accent); }

/* One question: written, questionnaire and the exercises */
.q { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.q > * { margin: 0; }
.q .qt { font-weight: 600; }
.opt { display: flex; align-items: flex-start; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.opt:hover { border-color: var(--line-strong); }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--danger); background: var(--danger-soft); }
.opt input { flex-shrink: 0; margin-top: 4px; }

.score { font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.score.pass { color: var(--ok); }
.score.fail { color: var(--danger); }

/* Assessment layout: the component list beside the stage */
.course { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 18px; align-items: start; }
.course > * { min-width: 0; }
.panel.stage { padding: 1.25rem; font-size: 0.95rem; }
.stage h3 { color: var(--text); font-size: 1.05rem; }

/* ---------- the simulator exercises (the programme's own class names) ---------- */
.sim-stage h2 { margin: 0 0 8px; font-size: 1.3rem; }
.sim-stage h3 { margin: 8px 0; font-size: 1rem; }
.sim-stage p { margin: 0 0 10px; }
.sim-stage select { width: auto; max-width: 100%; }
.sim-stage input[type='text'], .sim-stage input[type='number'] { width: auto; max-width: 100%; }
.sim-stage input[type='range'] { width: 100%; }
.sim-stage ul, .sim-stage ol { margin: 0; padding-left: 1.25rem; }
.sim-stage table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.sim-stage th, .sim-stage td { padding: 8px 10px; border-bottom: 1px solid var(--row-line); text-align: left; vertical-align: top; }
.sim-stage thead th { color: var(--text-faint); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.sim-stage td.num, .sim-stage th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sim-stage .btn { min-height: 40px; padding: 9px 14px; font-size: 0.92rem; }
.sim-stage .tbl { overflow-x: auto; }
/* Plain buttons are already tinted, so a selected control in an exercise (rudder, telegraph, valve) has to stand out more */
.btn.sel, .btn.sel:hover:not(:disabled) { background: rgba(76, 201, 255, 0.34); border-color: var(--accent); color: #fff; box-shadow: inset 0 0 0 1px var(--accent); }
.note { margin: 0; padding: 0.7rem 0.9rem; border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: 0 8px 8px 0; background: var(--well); font-size: 0.92rem; }
.note.ok { border-left-color: var(--ok); background: var(--ok-soft); }
.note.bad { border-left-color: var(--danger); background: var(--danger-soft); }
.note.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.sim-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.console { padding: 10px; border: 1px solid var(--console-line); border-radius: 12px; background: var(--console); color: var(--console-ink); }
.cv { display: block; width: 100%; height: auto; border-radius: 8px; background: var(--console); }
/* .panel means something else to the exercises: their right-hand column */
.sim-stage .panel { display: grid; gap: 12px; min-width: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; backdrop-filter: none; }
.readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.ro { padding: 8px 10px; border: 1px solid var(--console-line); border-radius: 8px; background: var(--console); color: var(--console-ink); }
.ro .lbl { margin: 0 !important; color: var(--console-dim) !important; }
.ro b { color: var(--accent); font: 600 17px/1.3 var(--mono); font-variant-numeric: tabular-nums; }
.order { padding: 12px 14px; border: 1px solid var(--console-line); border-radius: 8px; background: var(--console); color: var(--accent); font: 600 20px/1.3 var(--mono); }
.log { max-height: 180px; margin: 0; padding: 8px 10px; overflow: auto; border-radius: 8px; background: var(--well); font: 12.5px/1.5 var(--mono); list-style: none; }
.log li { padding: 2px 0; border-bottom: 1px dashed var(--line); }
.arpa td { font-family: var(--mono); font-size: 12.5px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.tile { padding: 10px; border: 1px solid var(--console-line); border-radius: 9px; background: var(--console); color: var(--console-ink); }
.tile .n { color: var(--console-dim); font-size: 12px; }
.tile .v { color: var(--ok); font: 600 19px/1.3 var(--mono); }
.tile .r { color: var(--console-dim); font-size: 11.5px; }
.tile.high .v { color: var(--warn); }
.tile.alarm { border-color: #c84a4a; }
.tile.alarm .v { color: #ff7a7a; animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.45; } }
.alarmbar { padding: 9px 12px; border: 1px solid #c84a4a; border-radius: 8px; background: #3a1416; color: #ffb3b3; font: 600 14px/1.4 var(--mono); }
.seq { display: grid; gap: 6px; }
.seq button { text-align: left; }
.tanks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tank { display: grid; gap: 6px; padding: 8px; border: 1px solid var(--console-line); border-radius: 9px; background: var(--console); color: var(--console-ink); }
.tank .glass { position: relative; height: 150px; overflow: hidden; border: 1px solid var(--console-line); border-radius: 4px; background: #091218; }
.tank .fill { position: absolute; left: 0; right: 0; bottom: 0; background: #a8782f; }
.tank .mark { position: absolute; left: 0; right: 0; padding-right: 3px; border-top: 1px dashed var(--warn); color: var(--warn); font: 10px var(--mono); text-align: right; }
.tank .pct { color: var(--warn); font: 600 16px var(--mono); text-align: center; }

@media (max-width: 900px) {
  .course, .sim-grid { grid-template-columns: minmax(0, 1fr); }
  .tanks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* The result sheet goes to paper */
@media print {
  :root {
    --surface: #fff; --surface-solid: #fff; --well: #fff; --text: #000; --text-muted: #333; --text-faint: #555;
    --accent: #000; --line: #bbb; --line-strong: #888; --row-line: #bbb; --accent-line: #888; --shadow: none;
    --ok: #0b6b45; --danger: #a01818; --ok-soft: #fff; --danger-soft: #fff; --warn-soft: #fff;
  }
  body { background-image: none; }
  .no-print { display: none !important; }
  .panel { padding: 0; border: 0; box-shadow: none; background: none; backdrop-filter: none; }
  .course { display: block; }
  .page { padding: 0; }
  table.data th, table.data td { border-bottom-color: #bbb; }
  tr { break-inside: avoid; }
}
