* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 var(--font);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .4em; text-wrap: balance; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; margin-top: 1.6em; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 .7em; }
a { color: var(--link); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--azul); outline-offset: 2px; border-radius: 6px; }
:root[data-theme="dark"] :focus-visible { outline-color: var(--amarillo); }

/* Kopf */
.top { background: var(--amarillo); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; padding: 8px 16px; color: #17233F; text-decoration: none; max-width: 760px; margin: 0 auto; }
.brand svg { width: 34px; height: 34px; display: block; }
.brand-text { font: 700 1.2rem var(--font-display); }

/* Mochila-Band (Wayuú-Rauten) */
.mochila {
  height: 12px;
  background: #003893 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12'%3E%3Cpath d='M12 0 24 6 12 12 0 6z' fill='%23FCD116'/%3E%3Cpath d='M12 3.2 17.6 6 12 8.8 6.4 6z' fill='%23CE1126'/%3E%3C/svg%3E") repeat-x center / 24px 12px;
}
.mochila.thin { height: 8px; background-size: 16px 8px; border-radius: 4px; margin: 1.6em 0 0; opacity: .9; }

main { max-width: 760px; margin: 0 auto; padding: 18px 16px 32px; outline: none; }

/* Navigation unten */
.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; justify-content: center;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom a {
  flex: 1; max-width: 150px; min-height: 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600;
  border-top: 3px solid transparent;
}
.bottom a small { font-weight: 400; font-size: .62rem; }
.bottom a svg { width: 24px; height: 24px; }
.bottom a[aria-current="page"] { color: var(--link); border-top-color: var(--amarillo); }

/* Karten */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin: 0 0 14px; }
.card > :last-child { margin-bottom: 0; }
.sub { color: var(--muted); font-size: .92rem; }
.de-term { color: var(--muted); font-weight: 400; }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .03em; padding: 2px 10px; border-radius: 99px; border: 1.5px solid var(--mod, var(--line)); color: var(--mod, var(--muted)); }
.mod-grammatik { --mod: var(--andes); }
.mod-hort { --mod: var(--cafe); }
.mod-medien { --mod: var(--cartagena); }

/* Schaltflächen */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 18px;
  font: 600 1rem var(--font); color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px;
  cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--amarillo); border-color: #D9B200; color: var(--accent-ink); }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: .9rem; }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 20px; height: 20px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.icon-btn {
  width: 40px; height: 40px; flex: none; display: inline-grid; place-items: center; vertical-align: middle;
  background: transparent; border: 1.5px solid var(--line); border-radius: 50%; color: var(--link); cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }

/* Umschalter */
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.seg button { min-height: 42px; padding: 6px 14px; border: 0; background: transparent; color: var(--ink); font: 600 .9rem var(--font); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--amarillo); color: var(--accent-ink); }

/* Start */
.hero { display: flex; gap: 14px; align-items: center; }
.hero svg { width: 64px; height: 64px; flex: none; }
.beans { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.bean { width: 20px; height: 20px; color: var(--line); }
.bean.on { color: var(--cafe-bohne); }
.bean.fail { color: var(--bad); }
.bean svg { width: 100%; height: 100%; display: block; }

/* Lernpfad */
.module-head { display: flex; align-items: baseline; gap: 10px; border-left: 6px solid var(--mod); padding-left: 12px; margin: 1.6em 0 .7em; }
.module-head h2 { margin: 0; }
.module-head .region { color: var(--mod); font-weight: 700; font-size: .85rem; }
.path { list-style: none; margin: 0; padding: 0; }
.path li { margin-bottom: 8px; }
.path a, .path .planned {
  display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink);
}
.path .planned { opacity: .55; border-style: dashed; }
.path .num { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .9rem; border: 2px solid var(--mod); color: var(--mod); }
.path .done .num { background: var(--mod); color: var(--surface); }
.path .t { flex: 1; min-width: 0; }
.path .t b { display: block; }
.path .t span { font-size: .85rem; color: var(--muted); }
.path .lvl { font-size: .75rem; color: var(--muted); font-weight: 700; }

/* Lektion */
.lesson-head { margin-bottom: 14px; }
.lesson-head h1 { margin-top: 8px; }
.alt { display: block; color: var(--muted); margin-top: .25em; font-size: .95em; }
.table-wrap { overflow-x: auto; margin: .6em 0; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
th { background: var(--surface-2); }
.examples { list-style: none; padding: 0; margin: 0; }
.examples li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.examples li:last-child { border-bottom: 0; }
.examples .de { font-weight: 600; }
.examples .es { color: var(--muted); font-size: .92rem; display: block; }
.mistake .wrong { color: var(--bad); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.mistake .right { color: var(--ok); font-weight: 700; }
.mistake p { margin: 2px 0; }
.mistake .why { margin-top: 8px; font-size: .95rem; }

/* Übungen */
.ex-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ex-head .n { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.ex-head .task { flex: 1; font-weight: 700; }
.ex-head .badge { font-size: .8rem; font-weight: 700; }
.ex.is-ok { border-color: var(--ok); }
.ex.is-ok .ex-head .n { background: var(--ok); color: var(--surface); }
.ex.is-fail .ex-head .n { background: var(--bad); color: var(--surface); }
.satz { font-size: 1.12rem; line-height: 2.2; }
details.hilfe { margin: 4px 0 10px; font-size: .9rem; color: var(--muted); }
details.hilfe summary { cursor: pointer; min-height: 32px; display: inline-flex; align-items: center; color: var(--link); }
input[type="text"], textarea, select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 44px; line-height: 1.3;
}
input[type="text"]:focus, textarea:focus { border-color: var(--azul); outline: none; }
input.gap { width: 7.5em; margin: 0 4px; text-align: center; }
input.gap.suffix { width: 3.4em; margin-left: 1px; padding: 8px 4px; }
.nowrap { white-space: nowrap; }
input.wide, textarea { width: 100%; }
input.is-ok { border-color: var(--ok); background: var(--ok-bg); }
input.is-bad { border-color: var(--bad); background: var(--bad-bg); }
.fb { border-radius: 12px; padding: 10px 14px; margin-top: 12px; border-left: 5px solid; }
.fb.ok { background: var(--ok-bg); border-color: var(--ok); }
.fb.bad { background: var(--bad-bg); border-color: var(--bad); }
.fb p { margin: 4px 0 0; }
.fb .icon-btn { margin-left: 6px; width: 34px; height: 34px; }
.opts { display: grid; gap: 8px; margin: 8px 0; }
.opt { justify-content: flex-start; text-align: left; width: 100%; }
.opt.is-ok { border-color: var(--ok); background: var(--ok-bg); }
.opt.is-bad { border-color: var(--bad); background: var(--bad-bg); }
.question { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.question:first-child { border-top: 0; padding-top: 0; }
mark { background: var(--hint-bg); color: inherit; padding: 1px 4px; border-radius: 4px; border-bottom: 2px solid var(--amarillo); }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.match .btn { width: 100%; }
.match .btn.sel { border-color: var(--azul); box-shadow: inset 0 0 0 2px var(--azul); }
.match .btn.is-ok { border-color: var(--ok); background: var(--ok-bg); opacity: 1; }
.match .btn.shake { border-color: var(--bad); background: var(--bad-bg); }

.art-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.art-row:last-child { border-bottom: 0; }
.art-row .w { flex: 1; font-weight: 600; font-size: 1.05rem; }
.art-row .btn { min-width: 54px; padding: 6px 8px; }
.g-der { color: var(--der); } .g-die { color: var(--die); } .g-das { color: var(--das); }
.art-row .btn.pick-der { border-color: var(--der); color: var(--der); }
.art-row .btn.pick-die { border-color: var(--die); color: var(--die); }
.art-row .btn.pick-das { border-color: var(--das); color: var(--das); }
.art-row .btn.is-bad { text-decoration: line-through; opacity: .6; }

.tab-ex td:first-child { width: 40%; font-weight: 600; background: var(--surface-2); }
.tab-ex input { width: 100%; }

.bank, .answer { display: flex; flex-wrap: wrap; gap: 8px; min-height: 56px; padding: 8px; border-radius: 12px; }
.answer { border: 2px dashed var(--line); margin-bottom: 10px; align-items: center; }
.answer:empty::before { content: "Toca las palabras en orden…"; color: var(--muted); font-size: .9rem; }
.word { min-height: 44px; padding: 6px 14px; }
.word.is-ok { border-color: var(--ok); background: var(--ok-bg); }
.word.is-bad { border-color: var(--bad); background: var(--bad-bg); }

.dialog-lines { margin: 10px 0; }
.dialog-lines .line { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; }
.dialog-lines .who { font-weight: 700; min-width: 4.2em; color: var(--mod, var(--link)); }
.dialog-lines .es { display: block; color: var(--muted); font-size: .88rem; }
.read-text { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-size: 1.05rem; }
.check-list { list-style: none; padding: 0; margin: 10px 0; }
.check-list label { display: flex; gap: 10px; align-items: flex-start; min-height: 40px; padding: 4px 0; cursor: pointer; }
.check-list input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--azul); flex: none; }
.muster { background: var(--hint-bg); border-radius: 12px; padding: 12px 14px; margin-top: 10px; }

/* Spickzettel */
.sheet.cheat h2 { margin: 1.1em 0 .35em; }
.cheat-intro { font-style: italic; color: #444; }
.cheat-note { margin: 4px 0 0; }
.cheat-block { break-inside: avoid; }

/* Formulare (Generator) */
fieldset.card { margin: 0 0 14px; }
fieldset.card legend { font: 700 1.05rem var(--font-display); padding: 0 6px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2px 14px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--azul); flex: none; }
select { min-width: 6em; }

/* Aussprache */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.chip { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9rem; }
.chip:hover { border-color: var(--caribe); }
.sound-section { scroll-margin-top: 80px; }
.pairs { display: grid; gap: 8px; }
.pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.pair .vs { color: var(--muted); font-size: .85rem; }
.pair .btn { width: 100%; }
.syllables { display: flex; flex-wrap: wrap; gap: 4px; }
.syllables .btn { min-width: 52px; }
.syllables .btn.is-ok { border-color: var(--ok); background: var(--ok-bg); text-transform: uppercase; }
.syllables .btn.is-bad { border-color: var(--bad); background: var(--bad-bg); }
.stress-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.stress-row:last-child { border-bottom: 0; }
.stress-row .syllables { flex-basis: 100%; }
.stress-row .es { color: var(--muted); font-size: .9rem; flex: 1; min-width: 8em; }
.quiz-box { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }

/* Fortschritt */
.stat-row { margin-bottom: 14px; }
.stat-row:last-child { margin-bottom: 0; }
.stat-head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 6px; }
.stat-head > span:first-child { flex: 1; }
.bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; }

/* Vokabeln */
.mod-vokabeln { --mod: var(--caribe); }
.card.mod-vokabeln { border-top: 4px solid var(--caribe); }
.g-pl { color: var(--ink); }
.vlist .pl { display: block; font-size: .88rem; color: var(--muted); }
.box-badge { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--caribe); align-self: center; }
.boxes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 12px; }
.box-tile { background: var(--surface-2); border-radius: 10px; padding: 6px 4px; text-align: center; }
.box-tile b { display: block; font-size: 1.15rem; color: var(--caribe); }
.box-tile span { font-size: .7rem; color: var(--muted); }
.flash { min-height: 230px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.flash .big { font: 700 1.7rem/1.25 var(--font-display); }
.flash-back { display: flex; flex-direction: column; align-items: center; gap: 6px; border-top: 1px dashed var(--line); padding-top: 14px; margin-top: 4px; width: 100%; }
.ff h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ff p { margin: 4px 0; }

img.foto { display: block; max-width: 100%; max-height: 60vh; border-radius: 12px; margin: 8px 0 12px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; display: block; margin-bottom: 6px; }
.sheet .photo-box { border: 1.5px dashed #555; height: 7cm; width: 10cm; max-width: 100%; display: grid; place-items: center; color: #555; margin: 6px 0 10px; }

.done-box { text-align: center; }
.done-box > span svg { width: 72px; height: 72px; }

/* Einstellungen */
.field { margin-bottom: 18px; }
.field > label, .field > .label { display: block; font-weight: 700; margin-bottom: 6px; }
.list-links { list-style: none; padding: 0; margin: 0; }
.list-links li { border-bottom: 1px solid var(--line); }
.list-links li:last-child { border-bottom: 0; }
.list-links > li > a, .list-links > li > span { display: flex; justify-content: space-between; align-items: center; min-height: 52px; padding: 6px 0; text-decoration: none; color: var(--ink); gap: 10px; }
.list-links > li > span { color: var(--muted); }
.soon { font-size: .75rem; border: 1px dashed var(--line); padding: 1px 8px; border-radius: 99px; color: var(--muted); white-space: nowrap; }

/* Arbeitsblatt (Bildschirm-Vorschau: immer „Papier“) */
.sheet {
  background: #fff; color: #111; border: 1px solid #ccc; border-radius: 6px;
  padding: 28px 24px; margin: 0 0 20px; font: 15px/1.5 Georgia, "Times New Roman", serif;
}
.sheet h1 { font-size: 1.5rem; }
.sheet h2 { font-size: 1.05rem; margin: 1.3em 0 .4em; }
.sheet table { font-size: .95em; }
.sheet th, .sheet td { border-color: #888; }
.sheet th { background: #eee; }
.sheet-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid #111; padding-bottom: 8px; margin-bottom: 14px; }
.sheet-head .meta { font-size: .9em; white-space: nowrap; }
.sheet .rule { border: 1.5px solid #111; border-radius: 6px; padding: 8px 12px; margin-bottom: 10px; }
.sheet .rule h3 { font-size: 1em; margin-bottom: 4px; }
.sheet .task { break-inside: avoid; margin-bottom: 14px; }
.sheet .task-title { font-weight: 700; }
.sheet .es-hint { color: #555; font-style: italic; font-size: .9em; }
.sheet .wline { border-bottom: 1px solid #555; height: 2.1em; }
.sheet .blank { display: inline-block; min-width: 6em; border-bottom: 1px solid #111; }
.sheet .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; }
.sheet .box { display: inline-block; width: .9em; height: .9em; border: 1.5px solid #111; margin-right: .4em; vertical-align: -1px; }
.sheet ol.sol { padding-left: 1.4em; }
.sheet ol.sol li { margin-bottom: 6px; }
.sheet u { text-decoration-thickness: 2px; }

@media (max-width: 480px) {
  .table-wrap table { font-size: .84rem; }
  .table-wrap th, .table-wrap td { padding: 6px 7px; }
}
.table-wrap.scrolls { position: relative; }
.table-wrap.scrolls::after {
  content: "⟷ desliza"; position: sticky; left: 0; display: block; margin-top: 4px;
  font-size: .75rem; color: var(--muted);
}

@media (min-width: 700px) {
  body { font-size: 18px; }
  .opts.two { grid-template-columns: 1fr 1fr; }
}
