/* Переводчик «держи и говори» (вкладка «Переводчик», разметку строит tr.js). Вид v5 (шаг D1, 27.09.2026):
   две большие кнопки с живой волной и кругами, пока держишь; переводы крупными пузырями; запись разговора красная,
   с мигающей точкой и таймером. Цвета из style.css. */
:root {
  --them-a: #0D7F89;
  --them-b: #0A6770;
  --them: #0E7C86;
  --them-2: #13A3AE;
  --them-bg: #FFFFFF;
  --me-bub: #E3EAFF;
  --tl-bg: rgba(11, 20, 51, .045);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --them: #2BB8C4; --them-2: #3FD0D9; --them-bg: rgba(255, 255, 255, .06); --me-bub: #17307A; --tl-bg: rgba(255, 255, 255, .07); }
}
:root[data-theme="dark"] { --them: #2BB8C4; --them-2: #3FD0D9; --them-bg: rgba(255, 255, 255, .06); --me-bub: #17307A; --tl-bg: rgba(255, 255, 255, .07); }

/* старый вид переводчика (круглая кнопка, выбор одного языка) в этой вкладке не нужен */
#langRow { display: none !important; }
body.tr .stage, body.tr .log { display: none !important; }

.trp { order: 2; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.trchips { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; flex: 0 0 auto; }
.trchips-l { color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; flex: 0 0 auto; }
.trchip {
  appearance: none; -webkit-appearance: none;
  flex: 1 1 0; min-width: 0; text-overflow: ellipsis;
  background-color: var(--surface);
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 55%, calc(100% - 14px) 55%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
  padding: 8px 30px 8px 14px; min-height: 44px; font-size: 15px; font-weight: 650; color: var(--text);
  cursor: pointer;
}
.trchip option { background: var(--panel); color: var(--text); }
.trchip:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (max-width: 399px) { .trchips-l { display: none; } }
/* в приложении в строке ещё кнопка «Динамик / Трубка»: подпись «Перевод на» убираем, языкам нужно место */
.trchips:has(.ou-route) .trchips-l { display: none; }
.trtest {
  position: fixed; top: 2px; right: 2px; z-index: 5; padding: 2px 8px; border-radius: 999px;
  background: var(--err); color: #FFFFFF; font-size: 10px; font-weight: 800; pointer-events: none;
}

.trlist {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 12px; padding: 6px 0 4px;
  -webkit-mask: linear-gradient(to bottom, transparent 0, #000 14px); mask: linear-gradient(to bottom, transparent 0, #000 14px);
}
.trlist > :first-child { margin-top: auto; }
.trempty {
  color: var(--muted); padding: 18px 18px 16px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.trempty-h { margin: 0 0 8px; font-weight: 750; font-size: 17px; color: var(--text); }
.trempty ol { margin: 0; padding-left: 20px; display: grid; gap: 7px; line-height: 1.45; }

/* пузыри: свои справа (синие), собеседника слева */
.trcard {
  position: relative; border: 1px solid var(--line); border-radius: 26px; padding: 12px 14px 14px;
  background: var(--them-bg); overflow-wrap: anywhere; box-shadow: var(--shadow);
  animation: trin var(--t-mid, .45s) var(--spring, ease-out) both;
}
@keyframes trin { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.trcard.me { align-self: flex-end; width: min(100%, 94%); background: var(--me-bub); border-color: transparent; border-bottom-right-radius: 8px; }
.trcard.them { align-self: flex-start; width: min(100%, 94%); border-bottom-left-radius: 8px; }
.trcard.rec { align-self: stretch; background: var(--surface); }
.trcard.bad { border-color: color-mix(in srgb, var(--err) 55%, transparent); }
.trcard-h { font-size: 12.5px; font-weight: 750; color: var(--muted); margin-bottom: 4px; letter-spacing: .2px; }
.trcard.them .trcard-h { color: var(--them); }
.trcard.me .trcard-h { color: var(--accent); }
.trcard-b p { margin: 0; }
.trsrc { font-size: 16px; line-height: 1.45; }
.trcard.them .trsrc { color: var(--muted); font-size: 15.5px; }
.trru { font-size: 24px; line-height: 1.3; font-weight: 650; letter-spacing: -.2px; margin-top: 6px !important; }
.trcard-err { color: var(--err); }
.trwarn {
  margin: 8px 0 0 !important; padding: 7px 11px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--err) 45%, transparent); color: var(--err); background: transparent; font-size: 14px; line-height: 1.35;
}
.trwarn.soft { border-color: var(--line); color: var(--muted); }
.say.again { margin-top: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.trwait { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.trspin {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent);
  animation: trspin .9s linear infinite; flex: 0 0 auto;
}
@keyframes trspin { to { transform: rotate(360deg); } }

.trtl { margin-top: 10px; padding: 10px 12px 12px; border-radius: 18px; background: var(--tl-bg); }
.trcard.me .trtl { background: transparent; border-radius: 0; padding: 12px 0 2px; margin-top: 10px; border-top: 1px solid var(--line-2); }
.trtl-h { font-size: 12.5px; font-weight: 750; color: var(--muted); letter-spacing: .2px; }
.trtl-t { font-size: 23px; line-height: 1.3; font-weight: 650; letter-spacing: -.2px; margin: 3px 0 10px !important; }

.say {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 10px 18px 10px 14px; min-height: 48px;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); color: #FFFFFF; font-weight: 700; font-size: 16.5px; cursor: pointer;
  touch-action: manipulation; box-shadow: 0 6px 18px color-mix(in srgb, var(--grad-a) 30%, transparent);
  transition: transform var(--t-fast, .35s) var(--spring-fast, ease-out);
}
.trcard.them .say { background: linear-gradient(135deg, var(--them-a), var(--them-b)); box-shadow: 0 6px 18px color-mix(in srgb, var(--them-b) 30%, transparent); margin-top: 10px; }
.say .ic { width: 22px; height: 22px; fill: currentColor; flex: 0 0 auto; }
.say.playing { background: linear-gradient(135deg, var(--red-a, #D63447), var(--red-b, #C92A3F)) !important; }
.say.loading { opacity: .8; }
.say.err { background: transparent !important; color: var(--err); border: 1px solid var(--err); box-shadow: none; }
.say:active { transform: scale(.95); }

.trerr {
  margin: 0; padding: 10px 14px; border-radius: 16px; flex: 0 0 auto; text-align: center; font-size: 15px;
  background: color-mix(in srgb, var(--err) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--err) 40%, transparent); color: var(--err);
}

/* две большие кнопки «держи и говори» */
.trbtns { flex: 0 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 4px; }
.trhold {
  --lv: 0;
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px;
  min-height: 128px; padding: 14px 8px 44px;
  border: 0; border-radius: 32px; cursor: pointer; color: #FFFFFF; box-shadow: var(--shadow);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none;
  transition: transform var(--t-fast, .35s) var(--spring-fast, ease-out), border-radius var(--t-fast, .35s) var(--spring-fast, ease-out);
}
.trhold.me { background: linear-gradient(145deg, var(--grad-a), var(--grad-b)); }
.trhold.them { background: linear-gradient(145deg, var(--them-a), var(--them-b)); }
.trhold.rec, .trhold.arming { transform: scale(.97); border-radius: 44px; }
.trhold.rec.me, .trhold.arming.me { background: linear-gradient(145deg, #2A55E6, #5E3FE6); }
.trhold.rec.them, .trhold.arming.them { background: linear-gradient(145deg, #0B7680, #075A62); }
.trhold.arming { opacity: .9; }
.trhold-top { display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; z-index: 2; }
.trhold .ic { width: 30px; height: 30px; fill: currentColor; flex: 0 0 auto; }
.trhold-l { font-size: clamp(18px, 5vw, 21px); font-weight: 800; letter-spacing: .1px; white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1.2; }
.trhold-s { position: relative; z-index: 2; font-size: 12.5px; font-weight: 600; opacity: .92; text-align: center; line-height: 1.25; }
.trhold:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
/* живая волна и круги, пока держишь */
.trwave { position: absolute; left: 14px; right: 14px; bottom: 10px; height: 26px; width: calc(100% - 28px); z-index: 2; opacity: 0; transition: opacity .2s; pointer-events: none; }
.trhold.rec .trwave { opacity: 1; }
.trrip { position: absolute; left: 50%; top: 34px; width: 56px; height: 56px; margin: -28px 0 0 -28px; z-index: 1; pointer-events: none; }
.trrip::before, .trrip::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: rgba(255, 255, 255, .28); opacity: 0;
  transform: scale(calc(1 + var(--lv) * 1.6));
}
.trhold.rec .trrip::before { opacity: calc(.25 + var(--lv) * .5); }
.trhold.rec .trrip::after { animation: trripple 1.4s cubic-bezier(.2, .6, .3, 1) infinite; }
@keyframes trripple { from { transform: scale(1); opacity: .45; } to { transform: scale(3.6); opacity: 0; } }
.trmeter { display: none; }
.trmeter.on { display: block; position: static; opacity: 1; margin-top: 12px; height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.trmeter-f { display: block; height: 100%; border-radius: 3px; background: currentColor; transform: scaleX(0); transform-origin: left center; transition: transform .08s linear; }
.trmeter.on .trmeter-f { background: linear-gradient(90deg, var(--live-2), var(--live)); }
@media (prefers-reduced-motion: reduce) {
  .trspin, .trhold.rec .trrip::after, .trrec.on .ic { animation: none !important; }
  .trhold, .trmeter-f, .say, .trcard { transition: none !important; animation: none !important; }
}

/* ── бегущая строка, предварительный перевод, «Записать разговор» ── */
.trlive { font-size: 17px; line-height: 1.4; margin: 0; }
.trlive.empty { color: var(--muted); font-style: italic; }
.trcard.them .trlive { color: var(--text); }
.trcard .trwait { margin-top: 8px; }
.trtl.prov .trtl-t, .trru.prov { opacity: .7; }
.trhold.off { opacity: .45; filter: grayscale(.4); }
.trrec {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 8px 16px; border-radius: 999px; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow);
  font-size: 16px; font-weight: 700; touch-action: manipulation;
  transition: transform var(--t-fast, .35s) var(--spring-fast, ease-out), background .2s;
}
.trrec:active { transform: scale(.97); }
.trrec .ic { width: 20px; height: 20px; fill: var(--live); flex: 0 0 auto; }
.trrec.on { background: linear-gradient(135deg, var(--red-a, #D63447), var(--red-b, #C92A3F)); color: #FFFFFF; border-color: transparent; }
.trrec.on .ic { fill: #FFFFFF; animation: trblink 1.2s ease-in-out infinite; }
.trrec-t { font-variant-numeric: tabular-nums; font-weight: 800; padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, .22); }
.trrec:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@keyframes trblink { 50% { opacity: .3; } }
.trrec-st { display: flex; align-items: center; gap: 8px; color: var(--muted); margin: 0; line-height: 1.4; }
.trrec-sum { margin: 6px 0 4px; padding: 10px 12px; border-radius: 16px; background: var(--tl-bg); }
.trrec-sum ul { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 15px; line-height: 1.4; }
.trrec-row { margin-top: 12px; padding-left: 12px; border-left: 3px solid var(--them); }
.trrec-row.me { border-left-color: var(--accent); }
.trrec-who { font-size: 12.5px; font-weight: 750; color: var(--muted); }
.trrec-src { margin: 2px 0 0 !important; font-size: 15px; line-height: 1.4; }
.trrec-row:not(.me) .trrec-src { color: var(--muted); }
.trrec-ru { margin: 2px 0 0 !important; font-size: 18px; line-height: 1.35; font-weight: 650; }
.trrec-note { margin-top: 12px !important; font-size: 13px; color: var(--muted); }

/* [E2] голос телефона и маленькая кнопка «OpenAI»; строка «кто распознаёт, нужен ли интернет» */
.sayrow { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.sayrow .say:not(.alt) { flex: 1 1 auto; }
.trcard.them .sayrow { margin-top: 12px; }
.trcard.them .sayrow .say { margin-top: 0; }
.say.alt {
  flex: 0 0 auto; min-width: 0; padding: 0 14px; font-size: 14px; font-weight: 650;
  background: var(--surface) !important; color: var(--text); border: 1px solid var(--line); box-shadow: none;
}
.say.alt .ic { width: 18px; height: 18px; }
.say.alt.playing { background: linear-gradient(135deg, var(--red-a, #D63447), var(--red-b, #C92A3F)) !important; color: #FFFFFF; }
.trnote { margin: 0 0 4px; padding: 0 6px; color: var(--muted); font-size: 13px; line-height: 1.4; text-align: center; }
.trnote.off { color: var(--err); font-weight: 650; }

/* ══ D2 (28.09.2026): верх ленты переводов гаснет плавно (раньше кнопка резалась под строкой языков),
   подсказка «Как переводить» по центру свободного места, а не прижата к кнопкам с пустотой сверху ══ */
.trlist { -webkit-mask: linear-gradient(to bottom, transparent 0, #000 30px); mask: linear-gradient(to bottom, transparent 0, #000 30px); padding-top: 12px; }
.trlist > .trempty:only-child { margin-top: auto; margin-bottom: auto; }
/* переводы короткие: строки ровные, «(≈» не остаётся в конце строки отдельно от суммы */
.trru, .trtl-t { text-wrap: balance; }
.trsrc, .trlive, .trempty li { text-wrap: pretty; }

/* ══ F (28.09.2026). Андрей: «кнопки „Я говорю“ и „Собеседник“ нужно сделать меньше, чтобы больше помещалось места для
   двух языков сразу. И одной маленькой кнопки на каждом воспроизведении языков достаточно».
   Кнопки внизу одним рядом высотой 68 px (держать большим пальцем удобно), «Записать» рядом узкой кнопкой; у каждой
   строки перевода одна круглая кнопка ▶ справа (голос телефона; голос OpenAI сам, если у телефона нет языка) ══ */
.trbtns { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 64px; gap: 8px; padding-top: 2px; }
.trhold { min-height: 68px; height: 68px; padding: 6px 6px 7px; gap: 0; border-radius: 22px; justify-content: center; }
.trhold.rec, .trhold.arming { border-radius: 28px; }
.trhold-top { gap: 2px; }
.trhold .ic { width: 22px; height: 22px; }
.trhold-l { font-size: clamp(15px, 4.4vw, 17px); line-height: 1.15; }
.trhold-s { font-size: 11px; line-height: 1.2; opacity: .85; margin-top: 1px; }
.trhold.rec .trhold-s { opacity: 0; }
.trwave { left: 10px; right: 10px; width: calc(100% - 20px); bottom: 4px; height: 16px; }
.trrip { top: 50%; }
.trhold .trmeter.on { margin-top: 4px; height: 4px; }
.trrec { grid-column: auto; flex-direction: column; gap: 3px; min-height: 68px; height: 68px; padding: 6px 2px;
  border-radius: 22px; font-size: 12.5px; font-weight: 750; }
.trrec .ic { width: 22px; height: 22px; }
.trrec-t { padding: 0 6px; font-size: 11.5px; }
.trcard { padding: 10px 12px 12px; }
.trtl { margin-top: 8px; padding: 8px 10px 10px; border-radius: 16px; }
.trcard.me .trtl { padding: 8px 0 0; margin-top: 8px; }
.trtl-row { display: flex; align-items: center; gap: 10px; }
.trtl-row > p { flex: 1 1 auto; min-width: 0; }
.trtl-t { font-size: 22px; margin: 2px 0 0 !important; }
.trru-row .trru { margin-top: 4px !important; }
.say.mini { position: relative; flex: 0 0 auto; width: 44px; height: 44px; min-height: 44px; padding: 0; gap: 0;
  justify-content: center; border-radius: 50%; box-shadow: none; margin: 0 !important; }
.say.mini .ic { width: 20px; height: 20px; }
.say.mini .say-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.say.mini.loading { animation: trpulse 1s ease-in-out infinite; }
@keyframes trpulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .say.mini.loading { animation: none; } }
