:root {
  --bg: #f5f6fb;
  --card: #ffffff;
  --ink: #161a26;
  --muted: #5d6475;
  --line: #e4e7f0;
  --brand: #2f6fed;
  --brand-ink: #ffffff;
  --brand-soft: #e8efff;
  --sun: #ffb020;
  --sun-soft: #fff4dc;
  --ok: #1f9d63;
  --ok-soft: #e3f6ec;
  --warn: #c98a00;
  --warn-soft: #fff3d1;
  --bad: #e5484d;
  --bad-soft: #fde8e8;
  --pron: #7a3fe0;
  --shadow: 0 6px 24px rgba(22, 26, 38, .07);
  --r: 22px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1420; --card: #171d2b; --ink: #eef1f8; --muted: #a2a9ba; --line: #283044;
    --brand: #5b8dff; --brand-soft: #1c2a4d; --sun-soft: #3a2f14; --ok-soft: #12352a; --warn-soft: #3a3012;
    --bad-soft: #3d1c1f; --pron: #b48cff; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1420; --card: #171d2b; --ink: #eef1f8; --muted: #a2a9ba; --line: #283044;
  --brand: #5b8dff; --brand-soft: #1c2a4d; --sun-soft: #3a2f14; --ok-soft: #12352a; --warn-soft: #3a3012;
  --bad-soft: #3d1c1f; --pron: #b48cff; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 18px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
#app {
  max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 28px);
}
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: var(--brand); }

/* ---------- ümumi ---------- */
.card { background: var(--card); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.tiny { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }

.btn {
  appearance: none; border: 0; border-radius: 18px; min-height: 58px; padding: 0 20px;
  font-size: 18px; font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--brand-soft); color: var(--brand); transition: transform .08s ease, opacity .2s;
  user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.sun { background: var(--sun); color: #2b1d00; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.block { width: 100%; }
.btn.big { min-height: 68px; font-size: 20px; border-radius: 22px; }
.btn.icon { min-height: 48px; width: 48px; padding: 0; border-radius: 16px; font-size: 22px; }
.btn.rec { background: var(--bad); color: #fff; }
.btn.rec.on { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(229,72,77,.45);} 50% { box-shadow: 0 0 0 14px rgba(229,72,77,0);} }

.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.topbar .title { flex: 1; font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; flex: 1; }
.progress > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .35s ease; }

/* ---------- ana səhifə ---------- */
.hello { display: flex; align-items: center; gap: 12px; margin: 6px 0 16px; }
.hello h1 { font-size: 26px; line-height: 1.2; flex: 1; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; font-size: 15px; font-weight: 600; }
.today { background: linear-gradient(135deg, #2f6fed, #6a4ff0); color: #fff; border: 0; }
.today .muted { color: rgba(255,255,255,.82); }
.today .btn.primary { background: #fff; color: #2f4fd6; }
.today .btn { background: rgba(255,255,255,.18); color: #fff; }
.today .big-emoji { font-size: 54px; line-height: 1; }
.today h2 { font-size: 26px; line-height: 1.2; }
.banner { display: flex; gap: 14px; align-items: flex-start; }
.banner .em { font-size: 30px; line-height: 1; }
.banner.sun { background: var(--sun-soft); border-color: transparent; }
.banner.ok { background: var(--ok-soft); border-color: transparent; }
.steps { margin: 8px 0 0; padding-left: 20px; }
.steps li { margin: 4px 0; }

.lessons { display: grid; gap: 8px; }
.lrow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); cursor: pointer; }
.lrow .em { font-size: 26px; width: 34px; text-align: center; }
.lrow .t { flex: 1; min-width: 0; }
.lrow .t b { display: block; font-size: 17px; }
.lrow .t span { font-size: 14px; color: var(--muted); }
.lrow.done { opacity: .7; }
.lrow.cur { border: 2px solid var(--brand); }
.section-title { font-size: 15px; font-weight: 700; color: var(--muted); margin: 22px 4px 10px; }

/* ---------- cümlə kartı ---------- */
.phrase { text-align: center; padding: 26px 20px; }
.phrase .em { font-size: 64px; line-height: 1; margin-bottom: 10px; }
.phrase .en { font-size: 32px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; }
.phrase .pron { font-size: 21px; color: var(--pron); font-weight: 650; margin-top: 8px; }
.phrase .pron small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 1px; }
.phrase .az { font-size: 19px; color: var(--muted); margin-top: 8px; }
.words { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 14px; }
.word { background: var(--brand-soft); color: var(--ink); border-radius: 12px; padding: 4px 10px; font-size: 15px; }
.word b { color: var(--brand); }
.tip { display: flex; gap: 10px; text-align: left; background: var(--sun-soft); border-radius: 16px; padding: 12px 14px; margin-top: 16px; font-size: 16px; }
.tip .em { font-size: 22px; margin: 0; }
.listen { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.result { border-radius: 18px; padding: 14px 16px; text-align: center; }
.result.s3 { background: var(--ok-soft); }
.result.s2 { background: var(--ok-soft); }
.result.s1 { background: var(--warn-soft); }
.result.s0 { background: var(--bad-soft); }
.stars { font-size: 30px; letter-spacing: 4px; }
.target { font-size: 22px; font-weight: 750; margin: 6px 0; }
.target .w { padding: 0 2px; border-radius: 6px; }
.target .ok { color: var(--ok); }
.target .close { color: var(--warn); }
.target .miss { color: var(--bad); text-decoration: underline wavy; text-underline-offset: 4px; }
.heard { font-size: 15px; color: var(--muted); }
.meter { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 10px; }
.meter > i { display: block; height: 100%; width: 0; background: var(--bad); transition: width .05s linear; }

/* ---------- dialoq ---------- */
.chat { display: grid; gap: 10px; }
.bub { max-width: 86%; padding: 10px 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); cursor: pointer; }
.bub .e { font-weight: 700; font-size: 18px; }
.bub .p { color: var(--pron); font-size: 15px; }
.bub .a { color: var(--muted); font-size: 14px; }
.bub.me { justify-self: end; background: var(--brand-soft); border-color: transparent; }
.bub.active { outline: 3px solid var(--sun); }
.who { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }

/* ---------- lego ---------- */
.lego-pattern { font-size: 26px; font-weight: 800; text-align: center; padding: 14px; border-radius: 18px; background: var(--sun-soft); }
.lego-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--bg); cursor: pointer; }
.lego-item b { display: block; font-size: 19px; }
.lego-item .p { color: var(--pron); font-size: 15px; }
.lego-item .a { color: var(--muted); font-size: 14px; }

/* ---------- maşın rejimi ---------- */
.car { min-height: calc(100dvh - 120px); display: flex; flex-direction: column; gap: 16px; }
.car .stage { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 10px; padding: 26px 18px; }
.car .stage .em { font-size: 72px; line-height: 1; }
.car .stage .cue-k { font-size: 16px; font-weight: 750; color: var(--brand); }
.car .stage .cue-k.say { color: var(--bad); }
.car .stage .cue-k.think { color: var(--warn); }
.car .stage .en { font-size: 34px; font-weight: 800; line-height: 1.15; }
.car .stage .pron { font-size: 21px; color: var(--pron); font-weight: 650; }
.car .stage .az { font-size: 21px; color: var(--muted); }
.car .ctrls { display: flex; align-items: center; justify-content: center; gap: 14px; }
.car .ctrls .play { width: 92px; height: 92px; border-radius: 50%; font-size: 38px; }
.car input[type=range] { width: 100%; accent-color: var(--brand); }

/* ---------- formalar ---------- */
.field { display: grid; gap: 6px; }
.field label { font-weight: 650; font-size: 15px; }
input[type=text], input[type=time], select {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  min-height: 52px; padding: 0 14px; width: 100%;
}
.seg { display: grid; grid-auto-flow: column; gap: 6px; background: var(--bg); padding: 5px; border-radius: 16px; }
.seg button { border: 0; background: transparent; border-radius: 12px; min-height: 44px; font-weight: 650; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--brand); box-shadow: var(--shadow); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.slots { display: flex; flex-wrap: wrap; gap: 6px; }
.slots span { background: var(--bg); border-radius: 10px; padding: 3px 9px; font-size: 14px; font-variant-numeric: tabular-nums; }
.slots span.sent { opacity: .45; text-decoration: line-through; }

/* ---------- onboarding / bitiş ---------- */
.hero { text-align: center; padding: 30px 8px 10px; }
.hero .em { font-size: 84px; line-height: 1; }
.hero h1 { font-size: 30px; margin-top: 14px; line-height: 1.2; }
.hero p { margin-top: 10px; color: var(--muted); }
.how { display: grid; gap: 10px; }
.how > div { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; font-size: 16px; }
.how > div > span { font-size: 26px; line-height: 1; }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti i { position: absolute; top: -40px; font-style: normal; font-size: 28px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translate(-50%, 140%);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 16px; font-size: 16px; max-width: calc(100% - 32px);
  transition: transform .25s ease; z-index: 10; text-align: center;
}
#toast.show { transform: translate(-50%, 0); }

.fade-in { animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
