/* =========================================================
   Latein Lektion 4 – Trainer
   ========================================================= */

:root {
  --paper: #f6efe1;
  --paper-2: #efe4cf;
  --card: #fffdf7;
  --ink: #241f19;
  --ink-soft: #6a5f51;
  --ink-faint: #988b78;
  --line: #e2d5bc;
  --line-strong: #cdbb9c;
  --red: #8d2f23;
  --red-dark: #6f2319;
  --red-soft: #f7e4df;
  --gold: #a97c22;
  --gold-soft: #f3e8cd;
  --green: #2c6b4c;
  --green-soft: #e1efe6;
  --shadow-sm: 0 1px 2px rgba(70, 48, 22, .07);
  --shadow: 0 2px 4px rgba(70, 48, 22, .06), 0 18px 40px -22px rgba(70, 48, 22, .45);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(1200px 600px at 12% -10%, #fdf8ec 0%, rgba(253, 248, 236, 0) 60%),
    radial-gradient(900px 500px at 100% 0%, #f2e6cd 0%, rgba(242, 230, 205, 0) 55%);
  background-attachment: fixed;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Kopfzeile ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(246, 239, 225, .86);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(155deg, #9c3a2b, #6f2319);
  color: #fbeeda;
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: .5px;
  box-shadow: var(--shadow-sm);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--serif); font-size: 19px; letter-spacing: .2px; }
.brand-text small { color: var(--ink-soft); font-size: 12px; letter-spacing: .4px; text-transform: uppercase; }

.tabs { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }

.tab {
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 550;
  border: 1px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.tab:hover { color: var(--ink); background: rgba(255, 253, 247, .7); }

.tab.is-active {
  color: var(--red-dark);
  background: var(--card);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

/* ---------- Layout ---------- */

.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

.view { display: none; }
.view.is-visible { display: block; animation: rise .28s ease both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
  margin-bottom: 22px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-head h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 25px;
  margin: 0 0 6px;
  letter-spacing: .2px;
}

.panel-head p { margin: 0; color: var(--ink-soft); font-size: 14.5px; max-width: 62ch; }

.badge {
  flex: none;
  font-size: 11.5px;
  letter-spacing: .9px;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid #e6d5ab;
  padding: 6px 11px;
  border-radius: 999px;
  white-space: nowrap;
}

.hidden { display: none !important; }
.spacer { flex: 1; }

/* ---------- Formularelemente ---------- */

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px 22px;
  margin-bottom: 22px;
}

.field { display: flex; flex-direction: column; gap: 7px; }

.field-grid > .field:first-child { grid-column: 1 / -1; }

.field-label {
  font-size: 11.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 650;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
  background: #f3ead7;
  border: 1px solid var(--line);
  border-radius: 11px;
  width: fit-content;
  max-width: 100%;
}

.segmented.wide { width: 100%; margin-bottom: 18px; }

.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 7px 13px;
  border-radius: 8px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}

.segmented button:hover { color: var(--ink); }

.segmented button.is-active {
  background: var(--card);
  color: var(--red-dark);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(80, 55, 25, .16);
}

select, .search, .answer-input {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: #fffefb;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 13px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

select { cursor: pointer; }

.search { min-width: 220px; }

.answer-input:focus, select:focus, .search:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(141, 47, 35, .13);
}

.answer-input { flex: 1; min-width: 0; font-family: var(--serif); font-size: 18px; padding: 12px 15px; }

.answer-area { display: flex; gap: 10px; margin-top: 4px; }
.answer-area[hidden] { display: none; }

/* ---------- Buttons ---------- */

.btn {
  appearance: none;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: 10px;
  padding: 11px 20px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease, color .15s ease;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn.primary {
  background: linear-gradient(180deg, #9c3a2b, #82291d);
  color: #fff6e8;
  box-shadow: 0 1px 2px rgba(80, 25, 15, .3), 0 8px 18px -10px rgba(120, 35, 22, .8);
}

.btn.primary:hover { background: linear-gradient(180deg, #a94233, #8d2f23); }

.btn.next {
  background: var(--green);
  color: #f2fbf5;
  box-shadow: 0 8px 18px -12px rgba(28, 90, 60, .9);
}

.btn.next:hover { background: #245a40; }

.btn.ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink-soft);
}

.btn.ghost:hover { background: #f5eddb; color: var(--ink); }

.btn:disabled { opacity: .5; cursor: not-allowed; }

.link-btn {
  appearance: none;
  background: none;
  border: 0;
  font: inherit;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 4px;
}

.link-btn:hover { color: var(--red); }

kbd {
  font-family: var(--sans);
  font-size: 10.5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 5px;
  background: #fbf6ea;
  color: var(--ink-soft);
  margin-left: 4px;
}

.micro { font-size: 12.5px; color: var(--ink-faint); }
.setup-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ---------- Trainer ---------- */

.trainer-top { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.grammar-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

.pill {
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  background: #f3ead7;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.pill.ok { background: var(--green-soft); color: var(--green); border-color: #c6e0d1; }
.pill.bad { background: var(--red-soft); color: var(--red); border-color: #ecd0c8; }

.progress {
  height: 7px;
  border-radius: 999px;
  background: #eee2cc;
  overflow: hidden;
  margin-bottom: 26px;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #b08228, #8d2f23);
  transition: width .3s ease;
}

.prompt { text-align: center; padding: 8px 0 24px; }

.prompt-dir {
  font-size: 11.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 650;
  margin-bottom: 12px;
}

.prompt-word {
  font-family: var(--serif);
  font-size: clamp(30px, 5.2vw, 46px);
  line-height: 1.2;
  letter-spacing: .3px;
  color: var(--ink);
  word-break: break-word;
}

.prompt-sub { margin-top: 10px; font-size: 13.5px; color: var(--ink-soft); }

.task { padding: 4px 0 22px; text-align: center; }
.task .prompt-word { font-size: clamp(24px, 4.2vw, 34px); }

/* ---------- Multiple Choice ---------- */

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 4px 0 6px;
}

.choice {
  appearance: none;
  font: inherit;
  font-size: 16px;
  font-family: var(--serif);
  text-align: left;
  padding: 13px 16px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: #fffefb;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  gap: 11px;
  align-items: center;
  transition: border-color .12s ease, background .12s ease, transform .08s ease;
}

.choice:hover:not(:disabled) { border-color: var(--red); background: #fffaf0; }
.choice:active:not(:disabled) { transform: translateY(1px); }
.choice .num {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: #f1e7d3;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.choice.is-correct { border-color: var(--green); background: var(--green-soft); }
.choice.is-wrong { border-color: var(--red); background: var(--red-soft); }
.choice:disabled { cursor: default; }

/* ---------- Rückmeldung ---------- */

.feedback {
  margin-top: 18px;
  padding: 15px 17px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fbf5e7;
  font-size: 15px;
  animation: rise .2s ease both;
}

.feedback.is-correct { border-color: #bfdccb; background: var(--green-soft); }
.feedback.is-wrong { border-color: #ebcec5; background: var(--red-soft); }

.feedback .verdict {
  font-weight: 700;
  font-family: var(--serif);
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.feedback.is-correct .verdict { color: var(--green); }
.feedback.is-wrong .verdict { color: var(--red-dark); }

.feedback .solution { font-family: var(--serif); font-size: 17px; }
.feedback .note { margin-top: 8px; font-size: 13.5px; color: var(--ink-soft); }
.feedback .hintline { margin-top: 6px; font-size: 13px; color: var(--gold); }
.feedback .readings { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--ink-soft); }

.mini-row {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--line-strong);
  font-family: var(--serif);
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.mini-row b { color: var(--red-dark); }

.trainer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.trainer-bottom .micro { max-width: 55ch; }

/* ---------- Auswertung ---------- */

.summary-head { text-align: center; padding: 6px 0 18px; }
.summary-head h2 { font-family: var(--serif); font-size: 30px; margin: 0 0 6px; }
.summary-score { font-family: var(--serif); font-size: 52px; color: var(--red); line-height: 1.1; }
.summary-sub { color: var(--ink-soft); }

.missed-list { margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }

.missed-list li {
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffaf0;
  flex-wrap: wrap;
}

.missed-list .m-la { font-family: var(--serif); font-size: 16.5px; min-width: 150px; }
.missed-list .m-de { color: var(--ink-soft); font-size: 14px; }

.summary-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

/* ---------- Tabellen ---------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.book-note {
  margin: 14px 4px 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--ink-soft);
  border-left: 3px solid var(--gold-soft);
  padding-left: 12px;
}

table { border-collapse: collapse; width: 100%; }

.decl-table { font-size: 14.5px; min-width: 640px; }

.decl-table th, .decl-table td {
  border: 1px solid var(--line);
  padding: 7px 10px;
  text-align: center;
}

.decl-table thead th {
  background: #f6ecd8;
  font-weight: 650;
  font-size: 13px;
  color: var(--ink-soft);
}

.decl-table thead th.group-a { background: #f3e2cf; color: var(--red-dark); }
.decl-table thead th.group-o { background: #f2e9d2; color: #6b5a2c; }
.decl-table thead th .micro { display: block; font-weight: 400; font-size: 10.5px; color: var(--ink-faint); }

.decl-table thead tr:first-child th { font-family: var(--serif); font-size: 15px; color: var(--ink); }

.decl-table td.form { font-family: var(--serif); font-size: 16px; }

.decl-table tr.is-group td {
  background: #fbf4e4;
  font-size: 11.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
  padding: 5px 10px;
}

.decl-table td.case-cell { text-align: left; white-space: nowrap; color: var(--ink-soft); font-size: 12.5px; }

.decl-table td.case-cell strong { color: var(--ink); font-size: 13.5px; display: block; font-weight: 650; }

.decl-table tr.is-target td { background: #fdf1d8; }

.vocab-table { font-size: 14.5px; min-width: 560px; }

.vocab-table th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 2px solid var(--line);
}

.vocab-table td { padding: 9px 10px; border-bottom: 1px solid #efe6d4; vertical-align: top; }

.vocab-table tr:hover td { background: #fffaee; }

.vocab-table .la { font-family: var(--serif); font-size: 16px; }
.vocab-table .de { color: var(--ink); }
.vocab-table .hint-cell { color: var(--ink-faint); font-size: 13px; font-style: italic; }

.boxes { display: inline-flex; gap: 3px; }
.box-dot { width: 7px; height: 7px; border-radius: 50%; background: #e3d7c1; }
.box-dot.on { background: var(--gold); }

/* ---------- Präpositionen ---------- */

.prep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 26px;
}

.prep-col h3 {
  font-family: var(--serif);
  font-size: 17px;
  margin: 0 0 10px;
  color: var(--red-dark);
  font-weight: 600;
}

.prep-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }

.prep-list li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffaf0;
  flex-wrap: wrap;
}

.prep-list .p-la { font-family: var(--serif); font-size: 16.5px; min-width: 78px; }
.prep-list .p-de { color: var(--ink-soft); font-size: 14px; }
.prep-list .p-note { width: 100%; font-size: 12px; color: var(--ink-faint); }

.footnote { font-size: 12.5px; color: var(--ink-faint); margin: 12px 0 0; }

.note-card {
  margin-top: 18px;
  padding: 14px 16px;
  border-left: 3px solid var(--gold);
  background: #fdf6e6;
  border-radius: 0 10px 10px 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.note-card em { font-family: var(--serif); font-style: italic; color: var(--ink); }

.tips-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }

.tip-card {
  padding: 16px 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fffdf7, #fdf7ea);
}

.tip-card h3 { font-family: var(--serif); font-size: 16.5px; margin: 0 0 6px; color: var(--red-dark); }
.tip-card p { margin: 0; font-size: 13.5px; color: var(--ink-soft); }

/* ---------- Grammatik-Chips ---------- */

.chips { display: grid; gap: 12px; margin: 4px 0 6px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }

.chip-row .chip-label {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
  min-width: 74px;
}

.chip {
  appearance: none;
  font: inherit;
  font-size: 13.5px;
  padding: 8px 13px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: #fffefb;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}

.chip:hover:not(:disabled) { border-color: var(--red); color: var(--ink); }

.chip.is-selected {
  background: var(--red);
  border-color: var(--red);
  color: #fff6e8;
  font-weight: 600;
}

.chip.is-correct { background: var(--green); border-color: var(--green); color: #f2fbf5; }
.chip.is-wrong { background: var(--red-soft); border-color: var(--red); color: var(--red-dark); }
.chip:disabled { cursor: default; }

.task-actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }

.tip-box {
  margin-top: 14px;
  padding: 13px 16px;
  border-radius: 11px;
  background: #fdf6e6;
  border: 1px dashed var(--line-strong);
  font-size: 14px;
  color: var(--ink-soft);
}

/* ---------- Fortschritt ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }

.stat {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffaf0;
}

.stat .stat-value { font-family: var(--serif); font-size: 30px; line-height: 1.1; color: var(--red-dark); }
.stat .stat-label { font-size: 12px; letter-spacing: .6px; text-transform: uppercase; color: var(--ink-faint); margin-top: 4px; }

/* ---------- Fuß ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 20px 40px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 12.5px;
}

.site-footer code {
  font-size: 12px;
  background: #f0e6d3;
  padding: 1px 5px;
  border-radius: 4px;
}

/* ---------- Mobil ---------- */

@media (max-width: 640px) {
  .hint-col { display: none; }
  .topbar-inner { padding: 10px 14px; gap: 10px; }
  .tabs { margin-left: 0; width: 100%; overflow-x: visible; flex-wrap: wrap; gap: 3px; }
  .tab { padding: 6px 11px; font-size: 13px; }
  .container { padding: 20px 14px 50px; }
  .panel { padding: 20px 17px; border-radius: 14px; }
  .panel-head { flex-direction: column; gap: 10px; }
  .panel-head h2 { font-size: 22px; }
  .answer-area { flex-direction: column; }
  .answer-area .btn { width: 100%; }
  .trainer-bottom { flex-direction: column-reverse; align-items: stretch; }
  .trainer-bottom .btn { width: 100%; }
  .search { width: 100%; }
  .prompt-word { font-size: 30px; }
  .chip-row .chip-label { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
