/* Fala! PTBR — Designsystem
   Ein einziger Satz Tokens, danach nur noch Komponenten. Keine externen
   Schriften oder CDNs: alles läuft lokal und offline. */

:root {
  --ink:        #16162A;
  --ink-2:      #45455F;
  --ink-3:      #7B7B95;
  --line:       #E6E2DA;
  --line-2:     #F1EEE8;
  --bg:         #FBF9F5;
  --card:       #FFFFFF;
  --accent:     #00A06A;
  --accent-2:   #007A50;
  --accent-bg:  #E3F5EC;
  --amber:      #E8930C;
  --amber-bg:   #FDF1DC;
  --blue:       #2F63D8;
  --blue-bg:    #E7EEFC;
  --coral:      #DD4B57;
  --coral-bg:   #FCE9EA;
  --violet:     #6E4BD8;
  --violet-bg:  #EDE8FC;
  --radius:     16px;
  --radius-sm:  10px;
  --shadow:     0 1px 2px rgba(22,22,42,.05), 0 8px 24px -12px rgba(22,22,42,.18);
  --shadow-lg:  0 2px 6px rgba(22,22,42,.06), 0 24px 48px -20px rgba(22,22,42,.28);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #F2F0EC; --ink-2: #B9B7C6; --ink-3: #86849A;
    --line: #2C2C42; --line-2: #23233A;
    --bg: #101021; --card: #191930;
    --accent: #2ECC94; --accent-2: #6FE3B7; --accent-bg: #123528;
    --amber: #F0AE3F; --amber-bg: #3A2C10;
    --blue: #7FA5F5; --blue-bg: #1A2444;
    --coral: #F0808A; --coral-bg: #3B1C21;
    --violet: #A78BFA; --violet-bg: #261C46;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-lg: 0 2px 6px rgba(0,0,0,.45), 0 24px 48px -20px rgba(0,0,0,.7);
  }
}

* , *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 28px; letter-spacing: -.02em; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-bg); }

/* ── Struktur ─────────────────────────────────────────── */
.app { min-height: 100%; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 940px; margin: 0 auto; padding: 0 20px; }
main { flex: 1; padding: 28px 0 40px; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -.02em; font-size: 17px; }
.brand-dot {
  width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), var(--blue)); color: #fff; font-size: 13px; font-weight: 800;
}
.brand em { font-style: normal; color: var(--accent); }
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav button {
  border: 0; background: none; color: var(--ink-2); font-weight: 600; font-size: 14px;
  padding: 7px 11px; border-radius: 9px; white-space: nowrap;
}
.nav button:hover { background: var(--line-2); color: var(--ink); }
.nav button[data-on="1"] { background: var(--ink); color: var(--bg); }
.meters { display: flex; gap: 8px; margin-left: auto; }
.meter {
  display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: 13px;
  padding: 5px 11px; border-radius: 999px; background: var(--card); border: 1px solid var(--line);
}

.tabbar { display: none; }

/* ── Bausteine ────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card-flat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.grid3 { display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); }
.grid4 { display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr); }
.muted { color: var(--ink-3); }
.dim   { color: var(--ink-2); }
.small { font-size: 13px; }
.tiny  { font-size: 12px; }
.center { text-align: center; }
.mono { font-family: var(--mono); font-size: 12.5px; }

.eyebrow {
  font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3);
}

.pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px;
  background: var(--line-2); color: var(--ink-2); white-space: nowrap;
}
.pill-accent { background: var(--accent-bg); color: var(--accent-2); }
.pill-amber  { background: var(--amber-bg);  color: var(--amber); }
.pill-blue   { background: var(--blue-bg);   color: var(--blue); }
.pill-coral  { background: var(--coral-bg);  color: var(--coral); }
.pill-violet { background: var(--violet-bg); color: var(--violet); }

.btn {
  border: 1px solid transparent; background: var(--ink); color: var(--bg);
  font-weight: 700; font-size: 15px; padding: 11px 18px; border-radius: 12px;
  transition: transform .06s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--line-2); filter: none; }
.btn-quiet { background: var(--line-2); color: var(--ink-2); border-color: transparent; }
.btn-sm { padding: 7px 13px; font-size: 13.5px; border-radius: 9px; }
.btn-lg { padding: 14px 22px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }

.field {
  width: 100%; background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: 16px;
}
.field:focus { border-color: var(--accent); }
textarea.field { min-height: 110px; resize: vertical; line-height: 1.5; }

.bar { height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .35s ease; }
.bar-amber > i { background: var(--amber); }
.bar-blue  > i { background: var(--blue); }

.dots { display: flex; gap: 6px; flex-wrap: wrap; }
.dot {
  width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink-3); font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}
.dot[data-on="1"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.dot[data-done="1"] { background: var(--accent-bg); color: var(--accent-2); border-color: transparent; }

/* ── Wochen ───────────────────────────────────────────── */
.week-hero {
  background: linear-gradient(150deg, var(--card), color-mix(in srgb, var(--accent-bg) 55%, var(--card)));
  border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow);
}
.unit {
  display: flex; gap: 14px; align-items: center; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); transition: transform .08s ease, box-shadow .2s ease;
}
.unit:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.unit[data-locked="1"] { opacity: .55; box-shadow: none; }
.unit-icon {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  font-size: 19px; flex: none; background: var(--line-2);
}
.unit-body { flex: 1; min-width: 0; }
.unit-title { font-weight: 700; font-size: 15.5px; }

.wk {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px;
}
.wk:hover { border-color: var(--ink-3); }
.wk-n {
  width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; background: var(--line-2); color: var(--ink-2);
}
.wk[data-status="COMPLETED"] .wk-n { background: var(--accent); color: #fff; }
.wk[data-status="READY_FOR_EXAM"] .wk-n { background: var(--amber); color: #fff; }
.wk[data-status="IN_PROGRESS"] .wk-n { background: var(--blue); color: #fff; }
.wk[data-status="LOCKED"] { opacity: .55; }

/* ── Aufgaben ─────────────────────────────────────────── */
.task-card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 26px; box-shadow: var(--shadow-lg); }
.task-prompt { font-size: 22px; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
.opt {
  display: block; width: 100%; text-align: left; background: var(--card);
  border: 1.5px solid var(--line); border-radius: 13px; padding: 13px 16px;
  font-size: 16px; font-weight: 600; transition: border-color .12s ease, background .12s ease;
}
.opt:hover { border-color: var(--ink-3); }
.opt[data-state="right"] { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-2); }
.opt[data-state="wrong"] { border-color: var(--coral); background: var(--coral-bg); color: var(--coral); }
.chip {
  border: 1.5px solid var(--line); background: var(--card); border-radius: 11px;
  padding: 9px 14px; font-size: 16px; font-weight: 600;
}
.chip:hover { border-color: var(--ink-3); }
.chip[data-used="1"] { opacity: .3; pointer-events: none; }
.slot {
  min-height: 56px; border: 1.5px dashed var(--line); border-radius: 13px; padding: 9px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; background: var(--bg);
}
.verdict { border-radius: 14px; padding: 14px 16px; font-weight: 600; }
.verdict-ok { background: var(--accent-bg); color: var(--accent-2); }
.verdict-no { background: var(--coral-bg); color: var(--coral); }

/* ── Listen ───────────────────────────────────────────── */
.list { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.list > * { background: var(--card); padding: 12px 15px; }
.list-head { background: var(--line-2) !important; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.lrow { display: grid; gap: 12px; align-items: center; }

/* ── Audio ────────────────────────────────────────────── */
.player { display: flex; align-items: center; gap: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.play {
  width: 46px; height: 46px; border-radius: 50%; border: 0; flex: none;
  background: var(--ink); color: var(--bg); font-size: 16px; display: grid; place-items: center;
}
.seek { flex: 1; height: 6px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; }
.seek > i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--accent); }

/* ── Toast ────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 90;
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 12px;
  font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); max-width: 90vw;
}

/* ── Auth ─────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; }

/* ── Konfetti ─────────────────────────────────────────── */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.confetti i { position: absolute; width: 8px; height: 12px; border-radius: 2px; animation: fall 1.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: 0; } }

/* ── Mobil ────────────────────────────────────────────── */
@media (max-width: 860px) {
  .grid3 { grid-template-columns: 1fr 1fr; }
  .nav { display: none; }
  main { padding-bottom: 96px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar button {
    border: 0; background: none; color: var(--ink-3); font-size: 10.5px; font-weight: 700;
    display: grid; gap: 2px; justify-items: center; padding: 6px 2px; border-radius: 10px;
  }
  .tabbar button b { font-size: 17px; font-weight: 400; line-height: 1; }
  .tabbar button[data-on="1"] { color: var(--accent); }
}
@media (max-width: 620px) {
  h1 { font-size: 23px; }
  .wrap { padding: 0 15px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .task-card { padding: 20px; border-radius: 16px; }
  .task-prompt { font-size: 19px; }
  .hide-s { display: none; }
}
