/* Приложение «Голос»: телефон в первую очередь (одна колонка, крупные кнопки), на компьютере — та же колонка по центру. */
:root {
  --font: 'Golos Text', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  --bg: #0D1014; --bg-2: #12161C; --panel: #171C23; --panel-2: #1D232C; --line: #262D38; --line-2: #313A47;
  --fg: #EEF1F5; --fg-2: #C5CCD7; --muted: #8E98A8; --dim: #5F6878;
  --a: #33D17A; --a-soft: rgba(51, 209, 122, .14); --a-fg: #06210F;   /* язык A (вы) — зелёный */
  --b: #6EA8FE; --b-soft: rgba(110, 168, 254, .14);                     /* язык B (собеседник) — голубой */
  --warn: #F5B544; --err: #F47A6E; --err-soft: rgba(244, 122, 110, .14);
  --r: 18px; --tap: 48px;
  --text: 19px;
  color-scheme: dark;
  -webkit-tap-highlight-color: transparent;
}
:root[data-size="s"] { --text: 16px; }
:root[data-size="l"] { --text: 24px; }
:root[data-size="xl"] { --text: 30px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); -webkit-font-smoothing: antialiased;
  overscroll-behavior: none; }
button, input, select { font: inherit; color: inherit; }
/* свои элементы вместо системных: на iPhone и Android выглядят одинаково (системные поля, списки, ползунки — разные) */
input { -webkit-appearance: none; appearance: none; border-radius: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, .bubble, .half .line { -webkit-user-select: text; user-select: text; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--b); outline-offset: 2px; }
svg { display: block; }

#app { height: 100%; max-width: 760px; margin: 0 auto; position: relative; }
.screen { height: 100%; display: flex; flex-direction: column; }

/* --- вход --- */
#login { align-items: center; justify-content: center; padding: 32px 24px calc(32px + env(safe-area-inset-bottom)); text-align: center; gap: 28px; }
.logo { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: var(--a-soft);
  box-shadow: 0 0 0 2px var(--a), 0 0 0 10px rgba(51, 209, 122, .07); color: var(--a); }
.logo svg { width: 46px; height: 46px; }
#login h1 { margin: 0; font-size: 34px; letter-spacing: -.5px; }
#login .lead { margin: 6px 0 0; color: var(--fg-2); font-size: 17px; line-height: 1.45; max-width: 340px; }
.login-box { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; max-width: 340px; }
#gbtn:empty { display: none; }
#gbtn { min-height: 44px; }
/* кнопки входа в приложении — одинаковые на Android и iPhone (по правилам оформления Google и Apple) */
.sso { width: 100%; height: 52px; border-radius: 26px; display: flex; align-items: center; justify-content: center; gap: 12px;
  font-weight: 600; font-size: 16px; }
.sso svg { width: 20px; height: 20px; flex: none; }
.sso.google { background: #131314; color: #E3E3E3; border: 1px solid #8E918F; }
.sso.apple { background: #FFFFFF; color: #000000; }
.sso.apple svg { width: 22px; height: 22px; margin-top: -2px; }
.dev { display: flex; gap: 8px; width: 100%; }
.dev input { flex: 1; min-width: 0; height: var(--tap); border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel);
  padding: 0 14px; }
.btn { height: var(--tap); padding: 0 20px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line-2);
  font-weight: 600; white-space: nowrap; }
.btn.primary { background: var(--a); border-color: var(--a); color: var(--a-fg); }
.btn.danger { color: var(--err); border-color: rgba(244, 122, 110, .35); background: var(--err-soft); }
.fine { color: var(--dim); font-size: 13px; line-height: 1.5; max-width: 340px; }
.fine a { color: var(--muted); }
.login-err { color: var(--err); font-size: 15px; min-height: 1.4em; }

/* --- верх: название, настройки --- */
.top { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 6px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; }
.brand .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: var(--a);
  background: var(--a-soft); box-shadow: 0 0 0 1.5px var(--a); }
.brand .dot svg { width: 14px; height: 14px; }
.spacer { flex: 1; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--fg-2); }
@media (hover: hover) { .icon-btn:hover { background: var(--panel); } }  /* на телефоне «наведение» залипает */
.icon-btn svg { width: 24px; height: 24px; }

/* --- языки --- */
.langbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 6px 14px 10px; }
.lang { min-height: 60px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); padding: 8px 14px;
  text-align: left; display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; position: relative; }
.lang::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; }
.lang.a::before { background: var(--a); }
.lang.b::before { background: var(--b); }
.lang .native { font-weight: 650; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swap { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--fg-2); background: var(--panel);
  border: 1px solid var(--line); transition: transform .25s; }
.swap.spin { transform: rotate(180deg); }
.swap svg { width: 20px; height: 20px; }

/* --- лента разговора --- */
.feed { flex: 1; overflow-y: auto; padding: 8px 14px 20px; display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
.empty { margin: auto 8px; text-align: center; color: var(--muted); font-size: 16px; line-height: 1.55; }
.empty b { color: var(--fg-2); font-weight: 600; display: block; font-size: 19px; margin-bottom: 6px; }
.bubble { max-width: 88%; border-radius: var(--r); padding: 12px 16px 11px; background: var(--panel); border: 1px solid var(--line);
  position: relative; animation: pop .18s ease-out; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }
.bubble.a { align-self: flex-start; border-top-left-radius: 6px; }
.bubble.b { align-self: flex-end; border-top-right-radius: 6px; }
.bubble.a { box-shadow: inset 3px 0 0 var(--a); }
.bubble.b { box-shadow: inset -3px 0 0 var(--b); }
.bubble .tr { font-size: var(--text); line-height: 1.38; font-weight: 500; overflow-wrap: anywhere; }
.bubble .src { margin-top: 6px; color: var(--muted); font-size: calc(var(--text) * .74); line-height: 1.4; overflow-wrap: anywhere; }
.bubble .src .draft, .bubble .tr .draft { color: var(--dim); }
.bubble .tr:empty { display: none; }
.bubble .tr:empty + .src { margin-top: 0; color: var(--fg-2); font-size: calc(var(--text) * .9); }
.bubble.speaking.a { box-shadow: inset 3px 0 0 var(--a), 0 0 0 2px var(--a); }
.bubble.speaking.b { box-shadow: inset -3px 0 0 var(--b), 0 0 0 2px var(--b); }
.bubble .who { position: absolute; top: -9px; font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  padding: 1px 7px; border-radius: 6px; background: var(--bg); }
.bubble.a .who { left: 12px; color: var(--a); }
.bubble.b .who { right: 12px; color: var(--b); }

/* --- лицом к лицу: верхняя половина — собеседнику напротив (перевёрнута) --- */
.face { flex: 1; display: grid; grid-template-rows: 1fr 1fr; min-height: 0; }
.half { overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.half.top { transform: rotate(180deg); border-bottom: 1px dashed var(--line-2); background: var(--bg-2); }
.half .line { font-size: calc(var(--text) * 1.15); line-height: 1.38; font-weight: 500; overflow-wrap: anywhere; }
.half .line.own { color: var(--muted); font-size: calc(var(--text) * .8); align-self: flex-end; text-align: right; max-width: 85%; }
.half .line .draft { color: var(--dim); }
.half .hint { margin: auto; color: var(--dim); text-align: center; font-size: 15px; }

/* --- низ: микрофон --- */
.dock { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 8px 18px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: linear-gradient(to bottom, var(--bg-2), var(--bg)); }
.dock .side { display: flex; }
.dock .side.right { justify-content: flex-end; }
.round { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: var(--fg-2); background: var(--panel);
  border: 1px solid var(--line); }
.round[aria-pressed="true"] { color: var(--b); border-color: var(--b); background: var(--b-soft); }
.round svg { width: 24px; height: 24px; }
.center { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.status { font-size: 14px; color: var(--muted); min-height: 1.3em; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.status .pip { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.status.listen .pip { background: var(--a); animation: ring 1.6s infinite; }
.status.speak .pip { background: var(--b); }
.status.err { color: var(--err); }
.status.err .pip { background: var(--err); }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(51, 209, 122, .55); } 70% { box-shadow: 0 0 0 7px rgba(51, 209, 122, 0); } 100% { box-shadow: none; } }
.mic { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: var(--a); color: var(--a-fg);
  box-shadow: 0 8px 28px rgba(51, 209, 122, .28); transition: transform .12s, background .2s; position: relative; }
.mic:active { transform: scale(.96); }
.mic svg { width: 36px; height: 36px; }
.mic .level { position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--a); opacity: 0; transition: opacity .08s, transform .08s; }
.mic.on { background: var(--panel-2); color: var(--a); box-shadow: 0 0 0 2px var(--a); }
.mic.on .level { opacity: .9; }
.mic.wait { background: var(--panel-2); color: var(--muted); box-shadow: 0 0 0 2px var(--line-2); }
.mic.wait svg { animation: fade 1.2s infinite; }
@keyframes fade { 50% { opacity: .35; } }

/* --- листы (настройки, выбор языка) --- */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; justify-content: flex-end;
  background: rgba(0, 0, 0, .55); animation: shade .15s; }
@keyframes shade { from { background: transparent; } }
.sheet .panel { background: var(--bg-2); border-top-left-radius: 22px; border-top-right-radius: 22px; max-height: 92%; width: 100%;
  max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; border: 1px solid var(--line); border-bottom: 0;
  animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: .4; } }
.sheet .head { display: flex; align-items: center; gap: 8px; padding: 14px 10px 8px 20px; }
.sheet .head h2 { margin: 0; font-size: 19px; flex: 1; }
.sheet .body { overflow-y: auto; padding: 4px 20px calc(24px + env(safe-area-inset-bottom)); }
.group { padding: 14px 0; border-bottom: 1px solid var(--line); }
.group:last-child { border-bottom: 0; }
.group h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.row { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.row .label { flex: 1; font-size: 16px; }
.row .label small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.seg { display: inline-flex; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; gap: 3px; }
.seg button { padding: 7px 13px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--panel-2); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line-2); }
.pick { height: 40px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line-2); padding: 0 12px;
  display: inline-flex; align-items: center; gap: 6px; max-width: 56%; color: var(--fg); }
.pick span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.switch { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line-2);
  position: relative; flex: none; margin: 0; cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  transition: left .15s; }
.switch:checked { background: var(--a); }
.switch:checked::after { left: 21px; }
/* ползунок — свой: дорожка и бегунок одинаковые в WebKit и Chromium */
input[type="range"] { width: 100%; height: 32px; background: transparent; margin: 0; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--a) var(--fill, 50%), var(--line-2) var(--fill, 50%)); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line-2); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--a); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; margin-top: -10px;
  border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .45); }
input[type="range"]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45); }
.account { display: flex; align-items: center; gap: 12px; }
.account img, .account .ph { width: 44px; height: 44px; border-radius: 50%; background: var(--panel-2); flex: none; object-fit: cover; }
.account .who { flex: 1; min-width: 0; }
.account .who div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account .who .mail { color: var(--muted); font-size: 14px; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* выбор языка */
.sheet .head, .search { flex: none; }  /* длинный список не сплющивает заголовок и поиск */
.search { margin: 0 20px 6px; height: 46px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel); padding: 0 14px; }
.langs { overflow-y: auto; padding: 0 10px calc(20px + env(safe-area-inset-bottom)); }
.langs h4 { margin: 12px 10px 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.langs button { width: 100%; text-align: left; display: flex; align-items: baseline; gap: 10px; padding: 12px 10px; border-radius: 12px; }
.langs button:focus-visible { background: var(--panel); }
@media (hover: hover) { .langs button:hover { background: var(--panel); } }
.langs button .d { display: block; color: var(--dim); font-size: 13px; margin-top: 3px; line-height: 1.35; }
.langs button.voice-row { flex-direction: column; align-items: stretch; gap: 0; }
/* окно подтверждения — своё (системное confirm() на iPhone и Android разное) */
.dialog { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px; background: rgba(0, 0, 0, .6); }
.dialog .box { width: 100%; max-width: 360px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 20px; padding: 22px; }
.dialog h2 { margin: 0 0 8px; font-size: 19px; }
.dialog p { margin: 0 0 18px; color: var(--fg-2); line-height: 1.5; }
.dialog .btns { justify-content: flex-end; margin: 0; }
.langs button .n { font-size: 17px; font-weight: 600; }
.langs button .e { color: var(--muted); font-size: 14px; }
.langs button[aria-current="true"] { background: var(--panel); box-shadow: inset 3px 0 0 var(--a); }

/* сообщения */
.toast { position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 12px 16px; max-width: min(92vw, 520px);
  font-size: 15px; line-height: 1.45; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.toast.err { border-color: rgba(244, 122, 110, .5); }
.toast b { display: block; margin-bottom: 2px; }

@media (min-width: 700px) {
  .bubble { max-width: 78%; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
