:root {
  --bg: #eef2f7;
  --surface: #eef2f7;
  --surface-light: #f7f9fc;
  --text: #2d3142;
  --muted: #7c8394;

  --primary: #6d35db;
  --primary-dark: #5928bc;
  --primary-soft: #e9e1fb;

  --traveler-name: #247caf;
  --receptionist-name: #6a3dd0;

  --success: #38945c;
  --warning: #bd7e1d;
  --error: #cf5555;

  --shadow-dark: rgba(163, 177, 198, 0.46);
  --shadow-light: rgba(255, 255, 255, 0.92);

  --outer-shadow:
    10px 10px 22px var(--shadow-dark),
    -10px -10px 22px var(--shadow-light);

  --small-shadow:
    5px 5px 11px var(--shadow-dark),
    -5px -5px 11px var(--shadow-light);

  --inset-shadow:
    inset 4px 4px 9px rgba(163, 177, 198, 0.42),
    inset -4px -4px 9px rgba(255, 255, 255, 0.9);

  --radius-large: 24px;
  --radius-medium: 16px;
  --radius-small: 12px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  width: min(100% - 34px, 1040px);
  margin: 34px auto 52px;
}

.listening-home-link {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  z-index: 1200;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--small-shadow);
  font-weight: 750;
  text-decoration: none;
}

.listening-home-link:hover,
.listening-home-link:focus-visible {
  color: var(--primary);
}

.listening-home-link:focus-visible {
  outline: 3px solid rgba(109, 53, 219, 0.28);
  outline-offset: 3px;
}

.listening-home-link:active {
  box-shadow: var(--inset-shadow);
}

.listening-home-link .button-icon {
  width: 18px;
  height: 18px;
}

@media (max-width: 520px) {
  .listening-home-link {
    width: 42px;
    min-height: 42px;
    justify-content: center;
    padding: 0;
  }

  .listening-home-link span {
    display: none;
  }
}

@media (max-width: 820px) {
  .listening-home-link {
    right: max(14px, env(safe-area-inset-right));
    left: auto;
    display: inline-flex;
  }
}

.exercise-card {
  padding: 30px;
  border: 0;
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--outer-shadow);
}

.exercise-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 11px;
}

.title-row h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2.5vw, 1.7rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.headphones-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary);
  font-size: 1.25rem;
  box-shadow: var(--small-shadow);
}

.title-block p {
  margin: 8px 0 0 53px;
  color: var(--muted);
  font-size: 0.88rem;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--small-shadow);
}

.badge-level {
  color: var(--success);
}

.badge-category {
  color: var(--primary);
}

.exercise-xp-row {
  display: flex;
  justify-content: flex-end;
  margin: 4px 0 12px;
}

@media (min-width: 821px) {
  .exercise-xp-row {
    position: relative;
    z-index: 6;
    height: 0;
    margin: 0 18px -18px 0;
    pointer-events: none;
  }

  .exercise-xp-row .hero-xp-badge {
    transform: translateY(18px);
  }

  .exercise-xp-row + .hero {
    margin-top: 0;
  }
}

.hero {
  margin: 24px 0 18px;
  overflow: hidden;
  border: 6px solid var(--surface);
  border-radius: 22px;
  background: var(--surface);
  aspect-ratio: 3.2 / 1;
  box-shadow: var(--outer-shadow);
}

.hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 16px;
}

.hero-xp-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--small-shadow);
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.hero-xp-badge.is-bumping {
  animation: heroXpBadgePop 420ms ease;
}

@media (max-width: 820px) {
  .exercise-xp-row {
    position: fixed !important;
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
    left: auto;
    bottom: auto;
    z-index: 1200;
    margin: 0;
    width: max-content;
    transform: translateZ(0);
    pointer-events: none;
  }

  .hero-xp-badge {
    min-height: 40px;
    padding: 0 12px;
  }
}

@media (max-width: 520px) {
  .hero-xp-badge strong {
    font-size: 0.78rem;
  }
}

.hero-xp-burst {
  position: absolute;
  right: 10px;
  bottom: calc(100% - 2px);
  color: var(--success);
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.94);
}

.hero-xp-burst.is-visible {
  animation: heroXpFloat 760ms ease forwards;
}

@keyframes heroXpBadgePop {
  0% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.08);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes heroXpFloat {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.94);
  }

  20% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateY(-12px) scale(1);
  }
}

.main-player {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: 64px;
  padding: 11px 16px;
  border: 0;
  border-radius: var(--radius-medium);
  background: var(--surface);
  box-shadow: var(--outer-shadow);
}

.main-play-button,
.phrase-play-button {
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary);
  cursor: pointer;
  box-shadow: var(--small-shadow);
  transition: transform 150ms ease, box-shadow 150ms ease, color 150ms ease;
}

.main-play-button {
  width: 46px;
  height: 46px;
}

.phrase-play-button {
  width: 36px;
  height: 36px;
}

.main-play-button:hover,
.phrase-play-button:hover {
  color: var(--primary-dark);
}

.main-play-button:active,
.phrase-play-button:active {
  transform: scale(0.97);
  box-shadow: var(--inset-shadow);
}

@keyframes snailAssistReveal {
  0%, 100% {
    transform: rotate(0deg) scale(1);
  }

  18% {
    transform: rotate(-11deg) scale(1.1);
    box-shadow: 0 0 0 4px rgba(109, 53, 219, 0.13), var(--small-shadow);
  }

  36% {
    transform: rotate(10deg) scale(1.1);
  }

  54% {
    transform: rotate(-7deg) scale(1.07);
  }

  72% {
    transform: rotate(5deg) scale(1.04);
  }
}

.phrase-slow-button[hidden] {
  display: none !important;
}

.phrase-slow-button.assist-control-pending {
  display: none !important;
  visibility: hidden !important;
}

.phrase-slow-button.is-assist-reveal {
  animation: snailAssistReveal 780ms cubic-bezier(.22, .8, .25, 1);
}

.play-symbol {
  margin-left: 2px;
  font-size: 0.85rem;
}

.time-display {
  min-width: 76px;
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.audio-range {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  appearance: none;
  background: var(--surface);
  box-shadow: var(--inset-shadow);
  cursor: pointer;
}

.audio-range::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  appearance: none;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 2px 2px 5px rgba(89, 40, 188, 0.28);
}

.audio-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: #666d7d;
  cursor: pointer;
  box-shadow: var(--small-shadow);
}

.icon-button:active {
  box-shadow: var(--inset-shadow);
}

.phrase-list {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.phrase-row {
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap: 12px;
  align-items: start;
}

.phrase-meta {
  align-self: center;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.message-layout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.is-receptionist .message-layout {
  justify-content: flex-start;
}

.is-traveler .message-layout {
  justify-content: flex-end;
}

.speaker-column {
  display: flex;
  flex: 0 0 40px;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  padding-top: 2px;
}

.phrase-card {
  flex: 0 1 690px;
  min-width: 0;
}

.is-receptionist .phrase-card {
  margin-right: auto;
}

.is-traveler .phrase-card {
  background: #edf4ef;
}

.phrase-number {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
}

.phrase-time {
  display: block;
  margin-top: 3px;
  color: #9ca4b5;
  font-size: 0.65rem;
}

.phrase-card {
  position: relative;
  width: min(100%, 690px);
  padding: 15px;
  border: 0;
  border-radius: var(--radius-medium);
  background: var(--surface);
  box-shadow: var(--outer-shadow);
}

.is-traveler .phrase-card {
  justify-self: end;
  background: #edf4ef;
}

.phrase-card.is-active {
  box-shadow:
    0 0 0 3px rgba(109, 53, 219, 0.13),
    var(--outer-shadow);
}

.speaker-name {
  margin: 0 48px 7px 0;
  color: var(--receptionist-name);
  font-size: 0.76rem;
  font-weight: 800;
}

.is-traveler .speaker-name {
  color: var(--traveler-name);
}

.help-button {
  position: absolute;
  top: 8px;
  right: 9px;
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-size: 1rem;
  box-shadow: none;
}

.help-button:active {
  box-shadow: none;
}

.phrase-info-button {
  position: absolute;
  top: 8px;
  right: 55px;
  display: inline-grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  box-shadow: none;
}

.phrase-info-button:hover .help-svg {
  transform: scale(1.06);
}

.phrase-info-button:active {
  box-shadow: none;
}

.phrase-info-button:active .help-svg {
  transform: scale(0.96);
}

.phrase-info-button:focus-visible {
  outline: 3px solid rgba(109, 53, 219, 0.24);
  outline-offset: 2px;
}

.phrase-card.has-explanation .phrase-speaker-toolbar {
  display: flex;
  min-width: 0;
  min-height: 26px;
  margin-bottom: 7px;
  align-items: center;
  gap: 3px;
}

.is-traveler .phrase-card.has-explanation .phrase-speaker-toolbar {
  justify-content: flex-end;
}

.phrase-card.has-explanation .phrase-speaker-toolbar .speaker-name {
  margin: 0;
}

.phrase-card.has-explanation .phrase-speaker-toolbar .help-button,
.phrase-card.has-explanation .phrase-speaker-toolbar .phrase-info-button,
.phrase-card.has-explanation .phrase-speaker-toolbar .phrase-toolbar-button {
  position: static;
  display: inline-grid;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  color: #dc2626;
}

.phrase-card.has-explanation .phrase-speaker-toolbar .help-button:focus-visible,
.phrase-card.has-explanation .phrase-speaker-toolbar .phrase-info-button:focus-visible,
.phrase-card.has-explanation .phrase-speaker-toolbar .phrase-toolbar-button:focus-visible {
  outline-color: rgba(220, 38, 38, 0.3);
}

.phrase-toolbar-button {
  display: inline-grid;
  width: 26px;
  height: 26px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #dc2626;
  cursor: pointer;
}

.phrase-toolbar-button:hover .help-svg {
  transform: scale(1.06);
}

.phrase-toolbar-button:active .help-svg {
  transform: scale(0.96);
}

.phrase-toolbar-button:focus-visible {
  outline: 3px solid rgba(220, 38, 38, 0.3);
  outline-offset: 2px;
}

.phrase-card.has-explanation .correct-text,
.is-traveler .phrase-card.has-explanation .correct-text {
  margin-right: 0;
  margin-left: 0;
}

body.phrase-modal-open {
  overflow: hidden;
}

.phrase-explanation-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(36, 24, 61, 0.12);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 160ms ease, visibility 160ms ease;
}

.phrase-explanation-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.phrase-explanation-modal {
  position: relative;
  width: min(920px, 96vw);
  max-height: min(90vh, 760px);
  max-height: min(90dvh, 760px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 56px 22px 22px;
  border-radius: 28px;
  background: var(--surface);
  box-shadow:
    18px 18px 40px rgba(82, 62, 130, 0.14),
    -18px -18px 40px rgba(255, 255, 255, 0.96);
}

.phrase-explanation-close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 2;
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--small-shadow);
}

.phrase-explanation-close:focus-visible {
  outline: 3px solid rgba(109, 53, 219, 0.24);
  outline-offset: 2px;
}

.phrase-comparison-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin-top: 12px;
  overflow: hidden;
  border-radius: 20px;
  background: #f9f8fd;
  box-shadow:
    9px 9px 20px rgba(82, 62, 130, 0.09),
    -9px -9px 20px rgba(255, 255, 255, 0.96);
}

.phrase-sentence-row {
  margin-top: 0;
}

.phrase-language-cell {
  min-width: 0;
  min-height: 88px;
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.phrase-language-cell + .phrase-language-cell {
  border-left: 1px solid rgba(111, 82, 201, 0.14);
}

.phrase-sentence-cell {
  position: relative;
  min-height: 112px;
  padding-left: 76px;
}

.phrase-language-flag {
  position: absolute;
  top: 50%;
  left: 26px;
  display: block;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border: 2px solid rgba(109, 53, 219, 0.16);
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
  box-shadow: 0 5px 12px rgba(82, 62, 130, 0.12);
  transform: translateY(-50%);
}

.phrase-explanation-sentence,
.phrase-explanation-main,
.phrase-explanation-form,
.phrase-explanation-support {
  overflow-wrap: anywhere;
}

.phrase-explanation-sentence {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 780;
  line-height: 1.4;
}

.phrase-explanation-main {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 760;
  line-height: 1.35;
}

.phrase-explanation-form {
  margin: 6px 0 0;
  font-size: 0.9rem;
  font-weight: 620;
  line-height: 1.35;
}

.phrase-explanation-support {
  margin: 9px 0 0;
  font-size: 0.82rem;
  font-weight: 520;
  line-height: 1.4;
}

.phrase-language-cell.is-spanish {
  color: #142a86;
}

.phrase-language-cell.is-english {
  color: #111;
}

@media (max-width: 720px) {
  .phrase-explanation-overlay {
    padding: 9px;
  }

  .phrase-explanation-modal {
    width: 100%;
    max-height: 94vh;
    max-height: 94dvh;
    padding: 50px 10px 12px;
    border-radius: 22px;
  }

  .phrase-comparison-row {
    margin-top: 9px;
    border-radius: 16px;
  }

  .phrase-sentence-row {
    margin-top: 0;
  }

  .phrase-language-cell {
    min-height: 76px;
    padding: 15px 11px;
  }

  .phrase-sentence-cell {
    min-height: 104px;
    padding-left: 50px;
  }

  .phrase-language-flag {
    left: 13px;
    width: 28px;
    height: 28px;
  }

  .phrase-explanation-sentence {
    font-size: 0.9rem;
  }

  .phrase-explanation-main {
    font-size: 0.86rem;
  }

  .phrase-explanation-form {
    margin-top: 5px;
    font-size: 0.76rem;
  }

  .phrase-explanation-support {
    margin-top: 7px;
    font-size: 0.7rem;
  }
}

.correct-text {
  margin: 0 48px 10px 0;
  color: #363b4c;
  font-size: 0.9rem;
  line-height: 1.5;
}

.translation-box {
  margin: 0 0 11px;
  padding: 11px 12px;
  border: 0;
  border-radius: var(--radius-small);
  background: var(--surface);
  color: #5e6473;
  font-size: 0.76rem;
  line-height: 1.45;
  box-shadow: var(--inset-shadow);
}

.translation-label {
  display: block;
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.answer-wrap {
  position: relative;
}

.answer-input {
  display: block;
  width: 100%;
  min-height: 46px;
  max-height: 116px;
  resize: none;
  overflow-y: auto;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--radius-small);
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.4;
  box-shadow: var(--inset-shadow);
}

.answer-input::placeholder {
  color: #9da5b4;
}

.answer-input:focus {
  box-shadow:
    inset 4px 4px 9px rgba(163, 177, 198, 0.45),
    inset -4px -4px 9px rgba(255, 255, 255, 0.92),
    0 0 0 3px rgba(109, 53, 219, 0.13);
}

.live-word-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
  min-height: 24px;
}

.live-word-token {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(207, 85, 85, 0.1);
  color: var(--error);
  font-size: 0.68rem;
  font-weight: 760;
  line-height: 1;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.live-word-token.is-correct {
  border-color: rgba(56, 148, 92, 0.18);
  background: rgba(56, 148, 92, 0.14);
  color: var(--success);
  box-shadow:
    0 8px 18px rgba(56, 148, 92, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.live-word-token.is-fresh {
  animation: xpWordPulse 520ms ease;
}

.live-word-token.is-fresh::after {
  content: "+1 XP";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  color: var(--success);
  font-size: 0.61rem;
  font-weight: 860;
  letter-spacing: 0.02em;
  white-space: nowrap;
  animation: xpFloat 700ms ease forwards;
  pointer-events: none;
}

@keyframes xpWordPulse {
  0% {
    transform: scale(0.92);
  }

  60% {
    transform: scale(1.08);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes xpFloat {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(6px);
  }

  18% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
}

.avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 800;
  box-shadow:
    4px 4px 8px rgba(163, 177, 198, 0.35),
    -4px -4px 8px rgba(255, 255, 255, 0.9);
}

.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
}

.avatar-audio-button {
  position: relative;
  overflow: visible;
  padding: 0;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.avatar-audio-button:hover {
  transform: translateY(-1px);
}

.avatar-audio-button:focus-visible {
  outline: 3px solid rgba(109, 53, 219, 0.28);
  outline-offset: 3px;
}

.avatar-audio-button.is-playing {
  box-shadow:
    0 0 0 3px rgba(109, 53, 219, 0.22),
    4px 4px 8px rgba(163, 177, 198, 0.35),
    -4px -4px 8px rgba(255, 255, 255, 0.9);
}

.avatar-play-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  z-index: 2;
  width: 17px;
  height: 17px;
  border: 1px solid rgba(91, 33, 182, 0.38);
  border-radius: 50%;
  background: var(--surface);
  color: #5b21b6;
  box-shadow: 2px 2px 5px rgba(163, 177, 198, 0.45);
}

.avatar-play-badge .play-svg {
  width: 9px;
  height: 9px;
}

.is-traveler .avatar-play-badge {
  right: auto;
  left: -4px;
}

.is-traveler .avatar-play-badge .play-svg {
  transform: scaleX(-1);
}

.feedback {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-small);
  font-size: 0.74rem;
  line-height: 1.35;
  box-shadow: var(--inset-shadow);
}

.feedback.correct {
  background: #edf7f1;
  color: var(--success);
}

.feedback.partial {
  background: #fbf4e7;
  color: var(--warning);
}

.feedback.incorrect {
  background: #fbecec;
  color: var(--error);
}

.phrase-card.state-correct {
  box-shadow:
    0 0 0 3px rgba(56, 148, 92, 0.16),
    var(--outer-shadow);
}

.phrase-card.state-partial {
  box-shadow:
    0 0 0 3px rgba(189, 126, 29, 0.16),
    var(--outer-shadow);
}

.phrase-card.state-incorrect {
  box-shadow:
    0 0 0 3px rgba(207, 85, 85, 0.16),
    var(--outer-shadow);
}

.results-panel {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-top: 26px;
  padding: 20px;
  border: 0;
  border-radius: var(--radius-medium);
  background: var(--surface);
  box-shadow: var(--outer-shadow);
}

.results-kicker {
  color: var(--primary);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.results-panel h2 {
  margin: 4px 0 0;
  font-size: 1.85rem;
}

.results-panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.hero-xp-badge strong {
  color: #2d7a4b;
  font-size: 0.86rem;
  line-height: 1;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.exercise-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
}

.reset-button,
.check-button,
.secondary-button,
.danger-button {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  font-weight: 750;
  cursor: pointer;
  box-shadow: var(--small-shadow);
}

.reset-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  background: var(--surface);
  color: #626979;
}

.check-button {
  display: inline-flex;
  min-width: 204px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 24px;
  background: var(--primary);
  color: #fff;
  box-shadow:
    6px 6px 13px rgba(89, 40, 188, 0.28),
    -5px -5px 12px rgba(255, 255, 255, 0.7);
}

.check-button:hover:not(:disabled) {
  background: var(--primary-dark);
}

.check-button:active:not(:disabled),
.reset-button:active,
.secondary-button:active,
.danger-button:active {
  box-shadow: var(--inset-shadow);
  transform: translateY(1px);
}

.check-button:disabled {
  background: #c8bddf;
  color: #f5f2fb;
  cursor: not-allowed;
  box-shadow: var(--inset-shadow);
}

.danger-button {
  padding: 0 17px;
  background: #d96a6a;
  color: #fff;
}

.confirm-dialog {
  width: min(92vw, 420px);
  border: 0;
  border-radius: 20px;
  padding: 0;
  background: var(--surface);
  box-shadow: var(--outer-shadow);
}

.confirm-dialog::backdrop {
  background: rgba(44, 49, 66, 0.32);
  backdrop-filter: blur(4px);
}

.confirm-dialog form {
  padding: 24px;
}

.confirm-dialog h2 {
  margin: 0;
  font-size: 1.18rem;
}

.confirm-dialog p {
  margin: 9px 0 22px;
  color: var(--muted);
  font-size: 0.87rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(109, 53, 219, 0.22);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 20px, 680px);
    margin-top: 14px;
  }

  .exercise-card {
    padding: 18px 13px;
    border-radius: 20px;
  }

  .exercise-header {
    flex-direction: column;
    gap: 15px;
  }

  .title-block p {
    margin-left: 0;
    line-height: 1.45;
  }

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

  .hero {
    aspect-ratio: 2.05 / 1;
    margin-top: 18px;
  }

  .main-player {
    grid-template-columns: auto auto 1fr auto;
    gap: 9px;
    padding-inline: 11px;
  }
  .phrase-row {
    grid-template-columns: 29px minmax(0, 1fr);
    gap: 8px;
  }

  .message-layout {
    gap: 8px;
  }

  .speaker-column {
    flex-basis: 32px;
    gap: 5px;
    padding-top: 1px;
  }

  .speaker-column {
    gap: 5px;
    padding-top: 2px;
  }

  .phrase-play-button {
    width: 32px;
    height: 32px;
  }

  .avatar {
    width: 31px;
    height: 31px;
  }

  .answer-input {
    font-size: 16px;
  }

  .exercise-actions {
    flex-direction: column-reverse;
  }

  .reset-button,
  .check-button {
    width: 100%;
  }

  .results-panel {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 400px) {
  .exercise-card {
    padding-inline: 10px;
  }

  .time-display {
    min-width: 60px;
    font-size: 0.69rem;
  }

  .volume-button {
    display: none;
  }

  .main-player {
    grid-template-columns: auto auto 1fr;
  }
  .phrase-row {
    grid-template-columns: 25px minmax(0, 1fr);
    gap: 5px;
  }

  .message-layout {
    gap: 6px;
  }

  .speaker-column {
    flex-basis: 29px;
  }


  .phrase-card {
    padding-inline: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}


/* Alineación final garantizada */
.phrase-row .message-layout {
  width: 100%;
}

.phrase-row.is-receptionist .speaker-column,
.phrase-row.is-traveler .speaker-column {
  align-self: flex-start;
}

.phrase-row.is-receptionist .phrase-card,
.phrase-row.is-traveler .phrase-card {
  align-self: flex-start;
}

.phrase-meta{display:none!important;}


/* Clean SVG controls for text and translation */
.help-button {
  padding: 0;
}

.help-svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.help-button:hover .help-svg {
  transform: scale(1.06);
}

.help-button:active .help-svg {
  transform: scale(0.96);
}


/* Lucide icon system */
.ui-icon,
.button-icon,
.badge-icon,
.play-svg,
.help-svg {
  display: block;
  fill: none;
  stroke: currentColor;
  flex: 0 0 auto;
}

.ui-icon {
  width: 20px;
  height: 20px;
}

.button-icon {
  width: 18px;
  height: 18px;
}

.badge-icon {
  width: 14px;
  height: 14px;
  margin-right: 6px;
}

.play-svg {
  width: 16px;
  height: 16px;
}

.main-play-button .play-svg {
  width: 18px;
  height: 18px;
}

.help-svg {
  width: 19px;
  height: 19px;
}

.play-symbol {
  display: grid;
  place-items: center;
  margin-left: 0;
}

.main-play-button .play-symbol svg,
.phrase-play-button .play-symbol svg {
  pointer-events: none;
}

.headphones-icon .ui-icon {
  width: 22px;
  height: 22px;
}

.reset-button,
.check-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}


/* ===== Listening library and fixed conversation viewport ===== */
body { overflow: hidden; }
.page-shell { height: calc(100vh - 36px); margin: 18px auto; }
.library-view,
.exercise-card { height: 100%; }
.library-view {
  padding: 30px;
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--outer-shadow);
  overflow: auto;
}
.library-header { display:flex; justify-content:space-between; align-items:flex-start; gap:24px; margin-bottom:26px; }
.library-header .title-row { align-items:flex-start; }
.library-header h1 { margin:0; font-size:clamp(1.45rem,3vw,2rem); }
.library-header p { margin:7px 0 0; color:var(--muted); font-size:.9rem; }
.library-filters { display:flex; gap:12px; flex-wrap:wrap; justify-content:flex-end; }
.filter-field { display:grid; gap:6px; color:var(--muted); font-size:.68rem; font-weight:800; letter-spacing:.05em; text-transform:uppercase; }
.filter-field select {
  min-width:150px; height:42px; padding:0 38px 0 14px; border:0; border-radius:13px;
  background:var(--surface); color:var(--text); box-shadow:var(--small-shadow); outline:none; cursor:pointer;
}
.filter-field select:focus { box-shadow:var(--inset-shadow),0 0 0 3px rgba(109,53,219,.13); }
.conversation-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:22px; }
.conversation-card {
  min-width:0; padding:0; overflow:hidden; border:0; border-radius:20px; background:var(--surface);
  color:var(--text); text-align:left; box-shadow:var(--outer-shadow); transition:transform .18s ease,box-shadow .18s ease;
}
button.conversation-card { cursor:pointer; }
button.conversation-card:hover { transform:translateY(-3px); box-shadow:13px 13px 26px var(--shadow-dark),-13px -13px 26px var(--shadow-light); }
.conversation-card img { display:block; width:100%; aspect-ratio:1/1; object-fit:cover; }
.conversation-card-body { display:grid; gap:5px; padding:15px 16px 17px; position:relative; }
.conversation-card-body strong { font-size:.98rem; }
.conversation-card-body > span:not(.level-chip) { color:var(--muted); font-size:.75rem; }
.conversation-card-body small { color:var(--muted); font-size:.68rem; }
.conversation-card-body .conversation-rating {
  display:flex;
  align-items:center;
  gap:4px;
  width:max-content;
  min-height:22px;
  margin-top:7px;
}
.conversation-rating-star {
  width:19px;
  height:19px;
  overflow:visible;
  color:#d1d5db;
  fill:rgba(209,213,219,.14);
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
  transition:color 180ms ease,fill 180ms ease,transform 180ms ease;
}
.conversation-rating-star.is-earned {
  color:#c88700;
  fill:#f5b82e;
}
.conversation-rating.is-celebrating .conversation-rating-star.is-earned {
  animation:conversationStarEarned 520ms ease both;
  animation-delay:calc((var(--star-index, 1) - 1) * 90ms);
}
@keyframes conversationStarEarned {
  0% { transform:scale(.72); }
  58% { transform:scale(1.2); filter:drop-shadow(0 0 5px rgba(245,184,46,.55)); }
  100% { transform:scale(1); filter:none; }
}
@media (prefers-reduced-motion:reduce) {
  .conversation-rating.is-celebrating .conversation-rating-star.is-earned { animation:none; }
}
.level-chip { position:absolute; top:14px; right:14px; padding:5px 9px; border-radius:999px; color:var(--primary); font-size:.68rem; font-weight:800; box-shadow:var(--small-shadow); }
.empty-state { padding:40px; text-align:center; color:var(--muted); }
.exercise-view { display:flex; flex-direction:column; padding:22px 28px 24px; overflow:hidden; }
.exercise-view[hidden], .library-view[hidden] { display:none !important; }
.exercise-header { display:block; flex:0 0 auto; }
.back-button { display:inline-flex; align-items:center; gap:7px; min-height:38px; margin-bottom:12px; padding:0 13px; border:0; border-radius:12px; background:var(--surface); color:var(--muted); font-weight:750; cursor:pointer; box-shadow:var(--small-shadow); }
.back-button:active { box-shadow:var(--inset-shadow); }
.exercise-heading-row { display:flex; justify-content:space-between; align-items:flex-start; gap:20px; }
.exercise-heading-row .title-block p { margin-left:53px; }
.exercise-view .hero { flex:0 0 auto; height:clamp(128px,18vh,190px); aspect-ratio:auto; margin:16px 0 14px; }
.exercise-view .main-player { flex:0 0 auto; }
.conversation-scroll { min-height:0; flex:1 1 auto; margin-top:18px; padding:6px 16px 26px 6px; overflow-y:auto; overflow-x:hidden; scrollbar-gutter:stable; }
.conversation-scroll::-webkit-scrollbar { width:10px; }
.conversation-scroll::-webkit-scrollbar-track { background:var(--surface); border-radius:999px; box-shadow:var(--inset-shadow); }
.conversation-scroll::-webkit-scrollbar-thumb { background:rgba(109,53,219,.35); border-radius:999px; border:2px solid var(--surface); }
/* Stronger traveler bubble without changing the palette */
.is-traveler .phrase-card { background:#dfeee5; }
/* Mirror every bubble control around its speaker. */
.is-receptionist .help-button { left:auto; right:9px; }
.is-receptionist .speaker-name { margin-left:0; margin-right:48px; }
.is-receptionist .correct-text { margin-left:0; margin-right:48px; }
.is-traveler .help-button { left:9px; right:auto; }
.is-traveler .speaker-name { margin-left:48px; margin-right:0; }
.is-traveler .correct-text { margin-left:48px; margin-right:0; }
/* Mirror the remaining bubble controls without reversing readable sentence text. */
.is-traveler .answer-input { text-align:right; }
.is-traveler .correct-text,
.is-traveler .translation-box,
.is-traveler .feedback { text-align:right; }
.is-traveler .live-word-row { justify-content:flex-end; }
.is-traveler .feedback { flex-direction:row-reverse; }
.is-traveler .phrase-play-button .play-symbol { scale:-1 1; }
/* Full-conversation player: slightly taller, finer contour and clearer elevation */
.main-player { min-height:76px; padding:14px 18px; border:1px solid rgba(109,53,219,.16); box-shadow:12px 12px 24px rgba(163,177,198,.5),-12px -12px 24px rgba(255,255,255,.96),inset 0 0 0 1px rgba(255,255,255,.35); }

@media (max-width: 820px) {
  body { overflow:auto; }
  .page-shell { height:auto; min-height:100vh; margin:12px auto 28px; }
  .library-view,.exercise-card { height:auto; min-height:calc(100vh - 24px); }
  .library-header { flex-direction:column; }
  .library-filters { width:100%; justify-content:flex-start; }
  .filter-field { flex:1 1 140px; }
  .filter-field select { width:100%; min-width:0; }
  .conversation-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .exercise-view { overflow:visible; }
  .conversation-scroll { overflow:visible; padding-right:6px; }
  .exercise-heading-row { flex-direction:column; }
  .exercise-heading-row .title-block p { margin-left:0; }
}
@media (max-width:520px) {
  .library-view { padding:18px 14px; }
  .conversation-grid { grid-template-columns:1fr; gap:18px; }
  .exercise-view { padding:15px 11px 20px; }
  .exercise-view .hero { height:145px; }
}


/* ===== Compact library and stable exercise layout ===== */
@media (min-width: 821px) {
  .page-shell {
    width: min(calc(100% - 28px), 1440px);
  }

  .library-view {
    width: 100%;
    padding: 32px 38px;
  }

  .conversation-grid {
    display: flex;
    align-items: flex-start;
    gap: 18px;
  }

  .conversation-card {
    width: 220px;
    flex: 0 0 220px;
    border-radius: 18px;
  }

  .conversation-card img {
    width: 158px;
    height: 158px;
    aspect-ratio: 1 / 1;
    margin: 14px auto 0;
    border-radius: 15px;
    object-fit: cover;
    object-position: center;
    box-shadow: var(--small-shadow);
  }

  .conversation-card-body {
    padding: 13px 15px 16px;
    gap: 4px;
  }

  .conversation-card-body strong {
    font-size: .92rem;
  }

  .exercise-view {
    position: relative;
    width: min(calc(100% - 370px), 1040px);
    margin-inline: auto;
    padding: 20px 28px 18px;
  }

  .back-button {
    position: absolute;
    top: 22px;
    left: -150px;
    margin: 0;
    z-index: 5;
  }

  .exercise-heading-row .badges {
    position: absolute;
    top: 22px;
    right: -178px;
    width: 160px;
    display: grid;
    justify-items: stretch;
    gap: 10px;
  }

  .exercise-heading-row .badge {
    justify-content: flex-start;
    width: 100%;
  }

  .exercise-view .hero {
    height: clamp(185px, 24vh, 245px);
    margin: 15px 0 14px;
  }

  .exercise-view .hero img {
    object-position: center 46%;
  }

  .conversation-scroll {
    margin-top: 15px;
    padding: 6px 16px 12px 6px;
  }

  .results-panel {
    flex: 0 0 auto;
    margin-top: 12px;
  }

  .exercise-actions {
    flex: 0 0 auto;
    margin-top: 14px;
    padding-top: 2px;
  }
}

@media (max-width: 1260px) and (min-width: 821px) {
  .exercise-view {
    width: calc(100% - 250px);
  }
  .back-button { left: -112px; }
  .exercise-heading-row .badges { right: -122px; width: 110px; }
  .exercise-heading-row .badge { padding-inline: 10px; font-size: .68rem; }
}

@media (max-width: 820px) {
  .conversation-card {
    max-width: 230px;
  }

  .conversation-card img {
    aspect-ratio: 1 / 1;
    object-position: center;
  }

  .exercise-actions {
    position: sticky;
    bottom: 8px;
    z-index: 20;
    padding: 10px;
    border-radius: 16px;
    background: rgba(238, 242, 247, .94);
    box-shadow: var(--outer-shadow);
    backdrop-filter: blur(8px);
  }
}


/* ===== Requested wide conversation layout ===== */
@media (min-width: 821px) {
  .page-shell {
    width: min(calc(100% - 36px), 1580px);
  }

  .library-view,
  .exercise-view {
    min-height: 100%;
  }

  .exercise-view {
    width: min(calc(100% - 400px), 1160px);
    max-width: 1160px;
    margin-inline: auto;
  }

  .exercise-left-rail {
    position: absolute;
    top: 20px;
    left: -194px;
    width: 174px;
    display: grid;
    gap: 20px;
    align-content: start;
  }

  .back-button {
    position: static;
    width: max-content;
    max-width: 100%;
    margin: 0;
  }

  .exercise-side-intro {
    padding: 16px 14px;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--small-shadow);
  }

  .side-intro-title {
    display: flex;
    align-items: center;
    gap: 9px;
  }

  .side-intro-title .headphones-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
  }

  .side-intro-title h1 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.18;
    letter-spacing: -.02em;
  }

  .exercise-side-intro p {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: .76rem;
    line-height: 1.48;
  }

  .exercise-heading-row {
    min-height: 0;
  }

  .exercise-heading-row .badges {
    top: 20px;
    right: -194px;
    width: 174px;
  }

  .conversation-scroll {
    padding-inline: 10px 18px;
  }

  .phrase-list {
    gap: 26px;
  }

  .message-layout {
    gap: 16px;
  }
}

@media (max-width: 1260px) and (min-width: 821px) {
  .exercise-view {
    width: calc(100% - 300px);
  }

  .exercise-left-rail {
    left: -140px;
    width: 126px;
  }

  .exercise-heading-row .badges {
    right: -140px;
    width: 126px;
  }

  .exercise-side-intro {
    padding: 13px 11px;
  }

  .side-intro-title {
    align-items: flex-start;
  }

  .side-intro-title .headphones-icon {
    display: none;
  }
}

@media (max-width: 820px) {
  .exercise-left-rail {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
  }

  .exercise-side-intro {
    padding: 14px;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--small-shadow);
  }

  .side-intro-title {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .side-intro-title h1 {
    margin: 0;
    font-size: 1.12rem;
  }

  .exercise-side-intro p {
    margin: 8px 0 0 46px;
    color: var(--muted);
    font-size: .8rem;
    line-height: 1.45;
  }

  .phrase-list {
    gap: 22px;
  }
}


/* ==========================================================
   SIDE PANELS ONLY — the central conversation remains intact
   ========================================================== */
@media (min-width: 1261px) {
  .exercise-left-rail {
    position: absolute;
    top: 0;
    left: -214px;
    width: 190px;
    height: 100%;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 22px;
    align-content: stretch;
    z-index: 10;
  }

  .back-button {
    position: static;
    width: 100%;
    min-height: 54px;
    margin: 0;
    padding: 0 18px;
    justify-content: flex-start;
    border: 1px solid rgba(109, 53, 219, .14);
    border-radius: 16px;
    color: var(--primary);
    font-size: .86rem;
    box-shadow: var(--small-shadow);
  }

  .exercise-side-intro {
    min-height: 0;
    height: 100%;
    padding: 28px 22px;
    border-radius: 22px;
    background: var(--surface);
    box-shadow: var(--outer-shadow);
  }

  .side-intro-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    margin-bottom: 28px;
    border-radius: 50%;
    color: var(--primary);
    background: var(--surface);
    box-shadow: var(--small-shadow);
  }

  .side-intro-icon .ui-icon {
    width: 23px;
    height: 23px;
  }

  .exercise-side-intro h1 {
    margin: 0;
    font-size: 1.08rem;
    line-height: 1.2;
    letter-spacing: -.025em;
  }

  .exercise-side-intro p {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: .84rem;
    line-height: 1.65;
  }

  .exercise-right-rail {
    position: absolute;
    top: 0;
    right: -214px;
    width: 190px;
    display: grid;
    gap: 16px;
    z-index: 10;
  }

  .exercise-info-card {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 13px;
    align-items: center;
    min-height: 92px;
    padding: 17px 16px;
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--outer-shadow);
  }

  .exercise-info-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 14px;
    color: var(--primary);
    background: var(--surface);
    box-shadow: var(--small-shadow);
  }

  .exercise-info-icon .ui-icon {
    width: 21px;
    height: 21px;
  }

  .exercise-info-copy {
    display: grid;
    gap: 5px;
    min-width: 0;
  }

  .exercise-info-copy small {
    color: var(--muted);
    font-size: .72rem;
    line-height: 1;
  }

  .exercise-info-copy strong {
    color: var(--text);
    font-size: 1rem;
    line-height: 1.15;
  }
}

@media (max-width: 1260px) and (min-width: 821px) {
  .exercise-left-rail {
    position: absolute;
    top: 0;
    left: -142px;
    width: 126px;
    height: 100%;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 14px;
  }

  .back-button {
    position: static;
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 0 11px;
    justify-content: flex-start;
    font-size: .7rem;
  }

  .exercise-side-intro {
    height: 100%;
    padding: 18px 13px;
  }

  .side-intro-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    margin-bottom: 18px;
    border-radius: 50%;
    color: var(--primary);
    box-shadow: var(--small-shadow);
  }

  .exercise-side-intro h1 {
    margin: 0;
    font-size: .88rem;
  }

  .exercise-side-intro p {
    margin: 11px 0 0;
    font-size: .7rem;
    line-height: 1.5;
  }

  .exercise-right-rail {
    position: absolute;
    top: 0;
    right: -142px;
    width: 126px;
    display: grid;
    gap: 12px;
  }

  .exercise-info-card {
    display: grid;
    gap: 9px;
    min-height: 82px;
    padding: 13px 11px;
    border-radius: 15px;
    background: var(--surface);
    box-shadow: var(--small-shadow);
  }

  .exercise-info-icon {
    color: var(--primary);
  }

  .exercise-info-icon .ui-icon {
    width: 19px;
    height: 19px;
  }

  .exercise-info-copy {
    display: grid;
    gap: 4px;
  }

  .exercise-info-copy small {
    color: var(--muted);
    font-size: .64rem;
  }

  .exercise-info-copy strong {
    font-size: .82rem;
  }
}

@media (max-width: 820px) {
  .exercise-left-rail {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
  }

  .back-button {
    width: max-content;
  }

  .exercise-side-intro {
    padding: 14px;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--small-shadow);
  }

  .side-intro-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    margin-bottom: 12px;
    border-radius: 50%;
    color: var(--primary);
    box-shadow: var(--small-shadow);
  }

  .exercise-side-intro h1 {
    margin: 0;
    font-size: 1.08rem;
  }

  .exercise-side-intro p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: .8rem;
    line-height: 1.45;
  }

  .exercise-right-rail {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
  }

  .exercise-info-card {
    display: flex;
    gap: 10px;
    align-items: center;
    min-height: 64px;
    padding: 12px;
    border-radius: 15px;
    background: var(--surface);
    box-shadow: var(--small-shadow);
  }

  .exercise-info-icon {
    color: var(--primary);
  }

  .exercise-info-copy {
    display: grid;
    gap: 3px;
  }

  .exercise-info-copy small {
    color: var(--muted);
    font-size: .66rem;
  }

  .exercise-info-copy strong {
    font-size: .86rem;
  }
}


/* ==========================================================
   FINAL SIDE-PANEL VISIBILITY FIX
   Only exposes the existing left/right rails outside the card.
   The central conversation layout, scroll, colors and logic stay intact.
   ========================================================== */
@media (min-width: 821px) {
  .exercise-view {
    overflow: visible !important;
  }
}


/* Traveler label mirrored to match the Agent layout.
   Agent position is unchanged. */
.is-traveler .speaker-name {
  text-align: right;
}


/* Full conversation repeat toggle */
.main-player {
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
}

.loop-button.is-active {
  color: var(--primary);
  box-shadow:
    inset 3px 3px 7px rgba(163, 177, 198, 0.38),
    inset -3px -3px 7px rgba(255, 255, 255, 0.92),
    0 0 0 2px rgba(109, 53, 219, 0.10);
}

@media (max-width: 760px) {
  .main-player {
    grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  }
}

@media (max-width: 400px) {
  .main-player {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
  }

  .volume-button {
    display: none;
  }
}


/* Full conversation speed controls */
.main-player {
  grid-template-columns: auto auto minmax(0, 1fr) auto auto auto auto;
}

.speed-button.is-active {
  color: var(--primary);
  box-shadow:
    inset 3px 3px 7px rgba(163, 177, 198, 0.38),
    inset -3px -3px 7px rgba(255, 255, 255, 0.92),
    0 0 0 2px rgba(109, 53, 219, 0.10);
}

@media (max-width: 760px) {
  .main-player {
    grid-template-columns: auto auto minmax(0, 1fr) auto auto auto auto;
    gap: 7px;
  }
}

@media (max-width: 520px) {
  .main-player {
    grid-template-columns: auto auto minmax(0, 1fr) auto auto auto;
  }

  .volume-button {
    display: none;
  }
}

@media (max-width: 400px) {
  .main-player {
    grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  }

  .loop-button {
    display: none;
  }
}


/* Four main-audio utility icons */
.main-player .speed-button,
.main-player .volume-button,
.main-player .loop-button {
  color: var(--primary);
}

.main-player .speed-animal-icon {
  width: 21px;
  height: 21px;
  stroke-width: 1.9;
}

.main-player .rabbit-icon {
  width: 22px;
  height: 22px;
}

.main-player .speed-button:hover,
.main-player .volume-button:hover,
.main-player .loop-button:hover {
  color: var(--primary-dark);
}


/* Audio controls: color state only — no layout changes */
.main-player .speed-button,
.main-player .volume-button,
.main-player .loop-button {
  color: #666d7d;
}

.main-player .speed-button.is-active,
.main-player .loop-button.is-active {
  color: var(--primary);
}

.main-player .speed-button:hover,
.main-player .volume-button:hover,
.main-player .loop-button:hover {
  color: var(--primary-dark);
}


/* Shared mascot for every conversation — right rail only */
.exercise-mascot {
  display: block;
  width: 118px;
  height: auto;
  margin: 4px 0 0 auto;
  object-fit: contain;
  align-self: end;
}

@media (min-width: 1261px) {
  .exercise-right-rail {
    height: 100%;
    grid-template-rows: auto auto 1fr;
  }

  .exercise-mascot {
    align-self: end;
    justify-self: end;
    margin-top: 8px;
  }
}

@media (max-width: 1260px) and (min-width: 821px) {
  .exercise-mascot {
    width: 92px;
    margin-top: 6px;
  }
}

@media (max-width: 820px) {
  .exercise-mascot {
    display: none;
  }
}


/* Conversation 5 only: Level/Topic cards inside left rail, scrollable flashcards on right */
.default-exercise-info {
  display: grid;
  gap: 16px;
}

.online-left-info {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.online-left-info .exercise-info-card {
  width: 100%;
}

.keywords-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  padding: 15px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--outer-shadow);
}

.keywords-heading h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -.02em;
}

.keywords-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .68rem;
  line-height: 1.35;
}

.keywords-scroll {
  min-height: 0;
  max-height: 470px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 3px 7px 7px 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(109, 53, 219, .35) transparent;
}

.keywords-scroll::-webkit-scrollbar {
  width: 7px;
}

.keywords-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(109, 53, 219, .3);
}

.keywords-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 11px;
}

.keyword-card {
  position: relative;
  width: 100%;
  height: 82px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  cursor: pointer;
  perspective: 900px;
}

.keyword-card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .38s cubic-bezier(.2, .72, .25, 1);
}

.keyword-card.is-flipped .keyword-card-inner {
  transform: rotateY(180deg);
}

.keyword-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 12px 28px 12px 12px;
  overflow: hidden;
  border-radius: 16px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: var(--small-shadow);
}

.keyword-front {
  background: var(--surface);
  color: var(--text);
}

.keyword-back {
  background: var(--primary-soft);
  color: var(--primary-dark);
  transform: rotateY(180deg);
}

.keyword-language {
  color: var(--muted);
  font-size: .53rem;
  font-weight: 850;
  letter-spacing: .09em;
  text-align: center;
}

.keyword-face strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: .88rem;
  line-height: 1.15;
  text-align: center;
}

.keyword-flip-icon {
  position: absolute;
  right: 9px;
  bottom: 7px;
  color: var(--muted);
  font-size: .72rem;
}

.keyword-card:hover .keyword-card-inner {
  transform: translateY(-2px);
}

.keyword-card.is-flipped:hover .keyword-card-inner {
  transform: rotateY(180deg) translateY(-2px);
}

.keyword-card:focus-visible {
  outline: 3px solid rgba(109, 53, 219, .22);
  outline-offset: 3px;
}

@media (min-width: 1261px) {
  .conversation-standard-layout .exercise-left-rail {
    grid-template-rows: auto auto auto;
    height: auto;
  }

  .conversation-standard-layout .exercise-side-intro {
    height: auto;
  }

  .conversation-standard-layout .exercise-left-rail .exercise-info-card {
    min-height: 78px;
    padding: 13px 12px;
    grid-template-columns: 36px 1fr;
    gap: 10px;
  }

  .conversation-standard-layout .exercise-left-rail .exercise-info-icon {
    width: 36px;
    height: 36px;
  }

  .conversation-standard-layout .exercise-right-rail {
    height: 100%;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: stretch;
  }

  .conversation-standard-layout .exercise-mascot {
    display: block;
    align-self: end;
    justify-self: end;
    margin-top: 10px;
  }
}

@media (max-width: 1260px) and (min-width: 821px) {
  .conversation-standard-layout .exercise-left-rail {
    grid-template-rows: auto auto auto;
    height: auto;
  }

  .conversation-standard-layout .exercise-side-intro {
    height: auto;
  }

  .conversation-standard-layout .online-left-info {
    gap: 10px;
  }

  .conversation-standard-layout .exercise-left-rail .exercise-info-card {
    min-height: 72px;
    padding: 11px 9px;
  }

  .conversation-standard-layout .exercise-right-rail {
    height: 100%;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .keywords-panel {
    padding: 11px;
  }

  .keywords-heading p {
    display: none;
  }

  .keywords-scroll {
    max-height: 410px;
  }

  .keyword-card {
    height: 70px;
  }

  .keyword-face strong {
    font-size: .76rem;
  }

  .conversation-standard-layout .exercise-mascot {
    display: block;
    align-self: end;
    justify-self: end;
  }
}

@media (max-width: 820px) {
  .conversation-standard-layout .online-left-info {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .conversation-standard-layout .exercise-right-rail {
    display: grid;
    grid-template-columns: 1fr;
  }

  .conversation-standard-layout .keywords-panel {
    width: 100%;
  }

  .keywords-scroll {
    max-height: 350px;
  }

  .keyword-card {
    height: 74px;
  }

  /* Preserve the existing mobile behavior: mascot stays hidden on small screens. */
}


/* Conversation 5 refinement: description and mascot cards */
.online-description-card {
  align-items: flex-start;
}

.online-description-card .exercise-info-copy strong {
  font-size: .74rem;
  font-weight: 650;
  line-height: 1.4;
}

.mascot-card {
  display: grid;
  place-items: center;
  min-height: 126px;
  padding: 10px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--outer-shadow);
}

.mascot-card .exercise-mascot {
  display: block;
  width: min(100%, 118px);
  height: auto;
  margin: 0;
  object-fit: contain;
}

@media (min-width: 821px) {
  .conversation-standard-layout .exercise-right-rail {
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 14px;
  }

  .conversation-standard-layout .mascot-card {
    align-self: end;
    justify-self: stretch;
  }
}

@media (max-width: 1260px) and (min-width: 821px) {
  .online-description-card .exercise-info-copy strong {
    font-size: .68rem;
  }

  .mascot-card {
    min-height: 108px;
    padding: 8px;
  }

  .mascot-card .exercise-mascot {
    width: min(100%, 96px);
  }
}

@media (max-width: 820px) {
  .conversation-standard-layout .online-left-info {
    grid-template-columns: 1fr;
  }

  .conversation-standard-layout .mascot-card {
    display: grid;
    width: 100%;
    min-height: 120px;
    margin-top: 14px;
  }

  .conversation-standard-layout .mascot-card .exercise-mascot {
    display: block;
    width: min(100%, 110px);
  }
}


/* Standard layout for every conversation */
.conversation-standard-layout .exercise-left-rail {
  height: 100%;
}

.conversation-standard-layout .online-left-info {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
}

.conversation-standard-layout .online-description-card {
  min-height: 0;
  height: 100%;
  align-content: start;
}

.conversation-standard-layout .online-description-card .exercise-info-copy strong {
  color: #8790a2;
  font-weight: 600;
  line-height: 1.55;
}

.conversation-standard-layout .exercise-right-rail {
  height: 100%;
  grid-template-rows: minmax(0, 1fr) auto;
}

.conversation-standard-layout .keywords-panel {
  height: 100%;
  min-height: 0;
}

.conversation-standard-layout .keywords-scroll {
  height: 100%;
  max-height: none;
}

.conversation-standard-layout .keywords-heading h2 {
  color: #8790a2;
}

.conversation-standard-layout .keywords-heading p {
  color: #a0a7b5;
}

.conversation-standard-layout .keyword-language {
  color: #a0a7b5;
}

@media (max-width: 820px) {
  .conversation-standard-layout .online-left-info {
    grid-template-rows: auto auto auto;
  }

  .conversation-standard-layout .online-description-card {
    height: auto;
  }

  .conversation-standard-layout .keywords-scroll {
    max-height: 350px;
  }
}


/* Final standard layout refinements for all conversations */
.conversation-standard-layout .exercise-left-rail {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.conversation-standard-layout .exercise-side-intro {
  height: auto;
}

.conversation-standard-layout .online-left-info {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.conversation-standard-layout .online-left-info > .exercise-info-card:not(.online-description-card) {
  min-height: 78px;
  height: auto;
  padding: 13px 12px;
}

.conversation-standard-layout .online-description-card {
  height: 100%;
  min-height: 0;
  align-content: start;
  padding: 16px 14px;
}

.conversation-standard-layout .online-description-card .exercise-info-copy {
  align-self: stretch;
}

.conversation-standard-layout .online-description-card .exercise-info-copy small {
  color: #9aa3b3;
}

.conversation-standard-layout .online-description-card .exercise-info-copy strong {
  color: #a1a9b8;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.65;
}

.conversation-standard-layout .exercise-right-rail {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.conversation-standard-layout .keywords-panel {
  height: 100%;
  min-height: 0;
}

.conversation-standard-layout .keywords-scroll {
  height: 100%;
  min-height: 0;
  max-height: none;
}

.new-word-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--outer-shadow);
}

.new-word-heading h2 {
  margin: 0;
  color: #8790a2;
  font-size: .96rem;
  letter-spacing: -.02em;
}

.new-word-heading p {
  margin: 5px 0 0;
  color: #a0a7b5;
  font-size: .66rem;
  line-height: 1.35;
}

.new-word-field {
  display: grid;
  gap: 5px;
}

.new-word-field span {
  color: #929aaa;
  font-size: .62rem;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.new-word-field input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 11px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-size: .76rem;
  box-shadow: var(--inset-shadow);
}

.new-word-field input::placeholder {
  color: #a7aeba;
}

.new-word-field input:focus {
  box-shadow:
    var(--inset-shadow),
    0 0 0 3px rgba(109, 53, 219, .13);
}

.new-word-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.new-word-folder-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  margin: 6px 0 0;
  color: #8790a2;
  font-size: .7rem;
  line-height: 1.4;
}

.new-word-folder-line span {
  color: inherit;
}

.new-word-folder-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--primary);
  font-size: .7rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .16em;
}

.new-word-folder-link:hover,
.new-word-folder-link:focus-visible {
  color: var(--primary-dark);
}

.new-word-folder-link:focus-visible {
  outline: 2px solid rgba(109, 53, 219, .2);
  outline-offset: 4px;
  border-radius: 8px;
}

.new-word-preview-tools {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.new-word-status {
  margin: 0;
  color: #8790a2;
  font-size: .68rem;
  line-height: 1.4;
}

.new-word-status:empty {
  display: none;
}

.new-word-status[data-tone="success"] {
  color: #0f8f5f;
}

.new-word-status[data-tone="warning"] {
  color: #b45309;
}

.new-word-save-button {
  min-width: 112px;
  min-height: 36px;
  justify-self: start;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  background: var(--primary);
  color: #fff;
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 22px rgba(89, 40, 188, .2);
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.new-word-save-button:hover:not(:disabled),
.new-word-save-button:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  background: var(--primary-dark);
  box-shadow: 0 16px 26px rgba(89, 40, 188, .24);
}

.new-word-save-button:focus-visible {
  outline: 2px solid rgba(109, 53, 219, .22);
  outline-offset: 3px;
}

.new-word-save-button:disabled {
  opacity: .52;
  cursor: not-allowed;
  box-shadow: none;
}

.folder-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 10020;
}

body.folder-picker-open {
  overflow: hidden;
}

.folder-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 23, 43, .28);
  backdrop-filter: blur(4px);
}

.folder-picker-card {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100vw - 48px));
  margin: 10vh auto 0;
  padding: 24px;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 32px 72px rgba(36, 24, 61, .2);
}

.folder-picker-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.folder-picker-kicker {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.folder-picker-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.28rem;
}

.folder-picker-copy {
  margin: 12px 0 0;
  color: #697386;
  font-size: .84rem;
  line-height: 1.55;
}

.folder-picker-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #f4f1fb;
  color: var(--primary);
  font-size: 1.3rem;
  cursor: pointer;
}

.folder-picker-list {
  display: grid;
  gap: 10px;
  max-height: min(48vh, 360px);
  margin-top: 18px;
  padding-right: 4px;
  overflow: auto;
}

.folder-picker-option {
  width: 100%;
  border: 1px solid #e5def8;
  border-radius: 18px;
  padding: 14px 16px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.folder-picker-option:hover,
.folder-picker-option:focus-visible {
  border-color: rgba(109, 53, 219, .42);
  box-shadow: 0 12px 24px rgba(109, 53, 219, .11);
}

.folder-picker-option:focus-visible {
  outline: 2px solid rgba(109, 53, 219, .18);
  outline-offset: 2px;
}

.folder-picker-option.is-selected {
  border-color: rgba(109, 53, 219, .65);
  background: rgba(109, 53, 219, .06);
}

.folder-picker-option strong,
.folder-picker-option span {
  display: block;
}

.folder-picker-option strong {
  font-size: .88rem;
}

.folder-picker-option span {
  margin-top: 4px;
  color: #7b8597;
  font-size: .72rem;
}

.folder-picker-empty {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  color: #8790a2;
  font-size: .78rem;
}

.folder-picker-empty p {
  margin: 0;
}

.folder-create-panel {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #eee7ff;
}

.folder-create-field {
  display: grid;
  gap: 6px;
}

.folder-create-field span {
  color: #929aaa;
  font-size: .68rem;
  font-weight: 750;
  text-transform: uppercase;
}

.folder-create-field input {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #ebe4ff;
  border-radius: 12px;
  outline: none;
  background: #fff;
  color: var(--text);
  font-size: .82rem;
}

.folder-create-field input:focus {
  border-color: rgba(109, 53, 219, .42);
  box-shadow: 0 0 0 4px rgba(109, 53, 219, .08);
}

.folder-create-actions,
.folder-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.folder-picker-actions {
  margin-top: 18px;
}

.folder-picker-secondary-button {
  min-width: 88px;
  min-height: 36px;
  border: 0;
  border-radius: 12px;
  padding: 0 14px;
  background: #f4f1fb;
  color: #6b7280;
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
}

.folder-picker-secondary-button:focus-visible,
.folder-picker-close:focus-visible {
  outline: 2px solid rgba(109, 53, 219, .2);
  outline-offset: 3px;
}

.conversation-standard-layout .mascot-card {
  min-height: 116px;
}

@media (max-width: 1260px) and (min-width: 821px) {
  .conversation-standard-layout .online-left-info > .exercise-info-card:not(.online-description-card) {
    min-height: 70px;
    padding: 11px 9px;
  }

  .conversation-standard-layout .online-description-card .exercise-info-copy strong {
    font-size: .7rem;
    line-height: 1.5;
  }

  .new-word-card {
    padding: 11px;
    gap: 8px;
  }

  .new-word-heading p {
    display: none;
  }

  .new-word-heading .new-word-folder-line {
    display: flex;
  }

  .new-word-field input {
    height: 34px;
    font-size: .7rem;
  }
}

@media (max-width: 820px) {
  .conversation-standard-layout .exercise-left-rail {
    grid-template-rows: auto auto auto;
    height: auto;
  }

  .conversation-standard-layout .online-left-info {
    grid-template-rows: auto auto auto;
    height: auto;
  }

  .conversation-standard-layout .online-description-card {
    height: auto;
  }

  .conversation-standard-layout .exercise-right-rail {
    grid-template-rows: auto auto auto;
    height: auto;
  }

  .conversation-standard-layout .keywords-scroll {
    max-height: 350px;
  }

  .new-word-folder-link,
  .new-word-folder-line,
  .new-word-preview-tools,
  .folder-picker-modal {
    display: none !important;
  }
}

body.listening-exercise-active .listening-home-link {
  display: none;
}

/* Mobile navigation and audio utilities. */
@media (max-width: 520px) {
  .main-player {
    grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  }

  .main-player #fastButton {
    display: none !important;
  }

  .main-player #loopButton {
    display: grid !important;
  }
}


/* Final text color adjustments */
.online-description-card .exercise-info-copy small,
.new-word-heading h2,
.new-word-heading p,
.keywords-heading h2,
.keywords-heading p {
  color: var(--text);
}

.new-word-heading p,
.keywords-heading p {
  opacity: .78;
}

.mascot-card {
  grid-template-columns: auto auto;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.mascot-card .exercise-mascot {
  width: min(100%, 92px);
}

.mascot-brand {
  color: var(--primary);
  font-size: .82rem;
  font-weight: 750;
  letter-spacing: .01em;
  opacity: .78;
  white-space: nowrap;
}

@media (max-width: 820px) {
  .mascot-card {
    grid-template-columns: auto auto;
  }

  .mascot-card .exercise-mascot {
    width: min(100%, 88px);
  }

  .mascot-brand {
    font-size: .78rem;
  }
}


/* Final branding tweak */
.keywords-heading h2,
.keywords-heading p{
  color: var(--text) !important;
  opacity: 1;
}

.mascot-card{
  display:grid;
  grid-template-columns:1fr;
  justify-content:center;
  justify-items:center;
  align-items:center;
  gap:4px;
}

.mascot-brand{
  order:0;
  color:#111111 !important;
  font-weight:800;
  opacity:1;
  letter-spacing:.02em;
}

.mascot-brand-link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
}

.mascot-brand-link:hover {
  color: #000000 !important;
}

.mascot-brand-link:focus-visible {
  border-radius: 8px;
  outline: 3px solid rgba(109, 53, 219, .22);
  outline-offset: 3px;
}

.mascot-link-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.mascot-card .exercise-mascot {
  width: min(100%, 118px);
}

.mascot-brand-mobile {
  display: none;
}

@media (max-width: 820px) {
  .mascot-card {
    grid-template-columns: auto auto;
    justify-items: initial;
    gap: 8px;
  }

  .mascot-brand-link {
    display: none;
  }

  .mascot-brand-mobile {
    display: inline;
  }

  .mascot-card .exercise-mascot {
    width: min(100%, 110px);
  }
}


/* About this audio title like Listen and type */
.online-description-card .exercise-info-copy small{
  display:block;
  font-size:1.15rem !important;
  font-weight:700 !important;
  color:var(--text) !important;
  text-transform:none !important;
  letter-spacing:-0.02em !important;
  margin-bottom:10px;
  opacity:1 !important;
}

.online-description-card .exercise-info-copy strong{
  display:block;
  color:#97A0B1 !important;
  font-size:.82rem !important;
  line-height:1.65 !important;
  font-weight:500 !important;
}

/* Keep long audio descriptions inside the side panel on short desktops. */
@media (min-width: 821px) {
  .conversation-standard-layout .online-description-card {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(109, 53, 219, .3) transparent;
  }

  .conversation-standard-layout .online-description-card .exercise-info-copy,
  .conversation-standard-layout .online-description-card .exercise-info-copy small,
  .conversation-standard-layout .online-description-card .exercise-info-copy strong {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .conversation-standard-layout .online-description-card::-webkit-scrollbar {
    width: 6px;
  }

  .conversation-standard-layout .online-description-card::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(109, 53, 219, .3);
  }
}


/* Final library symmetry and overflow fix */
@media (min-width: 821px) {
  .conversation-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(200px, 220px));
    justify-content: center;
    align-items: start;
    gap: 22px;
    width: 100%;
  }

  .conversation-card {
    width: 100% !important;
    max-width: 220px;
    min-width: 0;
    flex: none !important;
  }
}

@media (max-width: 820px) {
  .conversation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 230px));
    justify-content: center;
    gap: 18px;
  }

  .conversation-card {
    width: 100%;
    max-width: 230px;
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .conversation-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .conversation-card {
    width: 100%;
    max-width: 100%;
  }
}

/* Keep mobile conversations focused on the audio exercise. */
@media (max-width: 820px) {
  .conversation-standard-layout .exercise-left-rail {
    display: block;
    height: auto;
  }

  .conversation-standard-layout .exercise-side-intro,
  .conversation-standard-layout .online-left-info,
  .conversation-standard-layout .exercise-right-rail {
    display: none !important;
  }

  .conversation-standard-layout .phrase-row {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .conversation-standard-layout .message-layout {
    width: 100%;
    min-width: 0;
  }

  .conversation-standard-layout .phrase-card {
    flex: 1 1 auto;
    width: auto;
    max-width: calc(100% - 40px);
    min-width: 0;
  }

  .conversation-standard-layout .is-receptionist .phrase-card {
    margin-right: auto;
  }

  .conversation-standard-layout .is-traveler .phrase-card {
    margin-right: 0;
    margin-left: auto;
  }
}
