/* ==========================================================================
   Lëtzebuergesch Dictéeën – Stylesheet
   Kee Framework, kee CDN. Faarwen iwwer CSS-Variablen (hell + däischter Modus).
   ========================================================================== */

:root {
  --ink: #1b2433;
  --ink-soft: #4a5568;
  --muted: #6b7686;
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --line: #e2ddd3;
  --brand: #1d3557;
  --brand-ink: #ffffff;
  --accent: #c8102e;          /* rout wéi am Fändel */
  --accent-soft: #fbe9ec;
  --link: #1f5fa8;
  --ok: #1e7a46;
  --ok-soft: #e3f4ea;
  --warn: #a15c00;
  --warn-soft: #fff2dc;
  --ins: #116b3a;  --ins-bg: #d7f2e1;
  --del: #b3261e;  --del-bg: #fbdcda;
  --focus: #2b7de9;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 16px rgba(20, 30, 50, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-text: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8ebf0;
    --ink-soft: #c2c8d2;
    --muted: #949cab;
    --bg: #12161d;
    --surface: #1a2029;
    --surface-2: #222a35;
    --line: #2f3946;
    --brand: #9cc0ec;
    --brand-ink: #0f1620;
    --accent: #ff6b7d;
    --accent-soft: #3a1d24;
    --link: #8ab8f0;
    --ok: #6fd39a;
    --ok-soft: #173326;
    --warn: #f0b45c;
    --warn-soft: #3a2b14;
    --ins: #8ee3b0;  --ins-bg: #1d4030;
    --del: #ff9a92;  --del-bg: #4a2220;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.6 var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding-block: 2rem 4rem; }
img { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 1.2rem + 2.4vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.7rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 20px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 46rem; }
.prose { max-width: 46rem; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .35em; }

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--surface); padding: 8px 14px; border-radius: var(--radius-sm);
}
.skip-link:focus { left: 8px; }

/* ---------- Kapp & Fouss ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.brand img { border-radius: 8px; }
.brand strong { color: var(--accent); }
.main-nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a {
  color: var(--ink-soft); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-weight: 500;
}
.main-nav a:hover { background: var(--surface-2); color: var(--ink); }
.main-nav a[aria-current="page"] { background: var(--brand); color: var(--brand-ink); }

@media (max-width: 600px) {
  .site-header { position: static; }
  .header-inner { gap: 4px 12px; padding-block: 8px; min-height: 0; }
  .brand { font-size: .95rem; }
  .brand img { width: 30px; height: 30px; }
  .main-nav { margin-left: -12px; }
  .main-nav a { padding: 5px 12px; font-size: .95rem; }
  main { padding-block: 1.25rem 3rem; }
}

.site-footer { border-top: 1px solid var(--line); background: var(--surface); font-size: .875rem; color: var(--ink-soft); }
.footer-inner { padding-block: 24px; }
.footer-inner p { margin: 0 0 .4em; }
.site-footer a { color: inherit; }

/* ---------- Knäppercher ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; line-height: 1.2;
  padding: 11px 20px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: background .15s, transform .05s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.spinner {
  width: 1em; height: 1em; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Kaarten & Sektiounen ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
.section { margin-top: 3rem; scroll-margin-top: 80px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head p { margin: 0; }

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); text-decoration: none; font-weight: 500; margin-bottom: 1rem; }
.back-link:hover { color: var(--ink); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-soft); white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- Startsäit ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: center; padding-block: 1rem 1.5rem; }
.hero-logo { width: 150px; border-radius: 28px; box-shadow: var(--shadow); }
.hero h1 span { color: var(--accent); }
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; }
  .hero-logo { display: none; }
}

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 1.5rem 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps li {
  counter-increment: step; display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
.steps li::before {
  content: counter(step); flex: none; display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 700;
}
.steps strong { display: block; }
.steps span { color: var(--muted); font-size: .9rem; }
@media (max-width: 720px) { .steps { grid-template-columns: 1fr; } }

.jump-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2rem; }
.jump-nav a {
  text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  padding: 7px 14px; border-radius: 999px; font-weight: 500; font-size: .95rem;
}
.jump-nav a:hover { border-color: var(--brand); }

.dictee-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 1rem; }
.dictee-card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; text-decoration: none; color: var(--ink);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.dictee-card:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }
.dictee-card .title { font-weight: 650; font-size: 1.05rem; }
.dictee-card .meta { color: var(--muted); font-size: .875rem; }
.dictee-card .status { min-height: 22px; }

.sentence-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; margin-top: 1rem; }
.sentence-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  aspect-ratio: 1 / 1; border-radius: 12px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  transition: border-color .15s, background .15s;
}
.sentence-tile:hover { border-color: var(--brand); }
.sentence-tile b { font-size: 1.1rem; }
.sentence-tile small { font-size: .7rem; color: var(--muted); }
.sentence-tile.is-done { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.sentence-tile.is-done small { color: var(--ok); }
.sentence-tile.is-draft { border-style: dashed; border-color: var(--warn); }

.progress-summary { font-size: .9rem; color: var(--muted); }

/* ---------- Dictée-Säit ---------- */
.dictee-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; margin-top: 1.25rem; }
.dictee-layout.no-aside { grid-template-columns: minmax(0, 1fr); }
.dictee-layout > * { min-width: 0; }
@media (max-width: 900px) { .dictee-layout { grid-template-columns: 1fr; } .dictee-layout aside { order: -1; } }

.player { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; }
.player audio { flex: 1 1 300px; min-width: 0; height: 44px; }
.speed { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.speed button {
  font: inherit; font-size: .85rem; font-weight: 600; border: 0; padding: 6px 11px; cursor: pointer;
  background: var(--surface); color: var(--ink-soft);
}
.speed button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }

.sentence-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.sentence-list button {
  width: 100%; display: flex; align-items: center; gap: 8px; justify-content: flex-start;
  font: inherit; font-size: .9rem; padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.sentence-list button:hover { border-color: var(--brand); }
.sentence-list button .icon { width: 18px; height: 18px; flex: none; }
.sentence-list button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.sentence-list button.played:not([aria-pressed="true"]) { background: var(--surface-2); }

/* Schmuel Ecranen: Sätz als horizontal Leescht iwwert dem Textfeld */
@media (max-width: 900px) {
  .dictee-layout aside { padding: 12px 14px; }
  .dictee-layout aside h3 { font-size: .95rem; margin-bottom: 8px; }
  .dictee-layout aside > p { display: none; }
  .sentence-list {
    display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px;
    scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
  }
  .sentence-list li { flex: none; scroll-snap-align: start; }
  .sentence-list button { width: auto; white-space: nowrap; }
  .editor { min-height: 16rem; }
}

.editor-card { padding: 0; overflow: hidden; }
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.editor-toolbar .label { font-size: .8rem; color: var(--muted); margin-right: 4px; }
.char-btn {
  font: 600 1rem/1 var(--font-text); min-width: 34px; height: 34px; padding: 0 6px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.char-btn:hover { border-color: var(--brand); }
.editor {
  display: block; width: 100%; min-height: 22rem; resize: vertical;
  border: 0; outline: none; padding: 18px 20px; background: var(--surface); color: var(--ink);
  font: 1.15rem/1.75 var(--font-text);
}
.editor.short { min-height: 9rem; }
.editor-card:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.editor-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; align-items: center;
  padding: 10px 16px; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted);
}
kbd {
  font: .78rem var(--mono); padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--line); border-bottom-width: 2px; background: var(--surface);
}
.submit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 1.25rem; }
.notice { font-size: .85rem; color: var(--muted); max-width: 40rem; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); margin-top: 1rem; }

/* ---------- Resultat-Säit ---------- */
.score-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: center; }
.score-ring {
  --p: 0; --c: var(--ok);
  width: 120px; height: 120px; border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-2) 0);
  display: grid; place-items: center;
}
.score-ring::before {
  content: attr(data-label); display: grid; place-items: center;
  width: 92px; height: 92px; border-radius: 50%; background: var(--surface);
  font-size: 1.6rem; font-weight: 750; color: var(--ink);
}
.score-card h1 { margin-bottom: .2em; }
.score-card p { margin: 0; color: var(--ink-soft); }
@media (max-width: 560px) { .score-card { grid-template-columns: 1fr; justify-items: start; } }

.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: .9rem; color: var(--ink-soft); }
.filter { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.filter button {
  font: inherit; font-size: .88rem; font-weight: 600; border: 0; padding: 7px 14px; cursor: pointer;
  background: transparent; color: var(--ink-soft);
}
.filter button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }

.diff {
  white-space: pre-wrap; overflow-wrap: anywhere;
  font: 1.15rem/1.9 var(--font-text); margin-top: 1rem;
}
.diff ins, .diff del, .legend ins, .legend del { text-decoration: none; border-radius: 4px; padding: 1px 2px; }
.diff ins, .legend ins { color: var(--ins); background: var(--ins-bg); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--ins) 55%, transparent); }
.diff del, .legend del { color: var(--del); background: var(--del-bg); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.diff.only-deletions ins, .diff.only-insertions del { display: none; }

.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 1rem; }
.compare h3 { font-size: .95rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.compare .text { white-space: pre-wrap; font: 1.02rem/1.7 var(--font-text); background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; margin: 0; }
@media (max-width: 720px) { .compare { grid-template-columns: 1fr; } }

details.card > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "▸"; transition: transform .15s; color: var(--muted); }
details.card[open] > summary::before { transform: rotate(90deg); }

.stack > * + * { margin-top: 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0s !important; }
}
