/* Тренажёры, экран записи и разбор. Поверх переменных и классов из base.css. */

.tr-root {
  display: flex; flex-direction: column; gap: 12px;
  color: var(--ink, #161b3d); font-family: var(--text, "Inter", system-ui, sans-serif);
  -webkit-tap-highlight-color: transparent;
}
.tr-root [hidden] { display: none !important; }
.tr-hint { margin: 0; font-size: 16px; line-height: 1.45; color: var(--ink, #161b3d); }
.tr-top:empty, .tr-result:empty, .tr-status:empty, .tr-big:empty { display: none; }
.tr-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tr-chip {
  min-height: 44px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line, #dfe3f2); background: var(--bg, #fff); color: var(--navy, #232e85);
  font: 600 14px/1 var(--text, "Inter", system-ui, sans-serif);
}
.tr-chip[aria-selected="true"], .tr-chip[aria-pressed="true"] { background: var(--navy, #232e85); border-color: var(--navy, #232e85); color: #fff; }
.tr-chip:disabled { opacity: .5; cursor: default; }
.tr-target { font-size: 14px; }

.tr-viz { display: flex; flex-direction: column; gap: 12px; }
.tr-canvas { display: block; width: 100%; touch-action: manipulation; }
.tr-big {
  font: 800 28px/1.15 var(--display, "Inter Tight", "Inter", system-ui, sans-serif);
  color: var(--navy, #232e85); text-align: center; font-variant-numeric: tabular-nums;
}
.tr-status { margin: 0; text-align: center; font-size: 15px; line-height: 1.4; min-height: 1.4em; }
.tr-result-tile { display: flex; flex-direction: column; gap: 6px; }
.tr-result-tile p { margin: 0; line-height: 1.45; }
.tr-result-tile p:first-child { font: 700 18px/1.3 var(--display, "Inter Tight", "Inter", system-ui, sans-serif); color: var(--navy, #232e85); }

.tr-actions { display: flex; flex-direction: column; gap: 8px; padding-bottom: env(safe-area-inset-bottom, 0); }
.tr-actions .btn { width: 100%; min-height: 52px; }
.tr-actions.row { flex-direction: row; }
.tr-actions.row .btn { flex: 1; }

.tr-error { border-left: 4px solid var(--cta, #d92a10); display: flex; flex-direction: column; gap: 10px; }
.tr-error p { margin: 0; line-height: 1.45; }

/* ---------- тексты для чтения ---------- */
.tr-reading { font-size: 19px; line-height: 1.65; color: var(--ink, #161b3d); }
.tr-reading p { margin: 0; }
.tr-reading-title { font: 700 14px/1.2 var(--text, "Inter", system-ui, sans-serif); color: var(--muted, #5d6488); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.tr-pause { display: inline-block; width: 2px; height: 1.05em; margin: 0 .35em; vertical-align: -0.15em; background: var(--cta, #d92a10); border-radius: 1px; }
.tr-pause--long { width: 7px; background: linear-gradient(90deg, var(--cta, #d92a10) 0 2px, transparent 2px 5px, var(--cta, #d92a10) 5px 7px); }
.tr-stress { font-weight: 800; color: var(--navy, #232e85); text-decoration: underline; text-decoration-color: var(--gold, #f6c945); text-decoration-thickness: 3px; text-underline-offset: 3px; }
.tr-word { transition: color .15s, background-color .15s; border-radius: 4px; }
.tr-word--past { color: var(--muted, #5d6488); }
.tr-word--now { background: var(--gold, #f6c945); color: var(--ink, #161b3d); }
.tr-gauge { width: 100%; }

/* ---------- дикция ---------- */
.tr-twister { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.tr-twister-text { margin: 0; font: 700 22px/1.4 var(--display, "Inter Tight", "Inter", system-ui, sans-serif); color: var(--navy, #232e85); }
.tr-pulse, .tr-strip { width: 100%; }

/* ---------- манера ---------- */
.tr-manner-card { display: flex; align-items: center; gap: 12px; min-height: 120px; }
.tr-manner-card-body { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.tr-card-title { font: 800 30px/1.1 var(--display, "Inter Tight", "Inter", system-ui, sans-serif); color: var(--panel-ink, #fff); }
.tr-card-hint { font-size: 15px; color: var(--panel-muted, #b9c0ee); }
.tr-ring { position: relative; width: 64px; height: 64px; flex: none; }
.tr-ring svg { display: block; }
.tr-ring-num { position: absolute; inset: 0; display: grid; place-items: center; font: 800 18px/1 var(--display, "Inter Tight", sans-serif); color: var(--panel-ink, #fff); }
.tr-flip { animation: tr-flip .35s ease-out; }
@keyframes tr-flip { from { transform: scale(.94); opacity: .4; } to { transform: none; opacity: 1; } }

/* ---------- зеркало ---------- */
.tr-mirror-stage { position: relative; width: 100%; aspect-ratio: 3 / 4; max-height: 70vh; border-radius: var(--r, 16px); overflow: hidden; background: var(--ink, #161b3d); }
.tr-mirror-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.tr-mirror-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--panel-muted, #b9c0ee); }
.tr-mirror-ov { position: absolute; inset: 0; pointer-events: none; }
.tr-mirror-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.tr-ov-grid line { stroke: rgba(255,255,255,.55); stroke-width: .3; vector-effect: non-scaling-stroke; stroke-dasharray: 4 4; }
.tr-ov-frame { fill: none; stroke: var(--gold, #f6c945); stroke-width: 3; vector-effect: non-scaling-stroke; stroke-dasharray: 10 6; }
.tr-ov-grid, .tr-ov-frame, .tr-ov-label, .tr-ov-dot { display: none; }
.tr-show-grid .tr-ov-grid, .tr-show-frame .tr-ov-frame, .tr-show-gaze .tr-ov-dot { display: block; }
.tr-show-frame .tr-ov-frame-label, .tr-show-grid .tr-ov-grid-label { display: block; }
.tr-ov-label { position: absolute; left: 12px; right: 12px; text-align: center; font: 600 12px/1.2 var(--text, "Inter", sans-serif); color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.tr-ov-frame-label { top: calc(30% - 20px); }
.tr-ov-grid-label { bottom: 8px; }
.tr-show-frame.tr-show-grid .tr-ov-grid-label { bottom: auto; top: calc(66.6% + 6px); }
.tr-ov-dot { position: absolute; top: 10px; left: 50%; width: 22px; height: 22px; margin-left: -11px; }
.tr-ov-dot span { position: absolute; inset: 4px; border-radius: 50%; background: var(--cta, #d92a10); box-shadow: 0 0 0 3px rgba(255,255,255,.85); }
.tr-ov-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--cta, #d92a10); animation: tr-ping 1.6s ease-out infinite; }
@keyframes tr-ping { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }

/* ---------- разминка ---------- */
.tr-warm-title { margin: 0; text-align: center; }
.tr-warm-instr { margin: 0; font-size: 17px; line-height: 1.5; text-align: center; }
.tr-warm-next { margin: 0; text-align: center; font-size: 14px; }

/* ---------- экран записи ---------- */
.tr-rec-text { max-height: 46vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tr-rec-video-wrap { position: relative; width: 100%; aspect-ratio: 3 / 4; max-height: 56vh; border-radius: var(--r, 16px); overflow: hidden; background: var(--ink, #161b3d); }
.tr-rec-video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.tr-rec-video--review { transform: none; border-radius: var(--r, 16px); background: var(--ink, #161b3d); aspect-ratio: 3 / 4; max-height: 56vh; object-fit: contain; }
.tr-rec-stage { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px 0; }
.tr-rec-timer { font-variant-numeric: tabular-nums; }
.tr-level { width: min(260px, 80%); height: 8px; border-radius: 4px; background: var(--tile, #f2f4fb); overflow: hidden; }
.tr-level > i { display: block; height: 100%; width: 0; background: var(--ok, #1f9d55); border-radius: 4px; transition: width .06s linear; }
.tr-rec-btn.btn {
  width: 88px; height: 88px; min-height: 88px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; box-shadow: 0 6px 20px rgba(217, 42, 16, .28);
}
.tr-rec-status { margin: 0; text-align: center; font-size: 15px; }
.tr-rec-live { margin: 0; text-align: center; font-size: 14px; min-height: 1.3em; }
.tr-rec-live:empty { display: none; }
.tr-rec-player audio { width: 100%; }
.tr-rec-player:empty { display: none; }

/* ---------- разбор записи ---------- */
.tr-metrics { display: grid; grid-template-columns: 1fr; gap: 8px; }
.tr-metric { display: flex; flex-direction: column; gap: 4px; border-left: 4px solid var(--line, #dfe3f2); }
.tr-metric--ok { border-left-color: var(--ok, #1f9d55); }
.tr-metric--warn { border-left-color: var(--gold, #f6c945); }
.tr-metric-title { font: 600 13px/1.2 var(--text, "Inter", sans-serif); color: var(--muted, #5d6488); text-transform: uppercase; letter-spacing: .04em; }
.tr-metric-value { font: 800 20px/1.25 var(--display, "Inter Tight", "Inter", sans-serif); color: var(--navy, #232e85); }
.tr-metric-text { font-size: 15px; line-height: 1.45; color: var(--ink, #161b3d); }
.tr-metric-note { margin: 4px 0 0; font-size: 13px; }
.tr-delta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 14px; color: var(--muted, #5d6488); }
.tr-delta svg { flex: none; }
.tr-delta-word { margin-left: auto; font-weight: 700; }
.tr-delta--up { color: var(--ok, #1f9d55); }
.tr-delta--down { color: var(--cta, #d92a10); }
.tr-transcript p { margin: 0; font-size: 17px; line-height: 1.6; }
.tr-filler { background: none; color: var(--cta, #d92a10); font-weight: 700; text-decoration: underline wavy; text-underline-offset: 3px; }

@media (min-width: 520px) {
  .tr-metrics { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .tr-flip, .tr-ov-dot::after { animation: none; }
  .tr-word, .tr-level > i { transition: none; }
}
