:root {
  --paper: #fbf7ef;
  --surface: #ffffff;
  --ink: #23302f;
  --muted: #5d6b69;
  --line: #e4dccd;
  --brand: #0f6b5f;
  --brand-ink: #ffffff;
  --accent: #d9622b;
  --good: #dff3e6;
  --good-ink: #17603a;
  --again: #fdeadb;
  --again-ink: #8f3c12;
  --der: #1f5fbf;
  --die: #c0303f;
  --das: #1f7a46;
  /* Word classes: shapes and colours apart from der/die/das. */
  --noun: #d9a400;
  --verb: #e06c00;
  --adj: #8a4fd6;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(35 48 47 / 8%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151c1b;
    --surface: #1f2928;
    --ink: #eef2f0;
    --muted: #a6b3b0;
    --line: #34413f;
    --brand: #3fb6a4;
    --brand-ink: #0e1a18;
    --accent: #f0935f;
    --good: #1d3b2b;
    --good-ink: #a6e6c0;
    --again: #43291a;
    --again-ink: #f6c6a6;
    --der: #7fb0ff;
    --die: #ff8f9b;
    --das: #74d6a0;
    --noun: #f2cc4a;
    --verb: #ff9d4d;
    --adj: #b98cff;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans", "Noto Sans Ethiopic", "Noto Sans Arabic", sans-serif;
  font-size: 18px;
  line-height: 1.4;
}

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

button:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

h1, h2, p { margin: 0; }

h1 { font-size: 1.6rem; line-height: 1.2; }

h2 { font-size: 1.1rem; margin-top: 12px; }

.page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  max-width: 880px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.page.narrow { max-width: 560px; }

.stack { display: flex; flex-direction: column; gap: 2px; }

.l1 { color: var(--muted); font-size: 0.9em; font-weight: 400; }

.l1[lang="ar"] { font-size: 1em; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--brand);
}

.brand-mark { font-size: 1.4rem; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }

.text-button {
  border: 0;
  background: none;
  padding: 10px 4px;
  color: var(--brand);
  font-weight: 600;
}

.text-button.danger { color: var(--die); }

.primary {
  border: 0;
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--brand-ink);
  padding: 14px 20px;
  font-weight: 700;
  align-items: center;
}

.primary .l1 { color: inherit; opacity: 0.85; }

.primary:disabled { opacity: 0.4; cursor: default; }

.wide { width: 100%; margin-top: auto; }

.round {
  width: 52px;
  height: 52px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  font-size: 1.3rem;
}

.audio { display: flex; justify-content: center; gap: 12px; }

.notice {
  border-radius: 12px;
  background: var(--again);
  color: var(--again-ink);
  padding: 10px 14px;
}

.notice .l1 { color: inherit; }

/* Getting started */

.animals { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 12px; }

.animal {
  aspect-ratio: 1;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 2.6rem;
  line-height: 1;
}

.animal:hover { border-color: var(--brand); }

.animal.add { color: var(--brand); font-weight: 300; }

.animal.small { width: 52px; height: 52px; border-radius: 50%; font-size: 1.5rem; }

.stack-list { display: flex; flex-direction: column; gap: 10px; }

.choice {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 16px;
  text-align: start;
  font-weight: 600;
}

.choice:hover { border-color: var(--brand); }

.choice.big { padding: 18px 20px; font-size: 1.25rem; }

.choice.selected { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }

/* Home */

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 0;
  border-radius: 22px;
  background: var(--brand);
  color: var(--brand-ink);
  padding: 22px 24px;
  text-align: start;
  box-shadow: var(--shadow);
}

.hero-text { font-size: 1.5rem; font-weight: 700; }

.hero .l1 { color: inherit; opacity: 0.85; font-size: 1rem; }

.hero-count {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  flex: none;
  border-radius: 50%;
  background: var(--brand-ink);
  color: var(--brand);
  font-size: 1.5rem;
  font-weight: 800;
}

.hero.calm { flex-direction: column; align-items: flex-start; background: var(--surface); color: var(--ink); border: 2px solid var(--brand); }

.hero.calm .hero-text { font-size: 1.25rem; }

.hero-sub { color: var(--brand); font-weight: 700; }

.count { color: var(--muted); }

.count strong { color: var(--ink); font-size: 1.25rem; }

.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }

.topic {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  align-items: center;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  text-align: start;
  font-weight: 600;
}

.topic:hover { border-color: var(--brand); }

.topic-icon { font-size: 2rem; }

.meter {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
}

.meter > span { display: block; height: 100%; background: var(--brand); transition: width 0.25s; }

.topic .meter { grid-column: 1 / -1; }

.meter.grow { flex: 1; }

.wordlist { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }

.wordlist li {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  border-radius: 12px;
  background: var(--surface);
  padding: 8px 12px;
  box-shadow: var(--shadow);
}

/* Exercises */

.session { gap: 16px; }

.session-bar { display: flex; align-items: center; gap: 12px; }

.tag { align-self: center; align-items: center; color: var(--accent); font-weight: 700; }

.task { font-size: 1.25rem; font-weight: 700; }

.task .l1 { font-size: 1rem; }

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border-radius: 20px;
  background: var(--surface);
  padding: 22px 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.pic { font-size: 1.8rem; line-height: 1.1; }

.pic svg { display: block; width: 1.8em; height: auto; }

.ico { display: inline-grid; place-items: center; }

.ico svg, .brand-mark svg, .topic-icon svg { display: block; width: 100%; height: auto; }

.round .ico { width: 34px; }

.animal .ico { width: 78%; }

.animal.small .ico { width: 100%; }

.brand-mark { display: inline-block; width: 34px; }

.topic-icon { display: block; width: 52px; }

.edit-toggle .ico { width: 26px; }

.pic.scene { width: 100%; max-width: 320px; }

.pic.scene.big { max-width: 240px; }

.pic.scene svg { width: 100%; }

.options.pictures .pic { font-size: 3rem; }

.wordlist li.rec-row { display: flex; align-items: center; gap: 8px; }

.rec-text { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }

.round:disabled { opacity: 0.35; cursor: default; }

.round.rec { color: var(--die); }

.round.rec.on { background: var(--die); color: var(--brand-ink); }

.course-link {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  align-items: center;
  border: 2px solid var(--brand);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  text-align: start;
  font-weight: 700;
}

.course-link .meter { grid-column: 1 / -1; }

.course-link:has(.own-count) { grid-template-columns: auto 1fr auto; }

.own-count {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  border-radius: 18px;
  padding: 0 8px;
  background: var(--brand);
  color: var(--brand-ink);
}

.own-form { display: flex; flex-direction: column; gap: 12px; align-items: stretch; margin-bottom: 16px; }

.own-form .wide { margin-top: 4px; }

.own-list { margin-top: 16px; }

.wordlist.own-list li { grid-template-columns: 1fr auto; }

.own-actions { display: flex; gap: 8px; }

.keyboard { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; font-weight: 400; }

.key-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }

.key {
  flex: 1 0 34px;
  max-width: 52px;
  height: 44px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.25rem;
}

.key:hover { border-color: var(--brand); }

.key.space { flex: 4 0 120px; max-width: none; }

.key-row.forms { border-radius: 10px; background: var(--brand); padding: 6px; }

.key-row[hidden] { display: none; }

.key.big { height: 52px; font-size: 1.5rem; }

.stations { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }

.station {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 14px;
  text-align: start;
  font-weight: 600;
}

.station.next { border-color: var(--accent); }

.station-mark { flex: none; width: 24px; color: var(--brand); font-size: 1.1rem; font-weight: 800; text-align: center; }

.station-kind { color: var(--muted); font-size: 0.8rem; font-weight: 400; }

.station-next { margin-inline-start: auto; color: var(--accent); font-size: 0.75rem; text-align: end; }

.station-next .l1 { color: inherit; }

.conj { margin-top: 8px; border-collapse: collapse; font-size: 1.1rem; }

.conj td { border-bottom: 1px solid var(--line); padding: 6px 14px; text-align: start; cursor: pointer; }

.conj td:first-child { color: var(--muted); }

.form-ending { color: var(--accent); }

.form-changed { color: var(--die); }

.split { font-size: 1.5rem; font-weight: 600; }

.options.two { grid-template-columns: repeat(2, 1fr); }

.option.chosen { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

.option.wrong { border-color: var(--die); background: var(--again); }

.option:disabled { opacity: 0.35; cursor: default; }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.pic.figure { width: 110px; }

.pic.figure svg { width: 100%; }

.example-line { margin-top: 6px; border-radius: 10px; background: var(--paper); padding: 8px 12px; font-weight: 700; }

.field { font-weight: 600; }

.field .answer { margin-top: 4px; text-align: start; }

.option.center { align-items: center; }

.edit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 600;
}

.edit-toggle.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

.edit-toggle.corner { position: absolute; top: 10px; inset-inline-end: 10px; width: 44px; height: 44px; justify-content: center; padding: 0; font-size: 1rem; }

.card, .feedback { position: relative; }

.editable {
  border: 0;
  border-bottom: 2px dashed var(--accent);
  background: none;
  padding: 2px 4px;
  text-align: start;
}

.rule { font-size: 1.25rem; font-weight: 700; }

.examples { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin: 10px 0 0; padding: 0; list-style: none; }

.examples li { display: flex; flex-direction: column; align-items: center; gap: 4px; }

.capital { color: var(--accent); font-size: 1.3em; }

.fix { width: min(92vw, 460px); border: 0; border-radius: 20px; background: var(--surface); color: var(--ink); padding: 20px; }

.fix::backdrop { background: rgb(0 0 0 / 45%); }

.fix .answer { margin: 12px 0; font-size: 1.1rem; resize: vertical; }

.fix-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.pic.big { font-size: 3.5rem; }

.pic.huge { font-size: 5.5rem; }

.word { font-size: 1.15em; font-weight: 700; }

.card .word, .feedback .word { font-size: 1.7rem; }

.prompt-l1 { font-size: 1.35rem; }

.prompt-l1 .l1 { color: var(--ink); font-size: 1em; }

.art { font-weight: 800; }

.art-der { color: var(--der); }

.art-die { color: var(--die); }

.art-das { color: var(--das); }

.options { display: grid; grid-template-columns: 1fr; gap: 10px; }

.options.pictures { grid-template-columns: repeat(2, 1fr); }

.options.three { grid-template-columns: repeat(3, 1fr); }

.option {
  min-height: 58px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  font-weight: 600;
}

.option:hover { border-color: var(--brand); }

.option .l1 { color: var(--ink); font-size: 1.05rem; font-weight: 600; }

.options.pictures .option { aspect-ratio: 4 / 3; font-size: 3rem; line-height: 1; }

.art-button { font-size: 1.4rem; font-weight: 800; }

.art-button.art-der { border-color: var(--der); }

.art-button.art-die { border-color: var(--die); }

.art-button.art-das { border-color: var(--das); }

.type-form { display: flex; flex-direction: column; gap: 12px; flex: 1; }

.answer {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 16px;
  font-size: 1.3rem;
  text-align: center;
}

.letters { display: flex; justify-content: center; gap: 8px; }

.letter {
  width: 52px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 1.2rem;
}

.sentence-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 62px;
  border-bottom: 2px solid var(--line);
  padding: 6px 2px;
}

.tile-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

.tile {
  display: inline-block;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px 14px;
  font-weight: 600;
}

.tile.ghost { border-style: dashed; background: none; color: transparent; }

.feedback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border-radius: 20px;
  padding: 22px 16px;
  text-align: center;
}

.feedback.good { background: var(--good); border: 3px solid var(--good-ink); }

.feedback.again { background: var(--again); border: 3px solid var(--die); animation: shake 0.35s; }

@keyframes shake {
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

.mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
}

.good .mark { background: #1f8a4d; }

.again .mark { background: #c0303f; }

.given { display: flex; flex-direction: column; align-items: center; gap: 4px; }

.given .l1 { color: var(--again-ink); }

.given-answer { color: var(--die); font-size: 1.5rem; font-weight: 700; text-decoration-thickness: 3px; }

.feedback.again .feedback-title { font-size: 1.15rem; }

.choice.center { align-items: center; text-align: center; }

.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; min-height: 58px; }

.slot {
  display: grid;
  place-items: center;
  width: 46px;
  height: 56px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

button.slot { border-style: dashed; border-color: var(--brand); }

button.slot.taken { border-style: solid; background: var(--good); color: var(--ink); }

.slot.fixed { border-color: transparent; background: none; }

.letter-tile {
  min-width: 52px;
  padding: 10px;
  font-size: 1.5rem;
  line-height: 1.2;
  text-align: center;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.dragging {
  position: fixed;
  z-index: 10;
  margin: 0;
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 6px 16px rgb(0 0 0 / 25%);
  pointer-events: none;
}

.feedback-title { align-items: center; font-weight: 700; }

.feedback.good .feedback-title, .feedback.good .feedback-title .l1 { color: var(--good-ink); }

.feedback.again .feedback-title, .feedback.again .feedback-title .l1 { color: var(--again-ink); }

.done { margin-top: 12vh; }

.score { color: var(--muted); }

.settings-end { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 16px; }

.settings-end .choice { width: 100%; }

.help { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

.options.pictures .option { display: grid; place-items: center; padding: 8px; }

.options.pictures .pic { width: min(150px, 100%); }

.options.pictures .pic svg { width: 100%; }

/* Perfekt: haben/sein and the Partizip II frame the sentence */
.pf-aux { color: var(--der); }

.pf-part { color: var(--accent); }

.pf-line { cursor: pointer; }

.word.small { font-size: 1rem; }

/* Gut miteinander reden: sorting into two baskets, rows of faces */
.pic-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }

.pic-row .pic { width: 76px; }

.pic-row .pic svg { width: 100%; }

.sort-card { min-height: 110px; justify-content: center; }

.sort-baskets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

.basket-col { display: flex; flex-direction: column; gap: 6px; }

.option.basket { min-height: 64px; }

.sort-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }

.sort-list .sorted { border-radius: 10px; background: var(--good); color: var(--good-ink); padding: 6px 10px; font-weight: 600; }

.sort-list .corrected { background: var(--again); color: var(--again-ink); text-decoration: underline wavy; }

/* Lerneinheit Amazonien */

.reading { align-items: stretch; text-align: start; font-size: 1.1rem; line-height: 1.9; }

.reading p { margin: 0 0 12px; }

.reading p:last-child { margin-bottom: 0; }

.gl {
  position: relative;
  border-bottom: 2px dotted var(--muted);
  cursor: help;
}

.gl:focus { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

.gl-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  z-index: 5;
  transform: translateX(-50%);
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 8px 12px;
  box-shadow: 0 4px 14px rgb(0 0 0 / 18%);
  text-align: center;
  line-height: 1.4;
  white-space: nowrap;
}

.gl:hover .gl-tip, .gl:focus .gl-tip { display: flex; }

/* With a mouse, a clicked word does not keep its translation open while pointing elsewhere. */
@media (hover: hover) {
  .gl:focus:not(:focus-visible):not(:hover) .gl-tip { display: none; }
}

.gl-de { font-weight: 700; }

.rule-card { align-items: stretch; text-align: start; margin-bottom: 12px; }

.rule-card h2 { margin: 0; }

.rule-examples { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; font-size: 1.1rem; }

.option.right-answer { border-color: var(--good-ink); background: var(--good); }

.option.right-answer:disabled, .option.wrong:disabled { opacity: 1; }

.mk, .mk-sample { text-decoration-thickness: 3px; text-underline-offset: 6px; }

.mk-sample { width: fit-content; }

.mk {
  border: 2px solid transparent;
  border-radius: 4px;
  background: none;
  padding: 0 2px;
  color: inherit;
  font: inherit;
  line-height: 1.5;
  cursor: pointer;
}

.mk:hover { background: var(--paper); }

.mk-N { border: 2px solid var(--noun); border-radius: 4px; background: color-mix(in srgb, var(--noun) 18%, transparent); padding: 0 2px; }

.mk-V { text-decoration: underline wavy var(--verb); text-decoration-thickness: 2px; }

.mk-A { text-decoration: underline dotted var(--adj); text-decoration-thickness: 4px; }

.mk-missing.mk-N { border-style: dashed; background: none; }

.mk-missing.mk-V, .mk-missing.mk-A { text-decoration-style: dashed; }

.mk-wrong { opacity: 0.75; text-decoration: line-through var(--again-ink) 2px; }

.mk-wrong.mk-N { background: none; }

.mk-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }

.mk-tool {
  align-items: center;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 8px 4px;
  font-weight: 700;
}

.mk-tool.selected { border-color: var(--brand); background: var(--good); }

.marking { line-height: 2.3; }

/* Photos (Amazonien nouns) */

.pic.photos { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; font-size: inherit; }

.photo { position: relative; display: inline-block; max-width: 100%; line-height: 0; }

.photos .photo + .photo, .photos .photo:has(+ .photo) { max-width: calc(50% - 4px); }

.photo img { display: block; width: auto; height: auto; max-width: 100%; max-height: 64px; border-radius: 10px; }

.photo svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.photo .arrow, .photo .arrow-edge { stroke-linecap: round; }

.photo .arrow { stroke: #ffd400; stroke-width: 20px; }

.photo .arrow-edge { stroke: #23302f; stroke-width: 32px; }

.photo .arrow-tip { fill: #ffd400; stroke: #23302f; stroke-width: 7px; stroke-linejoin: round; }

.pic.photos.big .photo img { max-height: 170px; }

.pic.photos.huge .photo img { max-height: 210px; }

.wordlist .pic.photos .photo img { max-height: 44px; max-width: 64px; object-fit: cover; }

.wordlist li:has(.pic.photos) { grid-template-columns: 64px 1fr auto; }

.options.pictures .photo img { max-height: 110px; }

.credits { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; font-size: 0.85rem; overflow-wrap: anywhere; }

.credits li { display: grid; grid-template-columns: 72px 1fr; gap: 10px; align-items: start; }

.credits img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; }
