:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efebe4;
  --ink: #1f1d1a;
  --muted: #6b655c;
  --line: #e2dcd2;
  --accent: #a8322a;
  --accent-ink: #ffffff;
  --green: #2e7d4f;
  --yellow: #b67d00;
  --red: #c0392b;
  --grey: #9a948a;
  --green-bg: #e3f1e8;
  --yellow-bg: #f8edd2;
  --red-bg: #f7e1de;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 29, 26, .06), 0 4px 14px rgba(31, 29, 26, .06);
  --serif: "PT Serif", Georgia, serif;
  --sans: "PT Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16140f; --surface: #211e18; --surface-2: #2b2720; --ink: #f1ece3; --muted: #a59d90;
    --line: #3a352c; --accent: #e0675c; --accent-ink: #16140f;
    --green: #5cbf86; --yellow: #e2b146; --red: #ee7a6c; --grey: #7d766b;
    --green-bg: #1f3428; --yellow-bg: #3a3017; --red-bg: #3d221e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16140f; --surface: #211e18; --surface-2: #2b2720; --ink: #f1ece3; --muted: #a59d90;
  --line: #3a352c; --accent: #e0675c; --accent-ink: #16140f;
  --green: #5cbf86; --yellow: #e2b146; --red: #ee7a6c; --grey: #7d766b;
  --green-bg: #1f3428; --yellow-bg: #3a3017; --red-bg: #3d221e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font: 17px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { font: 700 20px/1 var(--serif); text-decoration: none; letter-spacing: .2px; }
.brand span { color: var(--accent); }
.usage { font-size: 13px; color: var(--muted); }

main { max-width: 640px; margin: 0 auto; padding: 16px 16px 96px; }
h1 { font: 700 26px/1.2 var(--serif); margin: 8px 0 6px; }
h2 { font: 700 19px/1.3 var(--serif); margin: 24px 0 10px; }
.lead { color: var(--muted); margin: 0 0 18px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 15px; }
.crumb svg { width: 16px; height: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.list { display: grid; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 14px; text-decoration: none; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.row:active { background: var(--surface-2); }
.row .t { flex: 1; min-width: 0; }
.row .t b { display: block; font-weight: 700; }
.row .t small { color: var(--muted); }
.row .glyph { font: 700 26px/1 var(--serif); min-width: 44px; text-align: center; color: var(--accent); }
.chev { width: 18px; height: 18px; color: var(--muted); flex: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 92px; text-decoration: none; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 6px; text-align: center;
}
.tile .big { font: 700 30px/1 var(--serif); }
.tile small { color: var(--muted); font-size: 13px; line-height: 1.25; }

/* Übungsansicht */
.word { font: 700 44px/1.15 var(--serif); margin: 6px 0 4px; word-break: break-word; }
.word.letter { font-size: 72px; }
.syl { border-radius: 6px; padding: 0 1px; transition: background .2s, color .2s; }
.syl.green { background: var(--green-bg); color: var(--green); }
.syl.yellow { background: var(--yellow-bg); color: var(--yellow); }
.syl.red { background: var(--red-bg); color: var(--red); }
.syl.grey { color: var(--grey); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); margin-bottom: 14px; }
.ipa { font-family: var(--sans); letter-spacing: .3px; }
.facts { display: grid; gap: 8px; margin: 14px 0; }
.fact { display: flex; gap: 10px; }
.fact > span:first-child { color: var(--muted); min-width: 96px; font-size: 15px; }
.kbd {
  display: inline-block; min-width: 28px; padding: 1px 8px; border: 1px solid var(--line);
  border-bottom-width: 3px; border-radius: 7px; text-align: center; background: var(--surface-2); font-weight: 700;
}

.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; text-decoration: none; font-weight: 700; font-size: 15px;
}
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: transparent; }
.btn:disabled { opacity: .5; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); min-height: 40px; padding: 0 12px; font-size: 14px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.rec {
  width: 84px; height: 84px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); cursor: pointer;
  touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.rec svg { width: 34px; height: 34px; }
.rec.on { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--accent) 25%, transparent); } }
.recwrap { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 22px 0 8px; }
.recwrap small { color: var(--muted); }

.result { margin-top: 14px; }
.score { display: flex; align-items: baseline; gap: 10px; }
.score b { font: 700 34px/1 var(--serif); }
.tips { display: grid; gap: 8px; margin-top: 12px; }
.tip { border-left: 4px solid var(--accent); padding: 10px 12px; background: var(--surface-2); border-radius: 0 10px 10px 0; }
.tip b { display: block; margin-bottom: 2px; }
.note { color: var(--muted); font-size: 14px; }
.error { color: var(--red); }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair .tile { min-height: 110px; }

form.login { display: grid; gap: 12px; margin-top: 30px; }
input[type="password"] {
  font: inherit; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
