: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; } }

/* ================= Emma kartları ================= */
.emma-card {
  appearance: none; border: 0; text-align: left; cursor: pointer; width: 100%;
  display: flex; align-items: center; gap: 12px; padding: 14px 16px 14px 8px; border-radius: 26px; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, #4b2fd6 0%, #2a1b6e 45%, #120d33 100%);
  box-shadow: 0 14px 40px rgba(60, 30, 180, .35); position: relative; overflow: hidden;
}
.emma-card::after { content: ''; position: absolute; inset: 0; background: radial-gradient(60% 80% at 100% 0%, rgba(255,170,120,.28), transparent 60%); pointer-events: none; }
.emma-card .emma-mini { width: 108px; height: 108px; flex: none; }
.emma-card .t { display: grid; gap: 4px; position: relative; z-index: 1; }
.emma-card small { font-size: 12px; font-weight: 800; letter-spacing: .04em; color: #ffcf9e; }
.emma-card b { font-size: 21px; line-height: 1.2; }
.emma-card span { font-size: 14.5px; color: rgba(255,255,255,.78); line-height: 1.35; }
.emma-hero {
  display: flex; align-items: center; gap: 10px; color: #fff; padding: 10px 16px 10px 4px; border-radius: 26px;
  background: radial-gradient(120% 140% at 0% 0%, #4b2fd6 0%, #2a1b6e 45%, #120d33 100%);
}
.emma-hero .emma-mini { width: 128px; height: 128px; flex: none; }
.emma-hero h2 { font-size: 22px; }
.emma-hero p { font-size: 15px; color: rgba(255,255,255,.8); margin-top: 4px; }
.scen-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scen {
  appearance: none; border: 1px solid var(--line); background: var(--card); border-radius: 20px; padding: 14px; text-align: left; cursor: pointer;
  display: grid; gap: 4px; box-shadow: var(--shadow); transition: transform .08s;
}
.scen:active { transform: scale(.97); }
.scen.wide { grid-column: 1 / -1; background: linear-gradient(135deg, var(--brand-soft), var(--card)); border-color: var(--brand); }
.scen .em { font-size: 30px; line-height: 1; }
.scen b { font-size: 17px; }
.scen small { font-size: 13.5px; color: var(--muted); }

/* ================= Zəng ekranı ================= */
body.in-call { background: #0b0a24; overflow: hidden; }
body.in-call #app { max-width: none; padding: 0; }
.call {
  position: fixed; inset: 0; display: flex; flex-direction: column; color: #fff; overflow: hidden;
  background: radial-gradient(130% 90% at 50% 0%, #2b1f7a 0%, #140f3f 45%, #07061a 100%);
  padding: calc(env(safe-area-inset-top) + 8px) 16px calc(env(safe-area-inset-bottom) + 12px);
}
.aurora { position: absolute; inset: -20%; pointer-events: none; filter: blur(60px); opacity: .55; }
.aurora i { position: absolute; width: 55vmax; height: 55vmax; border-radius: 50%; mix-blend-mode: screen; animation: drift 18s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { background: #5b3cff; left: -10%; top: -5%; }
.aurora i:nth-child(2) { background: #ff7a59; right: -15%; top: 20%; animation-duration: 23s; opacity: .55; }
.aurora i:nth-child(3) { background: #18c7b0; left: 10%; bottom: -25%; animation-duration: 27s; opacity: .45; }
@keyframes drift { from { transform: translate(0,0) scale(1); } to { transform: translate(6vmax, -4vmax) scale(1.15); } }
.call > *:not(.aurora) { position: relative; z-index: 1; }
.call-top { display: flex; align-items: center; gap: 10px; max-width: 560px; width: 100%; margin: 0 auto; }
.cround { appearance: none; border: 0; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }
.call-title { flex: 1; text-align: center; display: grid; }
.call-title b { font-size: 17px; }
.call-title span { font-size: 13px; color: rgba(255,255,255,.65); font-variant-numeric: tabular-nums; }
.call-stage { flex: 1 1 auto; min-height: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.call-stage .emma { width: min(78vw, 330px); height: min(78vw, 330px); max-height: 38vh; aspect-ratio: 1; }
.call-status { margin-top: -6px; font-size: 15px; font-weight: 650; color: rgba(255,255,255,.85); background: rgba(255,255,255,.08); padding: 6px 14px; border-radius: 99px; }
.call-cap, .call-bar, .call-you { max-width: 560px; width: 100%; margin-left: auto; margin-right: auto; }
.call-cap {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 24px; padding: 16px 18px;
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); text-align: center; display: grid; gap: 6px;
  max-height: 36vh; overflow-y: auto;
}
.call-cap.pop { animation: pop .35s ease; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: .4; } to { transform: none; opacity: 1; } }
.cap-start { display: grid; gap: 14px; }
.cap-az { font-size: 16.5px; color: rgba(255,255,255,.82); line-height: 1.4; transition: color .2s; }
.cap-az.on { color: #fff; }
.cap-label { font-size: 13px; font-weight: 750; color: #ffcf9e; margin-top: 4px; }
.cap-en { font-size: 30px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; }
.cap-en span { color: rgba(255,255,255,.55); transition: color .12s, text-shadow .12s; }
.cap-en span.past { color: #fff; }
.cap-en span.on { color: #ffd27a; text-shadow: 0 0 18px rgba(255,190,90,.65); }
.cap-pron { font-size: 19px; font-weight: 650; color: #c9b4ff; }
.cap-tr { font-size: 15px; color: rgba(255,255,255,.6); }
.cap-say { margin-top: 6px; display: grid; gap: 2px; padding: 10px 12px; border-radius: 16px; background: rgba(72,226,200,.12); border: 1px solid rgba(72,226,200,.35); }
.cap-say small { font-size: 12.5px; font-weight: 750; color: #7ff0dc; }
.cap-say b { font-size: 22px; }
.cap-say .p { color: #c9b4ff; font-weight: 650; }
.cap-say .a { color: rgba(255,255,255,.6); font-size: 14px; }
.cap-fix { font-size: 14px; background: rgba(255,208,92,.14); border: 1px solid rgba(255,208,92,.35); color: #ffe7a8; border-radius: 14px; padding: 7px 10px; }
.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%,100% { box-shadow: none; } 30% { box-shadow: 0 0 0 4px rgba(255,208,92,.7); } }
.call-go { background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; box-shadow: 0 10px 30px rgba(34,197,94,.45); }
.call-you { min-height: 34px; display: flex; justify-content: flex-end; margin-top: 8px; }
.you-bub { background: rgba(91,141,255,.25); border: 1px solid rgba(91,141,255,.45); padding: 7px 12px; border-radius: 16px 16px 4px 16px; font-size: 15px; max-width: 85%; }
.you-bub small { display: block; font-size: 11px; color: rgba(255,255,255,.6); font-weight: 700; }
.you-stars { margin-left: 6px; }
.call-bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 8px; padding: 8px; border-radius: 26px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.cbtn { appearance: none; border: 0; background: transparent; color: #fff; display: grid; justify-items: center; gap: 2px; padding: 6px 0; border-radius: 18px; cursor: pointer; }
.cbtn span { font-size: 24px; line-height: 1; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.1); }
.cbtn small { font-size: 11.5px; color: rgba(255,255,255,.75); font-weight: 600; }
.cbtn:active span { transform: scale(.92); }
.cbtn.mic span { width: 60px; height: 60px; margin-top: -10px; background: linear-gradient(135deg, #5b8dff, #7c4dff); box-shadow: 0 8px 24px rgba(91,141,255,.5); }
.cbtn.mic.on span { background: linear-gradient(135deg, #18c7b0, #0ea5e9); animation: pulse2 1.2s ease-in-out infinite; }
@keyframes pulse2 { 0%,100% { box-shadow: 0 0 0 0 rgba(24,199,176,.6); } 50% { box-shadow: 0 0 0 14px rgba(24,199,176,0); } }
.cbtn.end span { background: #e5484d; transform: rotate(135deg); }
@media (max-height: 700px) { .call-stage .emma { max-height: 30vh; } .cap-en { font-size: 25px; } .call-cap { max-height: 40vh; } }
