:root {
  color-scheme: light;
  --bg: #f8f7f3;
  --surface: #ffffff;
  --muted-surface: #f3f4f6;
  --primary: #7f1d2d;
  --primary-dark: #5f1320;
  --accent: #f59e0b;
  --success: #2f7d5c;
  --warning: #f97316;
  --error: #dc2626;
  --text: #111827;
  --secondary: #6b7280;
  --soft: #9ca3af;
  --border: #e5e7eb;
  --green: #2f7d5c;
  --shadow: 0 18px 48px rgba(64, 20, 30, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app {
  min-height: 100vh;
}

.screen {
  width: min(1120px, 100%);
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  padding: 14px 22px 140px;
}

.screen::before {
  content: "";
  position: fixed;
  top: -180px;
  right: -120px;
  z-index: -1;
  width: 560px;
  height: 420px;
  border-radius: 0 0 0 70%;
  background: rgba(127, 29, 45, 0.08);
}

.shell {
  display: grid;
  gap: 12px;
}

.narrow {
  width: min(520px, 100%);
  margin: 0 auto;
}

.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  color: white;
  background: var(--primary);
  box-shadow: 0 12px 24px rgba(127, 29, 45, 0.22);
}

.logo svg {
  width: 27px;
  height: 27px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 1.05rem;
}

.brand span {
  color: var(--secondary);
  font-size: 0.85rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  align-items: center;
  gap: 24px;
  min-height: calc(100dvh - 124px);
}

.hero-copy h1,
.page-title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.75rem);
  line-height: 1.02;
  letter-spacing: -2px;
}

.hero-copy p,
.lead {
  margin: 8px 0 0;
  color: var(--secondary);
  font-size: 1rem;
  line-height: 1.42;
}

.microcopy {
  margin: 14px 0 0;
  color: var(--secondary);
  font-size: 0.9rem;
}

.hero-visual {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 70% 20%, rgba(47, 125, 92, 0.22), transparent 28%),
    linear-gradient(145deg, #f4d9dd 0%, #ffffff 46%, #e3f3eb 100%);
  box-shadow: var(--shadow);
}

.coach-visual {
  position: absolute;
  inset: 36px;
  width: calc(100% - 72px);
  height: calc(100% - 72px);
}

.hero-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: cover;
  object-position: center;
}

.actions-row,
.quick-grid,
.choice-list,
.setting-list {
  display: grid;
  gap: 12px;
}

.actions-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.icon-btn,
.option-card,
.scenario-card,
.review-card {
  min-height: 44px;
  border: 0;
  color: var(--text);
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  gap: 8px;
}

.primary-btn svg,
.secondary-btn svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
}

.primary-btn {
  color: white;
  background: var(--primary);
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.primary-btn:disabled {
  color: var(--soft);
  background: var(--muted-surface);
}

.secondary-btn {
  border: 1px solid var(--border);
  background: var(--surface);
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--primary);
  background: transparent;
  font-weight: 700;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--muted-surface);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

.card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.plain-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.section-title {
  margin: 0 0 12px;
  font-size: 1.25rem;
  line-height: 1.2;
}

.today-title {
  margin: 0;
  color: #071631;
  font-size: clamp(2.55rem, 5.4vw, 4.25rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.card-title {
  margin: 0;
  font-size: 1.07rem;
  line-height: 1.3;
}

.label {
  margin: 0 0 7px;
  color: var(--secondary);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.option-card {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-align: left;
}

.option-card.is-selected {
  border-color: var(--primary);
}

.option-card.is-selected {
  box-shadow: 0 0 0 3px rgba(127, 29, 45, 0.12);
}

.option-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--muted-surface);
  color: var(--primary);
  font-weight: 800;
}

.option-icon svg {
  display: block;
  width: 21px;
  height: 21px;
  margin: auto;
}

.option-icon .option-png-icon {
  display: block;
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 12px;
}

.option-color {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.72);
}

.option-color-muted {
  background: #94a3b8;
}

.option-color-nervous {
  background: #f59e0b;
}

.option-color-ready {
  background: #2f9e72;
}

.option-color-speak {
  background: #8f1d32;
}

.choice-list .option-card .option-icon,
.step-card .option-card .option-icon,
.answer-area .option-card .option-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.choice-list .option-card .option-icon svg,
.step-card .option-card .option-icon svg,
.answer-area .option-card .option-icon svg {
  display: block;
  width: 21px;
  height: 21px;
  margin: auto;
  flex: 0 0 auto;
}

.flag {
  position: relative;
  display: block;
  width: 26px;
  height: 18px;
  overflow: hidden;
  border: 1px solid rgba(17, 24, 39, 0.16);
  border-radius: 3px;
  background: #fff;
}

.language-switcher .option-icon {
  overflow: hidden;
  padding: 0;
}

.language-switcher .option-icon .flag {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: inherit;
}

.flag-nl {
  background: linear-gradient(#ae1c28 0 33%, #fff 33% 66%, #21468b 66%);
}

.flag-en {
  background: #fff url("assets/flags/en.svg") center / cover no-repeat;
}

.flag-de {
  background: linear-gradient(#000 0 33%, #dd0000 33% 66%, #ffce00 66%);
}

.flag-fr {
  background: linear-gradient(90deg, #0055a4 0 33%, #fff 33% 66%, #ef4135 66%);
}

.flag-es {
  background: linear-gradient(#aa151b 0 25%, #f1bf00 25% 75%, #aa151b 75%);
}

.flag-se {
  background:
    linear-gradient(90deg, transparent 28%, #fecc00 28% 42%, transparent 42%),
    linear-gradient(transparent 38%, #fecc00 38% 58%, transparent 58%),
    #006aa7;
}

.flag-dk {
  background:
    linear-gradient(90deg, transparent 30%, #fff 30% 44%, transparent 44%),
    linear-gradient(transparent 40%, #fff 40% 58%, transparent 58%),
    #c60c30;
}

.option-card strong,
.option-card span,
.scenario-card strong,
.scenario-card span {
  display: block;
}

.option-card span,
.scenario-card span,
.hint {
  color: var(--secondary);
  font-size: 0.9rem;
  line-height: 1.45;
}

.checkmark {
  color: var(--primary);
  font-weight: 900;
}

.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: var(--muted-surface);
}

.progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 240ms ease;
}

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

.metric {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.metric span,
.metric strong {
  display: block;
}

.metric span {
  color: var(--secondary);
  font-size: 0.82rem;
}

.metric strong {
  margin-top: 4px;
  font-size: 1.35rem;
}

.today-layout,
.progress-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.session-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.82fr);
  gap: 16px;
  align-items: center;
  min-height: 258px;
  padding: 18px 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 50%, rgba(245, 158, 11, 0.12), transparent 34%),
    rgba(255, 255, 255, 0.92);
}

.session-copy {
  display: grid;
  gap: 13px;
  align-content: center;
}

.session-copy .page-title {
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 0.98;
}

.session-art {
  width: 100%;
  min-height: 190px;
}

.session-art svg {
  width: 100%;
  height: auto;
}

.session-meta,
.chip-row,
.skill-row,
.step-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pill,
.cefr-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--primary-dark);
  background: #f4d9dd;
  font-size: 0.8rem;
  font-weight: 800;
}

.pill.warn {
  color: #9a4d00;
  background: #ffedd5;
}

.pill.good {
  color: #1f5f45;
  background: #dff2e8;
}

.focus-list {
  display: grid;
  gap: 14px;
}

.focus-item {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
}

.focus-icon,
.stat-icon,
.quick-icon {
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--primary);
  background: #f8e8eb;
}

.focus-icon {
  width: 46px;
  height: 46px;
}

.focus-icon svg,
.stat-icon svg,
.quick-icon svg {
  width: 22px;
  height: 22px;
}

.today-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stat-icon {
  width: 42px;
  height: 42px;
}

.metric .stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.metric .stat-icon svg {
  display: block;
  width: 22px;
  height: 22px;
  margin: auto;
  transform: translate(0, 0);
}

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

.quick-action {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.quick-action strong,
.quick-action span {
  display: block;
}

.quick-action span {
  color: var(--secondary);
  font-size: 0.88rem;
}

.quick-icon {
  width: 40px;
  height: 40px;
}

.quick-action .quick-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.quick-action .quick-icon svg {
  display: block;
  width: 22px;
  height: 22px;
  margin: auto;
}

/* 100-step language path */
.path-page {
  display: grid;
  gap: 14px;
  width: min(1120px, 100%);
  height: calc(100dvh - 126px);
  margin: 0 auto;
  overflow: hidden;
}

.path-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
}

.path-header .page-title {
  font-size: clamp(2.2rem, 4vw, 3.8rem);
}

.path-progress-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.06);
}

.path-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding: 2px 4px 110px;
  scrollbar-width: thin;
}

.path-node {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--text);
  background: #fff;
  text-align: left;
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.045);
}

.path-node-number {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  color: var(--primary);
  background: #fff1f3;
  font-weight: 900;
}

.path-node-copy {
  min-width: 0;
}

.path-node-copy strong,
.path-node-copy span {
  display: block;
}

.path-node-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.path-node-copy span {
  margin-top: 3px;
  color: var(--secondary);
  font-size: 0.86rem;
}

.path-node-status {
  min-width: 58px;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--secondary);
  background: var(--muted-surface);
  font-size: 0.76rem;
  font-weight: 850;
  text-align: center;
}

.path-node.is-done {
  opacity: 0.82;
}

.path-node.is-done .path-node-number {
  color: #fff;
  background: var(--green);
}

.path-node.is-next {
  border-color: rgba(127, 29, 45, 0.42);
  background: linear-gradient(135deg, #fff 0%, #fff4f6 100%);
  box-shadow: 0 12px 28px rgba(127, 29, 45, 0.1);
}

.path-node.is-next .path-node-status {
  color: var(--primary);
  background: #fbe7ee;
}

.path-node.is-locked {
  cursor: not-allowed;
  opacity: 0.52;
}

/* Talk page layout */
.talk-layout {
  display: grid;
  gap: 16px;
  height: calc(100dvh - 118px);
  padding: 24px 30px;
  border: 1px solid rgba(127, 29, 45, 0.16);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  align-content: start;
  overflow: visible;
}

.talk-header {
  position: relative;
  display: block;
  min-height: 300px;
  overflow: visible;
}

.talk-header > div:first-child {
  position: relative;
  z-index: 2;
  max-width: 560px;
}

.talk-header .page-title {
  max-width: 560px;
  font-size: clamp(3.1rem, 4.8vw, 4.65rem);
  line-height: 0.96;
}

.talk-header .lead {
  max-width: 500px;
}

.talk-kicker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.talk-kicker-icon,
.talk-status-icon {
  display: grid;
  place-items: center;
  color: var(--primary);
}

.talk-kicker-icon {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(127, 29, 45, 0.18);
  border-radius: 10px;
  background: #fff7f3;
}

.talk-kicker-icon svg {
  width: 22px;
  height: 22px;
}

.talk-status {
  display: grid;
  grid-template-columns: 34px 240px auto;
  gap: 12px;
  align-items: center;
  margin-top: 6px;
}

.talk-visual-column {
  position: absolute;
  top: 10px;
  right: 0;
  z-index: 1;
  display: grid;
  gap: 12px;
  justify-items: end;
  width: min(590px, 48%);
  pointer-events: none;
}

.talk-hero-image {
  display: block;
  width: min(500px, 100%);
  aspect-ratio: 16 / 7;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 18px 42px rgba(64, 20, 30, 0.14);
}

.talk-status-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #fff1df;
}

.talk-status-copy {
  display: grid;
  gap: 7px;
}

.talk-status-copy span {
  color: var(--secondary);
  font-size: 0.92rem;
}

.xp-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.06);
  font-weight: 800;
}

.xp-pill svg {
  width: 17px;
  height: 17px;
  color: var(--accent);
}

.talk-kicker .label {
  margin: 0;
}

.talk-layout .scenario-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.talk-layout .scenario-card {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 18px;
  align-items: center;
  width: 100%;
  min-height: 128px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-align: left;
  box-shadow: 0 14px 30px rgba(17, 24, 39, 0.06);
}

.talk-layout .scenario-card.is-recommended {
  border-color: var(--primary);
  background: linear-gradient(135deg, #fff 0%, #fff7f4 100%);
}

.talk-layout .scenario-card .scenario-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  min-width: 62px;
  border-radius: 999px;
  color: var(--primary);
  background: #fff0ef;
  line-height: 0;
  box-shadow: 0 12px 24px rgba(127, 29, 45, 0.08);
}

.talk-layout .scenario-card .scenario-icon svg {
  display: block;
  width: 30px;
  height: 30px;
  margin: auto;
  flex: 0 0 auto;
}

.scenario-title {
  font-size: 1.22rem;
  font-weight: 900;
}

.talk-layout .scenario-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 7px;
  color: var(--secondary);
  font-size: 0.92rem;
}

.talk-layout .scenario-meta svg {
  width: 17px;
  height: 17px;
}

/* Input feed */
.input-layout {
  display: grid;
  gap: 12px;
  height: calc(100dvh - 154px);
  overflow: hidden;
  align-content: start;
}

.input-header {
  display: grid;
  gap: 8px;
}

.input-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 18px;
  align-items: center;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.04);
}

.input-progress strong,
.input-progress span {
  display: block;
}

.input-progress span {
  color: var(--secondary);
  font-size: 0.9rem;
}

.input-progress .progress-track {
  grid-column: 1 / -1;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--secondary);
  background: #fff;
  font-weight: 650;
}

.filter-chip.is-active {
  color: var(--primary);
  border-color: rgba(127, 29, 45, 0.28);
  background: #fff1f3;
}

.input-feed {
  display: grid;
  gap: 8px;
}

.feed-section-title {
  margin: 2px 0 0;
}

.feed-section-title strong,
.feed-section-title span {
  display: block;
}

.feed-section-title strong {
  font-size: 1rem;
}

.feed-section-title span {
  margin-top: 2px;
  color: var(--secondary);
  font-size: 0.86rem;
  font-weight: 500;
}

.input-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 88px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.94);
  text-align: left;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.05);
}

.input-card.is-featured {
  min-height: 128px;
  max-height: 160px;
  border-color: rgba(127, 29, 45, 0.32);
  background: linear-gradient(135deg, #fff 0%, #fff4f5 100%);
}

.input-card-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  color: var(--primary);
  background: #fff0ef;
}

.input-card-icon svg {
  width: 20px;
  height: 20px;
}

.input-card-copy {
  min-width: 0;
}

.input-card-top,
.input-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.input-card-top {
  justify-content: space-between;
}

.input-card-title {
  font-size: 1rem;
  font-weight: 900;
}

.input-card-meta,
.input-card-copy p {
  color: var(--secondary);
  font-size: 0.9rem;
}

.input-card-copy p {
  margin: 5px 0 0;
  line-height: 1.35;
  max-width: 620px;
}

.input-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  color: #fff;
  background: var(--primary);
  font-weight: 900;
}

.input-action svg {
  width: 17px;
  height: 17px;
}

.wave-mini {
  display: flex;
  gap: 3px;
  align-items: center;
  margin-top: 8px;
  height: 14px;
}

.wave-mini span {
  width: 4px;
  border-radius: 999px;
  background: rgba(127, 29, 45, 0.42);
}

.wave-mini span:nth-child(1) { height: 8px; }
.wave-mini span:nth-child(2) { height: 15px; }
.wave-mini span:nth-child(3) { height: 11px; }
.wave-mini span:nth-child(4) { height: 18px; }
.wave-mini span:nth-child(5) { height: 10px; }
.wave-mini span:nth-child(6) { height: 14px; }

@media (max-width: 860px) {
  .talk-layout {
    height: calc(100dvh - 100px);
    padding: 18px;
  }

  .talk-header {
    min-height: 0;
  }

  .talk-header > div:first-child,
  .talk-header .page-title,
  .talk-header .lead {
    max-width: none;
  }

  .talk-header .page-title {
    font-size: 2.4rem;
  }

  .talk-layout .scenario-grid {
    grid-template-columns: 1fr;
  }

  .talk-status {
    grid-template-columns: 34px 1fr auto;
  }

  .talk-visual-column {
    position: static;
    width: 100%;
    justify-items: stretch;
    margin-top: 16px;
    pointer-events: auto;
  }

  .talk-hero-image {
    width: 100%;
    max-height: 210px;
  }

  .input-header {
    grid-template-columns: 1fr;
  }

  .input-card {
    grid-template-columns: 48px 1fr;
  }

  .input-action {
    grid-column: 2;
    width: fit-content;
  }
}

/* Settings and additional language flags */
.flag-it {
  background: linear-gradient(90deg, #009246 0 33%, #fff 33% 66%, #ce2b37 66%);
}

.flag-pt {
  background: url("assets/flags/pt.svg") center / cover no-repeat;
}

.flag-pt::before {
  content: none;
}

.flag-pt::after {
  content: none;
}

.flag-tr {
  background: url("assets/flags/tr.svg") center / cover no-repeat;
}

.flag-tr::before {
  content: none;
}

.flag-tr::after {
  content: none;
}

.flag-jp {
  background: radial-gradient(circle at center, #bc002d 0 28%, #fff 30%);
}

.settings-screen {
  height: calc(100dvh - 100px);
  overflow: hidden;
}

.setting-list .option-card .option-icon,
.language-switcher .option-card .option-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.setting-list .option-card .option-icon svg,
.language-switcher .option-card .option-icon svg {
  display: block;
  width: 21px;
  height: 21px;
  margin: auto;
  flex: 0 0 auto;
}

.language-switcher .option-card .option-icon {
  overflow: hidden;
  padding: 0;
}

.language-switcher .option-card .option-icon .flag {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: inherit;
}

/* Compact Input Feed override */
.screen {
  padding-bottom: 140px;
}

.input-layout {
  width: min(1180px, 100%);
  height: calc(100dvh - 154px);
  margin: 0 auto;
  padding-bottom: 130px;
  overflow: hidden;
}

.input-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 330px);
  gap: 20px;
  align-items: end;
}

.input-progress {
  width: 100%;
  max-width: 330px;
  justify-self: end;
  padding: 14px 16px;
  border: 1px solid rgba(127, 29, 45, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.06);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--secondary);
  background: #fff;
  font-size: 0.88rem;
  font-weight: 650;
}

.filter-chip.is-active {
  color: var(--primary);
  border-color: rgba(127, 29, 45, 0.32);
  background: #fff1f3;
}

.input-feed {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.feed-section-title {
  margin: 0;
}

.feed-section-title strong {
  font-size: 1rem;
  line-height: 1.2;
}

.feed-section-title span {
  margin-top: 2px;
  color: var(--secondary);
  font-size: 0.86rem;
}

.input-card,
.input-card.is-featured {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  width: 100%;
  min-height: 112px;
  max-height: 170px;
  padding: 20px 22px;
  overflow: hidden;
  border: 1px solid rgba(127, 29, 45, 0.12);
  border-radius: 24px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.94);
  text-align: left;
  box-shadow: 0 12px 30px rgba(17, 24, 39, 0.06);
}

.input-card.is-featured {
  border-color: rgba(127, 29, 45, 0.32);
  background: linear-gradient(135deg, #fff 0%, #fff5f6 100%);
}

.input-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  min-width: 48px;
  max-width: 48px;
  min-height: 48px;
  max-height: 48px;
  overflow: hidden;
  border-radius: 999px;
  color: var(--primary);
  background: #fff0ef;
  line-height: 0;
}

.input-card-icon svg,
.input-card .input-card-icon svg {
  display: block;
  width: 24px !important;
  height: 24px !important;
  min-width: 24px;
  min-height: 24px;
  max-width: 24px;
  max-height: 24px;
  margin: auto;
  flex: 0 0 auto;
}

.input-card-copy {
  display: block;
  min-width: 0;
}

.input-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.input-card-title {
  overflow: hidden;
  font-size: 1.04rem;
  font-weight: 900;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.input-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-top: 5px;
  color: var(--secondary);
  font-size: 0.9rem;
}

.input-card-meta svg {
  width: 16px !important;
  height: 16px !important;
  flex: 0 0 auto;
}

.input-card-copy p {
  display: -webkit-box;
  max-width: 660px;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--secondary);
  font-size: 0.9rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.input-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 104px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  color: #fff;
  background: var(--primary);
  font-size: 0.9rem;
  font-weight: 900;
  white-space: nowrap;
}

.input-action svg {
  width: 16px !important;
  height: 16px !important;
}

.wave-mini {
  display: none;
}

.tabbar {
  box-shadow: 0 18px 42px rgba(17, 24, 39, 0.12);
}

@media (max-width: 860px) {
  .input-layout {
    height: calc(100dvh - 144px);
    padding-bottom: 132px;
  }

  .input-header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .input-progress {
    max-width: none;
    justify-self: stretch;
  }

  .input-card,
  .input-card.is-featured {
    grid-template-columns: 48px minmax(0, 1fr);
    max-height: none;
    padding: 18px;
  }

  .input-action {
    grid-column: 2;
    justify-self: start;
    margin-top: 2px;
  }
}

@media (max-width: 560px) {
  .input-card,
  .input-card.is-featured {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    min-height: 118px;
    border-radius: 20px;
  }

  .input-card-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
  }

  .input-card-icon svg,
  .input-card .input-card-icon svg {
    width: 22px !important;
    height: 22px !important;
  }
}

/* Compact Talk scenario buttons */
.talk-layout .scenario-grid {
  gap: 12px 18px;
}

.talk-layout .scenario-card {
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 92px;
  padding: 14px 18px;
}

.talk-layout .scenario-card .scenario-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
}

.talk-layout .scenario-card .scenario-icon svg {
  width: 24px;
  height: 24px;
}

.talk-layout .scenario-title {
  font-size: 1.05rem;
  line-height: 1.2;
}

.talk-layout .scenario-meta {
  margin-top: 5px;
  font-size: 0.86rem;
}

.talk-layout .cefr-badge {
  min-height: 26px;
  padding: 0 9px;
  font-size: 0.78rem;
}

/* Clean lesson intro/player layout */
.screen {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 22px 24px 128px;
}

.lesson-player {
  display: grid;
  gap: 18px;
  width: min(1100px, 100%);
  min-height: calc(100dvh - 150px);
  margin: 0 auto;
  align-content: start;
}

.lesson-header {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.lesson-header .topline {
  display: contents;
}

.lesson-header .icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  color: var(--secondary);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.05);
}

.lesson-header .icon-btn:hover {
  color: var(--primary);
  border-color: rgba(127, 29, 45, 0.24);
  background: #fff6f7;
}

.lesson-header .pill {
  justify-self: end;
  min-height: 34px;
  padding: 0 13px;
}

.lesson-header > .progress-track {
  grid-column: 2;
  height: 9px;
}

.step-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: clamp(360px, 52dvh, 440px);
  height: auto;
  padding: clamp(32px, 4vw, 46px);
  overflow: visible;
  border-radius: 24px;
}

.step-card .label {
  margin: 0;
}

.step-card .page-title {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  line-height: 1;
}

.step-card .lead {
  max-width: 760px;
  margin: 0;
  font-size: 1.03rem;
  line-height: 1.55;
}

.step-card .chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
}

.step-card .chip-row .pill {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(127, 29, 45, 0.12);
  border-radius: 999px;
  color: var(--primary);
  background: #fff1f3;
  font-size: 0.85rem;
  font-weight: 750;
}

.lesson-player > .actions-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  width: min(560px, 100%);
  margin: 0 auto;
}

.tabbar {
  right: auto;
  left: 50%;
  bottom: 16px;
  width: min(calc(100% - 32px), 1100px);
  height: 72px;
  transform: translateX(-50%);
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.12);
  overflow: hidden;
}

.tab.is-active {
  position: relative;
  color: var(--primary);
}

.tab.is-active::after {
  content: "";
  position: absolute;
  right: 34%;
  bottom: 0;
  left: 34%;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: var(--primary);
}

@media (max-width: 760px) {
  .screen {
    padding: 16px 14px 122px;
  }

  .lesson-player {
    gap: 14px;
  }

  .lesson-header {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .lesson-header .pill {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .lesson-header > .progress-track {
    grid-column: 2;
  }

  .step-card {
    min-height: 340px;
    padding: 24px;
  }

  .step-card .page-title {
    font-size: clamp(2rem, 11vw, 3rem);
  }

  .lesson-player > .actions-row {
    grid-template-columns: 1fr;
  }

  .tabbar {
    width: calc(100% - 20px);
    height: 70px;
    bottom: 10px;
  }
}

.skillbar {
  display: grid;
  gap: 7px;
}

.skillbar-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--secondary);
  font-size: 0.9rem;
}

.skillbar-top strong {
  color: var(--text);
}

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

.scenario-card {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 88px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-align: left;
}

.scenario-card.is-recommended {
  border-color: var(--primary);
}

.scenario-card .scenario-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 999px;
  background: var(--muted-surface);
  color: var(--primary);
  line-height: 0;
}

.scenario-card .scenario-icon svg {
  display: block;
  width: 22px;
  height: 22px;
  margin: auto;
  flex: 0 0 auto;
}

.lesson-player {
  display: grid;
  gap: 12px;
}

.lesson-header {
  display: grid;
  gap: 12px;
}

.step-card {
  display: grid;
  gap: 12px;
  min-height: 0;
  height: calc(100dvh - 210px);
  overflow: hidden;
}

.dialogue {
  display: grid;
  gap: 10px;
}

.bubble {
  width: fit-content;
  max-width: min(560px, 100%);
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--muted-surface);
  line-height: 1.5;
}

.bubble.ai {
  background: #f4d9dd;
}

.bubble.user {
  justify-self: end;
  color: white;
  background: var(--primary);
}

.audio-player,
.mic-panel,
.feedback-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--muted-surface);
}

.audio-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
}

.wave {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 34px;
}

.wave span {
  width: 5px;
  border-radius: 999px;
  background: var(--primary);
}

.wave span:nth-child(1) { height: 10px; }
.wave span:nth-child(2) { height: 22px; }
.wave span:nth-child(3) { height: 15px; }
.wave span:nth-child(4) { height: 30px; }
.wave span:nth-child(5) { height: 18px; }
.wave span:nth-child(6) { height: 25px; }

.answer-input,
.coach-textarea {
  width: 100%;
  min-height: 52px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  background: var(--surface);
}

.coach-textarea {
  min-height: 112px;
  resize: vertical;
}

.feedback-card {
  border-left: 4px solid var(--warning);
}

.feedback-card.success {
  border-left-color: var(--success);
}

.feedback-card h3,
.feedback-card p {
  margin: 0;
}

.feedback-card p {
  color: var(--secondary);
  line-height: 1.55;
}

.talk-layout {
  display: grid;
  gap: 18px;
}

.conversation-window {
  display: grid;
  gap: 12px;
  min-height: 390px;
  align-content: start;
}

.review-card {
  display: grid;
  gap: 12px;
  width: 100%;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-align: left;
}

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

.rating-grid button {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-weight: 700;
}

.tabbar {
  position: fixed;
  right: max(22px, calc((100vw - 1120px) / 2 + 22px));
  bottom: 12px;
  left: max(22px, calc((100vw - 1120px) / 2 + 22px));
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 68px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.tab {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 0;
  color: var(--soft);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 800;
}

.tab svg {
  width: 23px;
  height: 23px;
}

.tab.is-active {
  color: var(--primary);
}

.is-hidden {
  display: none !important;
}

.language-switcher,
.setting-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.language-switcher .option-card,
.setting-list .option-card {
  min-height: 52px;
  padding: 8px 10px;
}

@media (max-width: 860px) {
  .screen {
    padding: 14px 14px 84px;
  }

  .hero,
  .today-layout,
  .progress-layout {
    grid-template-columns: 1fr;
  }

  .session-card {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .session-art {
    display: none;
  }

  .hero {
    min-height: auto;
  }

  .hero-visual {
    min-height: 250px;
  }

  .metric-grid,
  .scenario-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .screen {
    padding-inline: 14px;
  }

  .page-title,
  .hero-copy h1 {
    font-size: 1.8rem;
  }

  .today-title {
    font-size: 2.55rem;
  }

  .today-stats {
    grid-template-columns: 1fr;
  }

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

  .actions-row,
  .rating-grid {
    grid-template-columns: 1fr;
  }

  .topline {
    align-items: flex-start;
  }

  .scenario-card {
    grid-template-columns: 44px 1fr;
  }

  .cefr-badge {
    grid-column: 2;
    width: fit-content;
  }
}

/* Final navigation and lesson fit fixes */
body .tabbar#tabbar {
  position: fixed;
  right: auto !important;
  left: 50% !important;
  bottom: 16px !important;
  width: min(calc(100vw - 32px), 1120px) !important;
  min-height: 72px;
  height: 72px;
  transform: translateX(-50%) !important;
  z-index: 50;
}

.screen:has(.lesson-player) {
  max-width: none;
  height: 100dvh;
  padding: 18px 20px 104px;
  overflow: hidden;
}

.screen:has(.lesson-player) .lesson-player {
  width: min(calc(100vw - 40px), 1040px);
  height: calc(100dvh - 122px);
  padding-top: 0;
  gap: 12px;
}

.screen:has(.lesson-player) .lesson-header {
  gap: 9px;
  flex: 0 0 auto;
}

.screen:has(.lesson-player) .step-card {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  padding: clamp(22px, 3vw, 36px);
  gap: 14px;
}

.screen:has(.lesson-player) .step-card .page-title,
.screen:has(.lesson-player) .step-card .section-title {
  margin: 0;
  font-size: clamp(2rem, 4.2vw, 3.5rem);
  line-height: 1.04;
}

.screen:has(.lesson-player) .step-card .lead {
  line-height: 1.48;
}

.screen:has(.lesson-player) .dialogue {
  gap: 8px;
}

.screen:has(.lesson-player) .bubble {
  padding: 9px 12px;
}

.screen:has(.lesson-player) .audio-player,
.screen:has(.lesson-player) .mic-panel,
.screen:has(.lesson-player) .feedback-card {
  padding: 12px;
}

.screen:has(.lesson-player) .choice-list,
.screen:has(.lesson-player) .answer-area {
  gap: 8px;
}

.screen:has(.lesson-player) .option-card,
.screen:has(.lesson-player) .choice-btn {
  min-height: 46px;
  padding: 9px 12px;
}

.screen:has(.lesson-player) .coach-textarea {
  min-height: 84px;
}

.translation-prompt {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid rgba(127, 29, 45, 0.16);
  border-radius: 18px;
  background: #fff6f7;
}

.translation-prompt span {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.translation-prompt strong {
  color: var(--text);
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  line-height: 1.25;
}

.screen:has(.lesson-player) .conversation-window {
  min-height: 0;
  max-height: 220px;
  overflow: hidden;
}

.screen:has(.lesson-player) .metric-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.screen:has(.lesson-player) .lesson-player > .actions-row {
  flex: 0 0 auto;
  justify-content: flex-end;
  width: 100%;
}

.screen:has(.lesson-player) .lesson-player > .actions-row .primary-btn,
.screen:has(.lesson-player) .lesson-player > .actions-row .secondary-btn {
  min-height: 44px;
}

@media (max-width: 720px) {
  body .tabbar#tabbar {
    bottom: 10px !important;
    width: calc(100vw - 20px) !important;
    height: 70px;
  }

  .screen:has(.lesson-player) {
    padding: 12px 10px 92px;
  }

  .screen:has(.lesson-player) .lesson-player {
    width: 100%;
    height: calc(100dvh - 104px);
  }

  .screen:has(.lesson-player) .step-card {
    padding: 20px;
  }

  .path-page {
    height: calc(100dvh - 112px);
  }

  .path-header {
    grid-template-columns: 1fr;
  }

  .path-header .primary-btn {
    width: 100%;
  }

  .path-grid {
    grid-template-columns: 1fr;
    padding-bottom: 96px;
  }

  .path-node {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .path-node-status {
    grid-column: 2;
    width: fit-content;
  }
}

.screen:has(.lesson-player) .lesson-player {
  align-content: stretch; /* was: start */
}

.screen:has(.lesson-player) .step-card {
  flex: 1 1 auto; /* al aanwezig, maar zorg ook voor: */
  min-height: 0;
  height: calc(100vh - 262px);
  overflow-y: auto;
}
/* AI conversation prototype */
.conversation-shell {
  padding-bottom: 112px;
}

.ai-coach-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.ai-coach-card,
.ai-chat-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
}

.ai-coach-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px;
  min-height: 560px;
}

.ai-chat-card {
  display: flex;
  flex-direction: column;
  min-height: 560px;
  padding: 24px;
}

.ai-avatar {
  position: relative;
  width: 170px;
  height: 190px;
  margin: 0 auto 6px;
  display: grid;
  place-items: center;
  border-radius: 42px;
  background: linear-gradient(180deg, #f7e3df, #fff7f3);
  box-shadow: 0 22px 48px rgba(127, 29, 45, 0.14);
  overflow: hidden;
}

.ai-avatar::after {
  content: "";
  position: absolute;
  inset: auto 18px 12px;
  height: 44px;
  border-radius: 999px 999px 0 0;
  background: #7f1d2d;
  opacity: 0.92;
}

.ai-avatar.is-listening {
  animation: ai-listen-pulse 1.1s ease-in-out infinite;
}

.ai-hair {
  position: absolute;
  top: 36px;
  width: 104px;
  height: 76px;
  border-radius: 46px 46px 26px 26px;
  background: #322014;
  z-index: 2;
}

.ai-face {
  position: relative;
  z-index: 3;
  width: 96px;
  height: 112px;
  margin-top: 28px;
  border-radius: 42px 42px 48px 48px;
  background: #f3c9b3;
  box-shadow: inset 0 -8px 0 rgba(127, 29, 45, 0.08);
}

.ai-neck {
  position: absolute;
  z-index: 2;
  bottom: 42px;
  width: 34px;
  height: 38px;
  border-radius: 16px;
  background: #e9bba6;
}

.ai-eye {
  position: absolute;
  top: 48px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #121827;
}

.ai-eye.left {
  left: 26px;
}

.ai-eye.right {
  right: 26px;
}

.ai-mouth {
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: 28px;
  height: 9px;
  transform: translateX(-50%);
  border-radius: 0 0 18px 18px;
  border-bottom: 4px solid #7f1d2d;
}

.ai-avatar.is-speaking .ai-mouth {
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: #7f1d2d;
  animation: ai-talk-mouth 0.34s ease-in-out infinite;
}

.ai-avatar.is-thinking .ai-eye,
.ai-avatar.is-speaking .ai-eye {
  animation: ai-blink 3s ease-in-out infinite;
}

.ai-speak-btn {
  width: 100%;
  justify-content: center;
}

.ai-chat-window {
  flex: 1;
  min-height: 0;
  max-height: 390px;
  overflow: auto;
  padding: 4px;
}

.ai-chat-card .coach-textarea {
  min-height: 92px;
  margin-top: 16px;
}

.ai-chat-card .actions-row {
  margin-top: 14px;
}

@keyframes ai-talk-mouth {
  0%, 100% {
    height: 8px;
    width: 24px;
  }
  50% {
    height: 26px;
    width: 34px;
  }
}

@keyframes ai-listen-pulse {
  0%, 100% {
    box-shadow: 0 22px 48px rgba(127, 29, 45, 0.14), 0 0 0 0 rgba(127, 29, 45, 0.14);
  }
  50% {
    box-shadow: 0 22px 48px rgba(127, 29, 45, 0.14), 0 0 0 12px rgba(127, 29, 45, 0.04);
  }
}

@keyframes ai-blink {
  0%, 92%, 100% {
    transform: scaleY(1);
  }
  95% {
    transform: scaleY(0.12);
  }
}

@media (max-width: 860px) {
  .ai-coach-layout {
    grid-template-columns: 1fr;
  }

  .ai-coach-card,
  .ai-chat-card {
    min-height: auto;
  }

  .ai-avatar {
    width: 132px;
    height: 150px;
  }

  .ai-chat-window {
    max-height: 320px;
  }
}

.screen:has(.onboarding-screen) {
  overflow-x: hidden;
  overflow-y: auto;
  scroll-padding-bottom: 120px;
}

.onboarding-screen {
  min-height: auto;
  padding-bottom: 128px;
}

.onboarding-screen .choice-list {
  padding-bottom: 4px;
}

/* Conversation fit fixes */
.screen:has(.conversation-shell) {
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 112px;
}

.conversation-shell {
  max-width: 1180px;
  padding-bottom: 118px;
}

.ai-coach-layout {
  align-items: start;
}

.ai-coach-card,
.ai-chat-card {
  min-height: 0;
}

.ai-coach-card {
  gap: 12px;
  padding: 24px;
}

.ai-chat-card {
  max-height: calc(100dvh - 220px);
  padding: 22px;
}

.ai-chat-window {
  min-height: 260px;
  max-height: min(360px, calc(100dvh - 470px));
}

.ai-chat-card .coach-textarea {
  min-height: 82px;
  resize: none;
}

.ai-chat-card .actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ai-chat-card .actions-row .secondary-btn:last-child {
  grid-column: 1 / -1;
}

@media (max-width: 860px) {
  .conversation-shell {
    padding-bottom: 126px;
  }

  .ai-chat-card {
    max-height: none;
  }

  .ai-chat-window {
    max-height: 300px;
  }

  .ai-chat-card .actions-row {
    grid-template-columns: 1fr;
  }
}

/* Supabase authentication */
.screen:has(.auth-shell) {
  width: 100%;
  max-width: none;
  overflow-y: auto;
  padding: 0;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(420px, 1.15fr);
  min-height: 100dvh;
  background: var(--surface);
}

.auth-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 54px;
}

.auth-back {
  position: absolute;
  top: 28px;
  left: 54px;
}

.auth-copy {
  display: grid;
  gap: 6px;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.field-label {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 750;
}

.auth-input {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: none;
  color: var(--text);
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(127, 29, 45, 0.1);
}

.auth-submit {
  justify-content: center;
  margin-top: 10px;
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.72;
}

.auth-switch {
  border: 0;
  padding: 4px;
  color: var(--primary);
  background: transparent;
  font-weight: 750;
  text-align: left;
}

.auth-message {
  margin: -8px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.auth-message p {
  margin: 0;
}

.auth-message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
}

.auth-message-action {
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: 800;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.auth-message-action:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 6px;
}

.auth-message.is-error {
  color: #991b1b;
  background: #fef2f2;
}

.auth-message.is-success {
  color: #166534;
  background: #f0fdf4;
}

.auth-reset-link {
  margin-top: -8px;
  font-size: 0.95rem;
}

.auth-visual {
  min-height: 100dvh;
  overflow: hidden;
  background: #f7e7e8;
}

.auth-visual img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  object-fit: cover;
}

.auth-loading {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  min-height: 100dvh;
  color: var(--secondary);
}

.auth-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #eadadd;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: auth-spin 700ms linear infinite;
}

.signout-btn {
  justify-content: center;
  color: var(--primary);
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 820px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    min-height: 100dvh;
    padding: 76px 24px 36px;
  }

  .auth-back {
    top: 20px;
    left: 24px;
  }

  .auth-visual {
    display: none;
  }
}

/* Final scroll policy: pages may stay compact, but overflowing content must remain reachable. */
body {
  overflow-x: hidden;
  overflow-y: auto;
}

.screen {
  min-height: 100dvh;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.screen:has(.settings-screen),
.screen:has(.onboarding-screen),
.screen:has(.auth-shell),
.screen:has(.conversation-shell),
.screen:has(.lesson-player),
.screen:has(.path-shell),
.screen:has(.today-grid),
.screen:has(.input-layout) {
  height: auto;
  overflow-y: auto;
}

.settings-screen {
  height: auto;
  min-height: calc(100dvh - 100px);
  overflow: visible;
  padding-bottom: 136px;
}

.settings-screen .plain-card,
.settings-screen .setting-list {
  min-width: 0;
}

.account-card {
  display: grid;
  gap: 12px;
}

.account-card .section-title {
  margin: 0;
}

.account-card .signout-btn {
  width: 100%;
}
