/* assets/css/app.css – qMem
   Design wie qCircle/qBingo: Nunito, dieselben Grundfarben, Kopfzeile in --ink.
   Keine Inline-Styles (CSP style-src 'self'): alles, was sich ändert, hängt
   an Klassen oder data-Attributen. */

@font-face {
  font-family: 'Nunito';
  src: local('Nunito'), url('/assets/fonts/nunito.woff2') format('woff2');
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --ink: #14213d;
  --bg: #f4f6fb;
  --card: #fff;
  --line: #dde2ec;
  --muted: #667085;
  --accent: #f59e0b;
  --brand: #0f766e;
  --ok: #059669;
  --err: #dc2626;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

a { color: inherit; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; background: #eef1f6; padding: 1px 5px; border-radius: 5px; }

/* ---------- Kopfzeile ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 20px; background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-name { font-weight: 900; font-size: 20px; letter-spacing: .3px; }
.topbar-right { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 14px; align-items: center; font-size: 14px; }
.tb-role { background: rgba(255,255,255,.15); padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.tb-link { color: #fff; opacity: .8; }
.tb-link:hover { opacity: 1; }

/* ---------- Grundgerüst ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 32px 16px 64px; }
h1 { font-size: 34px; line-height: 1.15; margin: 0 0 12px; }
h2 { font-size: 20px; margin: 0 0 8px; }
h3 { font-size: 16px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.lead { font-size: 19px; color: #3a4660; max-width: 38em; }
.hint { color: var(--muted); font-size: 15px; margin-top: 0; }
.hint.block, .block { display: block; }
.note { border-left: 4px solid var(--accent); background: #fffbeb; padding: 10px 14px; border-radius: 0 10px 10px 0; max-width: 46em; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; margin-top: 28px;
}
.flash { padding: 12px 16px; border-radius: 10px; margin-top: 20px; border: 1px solid var(--line); }
.flash.error { border-color: var(--err); background: #fef2f2; }
.flash.ok { border-color: var(--ok); background: #ecfdf5; }

/* ---------- Knöpfe ----------
   Höhe über Polsterung, NICHT über inline-flex: sonst werden die Textstücke
   eines Knopfes zu Flex-Elementen und die Zwischenräume verschwinden. */
.btn {
  display: inline-block; padding: 11px 18px; min-height: 44px; border-radius: 10px;
  text-decoration: none; font: inherit; font-weight: 700; border: 2px solid var(--ink);
  background: transparent; color: var(--ink); cursor: pointer;
  margin: 0 8px 8px 0;
}
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { filter: brightness(1.25); }
.btn.small { font-size: 15px; padding: 9px 14px; border-width: 1px; border-color: var(--line); }

/* ---------- Startseite ---------- */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 14px 0 18px; }
.pair figure, .shots figure { margin: 0; }
.pair img, .shots img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
@media (max-width: 760px) {
  .pair { grid-template-columns: 1fr; }
  h1 { font-size: 28px; }
}

/* ---------- Bildvorschau ---------- */
.preview-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.preview-layout .card { margin-top: 12px; }
.preview-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 700; }
.preview-form textarea {
  width: 100%; font: 15px/1.5 ui-monospace, Consolas, monospace; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; resize: vertical; margin: 4px 0 12px;
}
.preview-form select { font: inherit; font-size: 15px; padding: 9px 10px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.preview-form .row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.syntax dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 8px 0 12px; font-size: 15px; }
.syntax dt { font-weight: 700; white-space: nowrap; }
.syntax dd { margin: 0; color: #3a4660; }
.errors { color: var(--err); margin: 6px 0 0; }

table.fit { border-collapse: collapse; width: 100%; margin-top: 12px; font-size: 15px; }
table.fit th, table.fit td { text-align: left; vertical-align: top; padding: 10px 12px; border-top: 1px solid var(--line); }
table.fit thead th { border-top: 0; color: var(--muted); font-size: 13px; }
table.fit td.yes { color: var(--ok); font-weight: 700; }
table.fit td.part { color: #b45309; font-weight: 700; }
table.fit td.no { color: var(--err); font-weight: 700; }
table.fit .hint { font-weight: 400; font-size: 13px; }

.shots-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.shots { display: grid; gap: 16px; }
.shots.quer { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.shots.hoch { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); align-items: start; }
.shots figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }

@media (max-width: 900px) {
  .preview-layout { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  table.fit { display: block; overflow-x: auto; }
}

/* ---------- Prüfseite ---------- */
.ok { color: #067647; }
.bad { color: #b42318; font-weight: 700; }
.probe { margin: 10px 0 20px; }
.probe img { max-width: 100%; height: auto; border: 1px solid var(--line); }
.probe figcaption { font-size: 14px; color: var(--muted); }

/* ---------- Fuß, Impressum ---------- */
.foot { text-align: center; padding: 8px 16px 32px; font-size: 14px; color: var(--muted); }
.foot a { color: var(--muted); }
.rechtstext { max-width: 760px; }
.rechtstext h2 { margin-top: 22px; }

/* ---------- Verwaltung: Listen und Formulare (Bauschritt 2) ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.page-head h1 { margin: 0; }
.crumbs { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.narrow { max-width: 520px; }

.filter { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 18px 0 8px; }
.filter label, .field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 700; }
.field { margin: 0 0 16px; border: 0; padding: 0; min-width: 0; }
.field legend { padding: 0; margin-bottom: 6px; }
.field .hint { font-weight: 400; }
.filter select, .filter input, .field input[type="text"], .field input[type="number"], .field input[type="search"],
.field select, .field textarea {
  font: inherit; font-size: 16px; font-weight: 400; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; min-height: 44px;
}
.field textarea { width: 100%; resize: vertical; line-height: 1.5; }
.text-form textarea[name="body"] { font: 15px/1.5 ui-monospace, Consolas, monospace; }
.field input[type="text"] { width: 100%; }
fieldset.field input[type="text"] { margin-bottom: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 0 16px; }
.row > .field { flex: 1 1 140px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; }

.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); font-size: 15px; min-height: 36px; }
.check input { width: 20px; height: 20px; }

/* Auswahlkarten: Radio versteckt, nur input:checked + span gestaltet (Lehre aus qBingo) */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: block; border: 2px solid var(--line); border-radius: 10px; padding: 9px 12px; min-height: 44px;
  color: var(--ink); font-weight: 400; cursor: pointer;
}
.choice small { display: block; color: var(--muted); font-size: 12px; }
.choice input:checked + span { border-color: var(--brand); background: #ecfdf5; }
.choice input:focus-visible + span { outline: 3px solid var(--accent); }

.table-wrap { overflow-x: auto; margin-top: 12px; }
table.list { border-collapse: collapse; width: 100%; background: var(--card); border: 1px solid var(--line); font-size: 15px; }
table.list th, table.list td { text-align: left; vertical-align: top; padding: 10px 12px; border-top: 1px solid var(--line); }
table.list thead th { border-top: 0; color: var(--muted); font-size: 13px; }
table.list tr.st-retired td { opacity: .55; }
.tag { display: inline-block; font-size: 12px; background: #eef1f6; color: #3a4660; border-radius: 999px; padding: 0 8px; margin-left: 4px; }
.status { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 10px; }
.status.active { background: #dcfce7; color: #166534; }
.status.draft { background: #fef3c7; color: #92400e; }
.status.retired { background: #e5e7eb; color: #4b5563; }
.fitcell span { font-size: 12px; font-weight: 700; margin-right: 6px; }
.yes { color: var(--ok); }
.no { color: var(--err); }

.text-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.text-layout > .card, .text-layout > div > .card:first-child, .text-layout > aside > .card:first-child { margin-top: 16px; }
.body-view { white-space: pre-wrap; font: 14px/1.5 ui-monospace, Consolas, monospace; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 520px; overflow: auto; margin: 0; }
.fitline { font-size: 15px; }
.mini-shots { display: grid; grid-template-columns: 1fr; gap: 8px; }
.mini-shots a.hoch { max-width: 60%; }
.mini-shots img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; }
.inline-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; margin: 0; }
.inline-buttons .btn[disabled] { opacity: .45; cursor: not-allowed; }

.qlist { padding-left: 22px; }
.qlist li { margin-bottom: 10px; }
.qlist li.st-retired { opacity: .55; }
.danger-zone { border-color: #fecaca; }
.danger-zone form + form { margin-top: 10px; }
.btn.danger { border-color: var(--err); color: var(--err); }
.btn.danger[disabled] { opacity: .45; cursor: not-allowed; }
.btn.big { font-size: 19px; padding: 13px 26px; }

@media (max-width: 900px) {
  .text-layout { grid-template-columns: 1fr; }
}

/* ---------- Probedurchgang ---------- */
.probe-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.probe-head form { margin: 0; }
.reading { margin-top: 12px; text-align: center; }
.reading .textbild, .solution-layout .textbild {
  display: block; width: 100%; height: auto; margin: 12px auto; background: #fff;
  border: 1px solid var(--line); border-radius: 8px;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.reading.hoch .textbild { max-width: 560px; }
/* Querformat (Beamer, PC) immer ganz im Fenster – beim Lesen soll niemand scrollen müssen */
.reading.quer .textbild { width: auto; max-width: 100%; max-height: calc(100vh - 170px); }
.timebar { position: relative; height: 28px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.timebar-fill { height: 100%; width: 100%; background: var(--brand); transition: width .2s linear; }
.timebar.is-low .timebar-fill { background: var(--accent); }
.timebar-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; color: var(--ink); }
/* Breite in 5-%-Schritten über Klassen (CSP style-src 'self', siehe seite.js) */
.timebar-fill.w0 { width: 0; } .timebar-fill.w5 { width: 5%; } .timebar-fill.w10 { width: 10%; }
.timebar-fill.w15 { width: 15%; } .timebar-fill.w20 { width: 20%; } .timebar-fill.w25 { width: 25%; }
.timebar-fill.w30 { width: 30%; } .timebar-fill.w35 { width: 35%; } .timebar-fill.w40 { width: 40%; }
.timebar-fill.w45 { width: 45%; } .timebar-fill.w50 { width: 50%; } .timebar-fill.w55 { width: 55%; }
.timebar-fill.w60 { width: 60%; } .timebar-fill.w65 { width: 65%; } .timebar-fill.w70 { width: 70%; }
.timebar-fill.w75 { width: 75%; } .timebar-fill.w80 { width: 80%; } .timebar-fill.w85 { width: 85%; }
.timebar-fill.w90 { width: 90%; } .timebar-fill.w95 { width: 95%; } .timebar-fill.w100 { width: 100%; }

.question .prompt { font-size: 24px; line-height: 1.3; margin: 4px 0 16px; }
.options { display: grid; gap: 8px; margin-bottom: 14px; }
.option { position: relative; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option span { display: block; border: 2px solid var(--line); border-radius: 12px; padding: 12px 16px; min-height: 48px; cursor: pointer; font-size: 18px; }
.option input:checked + span { border-color: var(--brand); background: #ecfdf5; }
.option input:focus-visible + span { outline: 3px solid var(--accent); }
.answer-form textarea, .answer-line input {
  font: inherit; font-size: 18px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 48px;
}
.answer-form textarea { width: 100%; margin-bottom: 12px; }
.answer-line { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.answer-line input { flex: 1 1 auto; min-width: 0; max-width: 360px; }
.unit { font-weight: 700; }
.your-answer, .model-answer { border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; }
.your-answer { background: #f8fafc; border: 1px solid var(--line); }
.model-answer { background: #ecfdf5; border: 1px solid #a7f3d0; }
.your-answer p, .model-answer p { margin: 4px 0 0; }

.solution-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 12px; }
.solution-layout.hoch { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
.solution-layout .textbild { margin: 0; }
.results { margin: 0; padding-left: 22px; }
.results li { margin-bottom: 12px; padding: 8px 10px; border-radius: 8px; border-left: 4px solid var(--line); background: var(--card); }
.results li.right, .results li.self-yes { border-left-color: var(--ok); }
.results li.wrong, .results li.self-no { border-left-color: var(--err); }
.results li.self-partly { border-left-color: var(--accent); }
@media (max-width: 760px) {
  .solution-layout, .solution-layout.hoch { grid-template-columns: 1fr; }
  .question .prompt { font-size: 20px; }
}

/* ---------- Üben (Bauschritt 3) ---------- */
.note-card { border-color: var(--accent); background: #fffbeb; }
.start-form .row { margin-bottom: 4px; }
.next-row { margin-top: 18px; }
.pause-card { text-align: center; border-color: var(--brand); }
.pause-card .inline-buttons { justify-content: center; margin-top: 12px; }
.pause-card .lead { margin-left: auto; margin-right: auto; }
.result-card .summary { padding-left: 22px; }
.result-card .summary li { margin-bottom: 8px; }
.result-card .summary .hint { display: block; }

/* ---------- Import (Bauschritt 5) ---------- */
.tabs { display: flex; gap: 6px; }
.tabs a {
  display: inline-block; min-height: 44px; padding: 10px 16px; border-radius: 999px; line-height: 1.4;
  border: 1px solid var(--line); background: var(--card); text-decoration: none; font-weight: 700; font-size: 15px;
}
.tabs a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }
table.doc th { white-space: nowrap; width: 1%; }
table.doc td:nth-child(2) { white-space: nowrap; color: var(--muted); font-size: 13px; width: 1%; }
.nowrap { white-space: nowrap; }
.flash.note-list { border-color: var(--accent); background: #fffbeb; }
.flash ul { margin: 6px 0 0; padding-left: 20px; }
.per-text { padding-left: 20px; margin: 0 0 12px; }
.per-text li { margin-bottom: 4px; }
details.card summary { cursor: pointer; min-height: 32px; }
details.card[open] summary { margin-bottom: 10px; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 640px) {
  /* Spaltenbeschreibung: Name, Pflicht und Erklärung untereinander statt drei enger Spalten */
  table.doc, table.doc tbody, table.doc tr, table.doc th, table.doc td { display: block; width: auto; }
  table.doc tr { padding: 10px 12px; border-top: 1px solid var(--line); }
  table.doc tr:first-child { border-top: 0; }
  table.doc th, table.doc td { border: 0; padding: 0; white-space: normal; }
  table.doc th { display: inline; margin-right: 8px; }
  table.doc td:nth-child(2) { display: inline; }
  table.doc td:nth-child(3) { margin-top: 4px; }
}
