/* Оформление тренажёра. Правила: один шрифт, один акцентный цвет, цвета состояния только для состояний,
   шаг отступов 8 px, на блок — одна главная кнопка, пояснения — в подсказки «?». */
:root {
  --bg: #F3F4F6; --panel: #FFFFFF; --ink: #1B1F26; --muted: #6B7280; --faint: #9CA3AF; --line: #E1E4EA; --soft: #EEF0F3;
  --accent: #1F4FB8; --accent-ink: #163A8A; --accent-soft: #E8EEFB;
  --ok: #1E6B38; --ok-soft: #DDF3E3; --warn: #92400E; --warn-soft: #FBF3DC; --bad: #B42318; --bad-soft: #FDECEC;
  /* шкала напряжения: 0–2, 3–5, 6–8, 9–10 */
  --t0: #2E9E4F; --t1: #D9A50B; --t2: #D97706; --t3: #C2410C;
  --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 17px; font-weight: 700; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; } .mono, code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
b { font-weight: 600; }

/* шапка со вкладками */
header.top { display: flex; align-items: center; gap: 24px; height: 60px; padding: 0 32px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
header.top .title { font-weight: 700; font-size: 17px; white-space: nowrap; }
header.top nav { display: flex; gap: 4px; }
header.top nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; text-decoration: none; font-size: 14px; }
header.top nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
header.top .spacer { flex: 1; }
header.top .who { color: var(--muted); font-size: 13px; }
main { max-width: 1200px; margin: 0 auto; padding: 24px 32px 48px; }
section.tab[hidden] { display: none; }

/* карточки и сетка */
.card { background: var(--panel); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 20px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { margin-bottom: 12px; }
.card .head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card .head h2 { margin: 0; }
.cols { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.cols > .col { flex: 1 1 380px; min-width: 0; }
.cols > .col.wide { flex: 1.3 1 460px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* формы */
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 4px; font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 4px; }
input, select, textarea { font: inherit; padding: 9px 12px; border: 1px solid #CBD2DC; border-radius: 9px; background: #fff; width: 100%; min-height: 40px; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input.inline, select.inline { width: auto; }
button { font: inherit; font-weight: 600; height: 40px; padding: 0 16px; border-radius: 9px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; white-space: nowrap; }
button:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
button.secondary { background: #fff; color: var(--ink); border-color: #CBD2DC; font-weight: 500; }
button.secondary:hover { background: var(--soft); border-color: #CBD2DC; }
button.danger { background: #fff; color: var(--bad); border-color: #E5B4AE; font-weight: 500; }
button.danger:hover { background: var(--bad-soft); }
button.small { height: 32px; padding: 0 10px; font-size: 13px; }
button.big { height: 48px; font-size: 16px; padding: 0 22px; }
button.icon { width: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
button:disabled { opacity: .45; cursor: default; }
button.busy { opacity: .6; cursor: progress; }
/* подсказка «?» */
.q { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--faint); color: var(--muted); font-size: 12px; align-items: center; justify-content: center; cursor: help; vertical-align: middle; margin-left: 4px; font-weight: 600; }

/* таблицы — всегда во всю ширину, без обрезки */
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; text-align: right; }
.msg { min-height: 20px; font-size: 14px; }
.msg.ok { color: var(--ok); } .msg.bad { color: var(--bad); }
pre.review { white-space: pre-wrap; font: inherit; background: var(--soft); border-radius: 10px; padding: 14px 16px; margin: 0; }
.pwbox { background: var(--warn-soft); border-radius: 10px; padding: 12px 14px; margin-top: 12px; font-size: 14px; }
.pwbox code { font-size: 15px; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* состояния */
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--soft); color: var(--muted); }
.pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.live, .pill.closing { background: var(--ok-soft); color: var(--ok); } .pill.paused { background: var(--warn-soft); color: var(--warn); } .pill.waiting { background: var(--accent-soft); color: var(--accent); } .pill.ended { background: var(--soft); color: var(--muted); }
.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--soft); color: var(--ink); }
.chip.plus { background: var(--bad-soft); color: var(--bad); } .chip.minus { background: var(--ok-soft); color: var(--ok); }

/* разговор */
.transcript { display: flex; flex-direction: column; gap: 12px; }
.line { max-width: 85%; padding: 12px 16px; border-radius: 14px; line-height: 1.45; font-size: 16px; }
.line .who { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.line.master { align-self: flex-end; background: var(--accent-soft); border-bottom-right-radius: 4px; }
.line.master .who { color: var(--accent); text-align: right; }
.line.worker { align-self: flex-start; background: var(--soft); border-bottom-left-radius: 4px; }
.line.partial { opacity: .6; font-style: italic; }
.typing { align-self: flex-start; color: var(--muted); font-size: 14px; padding: 6px 16px; }

/* напряжение */
.tension { display: flex; align-items: center; gap: 16px; }
.tension .num { width: 72px; height: 72px; border-radius: 14px; color: #fff; background: var(--t1); font-size: 38px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .4s; }
.tension .scale { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tension .segs { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 3px; }
.tension .segs i { display: block; height: 12px; border-radius: 3px; background: var(--line); }
.tension .zones { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.flags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.hist { font-size: 13px; color: var(--muted); margin-top: 10px; }
.hist b { color: var(--ink); }
.big-code { font-size: 40px; font-weight: 700; letter-spacing: .12em; line-height: 1; font-variant-numeric: tabular-nums; }

/* волна звука */
.wave { display: inline-flex; align-items: flex-end; gap: 3px; height: 24px; }
.wave i { display: block; width: 5px; height: 4px; background: var(--accent); border-radius: 2px; transition: height .08s; }
.wave.mic i { background: var(--ok); }

/* портрет */
.portrait { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.portrait .pic { width: 200px; height: 250px; border-radius: 14px; background: #D7DBE1; object-fit: cover; outline: 4px solid transparent; transition: outline-color .3s; }
.portrait.speaking .pic { outline-color: var(--t0); }
.portrait .name { font-size: 26px; font-weight: 700; }
.portrait .job { color: var(--muted); font-size: 15px; }
.portrait .state { display: flex; align-items: center; gap: 10px; min-height: 24px; font-weight: 600; color: var(--muted); }

/* итог разговора */
.banner { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-radius: 14px; border: 2px solid var(--line); background: var(--soft); }
.banner .t { font-size: 22px; font-weight: 700; line-height: 1.1; }
.banner .s { color: var(--muted); font-size: 14px; }
.banner.договорились { background: var(--ok-soft); border-color: var(--t0); color: var(--ok); } .banner.договорились .s { color: #2F6B45; }
.banner.ушёл { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); } .banner.ушёл .s { color: #9A2B22; }
.banner.без-договорённости { background: var(--warn-soft); border-color: var(--t1); color: var(--warn); }

/* разбор по репликам */
.chart svg { width: 100%; height: auto; display: block; }
.chart circle.pt { cursor: pointer; }
.turncards { display: flex; gap: 16px; flex-wrap: wrap; }
.turncards .tc { flex: 1 1 280px; background: var(--panel); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.turncards .tc.m { border-left: 5px solid var(--accent); }
.turncards .tc .txt { font-size: 16px; line-height: 1.4; margin-top: 6px; }

@media (max-width: 760px) { main { padding: 16px; } header.top { padding: 0 16px; gap: 12px; height: auto; min-height: 56px; } .line { max-width: 95%; } .card { padding: 16px; } }

/* ---------- экран группы (проектор) ---------- */
body.screen { background: var(--soft); }
body.screen main { max-width: none; padding: 32px 48px; height: 100vh; overflow: hidden; display: flex; flex-direction: column; gap: 24px; }
body.screen header.top { background: transparent; border: 0; padding: 0; height: auto; }
body.screen .layout { display: flex; gap: 48px; flex: 1; min-height: 0; align-items: stretch; }
body.screen .side { width: 360px; flex-shrink: 0; }
body.screen .portrait .pic { width: 320px; height: 400px; }
body.screen .portrait .name { font-size: 44px; }
body.screen .portrait .job { font-size: 20px; }
body.screen .portrait .state { font-size: 20px; }
body.screen .portrait .wave { height: 26px; } body.screen .portrait .wave i { width: 5px; }
body.screen .stage { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 22px; overflow: auto; }
body.screen .transcript { gap: 22px; justify-content: flex-end; overflow: hidden; flex-shrink: 1; min-height: 0; }
body.screen .line { font-size: 34px; line-height: 1.3; font-weight: 500; max-width: 88%; padding: 22px 28px; background: var(--panel); box-shadow: var(--shadow); border-radius: 18px 18px 18px 6px; }
body.screen .line.master { background: transparent; box-shadow: none; padding: 0; font-size: 26px; font-weight: 400; color: #6B7482; max-width: 80%; border-radius: 0; }
body.screen .line .who { font-size: 15px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
body.screen .line.master .who { color: var(--faint); }
body.screen .line.partial { opacity: .55; }
body.screen .banner { padding: 24px 32px; } body.screen .banner .t { font-size: 36px; } body.screen .banner .s { font-size: 20px; }
body.screen .turncards .tc .txt { font-size: 24px; } body.screen .turncards .tc .label { font-size: 15px; }
body.screen .chip { font-size: 14px; }
body.screen .join { max-width: 460px; margin: 15vh auto 0; }
body.screen .join input { font-size: 40px; letter-spacing: .3em; text-align: center; height: 76px; font-weight: 700; }
body.screen .foot { display: flex; align-items: center; justify-content: space-between; font-size: 17px; color: var(--faint); }
@media (max-width: 1000px) { body.screen .layout { flex-direction: column; } body.screen .side { width: auto; } body.screen .portrait .pic { width: 200px; height: 250px; } body.screen .line { font-size: 24px; } }
