/* ==========================================================================
   Taapp — design system
   Neutral surfaces, one accent, Inter. Phone: top bar + tab bar.
   Desktop (≥960px): sidebar navigation + centred content column.
   ========================================================================== */
:root {
  --bg: #f6f6f7;
  --surface: #ffffff;
  --surface-2: #f1f1f3;
  --surface-3: #e9e9ec;
  --border: #e4e4e8;
  --border-strong: #d2d2d8;
  --ink: #0f1014;
  --ink-2: #50525c;
  --ink-3: #8b8d96;
  --accent: #3557f5;
  --accent-hover: #2847e0;
  --accent-soft: #edf0ff;
  --accent-ink: #ffffff;
  --live: #e5484d;
  --live-soft: #feeceb;
  --ok: #18794e;
  --ok-soft: #e6f6ed;
  --warn: #a35200;
  --mark: #fff3cf;
  --mark-ink: #6b4400;
  --shadow-sm: 0 1px 2px rgba(16, 18, 24, .06);
  --shadow: 0 1px 2px rgba(16, 18, 24, .05), 0 6px 20px -6px rgba(16, 18, 24, .12);
  --shadow-lg: 0 24px 60px -12px rgba(16, 18, 24, .28);
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --ts: 1;
  --font: "Inter", "Noto Sans Georgian", "Noto Sans Armenian", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sidebar: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0f; --surface: #15151a; --surface-2: #1c1c22; --surface-3: #25252d;
    --border: #25252d; --border-strong: #34343e;
    --ink: #f3f3f5; --ink-2: #b0b1ba; --ink-3: #747682;
    --accent: #7d93ff; --accent-hover: #93a6ff; --accent-soft: #1c2142; --accent-ink: #0b1030;
    --live: #ff6369; --live-soft: #3a1618; --ok: #4cc38a; --ok-soft: #13291e; --warn: #f1a10d;
    --mark: #3a2f10; --mark-ink: #ffd982;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -8px rgba(0,0,0,.6); --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0c0f; --surface: #15151a; --surface-2: #1c1c22; --surface-3: #25252d;
  --border: #25252d; --border-strong: #34343e;
  --ink: #f3f3f5; --ink-2: #b0b1ba; --ink-3: #747682;
  --accent: #7d93ff; --accent-hover: #93a6ff; --accent-soft: #1c2142; --accent-ink: #0b1030;
  --live: #ff6369; --live-soft: #3a1618; --ok: #4cc38a; --ok-soft: #13291e; --warn: #f1a10d;
  --mark: #3a2f10; --mark-ink: #ffd982;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -8px rgba(0,0,0,.6); --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: .45; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 24px; height: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ───────── Shell ───────── */
.app { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr) auto; height: 100dvh; }
.sidebar { display: none; }
.topbar {
  height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0 16px;
  display: flex; align-items: center; gap: 6px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border); position: relative; z-index: 5;
}
.topbar .title { font-weight: 650; font-size: 17px; letter-spacing: -.015em; display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .spacer { flex: 1; }
.view { min-height: 0; min-width: 0; overflow: hidden; position: relative; display: flex; flex-direction: column; }
.tabbar {
  display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.tabbar button { height: 52px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 550; color: var(--ink-3); }
.tabbar button .pill { width: 52px; height: 28px; border-radius: 14px; display: grid; place-items: center; transition: background .15s; }
.tabbar button.on { color: var(--ink); }
.tabbar button.on .pill { background: var(--accent-soft); color: var(--accent); }

.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: var(--bg); display: grid; place-items: center; flex: none; }
.logo svg { width: 18px; height: 18px; }
.brandname { font-weight: 700; letter-spacing: -.02em; font-size: 17px; }

.live-pill { display: none; align-items: center; gap: 8px; height: 30px; padding: 0 12px 0 10px; border-radius: 15px; background: var(--live-soft); color: var(--live); font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: blink 1.2s infinite; }
body.listening .live-pill { display: inline-flex; }
@keyframes blink { 50% { opacity: .3; } }
.net-off { display: none; align-items: center; gap: 6px; color: var(--live); font-size: 12.5px; font-weight: 600; padding: 0 6px; }
body.offline .net-off { display: inline-flex; }

@media (min-width: 960px) {
  .app { grid-template-columns: var(--sidebar) minmax(0,1fr); grid-template-rows: auto minmax(0,1fr); }
  .sidebar {
    display: flex; flex-direction: column; grid-row: 1 / span 2; border-right: 1px solid var(--border); background: var(--surface);
    padding: 18px 12px 14px; gap: 4px; overflow-y: auto;
  }
  .sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 18px; }
  .sidebar nav { display: flex; flex-direction: column; gap: 2px; }
  .sidebar nav button { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px; color: var(--ink-2); font-weight: 550; font-size: 14px; text-align: start; }
  .sidebar nav button:hover { background: var(--surface-2); color: var(--ink); }
  .sidebar nav button.on { background: var(--accent-soft); color: var(--accent); }
  .sidebar .grow { flex: 1; }
  .sidebar .side-card { border: 1px solid var(--border); border-radius: var(--r); padding: 12px; margin: 8px 0; background: var(--bg); }
  .sidebar .side-card .k { font-size: 11.5px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
  .tabbar { display: none; }
  .topbar { grid-column: 2; padding: 0 20px 0 28px; height: 64px; background: transparent; backdrop-filter: none; border-bottom: 1px solid var(--border); }
  .topbar .brand-m { display: none; }
  .topbar .title { font-size: 19px; }
  .view { grid-column: 2; }
}
@media (max-width: 959px) { .topbar .page-t { display: none; } }

/* ───────── Layout helpers ───────── */
.scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; scroll-behavior: smooth; overscroll-behavior: contain; }
.container { width: 100%; max-width: 760px; margin: 0 auto; padding: 16px; }
@media (min-width: 960px) { .container { padding: 24px 32px; } }
.row { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.center { text-align: center; }
.gap-lg { gap: 16px; }
.section-t { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); margin: 28px 0 10px; }
.section-t:first-child { margin-top: 4px; }
.h1 { font-size: 26px; font-weight: 700; letter-spacing: -.025em; line-height: 1.2; margin: 0; }
.h2 { font-size: 18px; font-weight: 650; letter-spacing: -.015em; margin: 0; }

/* ───────── Buttons ───────── */
.btn {
  height: 40px; padding: 0 16px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 14px; white-space: nowrap; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s; box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(53, 87, 245, .3); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--live); }
.btn.lg { height: 48px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; display: inline-grid; place-items: center; color: var(--ink-2); transition: background .15s, color .15s; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn.on { color: var(--accent); }
.icon-btn.fav { color: #e2a100; }
.sos-btn { height: 32px; padding: 0 12px; border-radius: 16px; background: var(--live-soft); color: var(--live); font-weight: 700; font-size: 12.5px; letter-spacing: .06em; display: inline-flex; align-items: center; gap: 6px; }
.sos-btn:hover { filter: brightness(.97); }

/* Chips & toggles */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--border); background: var(--surface); display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 550; color: var(--ink-2); white-space: nowrap; flex: none; transition: all .15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--ink); }
.chip.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip svg.i { width: 16px; height: 16px; }
.talk-mid .chip { max-width: 38vw; overflow: hidden; } .talk-mid .chip span, .talk-mid .chip { text-overflow: ellipsis; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--surface-2); color: var(--ink-2); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); gap: 2px; }
.seg button { height: 34px; padding: 0 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg.block { display: flex; } .seg.block button { flex: 1; justify-content: center; }

/* Inputs */
.field { margin-bottom: 16px; }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; line-height: 1.45; }
.input, .select, .textarea {
  width: 100%; height: 44px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 10px; padding: 0 14px; font-size: 15px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 120px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8d96' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 18px; height: 18px; }
.search .input { padding-left: 40px; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 13px; background: var(--surface-3); transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Cards & lists */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card.pad { padding: 16px; }
.group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.group > * + * { border-top: 1px solid var(--border); }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; width: 100%; text-align: start; }
button.item:hover, a.item:hover { background: var(--surface-2); }
.item .ic { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.item .ic.accent { background: var(--accent-soft); color: var(--accent); }
.item .t { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .chev { color: var(--ink-3); }
.empty { text-align: center; padding: 48px 24px; color: var(--ink-3); }
.empty .ico { width: 56px; height: 56px; border-radius: 16px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 14px; color: var(--ink-2); }
.empty .t { color: var(--ink); font-weight: 650; font-size: 16px; margin-bottom: 4px; }

/* ───────── Language pair ───────── */
.pair { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 5px; box-shadow: var(--shadow-sm); }
.pair .side { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 6px 12px; border-radius: 11px; min-width: 0; height: 52px; text-align: start; transition: background .15s; }
.pair .side:hover { background: var(--surface-2); }
.pair .side.r { align-items: flex-end; text-align: end; }
.pair .cap { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.pair .val { font-size: 15.5px; font-weight: 650; display: flex; align-items: center; gap: 6px; max-width: 100%; }
.pair .val span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pair .val .tag { height: 18px; font-size: 10.5px; padding: 0 6px; }
.pair .swap { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); transition: transform .25s, background .15s; }
.pair .swap:hover { background: var(--surface-3); color: var(--ink); }
.pair .swap:active { transform: rotate(180deg); }

/* ───────── Transcript ───────── */
.listen-head { padding: 12px 16px 8px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--border); background: var(--bg); }
@media (min-width: 960px) { .listen-head { padding: 16px 32px 12px; } .listen-head > * { width: 100%; max-width: 696px; margin: 0 auto; } }
.feed { display: flex; flex-direction: column; gap: 12px; padding-bottom: 200px; }
.utt { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px 10px; box-shadow: var(--shadow-sm); position: relative; }
.utt.fresh { animation: rise .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.utt.me { background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.utt .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); margin-bottom: 6px; min-height: 22px; }
.utt .meta .spk { font-weight: 650; }
.spk[data-n="1"] { color: #0f7b6c; } .spk[data-n="2"] { color: #8e4ec6; } .spk[data-n="3"] { color: #c2410c; } .spk[data-n="4"] { color: #2563eb; }
.utt .src { font-size: calc(15px * var(--ts)); color: var(--ink-2); line-height: 1.55; }
.utt .src .w { cursor: pointer; border-radius: 4px; transition: background .12s; }
.utt .src .w:hover { background: var(--accent-soft); color: var(--accent); }
.utt .src .w.low { text-decoration: underline dotted color-mix(in srgb, var(--warn) 80%, transparent) 2px; text-underline-offset: 4px; }
.utt .tr { font-size: calc(21px * var(--ts)); font-weight: 550; line-height: 1.4; letter-spacing: -.012em; margin-top: 8px; color: var(--ink); }
.utt .tr.wait { color: var(--ink-3); font-weight: 450; }
.utt .tr mark { background: var(--mark); color: var(--mark-ink); border-radius: 4px; padding: 0 3px; }
.utt .tl { font-size: calc(14px * var(--ts)); color: var(--ink-3); margin-top: 4px; font-style: italic; }
.utt .notes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.note { font-size: 12.5px; padding: 4px 10px; border-radius: 12px; background: var(--mark); color: var(--mark-ink); font-weight: 500; }
.note.idiom { background: var(--accent-soft); color: var(--accent); }
.utt .bar { display: flex; align-items: center; gap: 4px; margin: 10px -6px 0; }
.utt .bar .play { height: 32px; padding: 0 12px 0 10px; border-radius: 16px; background: var(--surface-2); color: var(--ink); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.utt .bar .play:hover { background: var(--surface-3); }
.utt .bar .play svg { width: 16px; height: 16px; }
.skeleton { height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; margin-top: 12px; }
.skeleton + .skeleton { width: 60%; margin-top: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.live-utt { border: 1.5px dashed color-mix(in srgb, var(--live) 45%, var(--border)); background: var(--surface); }
.live-utt .meta { color: var(--live); font-weight: 600; }
.live-utt .meta i { width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: blink 1.2s infinite; }
.live-utt .src { color: var(--ink); }
.live-utt .tr { color: var(--ink-2); font-weight: 500; }

/* Hero (empty listen) */
.hero { text-align: center; padding: 40px 12px 24px; }
@media (max-width: 600px) { .hero { padding: 20px 4px 12px; } .hero .rings { width: 92px; height: 92px; margin-bottom: 16px; } .hero h2 { font-size: 20px; } .quick { margin-top: 20px; gap: 8px; } .quick button { padding: 12px 6px; font-size: 12.5px; } }
.hero .rings { width: 120px; height: 120px; margin: 0 auto 22px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, var(--accent-soft) 0 60%, transparent 61%), radial-gradient(circle, color-mix(in srgb, var(--accent-soft) 50%, transparent) 0 100%); color: var(--accent); }
.hero .rings svg { width: 40px; height: 40px; stroke-width: 1.6; }
.hero h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 8px; }
.hero p { color: var(--ink-2); margin: 0 auto; max-width: 420px; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 28px; }
.quick button { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); transition: all .15s; }
.quick button:hover { border-color: var(--border-strong); color: var(--ink); box-shadow: var(--shadow); }
.quick button .ic { width: 38px; height: 38px; border-radius: 11px; background: var(--surface-2); display: grid; place-items: center; color: var(--accent); }

/* Mic dock */
.dock { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 16px 20px; display: flex; justify-content: center; align-items: center; pointer-events: none; background: linear-gradient(to top, var(--bg) 55%, transparent); }
.dock > * { pointer-events: auto; }
.dock-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%; max-width: 520px; gap: 12px; }
.dock-inner .l { justify-self: start; } .dock-inner .r { justify-self: end; }
.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.mic { width: 76px; height: 76px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; position: relative; box-shadow: 0 10px 30px -6px color-mix(in srgb, var(--accent) 60%, transparent); transition: transform .12s, background .2s; }
.mic svg { width: 30px; height: 30px; stroke-width: 2; }
.mic:hover { background: var(--accent-hover); }
.mic:active { transform: scale(.95); }
.mic.on { background: var(--live); color: #fff; box-shadow: 0 10px 30px -6px color-mix(in srgb, var(--live) 60%, transparent); }
.mic.on svg { fill: currentColor; width: 22px; height: 22px; }
.mic .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--live); opacity: 0; pointer-events: none; }
.mic.on .ring { opacity: .35; transform: scale(var(--lv, 1)); transition: transform .08s linear; }
.mic.on .ring.r2 { opacity: .15; transform: scale(calc(var(--lv, 1) * 1.18)); }
.mic.busy::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2.5px solid transparent; border-top-color: var(--accent); animation: spin .8s linear infinite; }
.mic-status { font-size: 12.5px; color: var(--ink-3); font-weight: 550; height: 18px; white-space: nowrap; }
@keyframes spin { to { transform: rotate(360deg); } }
.round { width: 48px; height: 48px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--ink-2); box-shadow: var(--shadow-sm); }
.round:hover { color: var(--ink); background: var(--surface-2); }
.round.on { color: var(--accent); border-color: var(--accent); }

/* ───────── Talk ───────── */
.talk { flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(0,1fr) auto minmax(0,1fr); grid-template-columns: minmax(0,1fr); }
.side-pane { min-height: 0; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.side-pane.them { background: var(--surface-2); }
.side-pane.flip { transform: rotate(180deg); }
.side-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.side-head .who { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.side-head .who b { font-size: 15px; font-weight: 650; }
.side-head .who span { font-size: 12px; color: var(--ink-3); }
.side-mic { width: 48px; height: 48px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; flex: none; transition: transform .1s; }
.side-mic:active { transform: scale(.95); }
.side-mic.on { background: var(--live); color: #fff; box-shadow: 0 0 0 6px color-mix(in srgb, var(--live) 22%, transparent); }
.side-mic svg { width: 22px; height: 22px; }
.side-log { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 86%; padding: 10px 14px; border-radius: 18px; line-height: 1.4; }
.bubble.in { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 6px; font-size: calc(19px * var(--ts)); font-weight: 550; letter-spacing: -.01em; }
.side-pane.them .bubble.in { background: var(--surface); }
.bubble.out { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; font-size: calc(15px * var(--ts)); }
.bubble .sub { font-size: 12.5px; opacity: .75; margin-top: 4px; font-weight: 450; }
.bubble.in .sub { color: var(--ink-3); opacity: 1; }
.bubble .tl { font-size: 13px; font-style: italic; opacity: .8; margin-top: 3px; }
.bubble mark { background: var(--mark); color: var(--mark-ink); border-radius: 4px; padding: 0 2px; }
.bubble .acts { display: flex; gap: 2px; margin: 6px -6px -4px; }
.bubble .acts button { width: 30px; height: 28px; border-radius: 8px; display: grid; place-items: center; opacity: .7; }
.bubble .acts button:hover { opacity: 1; background: color-mix(in srgb, currentColor 10%, transparent); }
.bubble .acts svg { width: 16px; height: 16px; }
.bubble.wait { opacity: .7; }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .4; animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
.talk-mid { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 10px; background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.hf { height: 44px; padding: 0 18px; white-space: nowrap; flex: none; border-radius: 22px; background: var(--accent); color: var(--accent-ink); font-weight: 650; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; box-shadow: var(--shadow); }
.hf.on { background: var(--live); color: #fff; }
.composer { display: flex; gap: 8px; align-items: center; padding: 8px 12px 10px; }
.composer .input { border-radius: 22px; height: 44px; }
.composer .send { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.sugg { display: flex; gap: 6px; overflow-x: auto; padding: 0 12px 6px; scrollbar-width: none; }
.sugg::-webkit-scrollbar { display: none; }
.live-line { font-size: 13.5px; color: var(--ink-3); font-style: italic; padding: 0 16px 6px; min-height: 0; }
.talk-empty { margin: auto; text-align: center; color: var(--ink-3); padding: 16px; max-width: 340px; font-size: 14px; }
.talk-empty b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 4px; font-weight: 650; }
@media (min-width: 960px) {
  .talk { grid-template-rows: auto minmax(0,1fr); grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .talk-mid { grid-column: 1 / span 2; grid-row: 1; border-top: 0; justify-content: center; background: var(--bg); }
  .side-pane.flip { transform: none; }
  .side-pane.them { grid-column: 1; grid-row: 2; border-right: 1px solid var(--border); }
  .side-pane.me { grid-column: 2; grid-row: 2; }
  .flip-btn { display: none !important; }
}

/* ───────── Translate ───────── */
.tx-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 1100px) { .tx-grid { grid-template-columns: 1fr 1fr; } }
.tx-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; min-height: 220px; }
.tx-card .hd { display: flex; align-items: center; gap: 6px; padding: 8px 8px 0 8px; }
.tx-card .hd .select { height: 36px; border: 0; background-color: transparent; font-weight: 650; padding-left: 8px; width: auto; max-width: 100%; box-shadow: none; }
.tx-card textarea { border: 0; outline: none; resize: none; background: transparent; padding: 10px 16px; font-size: calc(20px * var(--ts)); line-height: 1.45; flex: 1; min-height: 140px; }
.tx-card .out { padding: 10px 16px; font-size: calc(22px * var(--ts)); font-weight: 550; line-height: 1.4; letter-spacing: -.012em; flex: 1; }
.tx-card .out.ph { color: var(--ink-3); font-weight: 450; }
.tx-card .ft { display: flex; align-items: center; gap: 4px; padding: 6px 8px 8px; border-top: 1px solid var(--border); }
.verdict { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; padding: 4px 10px; border-radius: 12px; margin: 10px 16px 0; align-self: flex-start; }
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.fix { background: var(--mark); color: var(--mark-ink); }
.drop { border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); padding: 28px 16px; text-align: center; background: var(--surface); transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .ico { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 0 auto 12px; }
.drop b { display: block; font-size: 15.5px; margin-bottom: 4px; }
.imgprev { width: 100%; max-height: 320px; object-fit: contain; border-radius: var(--r); background: var(--surface-2); display: block; }
.read-row { padding: 12px 16px; display: grid; gap: 2px; }
.read-row .o { font-size: 13px; color: var(--ink-3); }
.read-row .t { font-size: 17px; font-weight: 600; letter-spacing: -.01em; cursor: pointer; }
.read-row .n { font-size: 13.5px; color: var(--ink-2); }
.read-row .w { font-size: 13px; color: var(--live); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r); background: var(--live-soft); color: var(--live); font-size: 14px; }
.alert.info { background: var(--accent-soft); color: var(--accent); }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }

/* ───────── Learn ───────── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px; }
.stat b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--ink-3); font-weight: 500; }
@media (max-width: 480px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.feature { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .feature { grid-template-columns: 1fr; } }
.fcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; text-align: start; display: flex; gap: 14px; align-items: flex-start; transition: all .15s; box-shadow: var(--shadow-sm); }
.fcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.fcard .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.fcard b { display: block; font-size: 15px; margin-bottom: 2px; }
.fcard span { font-size: 13px; color: var(--ink-3); }
.fcard:disabled { opacity: .55; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; text-align: start; display: flex; flex-direction: column; gap: 10px; transition: all .15s; }
.tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.tile .ic { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); display: grid; place-items: center; }
.tile b { font-size: 14.5px; }
.tile span { font-size: 12.5px; color: var(--ink-3); margin-top: -8px; }
.flash { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 28px; text-align: center; box-shadow: var(--shadow); }
.flash .word { font-size: 36px; font-weight: 700; letter-spacing: -.02em; }
.boxes { display: inline-flex; gap: 3px; }
.boxes i { width: 6px; height: 6px; border-radius: 50%; background: var(--surface-3); }
.boxes i.f { background: var(--ok); }
.score { font-size: 48px; font-weight: 750; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.chat { display: flex; flex-direction: column; gap: 12px; }
.chat .bubble.in { font-size: 16px; }
.fix { margin-top: 8px; padding-top: 8px; border-top: 1px dashed color-mix(in srgb, currentColor 30%, transparent); font-size: 13px; }

/* ───────── Overlays ───────── */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(9, 10, 14, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } }
.dialog { width: 100%; max-height: 92dvh; background: var(--bg); border-radius: 20px 20px 0 0; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: sheet .28s cubic-bezier(.2, .8, .2, 1); padding-bottom: env(safe-area-inset-bottom); }
.dialog.tall { height: 92dvh; }
.dialog .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 8px auto 0; flex: none; }
@keyframes sheet { from { transform: translateY(40px); opacity: .5; } }
.dialog .hd { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 20px; flex: none; }
.dialog .hd h2 { font-size: 17px; font-weight: 650; letter-spacing: -.015em; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog .bd { overflow-y: auto; padding: 4px 20px 20px; flex: 1; min-height: 0; }
.dialog .bd.flush { padding: 0 0 12px; }
.dialog .ft { padding: 12px 20px; border-top: 1px solid var(--border); flex: none; display: flex; gap: 8px; }
@media (min-width: 720px) {
  .scrim { align-items: center; padding: 24px; }
  .dialog { max-width: 560px; border-radius: 20px; max-height: 86dvh; animation: pop .22s cubic-bezier(.2, .8, .2, 1); }
  .dialog.tall { height: 86dvh; }
  .dialog.wide { max-width: 720px; }
  .dialog .grab { display: none; }
  .dialog .hd { padding: 16px 14px 10px 24px; }
  .dialog .bd { padding: 4px 24px 24px; }
  @keyframes pop { from { transform: scale(.96); opacity: 0; } }
}
.menu { position: fixed; z-index: 70; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; animation: pop2 .14s ease; }
@keyframes pop2 { from { transform: scale(.97); opacity: 0; } }
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; height: 40px; padding: 0 12px; border-radius: 9px; font-size: 14px; font-weight: 500; text-align: start; color: var(--ink); }
.menu button:hover { background: var(--surface-2); }
.menu button svg { color: var(--ink-2); width: 18px; height: 18px; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 4px; }
.fullscreen { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: flex; flex-direction: column; padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); animation: fade .15s; }
.fullscreen .fs-top { display: flex; align-items: center; gap: 8px; }
.fullscreen .fs-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 12px; overflow: auto; }
.fullscreen .big { font-weight: 700; line-height: 1.15; letter-spacing: -.02em; max-width: 1000px; }
.fullscreen .tl { color: var(--ink-3); font-size: 18px; font-style: italic; }
.fullscreen .sub { color: var(--ink-2); font-size: 16px; }
.fullscreen .fs-bar { display: flex; justify-content: center; gap: 10px; }
.fullscreen.flip .fs-body { transform: rotate(180deg); }
.subs { position: fixed; inset: 0; z-index: 80; background: #07080a; color: #f4f4f5; display: flex; flex-direction: column; justify-content: flex-end; padding: 24px clamp(20px, 6vw, 80px) 56px; }
.subs .line { font-size: calc(clamp(26px, 4vw, 44px) * var(--ts)); font-weight: 650; line-height: 1.25; letter-spacing: -.015em; margin-top: 12px; }
.subs .line.prev { color: #8d9099; font-size: calc(clamp(20px, 3vw, 30px) * var(--ts)); font-weight: 550; }
.subs .orig { color: #8d9099; font-size: 16px; margin-top: 14px; }
.subs .x { position: absolute; top: max(16px, env(safe-area-inset-top)); right: 16px; color: #d4d4d8; }
.subs .x:hover { background: rgba(255,255,255,.08); }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); max-width: min(92vw, 520px); animation: toast .25s cubic-bezier(.2, .8, .2, 1); }
.toast.err { background: var(--live); color: #fff; }
.toast button { font-weight: 700; color: inherit; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
@keyframes toast { from { transform: translate(-50%, 12px); opacity: 0; } }
@media (min-width: 960px) { .toast { left: calc(50% + var(--sidebar) / 2); bottom: 32px; } }

/* ───────── Auth ───────── */
.auth { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .logo { width: 48px; height: 48px; border-radius: 14px; margin-bottom: 24px; }
.auth-card .logo svg { width: 28px; height: 28px; }
.auth-card h1 { font-size: 30px; font-weight: 750; letter-spacing: -.03em; line-height: 1.15; margin: 0 0 10px; }
.auth-card p.lead { color: var(--ink-2); font-size: 16px; margin: 0 0 28px; }
.code-input { height: 60px !important; font-size: 26px !important; letter-spacing: .5em; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; border-radius: 14px !important; }
.steps { display: flex; gap: 6px; margin-bottom: 28px; }
.steps i { height: 4px; flex: 1; border-radius: 2px; background: var(--surface-3); }
.steps i.on { background: var(--accent); }
.err-text { color: var(--live); font-size: 13.5px; font-weight: 550; min-height: 20px; margin-top: 8px; }
.lang-choice { display: grid; gap: 12px; }

/* Language picker list */
.lang-list .item { min-height: 52px; }
.lang-list .code { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; flex: none; }
.lang-list .item.sel .code { background: var(--accent); color: var(--accent-ink); }
.lang-list .item .check { color: var(--accent); }

/* Settings */
.set-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; }
.set-row .tx { flex: 1; min-width: 0; }
.set-row .tx b { display: block; font-weight: 550; font-size: 14.5px; }
.set-row .tx span { display: block; font-size: 12.5px; color: var(--ink-3); }
.set-row .select { width: auto; min-width: 120px; max-width: 50%; height: 38px; font-size: 14px; }
button.set-row { width: 100%; text-align: start; }
button.set-row:hover { background: var(--surface-2); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--accent); animation: spin .7s linear infinite; display: inline-block; flex: none; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--ink-3); padding: 8px 0; font-size: 14px; }

@media print { .sidebar, .tabbar, .topbar, .dock { display: none !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
