:root {
  --bg: #0d1017;
  --panel: #151a24;
  --panel-2: #1d2530;
  --panel-3: #10151d;
  --line: #303947;
  --text: #f4f7fb;
  --muted: #a7b0be;
  --accent: #37c7d4;
  --accent-2: #f2b84b;
  --good: #46d28a;
  --warn: #f2b84b;
  --bad: #ff6b6b;
  --shadow: 0 22px 70px rgba(0, 0, 0, .38);
}

/* Coach humain IA: final layout override.
   The visual coach must occupy the full block; the adjacent drill cell remains in the DOM for app state only. */
.human-panel .coach-stage {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  align-items: stretch !important;
  width: 100% !important;
}

.human-panel .coach-stage > :not(.human-preview) {
  display: none !important;
}

.human-panel .human-preview {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  height: clamp(360px, 38vw, 560px) !important;
  min-height: 0 !important;
}

.human-panel .human-placeholder,
.human-panel .human-video,
.human-panel .human-portrait {
  width: 100% !important;
  height: 100% !important;
}

.human-panel .human-portrait {
  object-fit: cover !important;
  object-position: center top !important;
}

.human-panel .human-face-effects {
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 900px) {
  .human-panel .human-preview {
    height: clamp(330px, 70vw, 520px) !important;
  }
}

@media (max-width: 700px) {
  .human-panel .human-preview {
    height: clamp(320px, 108vw, 480px) !important;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(55, 199, 212, .16), transparent 26%),
    radial-gradient(circle at 90% 20%, rgba(242, 184, 75, .11), transparent 24%),
    linear-gradient(135deg, #090c12, var(--bg) 48%, #111722);
}

button,
textarea,
input {
  font: inherit;
}

button,
input,
textarea,
select {
  max-width: 100%;
}

button {
  color: inherit;
}

.app-shell {
  width: min(1660px, calc(100% - 22px));
  margin: 0 auto;
  padding: 14px 0 28px;
}

.app-shell.locked {
  display: none;
}

.onboarding-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
}

.onboarding-page.hidden {
  display: none;
}

.onboarding-card {
  display: grid;
  gap: 22px;
  width: min(560px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .085), rgba(255, 255, 255, .035));
  box-shadow: var(--shadow);
}

.onboarding-brand {
  justify-content: flex-start;
}

.onboarding-copy h1 {
  margin-bottom: 10px;
  font-size: 36px;
}

.topbar {
  display: grid;
  grid-template-columns: auto auto minmax(620px, 1fr);
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.brand,
.device-preview,
.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.brand {
  font-weight: 900;
  font-size: 21px;
}

.device-preview {
  justify-content: flex-start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .04);
}

.device-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.device-preview button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .055);
  color: var(--text);
  padding: 7px 9px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.device-preview button:hover {
  background: rgba(255, 255, 255, .09);
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #061014;
  background: linear-gradient(135deg, var(--accent), #d5fbff);
}

.status-pill,
.icon-button,
.ghost-button,
.primary-button,
.choices button,
.profile-select,
.player-input-row input,
.settings-dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .055);
  color: var(--text);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 750;
}

.player-pill {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(150px, .9fr) minmax(160px, .9fr);
  gap: 10px;
  min-height: 76px;
  width: min(820px, 100%);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .055);
  color: var(--text);
}

.top-plan-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 68px;
  min-width: 250px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .055);
}

.top-plan-card div {
  display: grid;
  gap: 3px;
}

.top-plan-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.top-plan-card strong {
  font-size: 19px;
}

.top-plan-card small {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.player-pill div {
  display: grid;
  align-content: center;
  gap: 3px;
  min-width: 0;
  padding: 0 10px;
  border-right: 1px solid rgba(255, 255, 255, .12);
}

.player-pill div:last-child {
  border-right: 0;
}

.player-pill strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 21px;
  line-height: 1.1;
}

.player-pill span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.player-pill small {
  color: var(--accent);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.1;
}

.status-pill.ready {
  color: var(--good);
  border-color: rgba(70, 210, 138, .4);
}

.status-pill.warning {
  color: var(--warn);
  border-color: rgba(242, 184, 75, .42);
}

.icon-button,
.ghost-button,
.primary-button,
.choices button {
  min-height: 38px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 800;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}

.icon-button:hover,
.ghost-button:hover,
.primary-button:hover,
.choices button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, .09);
}

.primary-button {
  background: var(--accent);
  color: #061014;
  border-color: transparent;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: .45;
  transform: none;
}

.workspace {
  display: grid;
  grid-template-columns: 580px 1fr;
  gap: 16px;
  align-items: start;
}

.setup-panel,
.record-zone,
.guided-section,
.text-test,
.score-board,
.result-card,
.practice-panel,
.history-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .065), rgba(255, 255, 255, .025));
  box-shadow: var(--shadow);
}

.setup-panel {
  position: sticky;
  top: 10px;
  max-height: none;
  overflow: visible;
  padding: 16px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: 30px;
  line-height: 1.06;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 24px;
  letter-spacing: 0;
}

.muted-text {
  color: var(--muted);
  line-height: 1.55;
}

.field-group {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.compact-field {
  margin-top: 0;
}

.wide-field {
  grid-column: 1 / -1;
}

.settings-section {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, .13);
}

.settings-section summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 950;
  list-style: none;
}

.settings-section summary::-webkit-details-marker {
  display: none;
}

.settings-section summary::after {
  content: "+";
  float: right;
  color: var(--accent);
}

.settings-section[open] summary::after {
  content: "-";
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-section[open] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-section summary {
  grid-column: 1 / -1;
}

.profile-section .field-group {
  grid-column: 1 / -1;
  margin-top: 0;
}

.field-label {
  color: var(--muted);
  font-size: 16px;
  font-weight: 850;
}

.premium-level-title {
  margin-top: 4px;
  color: var(--accent-2);
}

.field-label small,
.premium-note {
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 900;
}

.player-card {
  display: grid;
  gap: 13px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, .16);
}

.account-card,
.cancel-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, .16);
}

.cancel-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.cancel-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.danger-button {
  border-color: rgba(255, 107, 107, .45);
  color: #ffb4b4;
}

.hidden {
  display: none !important;
}

.choices button.locked {
  position: relative;
  color: var(--muted);
  border-style: dashed;
}

.choices button.locked::after {
  content: none;
  display: none;
}

.player-head,
.player-input-row,
.xp-row,
.xp-row > div {
  display: flex;
  align-items: center;
}

.player-head,
.xp-row {
  justify-content: space-between;
  gap: 10px;
}

.player-category-title {
  display: block;
  margin-top: 3px;
  font-size: 24px;
  line-height: 1;
}

.player-input-row {
  gap: 8px;
}

.player-input-row input {
  min-width: 0;
  width: 100%;
  height: 38px;
  padding: 0 10px;
  outline: none;
}

.profile-input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, .18);
  color: var(--text);
  padding: 0 11px;
  outline: none;
}

.objective-input {
  min-height: 52px;
  padding-inline: 14px;
  font-size: 16px;
}

.objective-helper {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .045);
  color: var(--text);
  font-size: 16px;
  font-weight: 850;
  line-height: 1.2;
}

.profile-select {
  min-height: 46px;
  padding: 0 12px;
  font-size: 16px;
  font-weight: 850;
  outline: none;
}

.profile-select option {
  color: #111821;
}

.profile-input::placeholder {
  color: rgba(167, 176, 190, .72);
}

.player-input-row input:focus,
.profile-input:focus {
  border-color: rgba(55, 199, 212, .75);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  color: #061014;
  background: var(--accent-2);
  font-size: 12px;
  font-weight: 950;
}

.player-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.player-stats-grid div {
  display: grid;
  gap: 3px;
  min-height: 52px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .045);
}

.player-stats-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.player-stats-grid strong {
  font-size: 20px;
  line-height: 1.1;
}

.xp-row {
  display: grid;
  grid-template-columns: 110px 1fr;
}

.session-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 14px;
  align-items: center;
}

.session-strip span {
  color: var(--muted);
  font-size: 16px;
  font-weight: 850;
}

.session-strip strong {
  font-size: 20px;
  line-height: 1.15;
}

.session-strip meter {
  grid-column: 1 / -1;
}

.xp-row > div {
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
}

.xp-row strong {
  font-size: 15px;
}

.xp-row span {
  color: var(--muted);
  font-size: 14px;
}

.player-progress,
.player-leaderboard {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.player-progress strong {
  font-size: 19px;
  line-height: 1.25;
}

.player-progress p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.48;
}

.mini-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 17px;
  font-weight: 950;
}

.mini-section-head small {
  color: var(--muted);
  font-size: 15px;
  font-weight: 850;
}

.choices {
  display: grid;
  gap: 9px;
}

.choices.two {
  grid-template-columns: repeat(2, 1fr);
}

.choices.one {
  grid-template-columns: 1fr;
}

.choices.three {
  grid-template-columns: repeat(3, 1fr);
}

.choices.stack {
  grid-template-columns: 1fr;
}

.choices button {
  min-width: 0;
  min-height: 42px;
  font-size: 16px;
  line-height: 1.15;
  white-space: normal;
}

.choices button.selected {
  color: #061014;
  background: var(--accent);
  border-color: transparent;
}

#situationChoices button {
  min-height: 46px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.main-panel {
  display: grid;
  gap: 12px;
}

.record-zone {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
}

.record-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.clear-session-button {
  min-width: 96px;
}

.timer {
  min-width: 84px;
  font-size: 30px;
  font-weight: 900;
}

.record-button {
  display: grid;
  place-items: center;
  width: 118px;
  height: 118px;
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 24%, rgba(255, 255, 255, .28), transparent 20%),
    linear-gradient(145deg, #263241, #111821);
  box-shadow: inset 0 0 34px rgba(255, 255, 255, .05), 0 22px 55px rgba(0, 0, 0, .36);
  cursor: pointer;
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(5, 8, 13, .74);
  backdrop-filter: blur(8px);
}

.payment-page {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 20% 15%, rgba(55, 199, 212, .18), transparent 30%),
    rgba(5, 8, 13, .86);
  backdrop-filter: blur(10px);
}

.payment-card {
  display: grid;
  gap: 22px;
  width: min(620px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .035));
  box-shadow: var(--shadow);
}

.payment-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.payment-summary div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, .16);
}

.payment-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.payment-summary strong {
  font-size: 20px;
}

.payment-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.settings-dialog {
  display: grid;
  gap: 16px;
  width: min(760px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 20px;
  box-shadow: var(--shadow);
}

.settings-dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-block {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, .16);
}

.settings-block small,
.settings-block strong {
  font-size: 18px;
  font-weight: 900;
}

.settings-block small {
  color: var(--accent);
}

.danger-zone {
  grid-column: 1 / -1;
}

.record-button span {
  display: block;
}

#recordIcon {
  font-size: 20px;
  font-weight: 950;
  color: var(--accent);
}

#recordButtonText {
  max-width: 104px;
  line-height: 1.15;
  font-weight: 900;
  font-size: 14px;
  text-align: center;
}

.record-button.recording {
  background:
    radial-gradient(circle at 36% 24%, rgba(255, 255, 255, .28), transparent 20%),
    linear-gradient(145deg, #733332, #271616);
  border-color: rgba(255, 107, 107, .7);
  animation: pulse 1.2s ease-in-out infinite;
}

.record-zone.loading .record-button {
  animation: pulse .9s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.04);
  }
}

.guided-section,
.text-test,
.score-board,
.practice-panel {
  padding: 14px;
}

.task-grid,
.score-practice-grid {
  display: grid;
  gap: 12px;
  align-items: stretch;
}

.task-grid {
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
}

.task-grid:has(.guided-section:not(.visible)) {
  grid-template-columns: 1fr;
}

.score-practice-grid {
  grid-template-columns: minmax(0, 1fr) minmax(360px, .85fr);
}

.guided-section {
  display: none;
}

.guided-section.visible {
  display: block;
}

#guidedSentence {
  margin: 0;
  color: #ecf7ff;
  font-size: 16px;
  line-height: 1.45;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 900;
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.compact-head {
  padding: 0 0 10px;
  margin-bottom: 10px;
}

.text-test textarea {
  width: 100%;
  resize: vertical;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, .18);
  color: var(--text);
  padding: 13px;
  line-height: 1.5;
  outline: none;
}

.text-test textarea:focus {
  border-color: rgba(55, 199, 212, .75);
}

.score-board {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 14px;
  align-items: center;
}

.global-score {
  display: grid;
  gap: 4px;
  min-height: 128px;
  place-items: center;
  border-radius: 8px;
  background: var(--panel-3);
  border: 1px solid var(--line);
}

.global-score span,
.global-score small {
  color: var(--muted);
  font-weight: 800;
}

.global-score strong {
  font-size: 48px;
  line-height: .9;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 14px;
}

.score-row {
  display: grid;
  grid-template-columns: 88px 1fr 34px;
  gap: 8px;
  align-items: center;
  min-height: 30px;
}

.score-row span {
  color: var(--muted);
  font-weight: 800;
}

meter {
  width: 100%;
  height: 10px;
}

.insights-grid {
  display: grid;
  grid-template-columns: .78fr 1.22fr;
  gap: 12px;
}

.result-card {
  overflow: hidden;
}

.output {
  min-height: 170px;
  max-height: 235px;
  overflow: auto;
  padding: 16px;
  white-space: pre-wrap;
  line-height: 1.55;
}

.output.muted {
  color: var(--muted);
}

.practice-panel {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  flex-direction: column;
}

.practice-panel h2 {
  font-size: 21px;
}

.practice-panel p {
  margin-bottom: 0;
}

.coach-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  min-height: 100%;
}

.coach-stage > :not(.human-preview) {
  display: none !important;
}

.human-preview {
  position: relative;
  grid-column: 1 / -1;
  width: 100%;
  height: clamp(330px, 36vw, 500px);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .08), transparent 42%),
    linear-gradient(135deg, #17202a, #0d141c);
}

.human-generator {
  --avatar-energy: 0;
  --mouth-open: 0;
  --mouth-left: 55.2%;
  --mouth-top: 49.5%;
  --mouth-width: clamp(30px, 5.15vw, 63px);
  --mouth-height-base: clamp(20px, 3.4vw, 42px);
  --mouth-rest-height: .13;
  --mouth-open-height: .44;
  --mouth-rest-scale: .74;
  --mouth-open-scale: .24;
  --mouth-tilt: 0deg;
  --mouth-highlight: rgba(255, 169, 148, .68);
  --mouth-fill-top: rgba(92, 30, 33, .95);
  --mouth-fill-bottom: rgba(30, 10, 14, .98);
  --mouth-border: rgba(90, 26, 30, .42);
  --mouth-line: rgba(255, 198, 185, .5);
  --mouth-svg-upper: rgb(118, 70, 62);
  --mouth-svg-lower: rgb(84, 48, 45);
  --mouth-svg-shadow: rgb(22, 7, 8);
  --mouth-svg-highlight: rgba(205, 144, 128, .42);
  --mouth-upper-height: 50%;
  --mouth-upper-clip: polygon(0 72%, 10% 59%, 24% 34%, 39% 13%, 50% 20%, 61% 13%, 76% 34%, 90% 59%, 100% 72%, 86% 74%, 64% 67%, 50% 61%, 36% 67%, 14% 74%);
  --mouth-upper-open: -24%;
  --mouth-upper-scale: .08;
  --mouth-lower-top: 40%;
  --mouth-lower-height: 66%;
  --mouth-lower-rest: 4%;
  --mouth-lower-open: 42%;
  --mouth-lower-scale: .12;
  --mouth-lower-clip: polygon(4% 43%, 13% 36%, 28% 29%, 42% 34%, 50% 40%, 58% 34%, 72% 29%, 87% 36%, 96% 43%, 86% 55%, 67% 80%, 50% 93%, 33% 80%, 14% 55%);
  --mouth-line-top: 47%;
  --mouth-line-left: 9%;
  --mouth-line-right: 9%;
  --mouth-line-fade: linear-gradient(90deg, transparent 0 7%, #000 22% 78%, transparent 93% 100%);
  --mouth-line-clip: polygon(0 55%, 14% 50%, 30% 52%, 44% 59%, 50% 68%, 56% 59%, 70% 52%, 86% 50%, 100% 55%, 96% 59%, 84% 58%, 67% 63%, 50% 73%, 33% 63%, 16% 58%, 4% 59%);
  --eye-top: 26.6%;
  --eye-left: 46.1%;
  --eye-right: 61.1%;
}

.human-generator[data-voice="femme"] {
  --mouth-left: 56.2%;
  --mouth-top: 48%;
  --mouth-width: clamp(31px, 4.78vw, 60px);
  --mouth-height-base: clamp(18px, 2.9vw, 36px);
  --mouth-rest-height: .11;
  --mouth-open-height: .34;
  --mouth-rest-scale: .72;
  --mouth-open-scale: .28;
  --mouth-tilt: 0deg;
  --mouth-highlight: rgba(238, 170, 152, .58);
  --mouth-fill-top: rgba(172, 112, 98, .88);
  --mouth-fill-bottom: rgba(104, 60, 55, .9);
  --mouth-border: rgba(190, 132, 116, .28);
  --mouth-line: rgba(255, 211, 198, .42);
  --mouth-svg-upper: rgba(172, 112, 98, .88);
  --mouth-svg-lower: rgba(104, 60, 55, .9);
  --mouth-svg-shadow: rgba(35, 12, 14, .62);
  --mouth-svg-highlight: rgba(255, 211, 198, .3);
  --mouth-upper-height: 52%;
  --mouth-upper-clip: polygon(0 68%, 9% 55%, 22% 32%, 38% 12%, 50% 22%, 62% 12%, 78% 32%, 91% 55%, 100% 68%, 84% 72%, 62% 65%, 50% 61%, 38% 65%, 16% 72%);
  --mouth-upper-open: 0%;
  --mouth-upper-scale: 0;
  --mouth-lower-top: 43%;
  --mouth-lower-height: 62%;
  --mouth-lower-rest: 5%;
  --mouth-lower-open: 32%;
  --mouth-lower-scale: .08;
  --mouth-lower-clip: polygon(0 27%, 10% 26%, 25% 24%, 39% 32%, 50% 37%, 61% 32%, 75% 24%, 90% 26%, 100% 27%, 89% 50%, 69% 78%, 50% 90%, 31% 78%, 11% 50%);
  --mouth-line-top: 45%;
  --mouth-line-left: 1%;
  --mouth-line-right: 1%;
  --mouth-line-fade: linear-gradient(90deg, #000, #000);
  --mouth-line-clip: polygon(0 46%, 12% 40%, 28% 46%, 43% 52%, 50% 56%, 57% 52%, 72% 46%, 88% 40%, 100% 46%, 100% 60%, 86% 58%, 69% 60%, 50% 64%, 31% 60%, 14% 58%, 0 60%);
  --eye-top: 25.4%;
  --eye-left: 43.7%;
  --eye-right: 58.5%;
}

.human-generator[data-interest="Travail"] .human-preview {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .08), transparent 42%),
    linear-gradient(135deg, #232833, #111820);
}

.human-generator[data-interest="Sport"] .human-preview {
  background:
    linear-gradient(180deg, rgba(70, 210, 138, .14), transparent 48%),
    linear-gradient(135deg, #11271c, #0c1511);
}

.human-generator[data-interest="Voyage"] .human-preview {
  background:
    linear-gradient(180deg, rgba(55, 199, 212, .18), transparent 50%),
    linear-gradient(135deg, #13283a, #0e1720);
}

.human-generator[data-interest="Culture"] .human-preview {
  background:
    linear-gradient(90deg, rgba(242, 184, 75, .16) 0 18%, transparent 18% 22%, rgba(242, 184, 75, .1) 22% 40%, transparent 40%),
    linear-gradient(135deg, #241d19, #11151c);
}

.human-generator[data-interest="Technologie"] .human-preview {
  background:
    linear-gradient(90deg, rgba(55, 199, 212, .16) 1px, transparent 1px),
    linear-gradient(0deg, rgba(55, 199, 212, .1) 1px, transparent 1px),
    linear-gradient(135deg, #101c28, #0c1118);
  background-size: 18px 18px, 18px 18px, auto;
}

.human-video,
.human-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.human-video {
  object-fit: cover;
  background: #05080d;
}

.human-placeholder {
  display: grid;
  align-content: end;
  gap: 8px;
  padding: 0;
}

.human-portrait {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: saturate(1.03) contrast(1.02);
  transform: scale(1.02);
}

.human-face-effects {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  transform-origin: center 24%;
}

.avatar-mouth-sync {
  position: absolute;
  left: var(--mouth-left);
  top: var(--mouth-top);
  width: var(--mouth-width);
  height: calc(var(--mouth-height-base) * (var(--mouth-rest-height) + (var(--mouth-open) * var(--mouth-open-height))));
  min-height: 3px;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  opacity: calc(.2 + (var(--avatar-energy) * .8));
  overflow: visible;
  transform: translate(-50%, -50%) rotate(var(--mouth-tilt)) scaleX(calc(var(--mouth-rest-scale) + (var(--mouth-open) * var(--mouth-open-scale))));
  transform-origin: center;
  transition: opacity .08s linear, height .06s linear, transform .06s linear;
}

.avatar-mouth-sync::before,
.avatar-mouth-sync::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  background:
    radial-gradient(ellipse at 50% 52%, var(--mouth-highlight), transparent 58%),
    linear-gradient(180deg, var(--mouth-fill-top), var(--mouth-fill-bottom));
  box-shadow:
    0 0 0 1px var(--mouth-border),
    inset 0 1px 2px rgba(255, 225, 214, .18);
}

.avatar-mouth-sync::before {
  top: 0;
  height: var(--mouth-upper-height);
  border-radius: 52% 52% 30% 30% / 78% 78% 24% 24%;
  clip-path: var(--mouth-upper-clip);
  transform: translateY(calc(var(--mouth-open) * var(--mouth-upper-open))) scaleY(calc(1 + (var(--mouth-open) * var(--mouth-upper-scale))));
  transform-origin: center bottom;
}

.avatar-mouth-sync::after {
  top: var(--mouth-lower-top);
  height: var(--mouth-lower-height);
  border-radius: 28% 28% 58% 58% / 22% 22% 78% 78%;
  clip-path: var(--mouth-lower-clip);
  filter: brightness(.9);
  transform: translateY(calc(var(--mouth-lower-rest) + (var(--mouth-open) * var(--mouth-lower-open)))) scaleY(calc(1 + (var(--mouth-open) * var(--mouth-lower-scale))));
  transform-origin: center top;
}

.avatar-mouth-line {
  position: absolute;
  left: var(--mouth-line-left);
  right: var(--mouth-line-right);
  top: var(--mouth-line-top);
  z-index: 1;
  height: max(1px, calc(var(--mouth-height-base) * (.018 + (var(--mouth-open) * .09))));
  border-radius: 50% / 100%;
  background:
    radial-gradient(ellipse at center, rgba(35, 12, 14, .62), transparent 64%),
    var(--mouth-line);
  clip-path: var(--mouth-line-clip);
  -webkit-mask-image: var(--mouth-line-fade);
  mask-image: var(--mouth-line-fade);
  opacity: calc(.55 - (var(--mouth-open) * .28));
}

.avatar-mouth-svg {
  position: absolute;
  inset: -46% -2% -58%;
  z-index: 2;
  display: block;
  width: 104%;
  height: 204%;
  overflow: visible;
  filter: drop-shadow(0 0 .8px rgba(10, 4, 5, .36));
  opacity: 1;
}

.avatar-mouth-svg-upper,
.avatar-mouth-svg-lower {
  stroke: var(--mouth-border);
  stroke-width: .65;
  vector-effect: non-scaling-stroke;
}

.avatar-mouth-svg-backdrop {
  fill: var(--mouth-svg-shadow);
  transform: scaleY(calc(.25 + (var(--mouth-open) * .9)));
  transform-origin: 50px 27px;
  opacity: calc(.12 + (var(--mouth-open) * .88));
}

.avatar-mouth-svg-upper {
  fill: var(--mouth-svg-upper);
  transform: translateY(calc(var(--mouth-open) * -5px)) scaleY(calc(1 + (var(--mouth-open) * .04)));
  transform-origin: 50px 26px;
}

.avatar-mouth-svg-lower {
  fill: var(--mouth-svg-lower);
  transform: translateY(calc(var(--mouth-open) * 6.5px)) scaleY(calc(1 + (var(--mouth-open) * .08)));
  transform-origin: 50px 26px;
}

.avatar-mouth-svg-line {
  fill: none;
  stroke: var(--mouth-svg-shadow);
  stroke-width: calc(.7px + (var(--mouth-open) * .65px));
  stroke-linecap: round;
  opacity: calc(.36 + (var(--mouth-open) * .28));
}

.avatar-mouth-svg-upper,
.avatar-mouth-svg-lower,
.avatar-mouth-svg-backdrop,
.avatar-mouth-svg-line {
  transition: transform .06s linear, opacity .06s linear, stroke-width .06s linear;
}

.human-generator:not([data-voice="femme"]) .avatar-mouth-sync::before,
.human-generator:not([data-voice="femme"]) .avatar-mouth-sync::after,
.human-generator:not([data-voice="femme"]) .avatar-mouth-line {
  display: none;
}

.human-generator[data-voice="femme"] .avatar-mouth-svg {
  display: none;
}

.avatar-eye {
  position: absolute;
  top: var(--eye-top);
  width: clamp(12px, 2vw, 24px);
  height: clamp(7px, 1.1vw, 13px);
  border-radius: 999px;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(14, 18, 22, .24) 0 20%, transparent 54%),
    radial-gradient(ellipse at center, rgba(255, 255, 255, .18), transparent 66%);
  opacity: .16;
  transform: translate(-50%, -50%) scaleY(1);
  transform-origin: center;
  mix-blend-mode: soft-light;
}

.avatar-eye::before {
  content: "";
  position: absolute;
  left: 52%;
  top: 42%;
  width: 28%;
  height: 34%;
  border-radius: 999px;
  background: rgba(255, 255, 255, .34);
  filter: blur(.2px);
  transform: translate(-50%, -50%);
}

.avatar-eye-left {
  left: var(--eye-left);
}

.avatar-eye-right {
  left: var(--eye-right);
}

.human-generator .avatar-eye {
  animation: avatarGaze 7.6s ease-in-out infinite;
}

.human-generator .avatar-eye-right {
  animation-delay: .08s;
}

.human-generator.speaking .avatar-eye {
  animation-duration: 5.8s;
}

.human-placeholder::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, transparent 38%, rgba(5, 8, 13, .42) 68%, rgba(5, 8, 13, .88) 100%),
    linear-gradient(90deg, rgba(5, 8, 13, .18), transparent 42%, rgba(5, 8, 13, .12));
}

.human-generator.generating .human-portrait {
  filter: saturate(1.03) contrast(1.02);
}

.human-badge,
.human-placeholder strong,
.human-placeholder small {
  position: relative;
  z-index: 1;
  display: none;
}

.human-badge {
  width: fit-content;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(55, 199, 212, .16);
  color: var(--accent);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.human-placeholder strong {
  font-size: 18px;
}

.human-placeholder small {
  color: var(--muted);
  line-height: 1.35;
}

.human-coach-status {
  margin-bottom: 6px;
  font-size: 13px;
}

.human-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.human-actions button {
  min-height: 44px;
}

@media (max-width: 700px) {
  .human-actions {
    grid-template-columns: 1fr;
  }
}

.human-generator.generating .human-preview {
  box-shadow: 0 0 0 1px rgba(55, 199, 212, .28), 0 0 34px rgba(55, 199, 212, .12);
}

.human-generator.speaking .human-preview {
  box-shadow: 0 0 0 1px rgba(55, 199, 212, .32), 0 0 28px rgba(55, 199, 212, .16);
}

@keyframes humanTalk {
  0%, 100% {
    filter: saturate(1.06) contrast(1.02) brightness(1);
    transform: scale(1.025) translateY(0);
  }

  45% {
    filter: saturate(1.16) contrast(1.06) brightness(1.04);
    transform: scale(1.05) translateY(-1px);
  }

  72% {
    filter: saturate(1.1) contrast(1.04) brightness(1.02);
    transform: scale(1.038) translateY(1px);
  }
}

@keyframes avatarGaze {
  0%, 16%, 100% {
    opacity: .16;
    transform: translate(-50%, -50%) scaleY(1);
  }

  24%, 42% {
    opacity: .19;
    transform: translate(calc(-50% + .8px), calc(-50% - .2px)) scaleY(1);
  }

  54%, 72% {
    opacity: .18;
    transform: translate(calc(-50% - .7px), -50%) scaleY(1);
  }

  82%, 87% {
    opacity: .16;
    transform: translate(-50%, calc(-50% + .2px)) scaleY(1);
  }

  90%, 92% {
    opacity: .5;
    transform: translate(-50%, -50%) scaleY(.2);
  }

  94% {
    opacity: .17;
    transform: translate(-50%, -50%) scaleY(1);
  }
}


.rank-track {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.rank-track span {
  display: grid;
  place-items: center;
  min-height: 32px;
  padding: 6px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.rank-track span.active {
  color: #061014;
  background: var(--accent);
  border-color: transparent;
}

.history-panel,
.leaderboard-list {
  overflow: hidden;
}

.history-list,
.leaderboard-list {
  display: grid;
}

.history-empty,
.history-item,
.leaderboard-empty,
.leaderboard-item {
  padding: 12px 14px;
}

.compact-leaderboard .leaderboard-empty,
.compact-leaderboard .leaderboard-item {
  padding: 10px 0;
}

.history-empty,
.leaderboard-empty {
  color: var(--muted);
}

.history-item,
.leaderboard-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
}

.compact-leaderboard .leaderboard-item {
  grid-template-columns: 34px 1fr auto;
  gap: 9px;
}

.history-item:first-child,
.leaderboard-item:first-child {
  border-top: 0;
}

.history-score,
.leaderboard-rank {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--panel-2);
  font-weight: 950;
}

.compact-leaderboard .leaderboard-rank {
  width: 34px;
  height: 34px;
}

.compact-leaderboard .leaderboard-name,
.compact-leaderboard .leaderboard-score {
  font-size: 15px;
}

.compact-leaderboard .leaderboard-meta {
  font-size: 14px;
}

.history-title,
.leaderboard-name {
  font-weight: 900;
}

.history-meta,
.leaderboard-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.leaderboard-score {
  color: var(--accent);
  font-weight: 950;
}

.history-item button {
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .topbar,
  .workspace,
  .record-zone,
  .score-board,
  .insights-grid,
  .task-grid,
  .score-practice-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    width: min(100% - 24px, 980px);
  }

  .main-panel {
    order: 1;
  }

  .setup-panel {
    order: 2;
  }

  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-section[open] {
    grid-template-columns: 1fr;
  }

  .settings-dialog-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .device-preview {
    justify-content: stretch;
  }

  .device-preview button {
    flex: 1;
  }

  .player-pill {
    width: 100%;
  }

  .setup-panel {
    position: static;
    max-height: none;
  }

  .record-zone {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .score-board {
    grid-template-columns: 170px 1fr;
  }
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 20px, 760px);
  }

  .topbar {
    gap: 12px;
  }

  .brand {
    justify-content: flex-start;
  }

  .top-plan-card {
    min-width: 0;
  }

  .record-zone,
  .task-grid,
  .score-practice-grid,
  .insights-grid {
    gap: 10px;
  }

  .coach-stage {
    grid-template-columns: 118px 1fr;
  }

  .coach-scene {
    min-height: 118px;
  }

  .record-zone {
    grid-template-columns: 1fr;
  }

  .record-control {
    justify-content: space-between;
  }

  .score-board {
    grid-template-columns: 1fr;
  }

  .global-score {
    min-height: 112px;
  }

  .score-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100% - 14px, 560px);
    padding: calc(10px + env(safe-area-inset-top)) 0 22px;
  }

  .setup-panel {
    padding: 12px;
  }

  .topbar,
  .record-control,
  .practice-panel {
    align-items: stretch;
  }

  .topbar-actions {
    width: 100%;
    flex-direction: column;
  }

  .device-preview {
    flex-wrap: wrap;
    width: 100%;
  }

  .device-preview span {
    width: 100%;
  }

  .icon-button {
    flex: 1;
    justify-content: center;
  }

  .player-pill {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 0;
    padding: 10px;
  }

  .player-pill div:first-child {
    grid-column: 1 / -1;
  }

  .player-pill div {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    padding: 8px 4px;
  }

  .player-pill div:last-child {
    border-bottom: 0;
  }

  .player-pill div:nth-child(2) {
    border-bottom: 0;
    border-right: 1px solid rgba(255, 255, 255, .12);
  }

  .record-control {
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
  }

  .timer {
    width: 100%;
    text-align: center;
    font-size: 34px;
  }

  .record-button {
    margin: 0 auto;
    width: 132px;
    height: 132px;
  }

  .clear-session-button {
    width: min(100%, 180px);
  }

  .score-grid,
  .choices.three,
  .profile-section #interestChoices,
  .profile-section #goalChoices {
    grid-template-columns: 1fr;
  }

  .score-row {
    grid-template-columns: 88px 1fr 36px;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .compact-head {
    padding: 0 0 10px;
  }

  .head-actions {
    width: 100%;
  }

  .head-actions .ghost-button,
  .text-test .ghost-button {
    flex: 1;
  }

  .guided-section,
  .text-test,
  .score-board,
  .practice-panel {
    padding: 12px;
  }

  .coach-stage {
    grid-template-columns: 1fr;
  }

  .coach-scene {
    min-height: 154px;
  }

  #guidedSentence {
    font-size: 15px;
  }

  .output {
    min-height: 142px;
    max-height: 220px;
    padding: 14px;
  }

  .settings-section {
    padding: 12px;
  }

  .rank-track {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .settings-modal,
  .payment-page {
    padding: 12px;
  }

  .settings-dialog,
  .payment-card,
  .onboarding-card {
    max-height: calc(100vh - 24px);
    overflow: auto;
    padding: 18px;
  }

  .payment-summary,
  .payment-actions {
    grid-template-columns: 1fr;
  }

  .history-item,
  .leaderboard-item {
    grid-template-columns: auto 1fr;
  }

  .history-item button {
    grid-column: 1 / -1;
  }

  .leaderboard-score {
    grid-column: 1 / -1;
  }
}

@media (max-width: 430px) {
  .brand {
    font-size: 18px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-copy small {
    font-size: 11px;
  }

  .top-plan-card,
  .player-pill,
  .record-zone,
  .guided-section,
  .text-test,
  .score-board,
  .practice-panel,
  .result-card,
  .history-panel,
  .setup-panel {
    border-radius: 8px;
  }

  .record-zone h2 {
    font-size: 21px;
  }

  .record-button {
    width: 124px;
    height: 124px;
  }

  .global-score strong {
    font-size: 44px;
  }

  .score-row {
    grid-template-columns: 78px 1fr 34px;
    gap: 7px;
  }

  .profile-input,
  .profile-select,
  .choices button,
  .ghost-button,
  .primary-button,
  .icon-button {
    min-height: 44px;
  }
}
