/* KouLi Speech Mode Results - Mobile-First AI Coach UX */
/* Palette: Main1 #A156F7, Main2 #4BA2A2, Accent #D8686A */

:root {
  --kouli-main1: #A156F7;
  --kouli-main2: #4BA2A2;
  --kouli-accent: #D8686A;
}

/* Results container - vertical rhythm */
.ted-results-redesign {
  padding: 0 16px 24px;
  max-width: 480px;
  margin: 0 auto;
}

.ted-results-redesign .ted-section {
  margin-bottom: 20px;
}

/* Score hero - circular progress ring */
.ted-score-hero {
  background: linear-gradient(135deg, rgba(161, 86, 247, 0.08) 0%, rgba(75, 162, 162, 0.08) 100%);
  border-radius: 20px;
  padding: 24px 20px;
  box-shadow: 0 4px 20px rgba(161, 86, 247, 0.08);
  text-align: center;
}

.ted-score-ring-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 16px;
}

.ted-score-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(
    var(--kouli-main1) calc(var(--score-pct, 0) * 1%),
    rgba(161, 86, 247, 0.15) calc(var(--score-pct, 0) * 1%)
  );
  animation: ted-ring-appear 0.8s ease-out forwards;
  transform: rotate(-90deg); /* Start from top */
}

.ted-score-ring-inner {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  bottom: 8px;
  background: var(--background, #fff);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.ted-score-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--kouli-main1);
  line-height: 1.1;
}

.ted-level-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 2px;
}

.ted-trend-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.ted-trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.ted-trend-up {
  background: rgba(75, 162, 162, 0.15);
  color: var(--kouli-main2);
}

.ted-trend-down {
  background: rgba(216, 104, 106, 0.15);
  color: var(--kouli-accent);
}

.ted-trend-same {
  background: var(--muted);
  color: var(--muted-foreground);
}

.ted-sparkline-wrap {
  margin-top: 12px;
  height: 32px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}

.ted-sparkline-bar {
  width: 8px;
  min-height: 4px;
  border-radius: 4px 4px 0 0;
  background: rgba(161, 86, 247, 0.35);
  transition: height 0.3s ease;
}

.ted-sparkline-bar.active {
  background: var(--kouli-main1);
}

/* Coach cards - Focus Next & Your Strength */
.ted-coach-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ted-coach-card {
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow: 0 2px 12px rgba(29, 53, 87, 0.06);
  border: 1px solid var(--border);
}

.ted-coach-card.focus {
  border-left: 4px solid var(--kouli-accent);
  background: linear-gradient(135deg, rgba(216, 104, 106, 0.05) 0%, transparent 100%);
}

.ted-coach-card.strength {
  border-left: 4px solid var(--kouli-main2);
  background: linear-gradient(135deg, rgba(75, 162, 162, 0.05) 0%, transparent 100%);
}

.ted-coach-card-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  margin-bottom: 6px;
}

.ted-coach-card.focus .ted-coach-card-label {
  color: var(--kouli-accent);
}

.ted-coach-card.strength .ted-coach-card-label {
  color: var(--kouli-main2);
}

.ted-coach-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 4px;
}

.ted-coach-card-tip {
  font-size: 0.85rem;
  color: var(--muted-foreground);
  line-height: 1.4;
}

.ted-breakdown-cta {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px 20px;
  background: var(--kouli-main1);
  color: white;
  border: none;
  border-radius: 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.ted-breakdown-cta:hover {
  background: #8b45e6;
}

.ted-breakdown-cta:active {
  transform: scale(0.98);
}

/* Practice Again CTA - mobile-first 375px */
.ted-practice-again-wrap {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.ted-practice-again-cta {
  display: block;
  width: 100%;
  max-width: 343px;
  padding: 16px 24px;
  background: var(--kouli-main1, #A156F7);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(161, 86, 247, 0.25);
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

.ted-practice-again-cta:hover {
  background: #8b45e6;
  box-shadow: 0 6px 20px rgba(161, 86, 247, 0.35);
}

.ted-practice-again-cta:active {
  transform: scale(0.98);
}

.ted-change-duration-link {
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 0.9rem;
  color: var(--muted-foreground);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.ted-change-duration-link:hover {
  color: var(--kouli-main1, #A156F7);
}

/* Sticky bottom CTA bar (appears on scroll, above bottom nav and Speech Coach FAB) */
.ted-results-sticky-cta {
  position: fixed;
  bottom: 80px;
  left: 0;
  right: 0;
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  max-width: 480px;
  margin: 0 auto;
  background: var(--background, #fff);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
}

.ted-results-sticky-cta.visible {
  display: flex;
}

.ted-results-sticky-cta .ted-practice-again-cta {
  flex: 1;
  max-width: none;
  margin: 0;
  padding: 12px 16px;
  font-size: 0.95rem;
}

.ted-results-sticky-cta .ted-sticky-breakdown-btn,
.ted-results-sticky-cta .ted-breakdown-cta {
  flex: 1;
  margin: 0;
  padding: 12px 16px;
  font-size: 0.95rem;
  background: var(--muted);
  color: var(--foreground);
  border: 1px solid var(--border);
}

.ted-results-sticky-cta .ted-sticky-breakdown-btn:hover,
.ted-results-sticky-cta .ted-breakdown-cta:hover {
  background: rgba(161, 86, 247, 0.1);
  color: var(--kouli-main1);
}

/* Confidence accordion */
.ted-confidence-accordion {
  background: var(--card);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(29, 53, 87, 0.06);
  border: 1px solid var(--border);
}

.ted-confidence-accordion h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 12px;
}

.ted-accordion-item {
  border-radius: 16px;
  margin-bottom: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.ted-accordion-item:last-child {
  margin-bottom: 0;
}

.ted-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--muted);
  cursor: pointer;
  transition: background 0.2s;
}

.ted-accordion-header:hover {
  background: rgba(161, 86, 247, 0.06);
}

.ted-accordion-header.expanded {
  background: rgba(161, 86, 247, 0.08);
}

.ted-accordion-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--foreground);
}

.ted-accordion-score {
  font-weight: 700;
  font-size: 0.9rem;
  margin-right: 8px;
}

.ted-accordion-chevron {
  width: 20px;
  height: 20px;
  opacity: 0.6;
  transition: transform 0.2s;
}

.ted-accordion-item.expanded .ted-accordion-chevron {
  transform: rotate(180deg);
}

.ted-accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.ted-accordion-item.expanded .ted-accordion-body {
  max-height: 400px;
}

.ted-accordion-content {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--background);
}

.ted-accordion-bars {
  margin-bottom: 12px;
}

.ted-accordion-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.ted-accordion-bar-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  min-width: 70px;
}

.ted-accordion-bar-track {
  flex: 1;
  height: 6px;
  background: var(--muted);
  border-radius: 3px;
  overflow: hidden;
}

.ted-accordion-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.ted-accordion-tip {
  font-size: 0.85rem;
  color: var(--foreground);
  line-height: 1.5;
  padding: 10px 12px;
  background: rgba(161, 86, 247, 0.06);
  border-radius: 12px;
  margin-bottom: 12px;
  border-left: 3px solid var(--kouli-main1);
}

.ted-accordion-example {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  font-style: italic;
  padding: 8px 12px;
  background: var(--muted);
  border-radius: 10px;
}

/* Confidence modal: mobile scroll + narrower on small screens */
.ted-confidence-modal {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}
@media (max-width: 480px) {
  .ted-confidence-modal {
    max-width: calc(100vw - 24px) !important;
  }
}

/* Audio player redesign */
.ted-audio-player-redesign {
  background: var(--card);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(29, 53, 87, 0.06);
  border: 1px solid var(--border);
}

.ted-audio-timeline-markers {
  position: relative;
  height: 24px;
  margin-bottom: 8px;
}

.ted-audio-marker {
  position: absolute;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.15s;
  background: var(--kouli-main1);
}

.ted-audio-marker:hover {
  transform: scale(1.3);
}

.ted-audio-marker.weak-language {
  background: var(--kouli-accent);
}

.ted-audio-marker.high-authority {
  background: var(--kouli-main2);
}

.ted-audio-marker.filler-cluster {
  background: var(--kouli-accent);
  border: 2px solid rgba(216, 104, 106, 0.5);
}

.ted-audio-progress-slider {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--muted);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.ted-audio-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.ted-audio-time-display {
  font-size: 0.8rem;
  color: var(--muted-foreground);
}

@keyframes ted-ring-appear {
  from {
    opacity: 0.5;
    transform: rotate(-90deg) scale(0.9);
  }
  to {
    opacity: 1;
    transform: rotate(-90deg) scale(1);
  }
}

/* ========== Bottom section: growth roadmap (mobile-first 375px) ========== */
.ted-results-redesign #ted-analysis-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}

.ted-bottom-card {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 1px 8px rgba(29, 53, 87, 0.04);
  overflow: hidden;
}

.ted-collapsible-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 20px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
}

.ted-collapsible-btn:hover {
  background: rgba(161, 86, 247, 0.04);
}

.ted-collapsible-title {
  color: var(--kouli-main1, #A156F7);
}

.ted-collapsible-chevron {
  width: 20px;
  height: 20px;
  opacity: 0.6;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.ted-collapsible-panel {
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.ted-collapsible-btn[aria-expanded="false"] + .ted-collapsible-panel {
  max-height: 0;
}

.ted-collapsible-btn[aria-expanded="true"] + .ted-collapsible-panel {
  max-height: 600px;
}

.ted-collapsible-btn[aria-expanded="true"] .ted-collapsible-chevron {
  transform: rotate(180deg);
}

/* Your Core Theme — lighter weight */
.ted-core-theme-content {
  padding: 0 20px 20px;
}

.ted-theme-pill {
  display: inline-block;
  background: rgba(161, 86, 247, 0.1);
  color: var(--kouli-main1, #A156F7);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  margin: 0 8px 8px 0;
}

.ted-theme-empty {
  opacity: 0.7;
}

.ted-core-theme-sentence {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.45;
  margin: 12px 0 0;
}

/* Inspiration card */
.ted-inspiration-content {
  padding: 0 20px 20px;
}

.ted-inspiration-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--foreground);
  margin-bottom: 4px;
}

.ted-inspiration-meta {
  font-size: 0.85rem;
  color: var(--muted-foreground);
  margin-bottom: 8px;
}

.ted-inspiration-interpretation {
  font-size: 0.875rem;
  color: var(--foreground);
  line-height: 1.45;
  margin: 0 0 12px;
}

.ted-inspiration-cta {
  display: inline-block;
  font-size: 0.875rem;
  color: var(--kouli-main1, #A156F7);
  text-decoration: none;
  font-weight: 500;
}

.ted-inspiration-cta:hover {
  text-decoration: underline;
}

.ted-inspiration-empty {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin: 0;
}

/* Insights: 3 blocks with color coding */
.ted-insights-content {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ted-insights-block-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.ted-whats-working .ted-insights-block-label {
  color: var(--kouli-main2, #4BA2A2);
}

.ted-where-to-improve .ted-insights-block-label {
  color: var(--kouli-accent, #D8686A);
}

.ted-structural .ted-insights-block-label {
  color: var(--kouli-main1, #A156F7);
}

.ted-insights-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--foreground);
}

.ted-whats-working .ted-insights-list li {
  color: var(--kouli-main2, #4BA2A2);
}

.ted-where-to-improve .ted-insights-list li {
  color: var(--kouli-accent, #D8686A);
}

.ted-structural-text {
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--foreground);
  margin: 0;
}

/* Your Next Session Plan */
.ted-next-plan-content {
  padding: 0 20px 20px;
}

.ted-next-goals-list {
  margin: 0 0 16px;
  padding-left: 1.25rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--foreground);
}

.ted-practice-goals-cta {
  display: block;
  width: 100%;
  padding: 12px 20px;
  background: var(--kouli-main1, #A156F7);
  color: white;
  border: none;
  border-radius: 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.ted-practice-goals-cta:hover {
  background: #8b45e6;
}

.ted-practice-goals-cta:active {
  transform: scale(0.98);
}

/* ========== Pre-Session Screen (Speech Mode) ========== */
.ted-pre-session-layout {
  padding: 0 16px;
  max-width: 420px;
  margin: 0 auto;
}

.ted-pre-session-layout .compact-timer-section {
  margin-bottom: 1.5rem;
}

.ted-pre-session-layout .timer-display {
  font-size: 1.75rem;
  color: var(--kouli-main1, #A156F7);
}

.ted-start-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.ted-start-cta {
  width: 100%;
  max-width: 320px;
  padding: 16px 24px;
  background: var(--kouli-main1, #A156F7);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(161, 86, 247, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: ted-start-pulse 2.5s ease-in-out infinite;
}

.ted-start-cta:hover {
  background: #8b45e6;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(161, 86, 247, 0.4);
}

.ted-start-cta:active {
  transform: scale(0.98);
}

@keyframes ted-start-pulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(161, 86, 247, 0.35); }
  50% { box-shadow: 0 6px 24px rgba(161, 86, 247, 0.5); }
}

.ted-start-hint {
  font-size: 0.9rem;
  color: var(--muted-foreground);
  margin: 0;
  font-style: italic;
}

/* Stage Mode Toggle */
.ted-stage-mode-toggle-wrap {
  margin-bottom: 1rem;
}

.ted-stage-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.ted-stage-mode-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.ted-stage-mode-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--muted);
  border-radius: 12px;
  transition: background 0.25s ease;
}

.ted-stage-mode-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.25s ease;
}

.ted-stage-mode-toggle input:checked + .ted-stage-mode-slider {
  background: var(--kouli-main1);
}

.ted-stage-mode-toggle input:checked + .ted-stage-mode-slider::before {
  transform: translateX(20px);
}

.ted-stage-mode-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--foreground);
}

/* Pre-session cards */
.ted-pre-session-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 24px;
  max-width: 420px;
  margin: 0 auto;
}

.ted-session-ready-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(29, 53, 87, 0.04);
}

.ted-session-ready-focus {
  font-size: 0.9rem;
  color: var(--foreground);
  margin-bottom: 12px;
}

.ted-session-ready-note {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.45;
  margin: 0;
}

.ted-todays-focus-card {
  background: rgba(75, 162, 162, 0.06);
  border: 1px solid rgba(75, 162, 162, 0.2);
  border-radius: 20px;
  padding: 16px 20px;
}

.ted-todays-focus-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--kouli-main2, #4BA2A2);
  margin-bottom: 8px;
}

.ted-todays-focus-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--foreground);
}

/* ========== During Recording Screen - Full-Screen, Isolated (375px) ========== */
body.ted-recording-active {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

.ted-recording-immersive {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: var(--background, #fff);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  padding-top: 56px;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.ted-recording-exit-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--foreground);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.ted-recording-exit-btn:hover {
  background: var(--muted);
}

.ted-recording-exit-btn:active {
  transform: scale(0.95);
}

.ted-recording-immersive.stage-mode .ted-recording-exit-btn {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.ted-recording-immersive.stage-mode .ted-recording-exit-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.ted-recording-countdown {
  font-size: 5rem;
  font-weight: 700;
  color: var(--kouli-main1);
  text-align: center;
  animation: ted-countdown-pulse 1s ease-in-out infinite;
}

@keyframes ted-countdown-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.05); }
}

.ted-recording-active {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 335px;
  gap: 28px;
}

.ted-recording-timer-wrap {
  text-align: center;
}

.ted-recording-timer {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--kouli-main1);
  animation: ted-timer-pulse 2s ease-in-out infinite;
}

.ted-recording-timer.urgent {
  color: var(--kouli-accent);
  animation: ted-timer-pulse-urgent 1s ease-in-out infinite;
}

@keyframes ted-timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

@keyframes ted-timer-pulse-urgent {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
}

.ted-recording-waveform-wrap {
  width: 100%;
  border-radius: 20px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(161, 86, 247, 0.06) 0%, rgba(75, 162, 162, 0.04) 100%);
  box-shadow: 0 0 40px rgba(161, 86, 247, 0.15), inset 0 0 20px rgba(161, 86, 247, 0.05);
  border: 1px solid rgba(161, 86, 247, 0.12);
}

.ted-waveform-canvas {
  display: block;
  width: 100%;
  height: 120px;
  border-radius: 12px;
}

.ted-recording-controls {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.ted-recording-btn {
  padding: 10px 24px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--foreground);
  transition: background 0.2s, transform 0.1s;
}

.ted-recording-btn:hover {
  background: rgba(161, 86, 247, 0.08);
}

.ted-recording-btn:active {
  transform: scale(0.98);
}

.ted-recording-btn.ted-recording-end {
  background: var(--kouli-accent);
  color: white;
  border-color: var(--kouli-accent);
}

.ted-recording-btn.ted-recording-end:hover {
  background: #c2585a;
}

.ted-recording-processing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--muted-foreground);
  font-size: 1rem;
}

.ted-processing-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--kouli-main1);
  border-radius: 50%;
  animation: ted-spin 0.8s linear infinite;
}

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

/* ========== Stage Mode - Immersive Dark Experience ========== */
.ted-recording-immersive.stage-mode {
  background: linear-gradient(180deg, #1E1A2F 0%, #2C2254 100%);
  animation: ted-stage-fade-in 0.4s ease-out;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.ted-recording-immersive.stage-mode::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 55%, rgba(161, 86, 247, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

@keyframes ted-stage-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ted-recording-immersive.stage-mode .ted-recording-countdown {
  color: #fff;
  text-shadow: 0 0 24px rgba(161, 86, 247, 0.6);
}

.ted-recording-immersive.stage-mode .ted-recording-active {
  animation: ted-stage-fade-in 0.5s ease-out;
}

.ted-recording-immersive.stage-mode .ted-recording-timer-wrap {
  position: relative;
}

.ted-recording-immersive.stage-mode .ted-recording-timer {
  font-size: 4.25rem;
  color: #fff;
  text-shadow: 0 0 20px rgba(161, 86, 247, 0.5);
}

.ted-recording-immersive.stage-mode .ted-recording-timer.urgent {
  color: #ff8a8c;
  text-shadow: 0 0 20px rgba(216, 104, 106, 0.6);
}

.ted-recording-live-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--kouli-main1);
  margin-top: 8px;
  text-shadow: 0 0 12px rgba(161, 86, 247, 0.5);
  opacity: 0.9;
}

.ted-recording-immersive.stage-mode .ted-recording-waveform-wrap {
  position: relative;
  background: transparent;
  box-shadow: 0 0 60px rgba(161, 86, 247, 0.25), inset 0 0 30px rgba(161, 86, 247, 0.08);
  border: 1px solid rgba(161, 86, 247, 0.35);
  border-radius: 20px;
  padding: 24px;
}

.ted-recording-immersive.stage-mode .ted-recording-waveform-wrap::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: radial-gradient(ellipse 90% 70% at 50% 50%, rgba(161, 86, 247, 0.2) 0%, transparent 70%);
  border-radius: 22px;
  pointer-events: none;
}

.ted-recording-immersive.stage-mode .ted-recording-pause {
  display: none;
}

.ted-recording-immersive.stage-mode .ted-recording-controls {
  gap: 12px;
}

.ted-recording-immersive.stage-mode .ted-recording-btn.ted-recording-end {
  background: var(--kouli-main1);
  border-color: rgba(161, 86, 247, 0.5);
  box-shadow: 0 0 20px rgba(161, 86, 247, 0.3);
}

.ted-recording-immersive.stage-mode .ted-recording-btn.ted-recording-end:hover {
  background: #8b45e6;
  box-shadow: 0 0 28px rgba(161, 86, 247, 0.4);
}

.ted-recording-immersive.stage-mode.ted-recording-fade .ted-recording-waveform-wrap {
  opacity: 0;
  transition: opacity 0.5s ease-out;
  transform: translateZ(0);
}

.ted-recording-immersive.stage-mode .ted-recording-processing {
  color: rgba(255, 255, 255, 0.85);
  animation: ted-stage-fade-in 0.4s ease-out;
}

.ted-recording-immersive.stage-mode .ted-processing-spinner {
  border-color: rgba(161, 86, 247, 0.3);
  border-top-color: var(--kouli-main1);
}

.ted-processing-progress-wrap {
  width: 100%;
  max-width: 280px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 12px;
}

.ted-processing-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--kouli-main1), rgba(161, 86, 247, 0.8));
  border-radius: 2px;
  transition: width 0.25s ease-out;
  will-change: width;
  transform: translateZ(0);
}

/* ========== Exit Confirmation Modal ========== */
.ted-exit-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  -webkit-tap-highlight-color: transparent;
}

.ted-exit-modal {
  background: var(--background, #fff);
  border-radius: 20px;
  padding: 24px;
  max-width: 320px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.ted-exit-modal h3 {
  margin: 0 0 12px;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--foreground);
}

.ted-exit-modal-p {
  margin: 0 0 24px;
  font-size: 0.95rem;
  color: var(--muted-foreground);
  line-height: 1.5;
}

.ted-exit-modal-actions {
  display: flex;
  gap: 12px;
}

.ted-exit-modal-resume {
  flex: 1;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--muted);
  color: var(--foreground);
  border: 1px solid var(--border);
  transition: background 0.2s, transform 0.1s;
}

.ted-exit-modal-resume:hover {
  background: rgba(161, 86, 247, 0.08);
}

.ted-exit-modal-resume:active {
  transform: scale(0.98);
}

.ted-exit-modal-end {
  flex: 1;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--kouli-accent, #D8686A);
  color: white;
  border: none;
  transition: background 0.2s, transform 0.1s;
}

.ted-exit-modal-end:hover {
  background: #c2585a;
}

.ted-exit-modal-end:active {
  transform: scale(0.98);
}

