:root {
  /* АМ palette */
  --bg0: #1c2838;
  --bg1: #1e293b;
  --ink: #e8eef5;
  --muted: #94a3b8;
  --accent: #2ecc71;
  --accent-deep: #27ae60;
  --line: rgba(232, 238, 245, 0.12);
  --danger: #e07a5f;
  --listen: #2ecc71;
  --speak: #2ecc71;
  --trainer: #27ae60;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-body: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
/* display:flex/grid on panels must not beat the hidden attribute */
[hidden] {
  display: none !important;
}
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(1100px 640px at 8% -8%, rgba(46, 204, 113, 0.12) 0%, transparent 52%),
    radial-gradient(900px 520px at 100% 8%, rgba(39, 174, 96, 0.1) 0%, transparent 48%),
    radial-gradient(700px 400px at 50% 110%, rgba(28, 40, 56, 0.9) 0%, transparent 55%),
    linear-gradient(165deg, var(--bg0), var(--bg1));
  background-attachment: fixed;
}

.shell {
  width: min(680px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.75rem 0 3.25rem;
  transition: width 0.25s ease;
}
.shell.is-session {
  width: min(920px, calc(100% - 1.25rem));
  padding-top: 1rem;
}
.shell.is-session .brand { margin-bottom: 0.25rem; }
.shell.is-session .tagline { margin-bottom: 0.75rem; font-size: 0.9rem; }
.shell.is-gate,
.shell.is-lobby,
.shell.is-report {
  min-height: calc(100vh - 1rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 2rem;
  padding-bottom: 2.5rem;
}
.meta-compact {
  margin-bottom: 0.6rem;
  font-size: 0.75rem;
}

.brand {
  text-align: center;
}
.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  letter-spacing: 0.01em;
  line-height: 1.1;
  text-align: center;
  animation: brand-in 0.7s ease both;
}
.tagline {
  margin: 0.45rem 0 1.75rem;
  color: var(--muted);
  font-size: 1.02rem;
  text-align: center;
  animation: brand-in 0.7s ease 0.08s both;
}
@keyframes brand-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.panel {
  border-top: 1px solid var(--line);
  padding-top: 1.5rem;
}
.panel h1 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.45rem;
}
.lede { color: var(--muted); margin: 0 0 1.25rem; line-height: 1.45; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0.75rem 0 0; }

/* —— Home: two roles —— */
.gate {
  border-top: 0;
  padding-top: 0.25rem;
  animation: brand-in 0.75s ease 0.12s both;
}
.gate-lede {
  margin: 0 0 1.35rem;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 28rem;
  line-height: 1.45;
}
.role-paths {
  display: grid;
  gap: 0.85rem;
}
.role-btn {
  display: grid;
  gap: 0.35rem;
  width: 100%;
  text-align: left;
  text-decoration: none;
  color: inherit;
  appearance: none;
  cursor: pointer;
  border-radius: 14px;
  padding: 1.15rem 1.25rem 1.25rem;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(46, 204, 113, 0.08), transparent 42%),
    rgba(0, 0, 0, 0.22);
  transition:
    transform 0.22s ease,
    border-color 0.22s ease,
    background 0.22s ease,
    box-shadow 0.22s ease;
}
.role-btn:hover,
.role-btn:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(46, 204, 113, 0.45);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
  outline: none;
}
.role-btn:active { transform: translateY(0); }
.role-seller:hover,
.role-seller:focus-visible {
  background:
    linear-gradient(135deg, rgba(46, 204, 113, 0.16), transparent 50%),
    rgba(0, 0, 0, 0.28);
}
.role-trainer {
  background:
    linear-gradient(135deg, rgba(39, 174, 96, 0.1), transparent 42%),
    rgba(0, 0, 0, 0.22);
}
.role-trainer:hover,
.role-trainer:focus-visible {
  border-color: rgba(39, 174, 96, 0.5);
  background:
    linear-gradient(135deg, rgba(39, 174, 96, 0.18), transparent 50%),
    rgba(0, 0, 0, 0.28);
}
.role-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.role-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.15;
}
.role-seller .role-title { color: var(--accent); }
.role-trainer .role-title { color: var(--trainer); }
.role-desc {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
  max-width: 34rem;
}
.gate-foot { margin-top: 1.5rem; }

.text-back {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  padding: 0;
  margin: 0 0 1rem;
  cursor: pointer;
}
.text-back:hover { color: var(--ink); }

.lobby .cta-wide {
  display: block;
  width: 100%;
  max-width: 22rem;
  margin: 1.15rem auto 0;
  text-align: center;
}
.report-actions {
  margin-top: 1.35rem;
  justify-content: center;
}

.field-label {
  display: block;
  margin: 0 0 0.4rem;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}
.field-select {
  display: block;
  width: 100%;
  max-width: 28rem;
  appearance: none;
  margin: 0 0 0.35rem;
  padding: 0.7rem 2.2rem 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 1.15rem) calc(50% - 0.18rem) / 0.4rem 0.4rem no-repeat,
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - 0.85rem) calc(50% - 0.18rem) / 0.4rem 0.4rem no-repeat,
    rgba(0, 0, 0, 0.28);
  color: var(--ink);
  font: inherit;
  line-height: 1.3;
  cursor: pointer;
}
.field-select:focus {
  outline: 2px solid rgba(46, 204, 113, 0.55);
  outline-offset: 1px;
}
.field-select option {
  background: #1e293b;
  color: var(--ink);
}
.lobby-minimal {
  width: 100%;
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  border-top: 0;
  padding-top: 0.5rem;
}
.lobby-minimal .text-back {
  display: inline-block;
  margin-bottom: 1.35rem;
}
.lobby-minimal .field-label {
  text-align: center;
}
.lobby-minimal .field-select {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  text-align-last: center;
}
.lobby-minimal .hint,
.lobby-minimal .error {
  text-align: center;
}
.lobby-minimal .warm-progress {
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
}
.shell.is-lobby .brand .tagline {
  display: none;
}
.gender-toggle {
  display: inline-flex;
  gap: 0.4rem;
  margin: 0 0 1.1rem;
  max-width: 28rem;
}
.warm-progress {
  margin: 0.85rem 0 0;
  max-width: 28rem;
}
.warm-progress[hidden] {
  display: none !important;
}
.warm-progress-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.warm-progress-track {
  flex: 1 1 auto;
  min-width: 0;
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(232, 238, 245, 0.12);
  overflow: hidden;
}
.warm-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
  transition: width 0.2s ease;
}
.warm-pct {
  flex: 0 0 auto;
  min-width: 2.6rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--muted);
}
.shell.is-session .brand .tagline {
  display: none;
}
.session-minimal .avatar-name:empty {
  display: none;
}
.gender-btn {
  appearance: none;
  flex: 1 1 0;
  min-width: 7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--muted);
  padding: 0.55rem 0.85rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.gender-btn:hover {
  border-color: rgba(232, 238, 245, 0.28);
  color: var(--ink);
}
.gender-btn[aria-pressed="true"] {
  border-color: rgba(46, 204, 113, 0.45);
  background: rgba(46, 204, 113, 0.16);
  color: var(--accent);
  font-weight: 600;
}
.lobby-minimal #start.cta {
  margin-top: 1.15rem;
  margin-left: auto;
  margin-right: auto;
}

.cta, .ghost {
  appearance: none;
  border-radius: 6px;
  padding: 0.75rem 1.2rem;
  font: inherit;
  cursor: pointer;
}
.cta {
  border: 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  color: #0b1a12;
  font-weight: 600;
}
.cta:disabled, .ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.voice-actions {
  margin-top: auto;
  padding-top: 1.75rem;
  padding-bottom: 0.35rem;
  justify-content: center;
}
.session-minimal {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 5.5rem);
}
.end-training {
  min-width: min(20rem, 92vw);
  padding: 0.85rem 1.35rem;
  font-size: 0.95rem;
}

.meta {
  display: flex;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 1.5rem;
  justify-content: center;
}

.voice-stage-photo {
  display: grid;
  justify-items: center;
  gap: 0.55rem;
  min-height: 52vh;
  padding: 0.25rem 0 0.75rem;
}

.avatar-photo {
  --mouth: 0;
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  width: 100%;
}
.avatar-frame {
  position: relative;
  height: min(52vh, 680px);
  width: min(92vw, calc(52vh * 0.75), 510px);
  aspect-ratio: 3 / 4;
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(232, 238, 245, 0.12);
  background: #1c2838;
}
.avatar-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
  background: #1c2838;
}
.avatar-video.is-active {
  opacity: 1;
}
.avatar-vignette {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 35%, transparent 45%, rgba(0, 0, 0, 0.22) 100%);
  z-index: 2;
}
.avatar-name {
  margin: 0 0 0.15rem;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 4.5vw, 2.15rem);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.02em;
  line-height: 1.15;
  text-align: center;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

.voice-stage[data-state="guest"] .avatar-frame {
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(46, 204, 113, 0.28);
}
.voice-stage[data-state="listen"] .avatar-frame {
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(126, 184, 162, 0.32);
}
.voice-stage[data-state="done"] .avatar-photo {
  opacity: 0.82;
}

@media (max-height: 720px) {
  .avatar-frame { height: min(48vh, 520px); }
}
@media (max-width: 520px) {
  .avatar-frame {
    height: auto;
    width: min(92vw, 420px);
  }
}

.voice-status {
  margin: 0.35rem 0 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  text-align: center;
  color: var(--muted);
}
.listen-orb {
  position: relative;
  display: grid;
  place-items: center;
  width: min(13.5rem, 72vw);
  height: min(13.5rem, 72vw);
  margin: 0.35rem auto 0;
}
.listen-orb-ring,
.listen-orb-core {
  grid-area: 1 / 1;
  border-radius: 50%;
}
.listen-orb-ring {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(46, 204, 113, 0.35);
  background: radial-gradient(
    circle,
    rgba(46, 204, 113, 0.12) 0%,
    rgba(46, 204, 113, 0.02) 55%,
    transparent 70%
  );
  animation: listen-pulse 2.4s ease-out infinite;
}
.listen-orb-ring-delay {
  animation-delay: 1.2s;
}
.listen-orb-core {
  width: 68%;
  height: 68%;
  display: grid;
  place-items: center;
  padding: 0.85rem;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.16), transparent 42%),
    radial-gradient(circle at 50% 55%, rgba(46, 204, 113, 0.45), rgba(28, 40, 56, 0.92) 72%);
  box-shadow:
    0 0 0 1px rgba(46, 204, 113, 0.28),
    0 12px 28px rgba(0, 0, 0, 0.35),
    inset 0 0 24px rgba(46, 204, 113, 0.18);
  animation: listen-breathe 2.4s ease-in-out infinite;
}
.listen-orb-label {
  max-width: 7.5rem;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.92rem;
  line-height: 1.25;
  color: var(--ink);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}
@keyframes listen-pulse {
  0% { transform: scale(0.72); opacity: 0.7; }
  70% { transform: scale(1); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}
@keyframes listen-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
@media (prefers-reduced-motion: reduce) {
  .listen-orb-ring,
  .listen-orb-core { animation: none; }
}
.mic {
  min-width: 9rem;
}
.mic.hot {
  background: var(--listen);
}

.error { color: var(--danger); text-align: center; }
pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0,0,0,0.28);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem;
  font-size: 0.85rem;
}

.report-panel {
  width: 100%;
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
  border-top: 0;
  padding-top: 0.5rem;
  text-align: center;
}
.report-panel .cta { margin-top: 0; }
.shell.is-report .brand .tagline {
  display: none;
}
.report-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}
.report-view { display: grid; gap: 1.1rem; margin-top: 0.85rem; justify-items: center; text-align: center; }
.report-hero {
  display: grid;
  gap: 0.45rem;
  justify-items: center;
  width: 100%;
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
  padding-bottom: 0.95rem;
  border-bottom: 1px solid var(--line);
}
.report-mood {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}
.report-mood[data-mood="доволен"],
.report-mood[data-mood="воодушевлён"] { color: var(--listen); }
.report-mood[data-mood="нейтрален"] { color: var(--ink); }
.report-mood[data-mood="скептичен"] { color: var(--accent); }
.report-mood[data-mood="разочарован"],
.report-mood[data-mood="раздражён"] { color: var(--danger); }
.report-score {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  line-height: 1;
}
.report-score-max {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--muted);
}
.report-score-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.report-verdict {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
}
.report-verdict[data-v="хорошо"] { color: var(--listen); }
.report-verdict[data-v="частично"] { color: var(--accent); }
.report-verdict[data-v="слабо"],
.report-verdict[data-v="не начата"] { color: var(--danger); }
.report-sub { margin: 0; color: var(--muted); font-size: 0.92rem; }
.lobby .field-label { margin-top: 0.95rem; }
.lobby .field-label:first-of-type { margin-top: 0; }
.lobby .field-select { margin-bottom: 0.15rem; }
.report-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.85rem;
}
.report-stats strong { color: var(--ink); font-weight: 600; }
.report-block h2 {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
}
.report-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
}
.report-list li {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  gap: 0.45rem;
  align-items: start;
  color: var(--ink);
  font-size: 0.92rem;
}
.report-mark { line-height: 1.35; }
.report-mark.ok { color: var(--listen); }
.report-mark.no { color: var(--danger); }
.report-mark.na { color: var(--muted); }
.transcript {
  display: grid;
  gap: 0.65rem;
  margin: 0;
}
.transcript-item {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-left: 3px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 0 6px 6px 0;
}
.transcript-item[data-role="guest"] { border-left-color: var(--accent); }
.transcript-item[data-role="seller"] { border-left-color: var(--listen); }
.transcript-who {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.transcript-text { margin: 0; white-space: pre-wrap; }
.report-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.report-raw {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.report-raw summary { cursor: pointer; user-select: none; }
.report-raw pre { margin-top: 0.5rem; max-height: 240px; overflow: auto; }
