/* ==========================================================================
   CORE TRAINING STUDIO STYLES (Listening -> Reciting -> Evaluation)
   ========================================================================== */
.studio-main {
  flex: 1;
  width: 100%;
  max-width: 1260px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

/* Top Control Bar: Seamless Joined Category & Passage Cascading Pickers */
.studio-toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: stretch;
  gap: 0;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 720px;
}

.category-picker-wrap {
  position: relative;
  width: 152px;
  flex-shrink: 0;
}

.category-trigger {
  width: 100%;
  height: 100%;
  background: rgba(28, 29, 34, 0.34);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-right: none;
  box-shadow:
    inset 0 0.5px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 1px rgba(255, 255, 255, 0.1),
    0 12px 30px rgba(0, 0, 0, 0.3);
  border-radius: 999px 0 0 999px;
  padding: 10px 14px 10px 18px;
  color: var(--text-contrast);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: var(--transition-smooth);
}

.category-trigger:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.78);
  box-shadow:
    inset 0 0.5px 0 rgba(255, 255, 255, 0.34),
    0 14px 34px rgba(0, 0, 0, 0.36);
}

.category-trigger-label {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.category-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.category-dot.Easy {
  background: #86efac;
  box-shadow: 0 0 10px rgba(134, 239, 172, 0.75);
}

.category-dot.Medium {
  background: #7dd3fc;
  box-shadow: 0 0 10px rgba(125, 211, 252, 0.75);
}

.category-dot.Hard {
  background: #fda4af;
  box-shadow: 0 0 10px rgba(253, 164, 175, 0.75);
}

.category-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 176px;
  width: 100%;
  background: rgba(26, 27, 32, 0.68);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 20px;
  padding: 8px;
  box-shadow: 0 26px 56px rgba(0, 0, 0, 0.56), inset 0 0.5px 0 rgba(255, 255, 255, 0.22);
  z-index: 160;
  display: none;
  flex-direction: column;
  gap: 4px;
}

.category-dropdown.open {
  display: flex;
}

.category-option {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 10px 13px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: var(--transition-smooth);
}

.category-option:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.45);
}

.category-option.active {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.68);
}

.category-option-left {
  display: flex;
  align-items: center;
  gap: 9px;
}

.category-count-pill {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
}

.passage-picker-wrap {
  position: relative;
  min-width: 0;
  flex: 1;
}

.passage-trigger {
  width: 100%;
  height: 100%;
  background: rgba(28, 29, 34, 0.34);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-left: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow:
    inset 0 0.5px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 1px rgba(255, 255, 255, 0.1),
    0 12px 30px rgba(0, 0, 0, 0.3);
  border-radius: 0 999px 999px 0;
  padding: 10px 18px 10px 14px;
  color: var(--text-contrast);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: var(--transition-smooth);
}

.passage-trigger:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.78);
  box-shadow:
    inset 0 0.5px 0 rgba(255, 255, 255, 0.34),
    0 14px 34px rgba(0, 0, 0, 0.36);
}

.passage-trigger-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.passage-order-pill {
  background: var(--color-accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  flex-shrink: 0;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45), 0 4px 12px rgba(242, 92, 42, 0.42);
}

.passage-trigger-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.passage-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  background: rgba(26, 27, 32, 0.62);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 22px;
  padding: 8px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 26px 56px rgba(0, 0, 0, 0.56), inset 0 0.5px 0 rgba(255, 255, 255, 0.22);
  z-index: 150;
  display: none;
  flex-direction: column;
  gap: 4px;
}

.passage-dropdown.open {
  display: flex;
}

.passage-option {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 10px 14px;
  color: var(--text-main);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: var(--transition-smooth);
}

.passage-option:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.48);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.24);
}

.passage-option.active {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.3);
}

.passage-option-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.passage-option-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-contrast);
}

.passage-option-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.badge-completed {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.22);
  color: #6ee7b7;
  border: 1px solid rgba(110, 231, 183, 0.5);
  flex-shrink: 0;
}

.badge-attempted {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.24);
  color: #bae6fd;
  border: 1px solid rgba(125, 211, 252, 0.55);
  flex-shrink: 0;
}

.badge-pending {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--text-main);
  flex-shrink: 0;
}

.badge-free-trial {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.2);
  border: 1px solid rgba(110, 231, 183, 0.48);
  color: #86efac;
  flex-shrink: 0;
}

.badge-locked {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(242, 92, 42, 0.2);
  border: 1px solid rgba(255, 168, 135, 0.48);
  color: #ffd4c4;
  flex-shrink: 0;
}

.passage-option.locked {
  opacity: 0.86;
}

/* Subscription Plans Grid (Shared by Upgrade Modal & Profile Page) */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  width: 100%;
}

.plan-option-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 18px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
}

@property --beam-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes borderBeamSpin {
  from {
    --beam-angle: 0deg;
  }

  to {
    --beam-angle: 360deg;
  }
}

.plan-option-card.recommended {
  position: relative;
  border-color: rgba(134, 239, 172, 0.42);
}

.plan-option-card.recommended::before {
  content: '';
  position: absolute;
  inset: -1.5px;
  padding: 2px;
  border-radius: inherit;
  pointer-events: none;
  z-index: 3;
  background: conic-gradient(from var(--beam-angle, 0deg),
      transparent 0deg,
      transparent 248deg,
      rgba(134, 239, 172, 0.28) 280deg,
      rgba(134, 239, 172, 0.95) 316deg,
      #ffffff 340deg,
      rgba(125, 211, 252, 0.85) 352deg,
      transparent 360deg);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  filter: drop-shadow(0 0 6px rgba(134, 239, 172, 0.55));
  animation: borderBeamSpin 4s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .plan-option-card.recommended::before {
    animation: none;
  }
}

.plan-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.plan-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-contrast);
}

.plan-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.34);
  color: #ffffff;
}

.plan-tag.highlight {
  background: #86efac;
  border-color: rgba(187, 247, 208, 0.85);
  color: #052e16;
}

.plan-price-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.plan-currency {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-contrast);
}

.plan-price {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-contrast);
}

.plan-period {
  font-size: 13px;
  color: var(--text-secondary);
}

.plan-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.plan-benefits-note {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
  text-align: center;
  line-height: 1.6;
}

@media (max-width: 520px) {
  .plans-grid {
    grid-template-columns: 1fr;
  }
}

/* Main Glass Card */
.studio-card {
  background: rgba(19, 25, 38, 0.76);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius-lg);
  padding: 28px 34px 32px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55), 0 0 40px rgba(99, 102, 241, 0.08);
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 540px;
}

/* Audio Aux Header Bar */
.stage-stepper {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-wrap: wrap;
}

/* Playback Speed & Highlight Controls */
.player-aux-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.speed-stepper {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.38);
  box-shadow:
    inset 0 0.5px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 1px rgba(255, 255, 255, 0.1),
    0 6px 18px rgba(0, 0, 0, 0.22);
  border-radius: 999px;
  padding: 3px 5px;
  gap: 4px;
}

.speed-step-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.36);
  color: #ffffff;
  font-family: inherit;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.speed-step-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.92);
  border-color: #ffffff;
  color: var(--text-on-light);
}

.speed-step-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.speed-step-value {
  min-width: 38px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-contrast);
  user-select: none;
}

.pill-toggle-btn {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.36);
  box-shadow:
    inset 0 0.5px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 1px rgba(255, 255, 255, 0.1),
    0 6px 18px rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.85);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-smooth);
}

.pill-toggle-btn.active {
  background: rgba(255, 255, 255, 0.9);
  border-color: #ffffff;
  color: var(--text-on-light);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.6), 0 8px 20px rgba(0, 0, 0, 0.26);
}

/* Stage 1: Bilingual Content Grid (Side-by-Side on Desktop, Stacked on Mobile) */
.bilingual-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 24px;
  flex: 1;
  align-items: stretch;
}

.panel-box {
  background: rgba(10, 14, 23, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
}

.chinese-collapse-btn {
  display: none;
}

.panel-hint {
  font-size: 12px;
  text-transform: none;
  font-weight: 400;
  color: var(--text-muted);
}

.english-tokens-area {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 3px 2px;
  line-height: 1.25;
  padding: 2px 0;
}

.word-token {
  appearance: none;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: clamp(19px, 1.85vw, 24px);
  line-height: 1.25;
  font-weight: 500;
  color: var(--text-contrast);
  padding: 1px 3px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.word-token:hover {
  background: rgba(56, 189, 248, 0.18);
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.42);
}

.word-token.active {
  background: rgba(56, 189, 248, 0.32);
  color: #ffffff;
  font-weight: 600;
  transform: scale(1.04);
  box-shadow:
    inset 0 0 0 1px rgba(125, 211, 252, 0.8),
    inset 0 0.5px 0 rgba(255, 255, 255, 0.24),
    0 4px 16px rgba(56, 189, 248, 0.34);
}

.chinese-text-body {
  font-size: clamp(17px, 1.5vw, 20px);
  line-height: 1.8;
  color: #86efac;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.32);
  font-weight: 400;
}

/* Audio Player Bar */
.audio-controls-section {
  background: rgba(10, 14, 23, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.seek-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.time-label {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  min-width: 44px;
}

.seek-slider {
  flex: 1;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  outline: none;
  cursor: pointer;
}

.seek-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.player-buttons-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.transport-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-circle-main {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid #ffffff;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  color: var(--text-on-light);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.6), 0 10px 28px rgba(0, 0, 0, 0.36);
  transition: var(--transition-smooth);
}

.btn-circle-main:hover {
  transform: scale(1.06);
  background: #ffffff;
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.75), 0 14px 34px rgba(0, 0, 0, 0.44);
}

.btn-circle-sub {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  box-shadow:
    inset 0 0.5px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 1px rgba(255, 255, 255, 0.1),
    0 8px 20px rgba(0, 0, 0, 0.26);
  color: #ffffff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.btn-circle-sub:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow:
    inset 0 0.5px 0 rgba(255, 255, 255, 0.34),
    0 10px 24px rgba(0, 0, 0, 0.32);
}

/* Stage 2: Blind Recitation & Recording Mode */
.recite-stage {
  display: none;
  flex-direction: column;
  gap: 22px;
  flex: 1;
}

.recite-prompt-card {
  background: rgba(10, 14, 23, 0.62);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 14px;
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.blind-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  font-size: 12px;
  font-weight: 600;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 4px 12px;
  border-radius: 999px;
}

.recorder-box {
  background: rgba(10, 14, 23, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.rec-status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
}

.rec-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--text-muted);
}

.rec-dot.recording {
  background: var(--color-danger);
  box-shadow: 0 0 12px var(--color-danger);
  animation: pulseRec 1s infinite alternate;
}

.rec-timer {
  font-size: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-contrast);
}

.waveform-bars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 58px;
  width: 100%;
  max-width: 460px;
}

.waveform-bar {
  width: 6px;
  height: 10px;
  border-radius: 999px;
  background: var(--grad-primary);
  transition: height 0.07s ease;
}

.rec-actions-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.rec-actions-primary {
  display: flex;
  justify-content: center;
  width: 100%;
}

.rec-actions-primary .btn {
  min-width: 180px;
}

.rec-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  width: 100%;
}

/* Stage 3: Evaluation Loading & Diff Result */
.evaluating-stage {
  display: none;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 50px 20px;
}

.spinner-large {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(56, 189, 248, 0.24);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.result-stage {
  display: none;
  flex-direction: column;
  gap: 22px;
  flex: 1;
}

.result-banner {
  border-radius: 14px;
  padding: 22px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.result-banner.passed {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.38);
}

.result-banner.failed {
  background: rgba(245, 158, 11, 0.11);
  border: 1px solid rgba(245, 158, 11, 0.38);
}

.score-circle {
  min-width: 92px;
  height: 92px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 23, 0.75);
  border: 3px solid var(--color-primary);
  padding: 8px;
}

.result-banner.passed .score-circle {
  border-color: var(--color-success);
}

.result-banner.failed .score-circle {
  border-color: var(--color-warning);
}

.score-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-contrast);
}

.score-caption {
  font-size: 11px;
  color: var(--text-secondary);
}

.stats-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.stat-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.stat-chip.equal {
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.5);
}

.stat-chip.replace {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.5);
}

.stat-chip.delete {
  color: #fda4af;
  border-color: rgba(251, 113, 133, 0.5);
}

.stat-chip.insert {
  color: #bae6fd;
  border-color: rgba(56, 189, 248, 0.5);
}

/* Diff Tokens Container */
.diff-tokens-box {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.diff-tokens-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 4px;
  line-height: 1.4;
}

.diff-word {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0 4px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
}

.diff-word.equal {
  color: #6ee7b7;
  background: transparent;
  border: none;
  padding: 0;
}

.diff-word.replace {
  color: #fef3c7;
  background: rgba(245, 158, 11, 0.24);
  border: 1px solid rgba(251, 191, 36, 0.52);
}

.diff-word.delete {
  color: #ffe4e6;
  background: rgba(244, 63, 94, 0.24);
  border: 1px dashed rgba(251, 113, 133, 0.62);
}

.diff-word.insert {
  color: #e0f2fe;
  background: rgba(56, 189, 248, 0.24);
  border: 1px solid rgba(125, 211, 252, 0.52);
  text-decoration: line-through;
}

.diff-wrong-strike {
  text-decoration: line-through;
  color: #fda4af;
  opacity: 0.9;
  font-size: 12.5px;
}

.result-actions-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.result-actions-primary {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.result-actions-primary .btn {
  min-width: 180px;
}

.result-actions-secondary {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

/* History Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.64);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-panel {
  background: rgba(19, 25, 38, 0.96);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 720px;
  max-height: 82vh;
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.records-scroll {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.record-row {
  background: rgba(10, 14, 23, 0.65);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

@keyframes pulseRec {
  from {
    transform: scale(0.9);
    opacity: 0.65;
  }

  to {
    transform: scale(1.2);
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .bilingual-grid {
    grid-template-columns: 1fr;
  }

  .studio-card {
    padding: 20px 18px 24px;
  }
}

@media (max-width: 768px) {
  .studio-main {
    padding: 16px 12px;
  }

  .studio-toolbar {
    gap: 0;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
  }

  .category-picker-wrap {
    width: 114px;
    min-width: 104px;
    flex-shrink: 0;
  }

  .category-trigger {
    padding: 9px 10px 9px 12px;
    gap: 5px;
  }

  .category-trigger-label {
    font-size: 13px;
  }

  .passage-picker-wrap {
    min-width: 0;
    max-width: none;
    flex: 1;
  }

  .passage-trigger {
    padding: 9px 12px 9px 10px;
    gap: 8px;
  }

  .passage-order-pill {
    font-size: 11px;
    padding: 2px 7px;
  }

  .passage-trigger-title {
    font-size: 13px;
  }

  .stage-stepper {
    justify-content: center;
  }

  .chinese-panel {
    padding: 16px 18px;
  }

  .chinese-panel.mobile-collapsed {
    padding: 13px 18px;
    gap: 0;
  }

  .chinese-panel.mobile-collapsed .chinese-text-body {
    display: none;
  }

  .chinese-panel-header {
    cursor: pointer;
    user-select: none;
  }

  .chinese-collapse-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 3px 10px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
  }

  .chinese-collapse-icon {
    font-size: 11px;
    transition: transform 0.22s ease;
  }

  .chinese-panel:not(.mobile-collapsed) .chinese-collapse-icon {
    transform: rotate(180deg);
  }

  .audio-controls-section {
    padding: 14px 12px;
  }

  .player-buttons-row {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
  }

  .transport-group {
    justify-content: center;
    width: auto;
    gap: 8px;
    flex-shrink: 0;
  }

  .btn-circle-main {
    width: 46px;
    height: 46px;
    font-size: 17px;
  }

  .btn-circle-sub {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }

  #btn-start-recite {
    margin: 0;
    min-width: 0;
    padding: 10px 14px;
    font-size: 14px;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
  }
}