/* Shared trainer presentation. Domain data, signal art and grading stay untouched. */
body.trainer-page {
  --bg:var(--ui-bg,#0d151f);
  --panel:var(--ui-surface,#162331);
  --soft:var(--ui-surface-soft,#1b2b3b);
  --line:var(--ui-border,#304356);
  --line-soft:#293c4f;
  --text:var(--ui-text,#eef4fa);
  --muted:var(--ui-muted,#afc0d1);
  --amber:#ffca73;
  --accent-wash:#302c24;
  --accent-soft:#322e26;
  background:var(--bg);
  font:15px/1.5 var(--ui-font,system-ui,-apple-system,"Segoe UI",sans-serif);
  -webkit-font-smoothing:antialiased;
}
.trainer-page[data-trainer="signale"] {--amber:#9be3bc;--accent-wash:#1b342e;--accent-soft:#20372f}
.trainer-page[data-trainer="betrieb"] {--amber:#95d9fa;--accent-wash:#203448;--accent-soft:#223b4d}
.trainer-page[data-trainer="tempo"] {--amber:#d8bdf7;--accent-wash:#302b42;--accent-soft:#322c43}
.trainer-page[data-trainer="rangieren"] {--amber:#ffc49b;--accent-wash:#3b2c26;--accent-soft:#3d3028}
.trainer-page[data-trainer="bremsen"] {--amber:#f3b7c4;--accent-wash:#3f2c36;--accent-soft:#432f39}
.trainer-page[data-trainer="quiz"] {--amber:#98ddfa;--accent-wash:#203749;--accent-soft:#223a49}

.trainer-page .shell {max-width:1120px;padding-inline:max(clamp(16px,3.5vw,32px),env(safe-area-inset-left)) max(clamp(16px,3.5vw,32px),env(safe-area-inset-right))}
.trainer-page #app {margin-inline:auto;padding-bottom:16px}
.trainer-page #app[data-screen="quiz"] {max-width:840px}
.trainer-page #app:is([data-screen="result"],[data-screen="stats"],[data-screen="info"]) {max-width:880px}
.trainer-page #app[data-screen="guide"] {max-width:960px}
.trainer-page .nav {max-width:660px;margin:4px auto 20px;padding:4px;gap:4px;border-radius:var(--ui-radius,14px);background:#111e2b;border-color:var(--line-soft)}
.trainer-page .nav button {min-height:44px;padding:8px;font-size:13px;font-weight:650;color:var(--muted);border-radius:10px}
.trainer-page .nav button[aria-current] {background:#26374a;color:#f3f7fc;box-shadow:0 2px 5px #0002}
.trainer-page :is(.hub-link,.hero-quick,.text-button,.quiet,.exit) {min-height:44px}
.trainer-page button {touch-action:manipulation}
.trainer-page :is(button,select,input,textarea,summary):focus-visible {outline:2px solid var(--amber);outline-offset:3px}

#quiz-replace-dialog {
  box-sizing:border-box;
  width:min(420px,calc(100% - 32px));
  max-width:calc(100% - max(16px,env(safe-area-inset-left)) - max(16px,env(safe-area-inset-right)));
  max-height:calc(100% - max(16px,env(safe-area-inset-top)) - max(16px,env(safe-area-inset-bottom)));
  padding:clamp(18px,5vw,24px);
  overflow:auto;
  border:1px solid var(--line);
  border-radius:var(--ui-radius,14px);
  background:var(--panel);
  color:var(--text);
  box-shadow:0 16px 48px #0006;
}
#quiz-replace-dialog::backdrop {background:#050b12bd}
#quiz-replace-dialog h2 {margin:0;font-size:clamp(19px,5vw,23px);font-weight:720;line-height:1.25;letter-spacing:-.02em}
#quiz-replace-dialog p {margin:8px 0 0;color:var(--muted);font-size:14px;line-height:1.5}
.quiz-replace-actions {display:flex;flex-wrap:wrap;justify-content:flex-end;gap:10px;margin-top:20px}
.quiz-replace-actions button {flex:1 1 auto}

.trainer-page .hero {min-height:168px;padding:clamp(20px,2.8vw,28px);border:1px solid #3a4d60;border-radius:var(--ui-radius,14px);background:linear-gradient(115deg,var(--accent-wash),#152130 80%);box-shadow:none}
.trainer-page .hero .words {max-width:78%}
.trainer-page .hero h1 {font-size:clamp(28px,3.4vw,36px);font-weight:720;line-height:1.12;letter-spacing:-.035em;margin-top:8px}
.trainer-page .hero p {max-width:52ch;color:#c6d3e1;font-size:15px;line-height:1.5;margin-top:10px}
.trainer-page .hero .eyebrow,.trainer-page .hero-quick,.trainer-page .hero-stats b {color:var(--amber)}
.trainer-page .hero-quick {display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;margin-top:18px;padding:8px 12px;border:1px solid #64717d;border-radius:10px;background:#101a2644;font-size:13px;font-weight:700}
.trainer-page .hero-stats {font-size:13px;margin-top:12px;color:#c2d0df}
.trainer-page :is(.hero-rail,.hero-signal,.route-art) {opacity:.34;pointer-events:none}
.trainer-page .eyebrow {font:700 11px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace;letter-spacing:.095em;color:var(--amber)}
.trainer-page .page-title {padding:4px 0 12px}
.trainer-page .page-title h1 {font-size:clamp(27px,3.1vw,32px);font-weight:720;line-height:1.15;letter-spacing:-.035em;margin-top:5px}
.trainer-page .page-title p {font-size:14px;line-height:1.5;max-width:60ch;color:var(--muted);margin-top:7px}

.trainer-page .training-layout {margin-top:20px;display:grid;gap:20px}
.trainer-page .training-layout>.section,.trainer-page .training-settings>.section:first-child {margin-top:0}
.trainer-page .training-settings {padding:16px;border:1px solid var(--line-soft);border-radius:var(--ui-radius,14px);background:#13212e;align-self:start}
.trainer-page .training-settings .section {margin-top:20px}
.trainer-page .section-title {gap:12px;align-items:baseline;margin-bottom:12px}
.trainer-page .section-title h2 {font-size:18px;font-weight:690;letter-spacing:-.02em}
.trainer-page :is(.section-title>span,.small,.small-note) {color:var(--muted);font-size:13px;line-height:1.5}
.trainer-page :is(.topic-list,.study-topics) {gap:9px}
.trainer-page .topic {min-height:68px;padding:12px;gap:12px;border:1px solid var(--line-soft);border-radius:12px;background:var(--panel)}
.trainer-page .topic[aria-pressed="true"] {background:var(--accent-soft);border-color:var(--amber);box-shadow:inset 3px 0 var(--amber)}
.trainer-page .topic-copy strong {font-size:14px;line-height:1.35;font-weight:690}
.trainer-page .topic-copy small {font-size:12px;line-height:1.4;color:var(--muted);margin-top:4px}
.trainer-page .topic-icon {width:36px;height:36px;border-radius:10px}
.trainer-page .topic-count {font-size:12px;color:#cfdae6;font-variant-numeric:tabular-nums}
.trainer-page .chips {gap:8px}
.trainer-page .chip {min-height:44px;padding:9px 13px;border-radius:10px;border-color:var(--line);background:#172433;font-size:13px;line-height:1.4;font-weight:650;color:#d0dbe7}
.trainer-page .chip[aria-pressed="true"] {color:var(--amber);background:var(--accent-soft);border-color:var(--amber)}
.trainer-page .chip:disabled {opacity:.46}
.trainer-page .small-note,.trainer-page .mode-note {margin-top:9px}
.trainer-page .action-row {gap:10px;margin-top:14px}
.trainer-page :is(.action,.secondary) {min-height:44px;padding:10px 14px;border-radius:var(--ui-control-radius,10px);font-size:14px;line-height:1.4;font-weight:700;transition:background-color 140ms,border-color 140ms}
.trainer-page .action {background:var(--amber);border-color:var(--amber);color:#13212b}
.trainer-page .secondary {background:#192737;border-color:#405268;color:#e0e9f3}
.trainer-page .action:disabled {opacity:.48}
.trainer-page .resume {margin-top:16px;padding:12px 14px;border-radius:12px;border-color:var(--line);background:#172433;gap:16px}
.trainer-page .resume strong {font-size:14px;margin-bottom:3px}
.trainer-page .resume .secondary {min-height:44px;font-size:13px;padding:9px 13px}

.trainer-page .quiz-bar {margin-bottom:8px;min-height:44px}
.trainer-page .quiz-count {font-size:12px;letter-spacing:.025em;color:#cbd8e7;white-space:nowrap}
.trainer-page .exit {font-size:13px;color:#c2d0df}
.trainer-page progress {height:5px;background:#263649}
.trainer-page .quiz-heading {margin:20px 0 16px}
.trainer-page .quiz-heading h1 {font-size:clamp(22px,2.8vw,28px);line-height:1.3;letter-spacing:-.027em;font-weight:680;margin-top:9px;overflow-wrap:break-word;max-width:43ch}
.trainer-page .quiz-review-nav {margin:14px 0 8px}
.trainer-page .quiz-review-note {font-size:13px}
.trainer-page .options {gap:10px;margin-top:16px}
.trainer-page .option {min-height:60px;padding:12px 14px;gap:12px;border-radius:var(--ui-control-radius,10px);font-size:15px;line-height:1.45;background:#162332;border-color:#34465b;align-items:flex-start}
.trainer-page .option .letter {width:28px;height:28px;margin-top:0;border-radius:8px;background:#203246;border-color:#40566f;font-size:12px;color:#d5e2f0}
.trainer-page .option>span:last-child {padding-top:3px}
.trainer-page .option.ok {background:#1b392f;border-color:#6db28d;color:#ecfaf1}
.trainer-page .option.no {background:#382631;border-color:#c17b91;color:#ffedf2}
.trainer-page .option.dim {color:#9fadc0;background:#131e2b;border-color:#29394b}
.trainer-page :is(.field,.written-form) {margin-top:18px}
.trainer-page :is(.field,.written-form) label {display:block;color:#dce6f0;font-size:13px;font-weight:650;margin-bottom:7px}
.trainer-page :is(.written,.search-input,.select,.written-form textarea) {min-height:44px;border:1px solid #435972;background:#111c29;color:#f2f6fa;border-radius:10px;padding:11px 12px;font:400 16px/1.4 system-ui,-apple-system,"Segoe UI",sans-serif;max-width:100%}
.trainer-page :is(.written.long,.written-form textarea) {min-height:96px;resize:vertical}
.trainer-page .written-form textarea {display:block;width:100%}
.trainer-page :is(.written,.search-input,.written-form textarea)::placeholder {color:#9bafc3;opacity:1}
.trainer-page .feedback {margin-top:16px;padding:16px;border:1px solid #355148;border-left:3px solid #8fdfb7;border-radius:var(--ui-radius,14px);background:#142629}
.trainer-page .feedback.wrong {background:#261f2a;border-color:#674457;border-left-color:#ffadba}
.trainer-page .feedback strong {display:inline;color:inherit;font:inherit;margin:0}
.trainer-page .feedback>strong:first-child {display:block;color:#a9e7c4;font-size:13px;font-weight:750;line-height:1.45;margin-bottom:10px}
.trainer-page .feedback.wrong>strong:first-child {color:#ffc1cf}
.trainer-page .feedback p {font-size:15px;line-height:1.55}
.trainer-page .answer-main,.trainer-page .feedback .answer-main,.trainer-page .mistake .answer-main {margin:12px 0;padding:10px 12px;border:0;border-left:2px solid #7ec9a7;border-radius:0;background:#1b342e66;color:#f1faf5;font-size:16px;font-weight:650;line-height:1.5;overflow-wrap:anywhere}
.trainer-page .answer-main>span {display:block}
.trainer-page .answer-label {display:block;margin-bottom:5px;color:#b2dfc7;font-size:11px;font-weight:750;line-height:1.4;letter-spacing:.075em;text-transform:uppercase}
.trainer-page .answer-name {font-size:17px;line-height:1.45;font-weight:700;color:#e7f1f8;margin:0 0 10px}
.trainer-page .answer-name strong {font:inherit;color:inherit}
.trainer-page .answer-explanation {font-size:15px;line-height:1.6;color:#c7d4e2;margin-top:10px}
.trainer-page .answer-explanation+.answer-explanation {margin-top:8px}
.trainer-page :is(.feedback,.mistake) .typed-answer {font-size:14px;line-height:1.5;color:#b8c8d8;border-left:2px solid #4d637a;padding-left:12px;margin:12px 0;white-space:pre-wrap;overflow-wrap:anywhere}
.trainer-page .typed-answer b,.trainer-page .typed-answer strong {color:#dce8f3;font-weight:650}
.trainer-page .ref {font-size:12px;line-height:1.5;color:#afc2d4;margin-top:14px;padding-top:10px;border-top:1px solid #344859}
.trainer-page :is(.reveal-note,.written-note,.source-status) {font-size:13px;line-height:1.55;color:#bdcddd}
.trainer-page .source-status {margin-top:8px}

.trainer-page .study-filters {display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);gap:12px;margin:4px 0 16px;padding:14px;border:1px solid var(--line-soft);border-radius:13px;background:#131f2d;align-items:end}
.trainer-page .study-filters.filter-single {grid-template-columns:1fr;max-width:420px}
.trainer-page .filter-field {min-width:0}
.trainer-page .filter-field :is(label,.search-label,.small) {display:block;margin:0 0 6px;color:#c0cedd;font-size:12px;line-height:1.35;font-weight:650}
.trainer-page .filter-field :is(.select,.search-input) {margin:0;width:100%;min-width:0}
.trainer-page .flash {padding:20px;margin-top:0;border:1px solid var(--line);border-radius:var(--ui-radius,14px);background:var(--panel);box-shadow:none}
.trainer-page .card-top {display:flex;align-items:baseline;justify-content:space-between;gap:16px;margin-bottom:14px}
.trainer-page .card-top .small {font-size:12px;line-height:1.4;text-align:right;max-width:58%}
.trainer-page .flash h1 {font-size:clamp(21px,2.4vw,25px);font-weight:680;line-height:1.3;letter-spacing:-.025em;margin-top:0}
.trainer-page .flash>.eyebrow:first-child {margin-bottom:13px}
.trainer-page .card-question {font-size:15px;line-height:1.5;color:#d6e2ee;margin-top:12px}
.trainer-page .card-answer {margin-top:18px;padding:16px 0 0;border:0;border-top:1px solid #3c5064;border-radius:0;background:none}
.trainer-page .card-answer>.answer-main:first-child {margin-top:0}
.trainer-page .card-answer .answer-meaning {font-size:17px;font-weight:600;line-height:1.5;color:#f0f8f3}
.trainer-page .card-answer .small-note {color:#bdcddd;font-size:14px;line-height:1.55}
.trainer-page .flash-controls {display:grid;grid-template-columns:46px minmax(0,1fr) 46px;gap:10px;margin-top:18px}
.trainer-page .flash-controls .secondary {padding:6px;font-size:27px;line-height:1;font-weight:500}
.trainer-page .flash-controls .action {font-size:14px}
.trainer-page .deck-list {max-height:50vh;gap:8px;margin-top:16px}
.trainer-page .deck-item {min-height:52px;padding:11px 13px;border-radius:11px;border-color:#34495f;background:#162536;color:#c3d0df;font-size:13px;line-height:1.4}
.trainer-page .deck-item strong {color:var(--amber);font-size:14px;margin-bottom:3px}
.trainer-page .deck-item[aria-current] {border-color:var(--amber);background:var(--accent-soft)}

.trainer-page .signal-plate {margin:14px 0;padding:12px;border-radius:12px;background:#f1f4f4}
.trainer-page .plate-caption {font-size:10px;letter-spacing:.065em;color:#4a5964;margin:0 0 9px}
.trainer-page .plate-images {min-height:0;gap:8px}
.trainer-page .plate-images img {object-fit:contain;max-height:160px}
.trainer-page .plate-images.many img {max-height:140px;max-width:calc(50% - 5px)}
.trainer-page .flash .signal-plate {margin:14px 0;padding:10px}
.trainer-page .flash .plate-images img {max-height:147px}
.trainer-page .flash .plate-images.many img {max-height:130px}
.signal-presentation {display:grid;gap:8px;margin:14px 0}
.signal-presentation :is(.signal-rhythm,figure) {min-width:0;margin:0;padding:11px 12px;border:1px solid var(--ui-border,#304356);border-radius:var(--ui-control-radius,10px);background:var(--ui-surface,#162331)}
.signal-presentation strong {display:block;margin-bottom:4px;color:var(--ui-text,#eef4fa);font-size:13px;line-height:1.4}
.signal-presentation :is(p,figcaption span) {color:var(--ui-muted,#afc0d1);font-size:13px;line-height:1.5;overflow-wrap:anywhere}
.signal-instrument {display:block;margin-top:3px;color:var(--ui-muted,#afc0d1);font-size:12px}
.signal-rhythm-images {display:flex;flex-wrap:wrap;gap:6px;width:fit-content;max-width:100%;margin-top:8px;padding:5px 7px;border-radius:6px;background:#f4f6f6}
.signal-rhythm-images img {display:block;width:auto;height:25px;max-width:100%;object-fit:contain}
.signal-giving {padding-inline:2px}
.signal-form-grid {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%, 135px),1fr));gap:8px}
.signal-form-grid img {display:block;width:auto;height:auto;max-width:100%;max-height:92px;object-fit:contain;margin:8px auto 0;border-radius:4px}
.signal-explanation .ref {display:inline-block;margin-top:5px}
.trainer-page .signal-tag {font-size:18px;line-height:1.4;padding:10px 13px;margin:10px 0;background:var(--accent-soft);border-color:#456474;color:#c4eadb}
.trainer-page .context {font-size:13px;line-height:1.5;color:#bdcedd;margin:8px 0 12px}
.trainer-page .look {font-size:15px;line-height:1.55;padding:13px 14px;margin:12px 0;color:#d9e5ef}
.trainer-page .mark {padding:16px;border-color:#42566b;background:#1b2c3d;font-size:clamp(20px,3vw,25px);border-radius:12px;margin-bottom:16px}
.trainer-page .paper {padding:13px 10px;border-radius:12px;margin-bottom:16px;background:#f0f2ee}
.trainer-page .paper-label {font-size:10px;line-height:1.4;letter-spacing:.07em;margin-bottom:8px}
.trainer-page .paper table {font-size:clamp(12px,1.65vw,16px);line-height:1.3}
.trainer-page .paper th,.trainer-page .paper td {padding:6px 3px}
.trainer-page .paper-head {font-size:14px}
.trainer-page .paper-head h2 {font-size:21px;line-height:1.25}
.trainer-page .rail-frame {padding:13px 10px;margin:14px 0 18px;border-radius:12px}
.trainer-page .rail-title {font-size:10px;line-height:1.4;letter-spacing:.065em;color:#bdd2e2}
.trainer-page .rail-step strong {font-size:12px;line-height:1.3}
.trainer-page .rail-step small {font-size:11px;line-height:1.35;color:#bdcfde}

.trainer-page :is(.summary,.stat-card,.source-card) {padding:20px;border-radius:var(--ui-radius,14px);border-color:var(--line);background:var(--panel)}
.trainer-page .summary h1 {font-size:26px;font-weight:700;line-height:1.25;letter-spacing:-.03em}
.trainer-page .score {font:700 clamp(42px,5.5vw,56px)/1.15 var(--ui-font,system-ui,-apple-system,"Segoe UI",sans-serif);color:var(--amber);letter-spacing:-.045em;font-variant-numeric:tabular-nums;margin:12px 0}
.trainer-page .summary p {font-size:15px;line-height:1.5;color:#bdcddd}
.trainer-page .metric-grid {gap:12px;margin-top:14px}
.trainer-page .metric {padding:16px 12px;border-radius:12px;background:#172636;border-color:var(--line-soft)}
.trainer-page .metric strong {font-size:26px;font-weight:700;line-height:1.2;color:var(--amber);font-variant-numeric:tabular-nums}
.trainer-page .metric span {font-size:12px;color:#bdcddd;display:block;margin-top:5px}
.trainer-page .stat-line {gap:16px;font-size:14px;line-height:1.4;margin-bottom:9px}
.trainer-page .stat-line span {font-size:13px;white-space:nowrap;color:var(--muted)}
.trainer-page .stat-card progress+.stat-line {margin-top:20px}
.trainer-page .mistake {margin-top:10px;padding:0 16px;border-radius:12px;background:#162332;border-color:#34485e}
.trainer-page .mistake summary {min-height:48px;display:list-item;align-content:center;padding:13px 0;font-size:15px;line-height:1.45;font-weight:650;cursor:pointer}
.trainer-page .mistake[open] {padding-bottom:16px}
.trainer-page .mistake p {font-size:14px;line-height:1.6;margin-top:10px}
.trainer-page .source-card p {font-size:15px;line-height:1.65;color:#c7d4e2}
.trainer-page .source-card h2 {font-size:19px;line-height:1.4;margin-bottom:12px}
.trainer-page .source-card p+p {margin-top:14px}
.trainer-page .rule-row {border-radius:13px;margin-bottom:10px;border-color:var(--line-soft)}
.trainer-page .rule-row summary {min-height:64px;padding:13px 14px;gap:6px 16px}
.trainer-page .rule-name {font-size:15px;line-height:1.4}
.trainer-page .rule-value {color:var(--amber);font-size:14px;line-height:1.4;max-width:21ch}
.trainer-page .rule-row small {font-size:12px;line-height:1.45;color:var(--muted)}
.trainer-page .rule-detail {padding:0 16px 18px;font-size:15px;line-height:1.6}

.trainer-page[data-trainer="quiz"] .hero .words {max-width:100%}
.trainer-page[data-trainer="quiz"] .selection-tools {margin:24px 0 14px}
.trainer-page[data-trainer="quiz"] .selection-tools h2 {font-size:19px;letter-spacing:-.02em}
.trainer-page[data-trainer="quiz"] .trainer-section {border-radius:var(--ui-radius,14px);background:var(--panel);border-color:var(--line)}
.trainer-page[data-trainer="quiz"] .trainer-section summary {min-height:56px;padding:14px;font-size:16px;line-height:1.35}
.trainer-page[data-trainer="quiz"] .trainer-section summary small {font-size:12px;color:#bac9d8}
.trainer-page[data-trainer="quiz"] .topic-options {padding:0 12px 8px}
.trainer-page[data-trainer="quiz"] .topic-check {min-height:64px;padding:10px 8px}
.trainer-page[data-trainer="quiz"] .topic-check strong {font-size:14px;line-height:1.4}
.trainer-page[data-trainer="quiz"] .topic-check small {font-size:12px;line-height:1.45;color:#b8c8d8}
.trainer-page[data-trainer="quiz"] .setup {padding:16px;border:1px solid var(--line-soft);border-radius:var(--ui-radius,14px);background:#13212e;margin:14px 0 0}
.trainer-page[data-trainer="quiz"] .setup-section h2 {font-size:17px;margin-bottom:12px}
.trainer-page[data-trainer="quiz"] .selection-summary {padding:12px 0 calc(12px + env(safe-area-inset-bottom));margin-top:16px;border-color:var(--line);background:#0d151ff5}
.trainer-page[data-trainer="quiz"] .selection-summary p {font-size:13px;line-height:1.5;color:#c2d2e2}
.trainer-page footer {font-size:12px;color:#aabdd0;margin-top:18px;padding-block:10px 24px;line-height:1.5}
.trainer-page footer button {min-height:44px;font-size:12px}

@media (hover:hover) {
  .trainer-page .secondary:hover,.trainer-page .chip:not([aria-pressed="true"]):hover,.trainer-page .topic:not([aria-pressed="true"]):hover,.trainer-page .option:not(:disabled):hover {background:#22364a;border-color:#647e98}
  .trainer-page .action:not(:disabled):hover {filter:brightness(1.06)}
  .trainer-page .hero-quick:hover {background:#263c4b66;border-color:var(--amber)}
}
@media (min-width:760px) {
  .trainer-page .options {grid-template-columns:repeat(2,minmax(0,1fr))}
  .trainer-page .option {min-height:72px}
  .trainer-page .rail-step strong {font-size:14px}
}
@media (min-width:960px) {
  .trainer-page .training-layout {grid-template-columns:minmax(0,1.35fr) minmax(320px,.9fr);gap:24px;align-items:start}
  .trainer-page[data-trainer="signale"] .training-layout {grid-template-columns:1fr}
  .trainer-page[data-trainer="signale"] .training-settings {display:grid;grid-template-columns:1fr 1fr 1fr;gap:24px}
  .trainer-page[data-trainer="signale"] .training-settings .section {margin:0}
  .trainer-page[data-trainer="signale"] .category-field .select {max-width:460px}
  .trainer-page #app[data-screen="cards"] {display:grid;grid-template-columns:240px minmax(0,1fr);gap:20px 24px}
  .trainer-page #app[data-screen="cards"]>.page-title {grid-column:1/-1;padding-bottom:0}
  .trainer-page #app[data-screen="cards"]>.study-filters {grid-column:1;grid-template-columns:1fr;margin:0;gap:18px;align-self:start}
  .trainer-page #app[data-screen="cards"]>:is(#card-area,#fahrplan-card-area,.flash) {grid-column:2;margin:0}
  .trainer-page[data-trainer="quiz"] #app[data-screen="home"] {display:grid;grid-template-columns:1fr 1fr;gap:16px;align-items:start}
  .trainer-page[data-trainer="quiz"] #app[data-screen="home"]>:is(.hero,.resume,.selection-tools,.setup,.selection-summary) {grid-column:1/-1}
  .trainer-page[data-trainer="quiz"] .trainer-section {margin:0}
  .trainer-page[data-trainer="quiz"] .topic-options {display:block}
}
@media (max-width:600px) {
  .trainer-page .nav {margin-bottom:18px}
  .trainer-page .nav button {padding-inline:4px;font-size:12px}
  .trainer-page .hero {min-height:152px;padding:20px 18px;border-radius:var(--ui-radius,14px)}
  .trainer-page .hero .words {max-width:88%}
  .trainer-page .hero h1 {font-size:28px}
  .trainer-page .hero p {font-size:14px;line-height:1.5}
  .trainer-page .hero-quick {margin-top:14px}
  .trainer-page .training-layout {gap:18px;margin-top:20px}
  .trainer-page .training-settings {padding:16px;border-radius:14px}
  .trainer-page .topic {min-height:68px;padding:12px;gap:10px}
  .trainer-page .topic-copy small {font-size:12px}
  .trainer-page .page-title {padding-top:0;padding-bottom:10px}
  .trainer-page .page-title h1 {font-size:27px}
  .trainer-page .page-title p {font-size:13px;margin-top:6px}
  .trainer-page #app[data-screen="cards"] .page-title p {max-width:none}
  .trainer-page .study-filters {grid-template-columns:1fr;padding:11px;gap:10px;margin:0 0 12px}
  .trainer-page .filter-field :is(.select,.search-input) {font-size:16px;padding:10px;min-height:44px}
  .trainer-page .flash {padding:16px;border-radius:14px}
  .trainer-page .card-top {margin-bottom:11px;gap:10px}
  .trainer-page .card-top .small {font-size:12px;line-height:1.35}
  .trainer-page .flash h1 {font-size:21px;line-height:1.3}
  .trainer-page .card-question {font-size:15px;line-height:1.5;margin-top:10px}
  .trainer-page .flash .signal-plate {padding:8px;margin:12px 0}
  .trainer-page .flash .plate-caption {margin-bottom:6px}
  .trainer-page .flash-controls {gap:8px;margin-top:14px;grid-template-columns:44px minmax(0,1fr) 44px}
  .trainer-page .flash-controls :is(.action,.secondary) {min-height:44px}
  .trainer-page .quiz-heading {margin:18px 0 16px}
  .trainer-page .quiz-heading h1 {font-size:22px;line-height:1.35}
  .trainer-page .option {padding:12px;font-size:15px;gap:10px;min-height:60px}
  .trainer-page .feedback {padding:16px;margin-top:16px}
  .trainer-page .answer-main,.trainer-page .feedback .answer-main,.trainer-page .mistake .answer-main {padding:12px;font-size:16px;line-height:1.5}
  .trainer-page .answer-explanation {font-size:14px;line-height:1.6}
  .trainer-page .paper {padding:10px 7px}
  .trainer-page .paper th,.trainer-page .paper td {padding:4px 2px}
  .trainer-page .rail-frame {padding:11px 7px}
  .trainer-page :is(.summary,.stat-card,.source-card) {padding:16px}
  .trainer-page .metric-grid {gap:8px}
  .trainer-page .metric {padding:14px 8px}
  .trainer-page .metric strong {font-size:24px}
  .trainer-page .metric span {font-size:12px}
  .trainer-page .rule-row summary {padding:13px 14px}
  .trainer-page .rule-value {max-width:15ch}
  .trainer-page[data-trainer="quiz"] .trainer-section summary {padding:14px;font-size:16px}
  .trainer-page[data-trainer="quiz"] .trainer-section summary small {font-size:12px}
  .trainer-page[data-trainer="quiz"] .setup {padding:16px}
}
@media (max-width:359px) {
  .trainer-page .shell {padding-inline:max(12px,env(safe-area-inset-left)) max(12px,env(safe-area-inset-right))}
  .trainer-page .hero .words {max-width:100%}
  .trainer-page .hero h1 {font-size:27px}
  .trainer-page .hero :is(.hero-rail,.hero-signal,.route-art) {opacity:.13}
  .trainer-page .study-filters {gap:8px;padding:10px}
  .trainer-page .filter-field label {font-size:11px}
  .trainer-page .flash {padding:13px}
  .trainer-page .flash-controls .action {padding-inline:8px;font-size:13px}
  .trainer-page .quiz-count {font-size:11px}
}
@media (prefers-reduced-motion:reduce) {
  .trainer-page :is(.action,.secondary) {transition:none}
}

/* Keep every navigation label inside its control on narrow phones. */
@media(max-width:600px){
 .trainer-page[data-trainer="tempo"] .nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px}
}
@media(max-width:359px){
 .bahn-app.trainer-page:is([data-trainer="rangieren"],[data-trainer="bremsen"]) .nav button{font-size:11px}
}

.trainer-page .topic-icon .ui-icon { width: 28px; height: 28px; }
.trainer-page .topic-icon { flex: 0 0 38px; width: 38px; height: 38px; }
.trainer-page .nav button > .ui-icon { width: 17px; height: 17px; margin-inline-end: .42em; }
.trainer-page .hero .hero-artwork {
  position: absolute;
  right: clamp(8px, 3%, 32px);
  top: 50%;
  transform: translateY(-50%);
  width: clamp(100px, 27%, 188px);
  height: auto;
  aspect-ratio: 160 / 130;
  color: var(--amber);
  opacity: .77;
  pointer-events: none;
}
.trainer-page .hero:has(.hero-artwork) .words { max-width: 70%; }
@media (max-width: 540px) {
  .trainer-page .nav button > .ui-icon { display: block; margin: 0 auto 3px; }
  .trainer-page .hero .hero-artwork { right: 4px; width: 26%; opacity: .65; }
}

.trainer-page[data-trainer="betrieb"] .study-topics :is([data-value="zugvorbereitung"],[data-value="wagenliste"],[data-value="arbeitsunterbrechung"]) .topic-icon {
  background: #303647; color: #d0d8ff;
}
.trainer-page[data-trainer="betrieb"] .study-topics :is([data-value="nachschieben"],[data-value="geschobene"],[data-value="zuruecksetzen"],[data-value="fahrtwechsel"]) .topic-icon {
  background: #243d40; color: #a6dfdb;
}
.trainer-page[data-trainer="betrieb"] .study-topics :is([data-value="technische-stoerungen"],[data-value="fehlleitung"],[data-value="gefahr-nothalt"],[data-value="vorbeifahrt-pzb"],[data-value="fahrzeugschaeden"],[data-value="oberleitung-brand"],[data-value="notbremsueberbrueckung"]) .topic-icon {
  background: #42362e; color: #f4cf9e;
}
