/* Gestaltung nach Brand Style Guide (Verena Diewerge):
   Farben: Hellgrau #d6d6d6, Fast-Schwarz #171715, Weiß · Schrift: Montserrat Medium
   Logo: Wortmarke in Versalien mit weitem Buchstabenabstand · Formen: eckig, flächig, ohne Verläufe.
   Abgeleitete Töne (nicht im Guide, nur für Lesbarkeit): --muted, --soft, --good, --bad. */
@font-face {
  font-family: "Montserrat";
  src: url("/fonts/montserrat.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #171715;
  --grey: #d6d6d6;
  --black: #07090a;
  --white: #ffffff;

  --bg: var(--white);
  --fg: var(--ink);
  --card: var(--white);
  --line: var(--grey);
  --soft: #f3f3f2;          /* abgeleitet: helle Fläche */
  --muted: #6b6b67;         /* abgeleitet: Zweittext, 5:1 Kontrast auf Weiß */
  --accent: var(--ink);
  --on-accent: var(--white);
  --panel: var(--grey);     /* helle Flächen-Kachel wie „Brand colors“ im Guide */
  --on-panel: var(--ink);
  --good: #2e6b4c;          /* funktionale Rückmeldung, bewusst gedämpft */
  --good-soft: #e6efe9;
  --bad: #a03a3a;
  --bad-soft: #f5e7e7;
  --mark: var(--grey);      /* Farbe der Wortmarke auf hellem Grund (Guide: Hellgrau) */
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--ink);
    --fg: var(--white);
    --card: #1f1f1d;
    --line: #3b3b38;
    --soft: #222220;
    --muted: #a4a4a0;
    --accent: var(--white);
    --on-accent: var(--ink);
    --panel: #262624;
    --on-panel: var(--white);
    --good: #7fc4a0;
    --good-soft: #1b2a22;
    --bad: #e08a8a;
    --bad-soft: #2d1c1c;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; border-radius: 0; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg);
  font: 500 16px/1.5 "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; font-feature-settings: "lnum", "kern"; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; touch-action: manipulation; }
input { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
b { font-weight: 700; }
svg.i { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: square; stroke-linejoin: miter; }

#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding: env(safe-area-inset-top) 0 0; }
.screen { flex: 1; display: flex; flex-direction: column; padding: 20px 20px calc(28px + env(safe-area-inset-bottom)); gap: 22px; }
.screen.has-tabs { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }

/* Wortmarke (Logo-Nutzung: Hellgrau auf Weiß · Weiß auf Schwarz · Hellgrau auf Tiefschwarz · Schwarz auf Weiß) */
.wordmark { text-transform: uppercase; letter-spacing: .24em; font-weight: 600; font-size: 11px; line-height: 1.5; color: var(--mark); }
.wordmark.on-dark { color: var(--white); }
.wordmark.lg { font-size: 13px; text-align: center; }

/* Typografie */
.label { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.big { font-size: 26px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
.big.en { color: var(--fg); }
.big.de { font-size: 20px; font-weight: 500; color: var(--muted); }
.muted { color: var(--muted); }
.count { font-size: 12px; font-weight: 600; letter-spacing: .1em; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.numeral { font-size: 72px; font-weight: 300; letter-spacing: -.02em; line-height: 1; color: var(--grey); font-variant-numeric: tabular-nums; }

/* Buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px; padding: 0 22px;
  background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 14px; letter-spacing: .1em; text-transform: uppercase; }
.btn:active { opacity: .85; }
.btn.good { background: var(--good); color: #fff; }
.btn.bad { background: var(--bad); color: #fff; }
.btn.ghost { background: transparent; color: var(--fg); }
.btn.soft { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1.5px var(--fg); }
.btn[disabled] { opacity: .35; pointer-events: none; }
.link { color: var(--fg); font-weight: 600; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; padding: 12px; text-align: center; width: 100%; text-decoration: underline; text-underline-offset: 4px; }
.icon-btn { width: 52px; height: 52px; box-shadow: inset 0 0 0 1.5px var(--fg); display: inline-flex; align-items: center; justify-content: center; flex: none; font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.icon-btn:active { background: var(--soft); }
.icon-btn.big { width: 92px; height: 92px; background: var(--accent); color: var(--on-accent); box-shadow: none; }
.icon-btn.big svg.i { width: 38px; height: 38px; }
.icon-btn.small { width: 40px; height: 40px; }
.icon-btn[disabled] { opacity: .35; }

/* Login & Profil */
.center { align-items: center; justify-content: center; text-align: center; }
.brandblock { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 8px 0 4px; }
.field { width: 100%; min-height: 56px; padding: 0 16px; border: 0; border-bottom: 2px solid var(--fg); background: var(--soft); font-size: 18px; font-weight: 500; }
.field:focus { outline: none; background: var(--card); box-shadow: inset 0 0 0 2px var(--fg); }
.error { color: var(--bad); font-weight: 600; min-height: 1.5em; }
.profiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.profile { display: flex; flex-direction: column; align-items: flex-start; gap: 24px; padding: 18px 16px; background: var(--panel); color: var(--on-panel); font-weight: 600; text-align: left; }
.profile:active { background: var(--ink); color: var(--white); }
.avatar { width: 44px; height: 44px; background: var(--ink); color: var(--grey); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 600; flex: none; }
.avatar.sm { width: 38px; height: 38px; font-size: 17px; background: transparent; color: var(--white); box-shadow: inset 0 0 0 1.5px var(--white); }

/* Home */
.masthead { background: var(--ink); color: var(--white); margin: -20px -20px 0; padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 22px; }
.masthead .row { display: flex; align-items: center; gap: 14px; }
.masthead .hello { flex: 1; font-size: 24px; font-weight: 600; letter-spacing: -.01em; line-height: 1.15; }
.masthead .hello small { display: block; font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--grey); margin-bottom: 2px; }
.streak { text-align: right; font-weight: 600; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--grey); line-height: 1.2; }
.streak b { display: block; font-size: 26px; letter-spacing: -.02em; color: var(--white); font-weight: 600; }
.hero { background: var(--panel); color: var(--on-panel); padding: 22px 20px; display: flex; flex-direction: column; gap: 20px; }
.hero h2 { font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
.hero .sub { color: var(--on-panel); opacity: .75; margin-top: 2px; font-size: 15px; }
.goal { height: 6px; background: rgba(23, 23, 21, .18); overflow: hidden; }
.goal i { display: block; height: 100%; background: var(--ink); transition: width .4s; }
.goal-label { font-size: 12px; font-weight: 600; letter-spacing: .06em; margin-top: 8px; }
@media (prefers-color-scheme: dark) { .goal { background: rgba(255,255,255,.2); } .goal i { background: var(--white); } .hero .btn { background: var(--white); color: var(--ink); } }

.track { display: flex; flex-direction: column; gap: 4px; }
.track-head { display: flex; align-items: baseline; gap: 12px; padding: 0 0 10px; border-bottom: 2px solid var(--fg); }
.track-head h3 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; flex: 1; }
.track-head p { font-size: 12px; font-weight: 600; letter-spacing: .1em; color: var(--muted); font-variant-numeric: tabular-nums; }
.lessons { display: flex; flex-direction: column; }
.lesson { display: flex; align-items: center; gap: 16px; padding: 16px 0; text-align: left; border-bottom: 1px solid var(--line); width: 100%; }
.lesson:active { background: var(--soft); }
.lesson .num { width: 34px; flex: none; font-size: 20px; font-weight: 300; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.lesson.next .num { color: var(--fg); font-weight: 700; }
.lesson.done .num { color: var(--good); }
.lesson .t { flex: 1; font-weight: 600; line-height: 1.3; }
.lesson .t small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; margin-top: 2px; }
.lesson.next .t::before { content: "Als Nächstes"; display: block; font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--fg); margin-bottom: 2px; }
.chip { padding: 3px 8px; box-shadow: inset 0 0 0 1px var(--fg); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.hint, .banner { background: var(--soft); padding: 14px 16px; font-size: 14px; display: flex; gap: 12px; align-items: flex-start; border-left: 3px solid var(--fg); }
.banner button { margin-left: auto; color: var(--muted); }

/* Tabbar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: var(--bg); border-top: 1px solid var(--fg); padding-bottom: env(safe-area-inset-bottom); }
.tabbar > div { display: flex; width: 100%; max-width: 520px; }
.tab { flex: 1; padding: 12px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); border-top: 3px solid transparent; margin-top: -1px; }
.tab.on { color: var(--fg); border-top-color: var(--fg); }

/* Fortschritt */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: var(--panel); color: var(--on-panel); padding: 18px 16px; }
.stat b { display: block; font-size: 38px; font-weight: 300; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.bars { display: flex; flex-direction: column; gap: 16px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: baseline; font-size: 14px; font-weight: 600; }
.bar-row .meter { grid-column: 1 / -1; height: 6px; background: var(--line); overflow: hidden; }
.bar-row .meter i { display: block; height: 100%; background: var(--fg); }
.bar-row em { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }

/* Lektion */
.session { flex: 1; display: flex; flex-direction: column; min-height: 100dvh; }
.s-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px 8px; }
.s-head .x { width: 40px; height: 40px; margin-left: -10px; display: flex; align-items: center; justify-content: center; }
.progress { flex: 1; height: 4px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--fg); transition: width .35s; }
.s-main { flex: 1; display: flex; flex-direction: column; gap: 22px; padding: 22px 20px; }
.say { display: flex; gap: 12px; align-items: center; }
.new-badge { align-self: flex-start; padding: 4px 10px; background: var(--ink); color: var(--white); font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.options { display: flex; flex-direction: column; gap: 10px; }
.opt { text-align: left; width: 100%; padding: 16px; box-shadow: inset 0 0 0 1.5px var(--line); background: var(--card); font-weight: 600; line-height: 1.35; }
.opt:active { box-shadow: inset 0 0 0 2px var(--fg); }
.opt.right { box-shadow: inset 0 0 0 2px var(--good); background: var(--good-soft); }
.opt.wrong { box-shadow: inset 0 0 0 2px var(--bad); background: var(--bad-soft); text-decoration: line-through; text-decoration-thickness: 1px; }
.opt[disabled] { pointer-events: none; }
.typebox { display: flex; flex-direction: column; gap: 12px; }
.typebox .field { font-size: 20px; }
.bubble { max-width: 88%; padding: 12px 16px; background: var(--soft); align-self: flex-start; font-weight: 500; }
.bubble.me { align-self: flex-end; background: var(--ink); color: var(--white); }
.bubble small { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.bubble.me small { color: var(--grey); }
.chat { display: flex; flex-direction: column; gap: 10px; }
.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.mic.rec .icon-btn { background: var(--bad); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(160, 58, 58, .5); } 70% { box-shadow: 0 0 0 20px rgba(160, 58, 58, 0); } 100% { box-shadow: 0 0 0 0 rgba(160, 58, 58, 0); } }
.status { min-height: 1.5em; color: var(--muted); text-align: center; font-size: 14px; }
.said { padding: 14px 16px; background: var(--soft); font-size: 19px; font-weight: 500; }
.w-ok { color: var(--good); font-weight: 700; }
.w-bad { color: var(--bad); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }

.fb { padding: 18px 20px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line); }
.fb.good { background: var(--good-soft); border-top-color: var(--good); }
.fb.bad { background: var(--bad-soft); border-top-color: var(--bad); }
.fb h3 { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.fb.good h3 { color: var(--good); }
.fb.bad h3 { color: var(--bad); }
.fb .answer { font-size: 18px; font-weight: 600; display: flex; gap: 12px; align-items: center; justify-content: space-between; }

/* Ergebnis */
.result { gap: 18px; align-items: flex-start; text-align: left; }
.result .big { font-size: 30px; }
.tip { text-align: left; background: var(--soft); padding: 16px; border-left: 3px solid var(--fg); width: 100%; }
.tip b { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }

/* KI-Gespräch */
.session.talk { flex: none; height: 100vh; height: 100dvh; min-height: 0; }  /* feste Höhe: nur der Verlauf scrollt, die Eingabeleiste bleibt unten */
.t-title { flex: 1; font-weight: 600; font-size: 16px; letter-spacing: -.005em; }
.goal-strip { margin: 0 20px; padding: 10px 14px; background: var(--panel); color: var(--on-panel); font-size: 13px; font-weight: 600; }
.chatlog { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 16px 20px; -webkit-overflow-scrolling: touch; }
.chatlog .bubble { max-width: 90%; }
.b-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.b-btn { padding: 7px 12px; box-shadow: inset 0 0 0 1.5px currentColor; font-weight: 700; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; display: inline-flex; align-items: center; gap: 6px; }
.b-btn svg.i { width: 16px; height: 16px; }
.b-de { display: block; margin-top: 10px; color: var(--muted); font-size: 14px; }
.talk-bar { padding: 10px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--fg); background: var(--bg); display: flex; flex-direction: column; gap: 10px; }
.talk-row { display: flex; align-items: flex-end; justify-content: space-around; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.talk-bar .typebox { flex-direction: row; }
.talk-bar .typebox .field { flex: 1; min-width: 0; font-size: 17px; }
.talk-bar .typebox .btn { width: auto; }
.hintcard { margin: 0 20px 10px; padding: 14px 16px; background: var(--soft); border-left: 3px solid var(--fg); }
.hintcard.bad { background: var(--bad-soft); border-left-color: var(--bad); }
.fb-list { margin: 4px 0 0; padding-left: 20px; }
.corr { padding: 12px 0; border-top: 1px solid var(--line); }
.corr:first-of-type { border-top: 0; }
.corr p { margin: 2px 0; }

/* Korrektur direkt unter dem eigenen Satz */
.corr-note { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.3); display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.corr-note .cn-better { font-weight: 700; }
.corr-note .cn-why { opacity: .85; font-size: 13px; }
.corr-note .b-btn { align-self: flex-start; margin-top: 6px; }
.corr-note.ok { flex-direction: row; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .8; border-top: 0; margin-top: 6px; padding-top: 0; }
.corr-note.ok svg.i { width: 16px; height: 16px; }
