:root {
  --bg: #03051a;
  --bg2: #070b26;
  --card: #0b1029;
  --card-b: #0d1132;
  --line: #1c2448;
  --line-b: #2c2f72;
  --text: #e7e9f6;
  --muted: #8a91b4;
  --dim: #5b6288;
  --indigo: #5b4ff0;
  --indigo-2: #4338ca;
  --ring: #7c7cf5;
  --glow: rgba(99, 88, 255, .45);
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --mono: ui-monospace, "Cascadia Mono", "Consolas", "SF Mono", monospace;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(ellipse 80% 50% at 50% 18%, #0b0f3a 0%, transparent 70%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.5 var(--sans);
  min-height: 100vh;
  overflow-x: hidden;
}
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.wrap { max-width: 1440px; margin: 0 auto; padding: 24px 16px 40px; }
@media (min-width: 900px) { .wrap { padding: 40px 64px 56px; } }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 12px;
  background: rgba(13, 18, 40, .8); border: 1px solid var(--line); border-radius: 18px;
  padding: 10px 12px 10px 18px;
}
.mode { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px 0; color: var(--muted); text-align: left; min-width: 0; }
.mode b { color: #cfd3ea; }
.mode .dot { width: 10px; height: 10px; border-radius: 50%; background: #5a57b8; flex: none; }
body.on .mode .dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.shortcut { margin-left: auto; color: var(--dim); white-space: nowrap; }
kbd { font: 600 13px var(--sans); color: #cfd3ea; background: #1a2140; border: 1px solid #2c3560; border-radius: 6px; padding: 2px 8px; margin: 0 4px; }
.iconbtn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  background: #151b38; border: 1px solid #262e57; border-radius: 10px; color: #b9bee0; font-size: 18px;
}
.iconbtn:hover { border-color: var(--ring); color: #fff; }
.note { color: var(--warn); font-size: 14px; margin: 10px 4px 0; }
@media (max-width: 640px) {
  .shortcut { display: none; }
  .mode { font-size: 14px; flex-wrap: wrap; gap: 4px 8px; }
  .topbar { justify-content: space-between; }
}

/* hero */
.hero { display: flex; flex-direction: column; align-items: center; padding: 36px 0 8px; }
.engage {
  position: relative; width: min(360px, 78vw); aspect-ratio: 1; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px;
  background: linear-gradient(180deg, #5248ea 0%, #4338ca 55%, #3b3593 100%);
  border: 5px solid var(--ring);
  box-shadow: 0 0 0 1px rgba(124, 124, 245, .3), 0 0 90px 30px var(--glow), 0 0 220px 80px rgba(70, 60, 200, .18);
  transition: transform .15s ease, box-shadow .3s ease;
}
.engage:hover { transform: scale(1.015); }
.engage:active { transform: scale(.985); }
.engage:focus-visible { outline: 3px solid #c7c4ff; outline-offset: 6px; }
.engage-icon { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; background: rgba(255, 255, 255, .1); font-size: 40px; margin-bottom: 6px; }
.engage-title { font-weight: 800; letter-spacing: .2em; text-transform: uppercase; font-size: clamp(18px, 5.4vw, 24px); line-height: 1.25; max-width: 11em; text-align: center; }
.engage-sub { color: #c4c2f7; font-weight: 600; font-size: 15px; }
body.on .engage {
  background: linear-gradient(180deg, #6157ff 0%, #4a3fe0 55%, #3a33a8 100%);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe {
  50% { box-shadow: 0 0 0 1px rgba(124, 124, 245, .5), 0 0 120px 44px rgba(110, 100, 255, .55), 0 0 260px 100px rgba(70, 60, 200, .22); }
}
@media (prefers-reduced-motion: reduce) { body.on .engage { animation: none; } }

.meters { display: flex; align-items: center; gap: 10px; margin-top: 30px; font: 600 13px var(--mono); color: var(--muted); letter-spacing: .06em; flex-wrap: wrap; justify-content: center; }
.meter-label:nth-of-type(3) { margin-left: 18px; }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 11px; height: 9px; border-radius: 3px; background: #252c4a; transition: background .08s; }
#micDots i.on { background: var(--ok); box-shadow: 0 0 6px rgba(52, 211, 153, .6); }
#earDots i.on { background: #8b85ff; box-shadow: 0 0 6px rgba(139, 133, 255, .7); }

.status { min-height: 1.5em; margin: 16px 0 0; text-align: center; color: var(--muted); max-width: 640px; }
.status[data-kind="ok"] { color: #a7f3d0; }
.status[data-kind="warn"] { color: var(--warn); }
.status[data-kind="err"] { color: var(--err); font-weight: 600; }

.lag { display: flex; gap: 10px; margin-top: 18px; }
.lag > div { display: flex; flex-direction: column; align-items: center; min-width: 92px; padding: 8px 12px; background: rgba(13, 18, 40, .7); border: 1px solid var(--line); border-radius: 12px; }
.lag-num { font: 700 22px var(--mono); color: #d8dbf3; }
.lag-num[data-kind="ok"] { color: var(--ok); }
.lag-num[data-kind="warn"] { color: var(--warn); }
.lag-num[data-kind="err"] { color: var(--err); }
.lag-cap { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.source-note { color: var(--dim); font-size: 14px; text-align: center; max-width: 620px; margin: 14px 0 0; }
.source-note b { color: var(--muted); font-weight: 600; }

/* channel cards */
.channels { display: grid; gap: 20px; margin-top: 36px; }
@media (min-width: 900px) { .channels { grid-template-columns: 1fr 1fr; gap: 24px; } }
.card { background: linear-gradient(180deg, var(--card), #080c22); border: 1px solid var(--line); border-radius: 22px; padding: 22px 24px; min-width: 0; }
.card-b { background: linear-gradient(180deg, var(--card-b), #090c26); border-color: var(--line-b); }
.card-head { display: flex; align-items: center; gap: 12px; }
.card-head h2 { display: flex; align-items: center; gap: 10px; margin: 0; font: 800 14px var(--sans); letter-spacing: .18em; text-transform: uppercase; color: #c9cce4; min-width: 0; }
#cardA h2 svg { color: #8b85ff; }
#cardB h2 { color: #c4c2f7; }
#cardB h2 svg { color: var(--ok); }
.chip { margin-left: auto; font: 600 13px var(--sans); padding: 4px 12px; border-radius: 8px; background: #1d2444; color: #9aa1c7; white-space: nowrap; }
.chip[data-kind="live"] { background: rgba(52, 211, 153, .15); color: var(--ok); }
.chip[data-kind="ok"] { background: rgba(124, 124, 245, .16); color: #b8b6ff; }
.chip[data-kind="warn"] { background: rgba(251, 191, 36, .14); color: var(--warn); }
.feed { height: 220px; overflow-y: auto; overflow-wrap: anywhere; margin: 14px 0 0; padding-right: 6px; font-size: 20px; line-height: 1.5; scrollbar-width: thin; scrollbar-color: #2a3260 transparent; }
@media (min-width: 900px) { .feed { height: 260px; font-size: 21px; } }
.feed p { margin: 0 0 10px; }
.feed .placeholder { color: #5f6790; font-style: italic; font-size: 22px; }
.feed .interim { color: #6f77a0; }
.feed .pending { color: #4f5680; }
.feed .speaking { color: #fff; text-shadow: 0 0 18px rgba(139, 133, 255, .5); }
#feedB p:not(.speaking):not(.pending) { color: #c8cbe6; }
.feed .skipped { color: #5b6288 !important; text-decoration: line-through; }
.feed .failed { color: var(--warn) !important; font-size: 16px; }
.card-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; font: 13px var(--mono); color: #747ba3; }

/* practice phrases */
.practice { margin-top: 28px; }
.practice-head { display: flex; align-items: baseline; gap: 8px 24px; flex-wrap: wrap; }
.practice-head h2 { display: flex; align-items: center; gap: 10px; margin: 0; font: 800 16px var(--sans); letter-spacing: .05em; text-transform: uppercase; color: #dfe2f5; flex: 1 1 420px; }
.practice-head h2 svg { color: #8b85ff; font-size: 22px; }
.practice-head p { margin: 0; color: var(--muted); font-size: 14px; flex: 1 1 320px; }
.practice-head p b { color: #c9cce4; }
.phrases { display: grid; gap: 14px; margin-top: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.phrase { display: flex; flex-direction: column; background: #060a20; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 12px; }
.phrase .ru { margin: 0; font-weight: 700; color: #eceefa; }
.phrase .en { margin: 6px 0 0; color: #a3a9c9; }
.phrase-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.phrase .ru + .en { margin-bottom: 12px; }
.phrase .iconbtn { width: 36px; height: 36px; font-size: 17px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid #6366f1; background: #4338ca; color: #fff; font-weight: 600; }
.btn:hover { background: #4f46e5; }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn.ghost { background: transparent; border-color: #2c3560; color: var(--muted); }

.foot { margin-top: 32px; text-align: center; color: #4c5378; font-size: 13px; }

/* settings drawer */
.scrim { position: fixed; inset: 0; background: rgba(2, 3, 14, .6); z-index: 9; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 10; width: min(420px, 100vw); overflow-y: auto;
  background: #0a0e27; border-left: 1px solid var(--line-b); padding: 18px 20px 28px;
  display: flex; flex-direction: column; gap: 16px; box-shadow: -20px 0 60px rgba(0, 0, 0, .5);
}
.drawer[hidden], .scrim[hidden] { display: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-head h2 { margin: 0; font-size: 18px; letter-spacing: .08em; text-transform: uppercase; }
.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 14px; }
.field output { color: var(--text); font-family: var(--mono); }
select, input[type="range"] { width: 100%; }
select { font: inherit; font-size: 15px; color: var(--text); background: #121838; border: 1px solid #2c3560; border-radius: 10px; padding: 10px; }
input[type="range"] { accent-color: var(--indigo); }
.toggle { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.toggle b { color: var(--text); }
.toggle input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--indigo); flex: none; }
.provider-status { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); }
.provider-status div { padding: 8px 10px; border-radius: 10px; background: #0e1433; border: 1px solid var(--line); }
.provider-status div[data-kind="ok"] { border-color: rgba(52, 211, 153, .4); }
.provider-status div[data-kind="warn"] { border-color: rgba(251, 191, 36, .45); }
.provider-status b { color: var(--text); }
.provider-status small { display: block; color: var(--dim); margin-top: 2px; }
.small { font-size: 13px; color: var(--dim); margin: 0; }
