/**
 * RhyRhy English - Step 4 Review Player & Step Navigation Styles
 */

/* ==========================================================================
   Step Navigation Tabs (1, 2, 3, 4)
   ========================================================================== */
.lesson-step-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 6px;
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.lesson-step-tabs::-webkit-scrollbar {
  display: none;
}

.step-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .lesson-step-tabs {
    gap: 6px;
    margin-bottom: 20px;
  }

  .step-tab-btn {
    padding: 6px 10px;
    font-size: 0.82rem;
    gap: 5px;
  }

  .step-tab-btn .step-num {
    width: 20px;
    height: 20px;
    font-size: 0.74rem;
  }
}

.step-tab-btn:hover:not(:disabled):not(.deactivated):not(.active),
.step-tab-btn:focus-visible:not(:disabled):not(.deactivated):not(.active) {
  color: var(--text-main);
  background-color: var(--surface-color-alt);
}

.step-tab-btn:focus:not(:focus-visible) {
  outline: none;
}

.step-tab-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.step-tab-btn.deactivated,
.step-tab-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.6);
}

.step-tab-btn.deactivated:hover,
.step-tab-btn:disabled:hover {
  background: transparent;
  color: var(--text-muted);
}

.step-lock-icon {
  font-size: 0.76rem;
  opacity: 0.75;
  margin-left: 2px;
  line-height: 1;
}

.step-tab-btn.active,
.step-tab-btn.active:hover,
.step-tab-btn.active:focus,
.step-tab-btn.active:active {
  background: var(--primary) !important;
  color: #FFFFFF !important;
  border-color: var(--primary-light) !important;
  box-shadow: 0 2px 10px var(--primary-glow) !important;
}

.step-tab-btn .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.15);
  font-size: 0.78rem;
  font-weight: 800;
  transition: all 0.2s ease;
}

.step-tab-btn.active .step-num,
.step-tab-btn.active:hover .step-num,
.step-tab-btn.active:focus .step-num,
.step-tab-btn.active:active .step-num {
  background: #FFFFFF !important;
  color: var(--primary) !important;
}

/* Light mode explicit step navigation tabs styling */
[data-theme="light"] .lesson-step-tabs {
  background-color: var(--surface-color);
  border-color: var(--surface-border);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

[data-theme="light"] .step-tab-btn:not(.active) {
  color: var(--text-muted);
}

[data-theme="light"] .step-tab-btn:not(.active) .step-num {
  background: rgba(15, 23, 42, 0.08);
  color: var(--text-muted);
}

[data-theme="light"] .step-tab-btn:hover:not(:disabled):not(.deactivated):not(.active),
[data-theme="light"] .step-tab-btn:focus-visible:not(:disabled):not(.deactivated):not(.active) {
  color: var(--text-main);
  background-color: var(--surface-color-alt);
}

[data-theme="light"] .step-tab-btn:hover:not(:disabled):not(.deactivated):not(.active) .step-num,
[data-theme="light"] .step-tab-btn:focus-visible:not(:disabled):not(.deactivated):not(.active) .step-num {
  background: rgba(15, 23, 42, 0.14);
  color: var(--text-main);
}

[data-theme="light"] .step-tab-btn.active,
[data-theme="light"] .step-tab-btn.active:hover,
[data-theme="light"] .step-tab-btn.active:focus,
[data-theme="light"] .step-tab-btn.active:active {
  background: var(--primary) !important;
  color: #FFFFFF !important;
  border-color: var(--primary-light) !important;
  box-shadow: 0 2px 12px var(--primary-glow) !important;
}

[data-theme="light"] .step-tab-btn.active .step-num,
[data-theme="light"] .step-tab-btn.active:hover .step-num,
[data-theme="light"] .step-tab-btn.active:focus .step-num,
[data-theme="light"] .step-tab-btn.active:active .step-num {
  background: #FFFFFF !important;
  color: var(--primary) !important;
}

/* ==========================================================================
   Step 4: Review Section & Music Player Bar
   ========================================================================== */
.review-section-wrapper {
  margin-top: 24px;
  margin-bottom: 48px;
}

/* Music Player Bar (Like a Music App) */
.review-player-bar {
  position: sticky;
  top: calc(var(--nav-height) + 12px);
  z-index: 40;
  background: var(--nav-bg, rgba(15, 23, 42, 0.92));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.25s ease;
}

[data-theme="light"] .review-player-bar {
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.review-player-bar.is-playing {
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 12px 36px var(--primary-glow);
}

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

/* Track Info */
.player-track-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

/* Sound Wave Equalizer */
.sound-wave-box {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  width: 24px;
  height: 24px;
  padding: 2px;
  flex-shrink: 0;
}

.sound-wave-box .wave-bar {
  width: 4px;
  height: 6px;
  background-color: var(--text-subtle);
  border-radius: 2px;
  transition: height 0.2s ease, background-color 0.2s ease;
}

.review-player-bar.is-playing .sound-wave-box .wave-bar {
  background: linear-gradient(180deg, var(--accent-emerald), var(--primary-light));
  animation: soundWaveAnim 1s ease-in-out infinite alternate;
}

.review-player-bar.is-playing .sound-wave-box .wave-bar:nth-child(1) {
  animation-delay: 0.1s;
}

.review-player-bar.is-playing .sound-wave-box .wave-bar:nth-child(2) {
  animation-delay: 0.3s;
}

.review-player-bar.is-playing .sound-wave-box .wave-bar:nth-child(3) {
  animation-delay: 0.2s;
}

.review-player-bar.is-playing .sound-wave-box .wave-bar:nth-child(4) {
  animation-delay: 0.4s;
}

@keyframes soundWaveAnim {
  0% {
    height: 4px;
  }

  100% {
    height: 22px;
  }
}

.player-text-details {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.player-track-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.player-track-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

/* Central Controls */
.player-controls-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-player-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-full);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-player-step:hover {
  background: var(--surface-color-alt);
  color: var(--text-main);
  transform: scale(1.05);
}

.btn-player-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary) 0%, #4F46E5 100%);
  border: none;
  border-radius: var(--radius-full);
  color: #FFFFFF;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--primary-glow);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-player-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px var(--primary-glow);
}

/* Secondary Options */
.player-controls-side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0 !important;
}

.btn-play-all-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  background: var(--surface-color-alt);
  border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

.btn-play-all-toggle .playall-text {
  white-space: nowrap !important;
}

.btn-play-all-toggle:hover {
  background: var(--surface-color);
  color: var(--text-main);
  border-color: var(--surface-border-hover);
}

.btn-play-all-toggle.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22) 0%, rgba(5, 150, 105, 0.3) 100%);
  color: #34D399;
  border-color: #10B981;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.35);
}

[data-theme="light"] .btn-play-all-toggle.active {
  background: rgba(16, 185, 129, 0.12);
  color: #065F46;
  border-color: #059669;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.15);
}

.btn-play-all-toggle.active:hover {
  background: #10B981;
  color: #FFFFFF;
  border-color: #10B981;
}

.btn-speed-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 10px;
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-speed-toggle:hover {
  color: var(--text-main);
  background: var(--surface-color-alt);
}

/* Scrubber / Progress Bar */
.player-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.player-time-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}

.player-progress-track {
  position: relative;
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  cursor: pointer;
}

.player-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent-emerald));
  border-radius: var(--radius-full);
  transition: width 0.1s linear;
}

/* ==========================================================================
   Sentence Cards List
   ========================================================================== */
.review-sentence-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quiz-sentence-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background-color: var(--surface-color);
  border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.22s ease;
}

.quiz-sentence-card:hover {
  border-color: var(--surface-border-hover);
  background-color: rgba(30, 41, 59, 0.8);
}

[data-theme="light"] .quiz-sentence-card:hover {
  background-color: #F8FAFC;
  border-color: var(--surface-border-hover);
}

.quiz-sentence-card.playing {
  border-color: var(--primary);
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.14) 0%, rgba(30, 41, 59, 0.9) 100%);
  box-shadow: 0 0 20px var(--primary-glow);
}

[data-theme="light"] .quiz-sentence-card.playing {
  border-color: var(--primary);
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.08) 0%, #FFFFFF 100%);
  box-shadow: 0 4px 18px rgba(79, 70, 229, 0.12);
}

.quiz-sentence-card.playing::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  background: linear-gradient(180deg, var(--accent-emerald), var(--primary-light));
  border-radius: 0 4px 4px 0;
}

/* Speaker Avatar Column (Conversational UI) */
.sentence-speaker-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  width: 52px;
  padding-top: 2px;
}

.sentence-speaker-avatar-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.sentence-speaker-avatar {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
  display: block;
  border: 2px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  background: var(--surface-color-alt);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease, box-shadow 0.25s ease;
}

.speaker-online-dot {
  position: absolute;
  bottom: 0px;
  right: 1px;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: #10B981;
  border: 2px solid var(--surface-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.sentence-speaker-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-subtle);
  letter-spacing: 0.3px;
  text-align: center;
  white-space: nowrap;
  transition: color 0.2s ease;
}

/* Speaker Active Playback States */
.quiz-sentence-card.playing .sentence-speaker-avatar {
  border-color: #34D399;
  transform: scale(1.06);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
}

.quiz-sentence-card.playing .sentence-speaker-name {
  color: #34D399;
  font-weight: 800;
}

[data-theme="light"] .quiz-sentence-card.playing .sentence-speaker-avatar {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 14px rgba(5, 150, 105, 0.35), 0 2px 8px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .quiz-sentence-card.playing .sentence-speaker-name {
  color: var(--accent-emerald);
}

.quiz-sentence-card.playing .speaker-online-dot {
  background: #34D399;
  animation: speakerPulse 1.5s infinite cubic-bezier(0.25, 1, 0.5, 1);
}

[data-theme="light"] .quiz-sentence-card.playing .speaker-online-dot {
  background: var(--accent-emerald);
}

@keyframes speakerPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.85);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.sentence-card-content {
  flex: 1;
  min-width: 0;
}

.sentence-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.sentence-index-pill {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-subtle);
  background: var(--surface-color-alt);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.sentence-keyword-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* Highlighted English Expression */
.sentence-en-text {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.5;
  margin-bottom: 6px;
}

.quiz-vocab-highlight {
  background: rgba(99, 102, 241, 0.28);
  color: #A5B4FC;
  border: 1px solid rgba(99, 102, 241, 0.55);
  border-radius: 4px;
  padding: 1px 6px;
  font-weight: 800;
}

[data-theme="light"] .quiz-vocab-highlight {
  color: #4338CA;
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.35);
}

.sentence-kr-text {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 6px;
}

.sentence-explanation-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
  background: var(--surface-color-alt);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-top: 6px;
}

/* Card Actions */
.sentence-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-top: 4px;
}

.sentence-card-actions .btn-card-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  background: rgba(99, 102, 241, 0.12);
  border: 1.5px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-md);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sentence-card-actions .btn-card-play:hover {
  background: rgba(99, 102, 241, 0.28);
  border-color: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.quiz-sentence-card.playing .sentence-card-actions .btn-card-play {
  background: var(--primary);
  border-color: var(--primary-light);
  color: #FFFFFF;
}

.btn-card-bookmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--surface-color);
  border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-md);
  color: var(--text-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-card-bookmark:hover {
  color: var(--accent-amber);
  border-color: var(--accent-amber);
}

.btn-card-bookmark.saved {
  color: var(--accent-amber);
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.12);
}

/* Mobile Responsive: Super Simple, Single-Row Audio Player */
@media (max-width: 768px) {
  .review-player-bar {
    top: calc(var(--nav-height) + 6px);
    padding: 8px 16px;
    border-radius: var(--radius-lg);
    gap: 0;
    margin-bottom: 20px;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
  }

  .player-bar-top {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
    width: 100%;
  }

  /* Left: Show simple 01/21 sentence indicator on mobile */
  .player-track-info {
    display: flex !important;
    flex: 0 0 auto;
    align-items: center;
    gap: 0;
  }

  .sound-wave-box,
  .player-track-title {
    display: none !important;
  }

  .player-track-badge {
    font-size: 0.82rem;
    font-weight: 800;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: #A5B4FC;
    background: rgba(99, 102, 241, 0.16);
    border: 1px solid rgba(99, 102, 241, 0.35);
    padding: 4px 8px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    letter-spacing: 0.5px;
  }

  /* Center: Previous, Play/Pause (current), Next */
  .player-controls-main {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .btn-player-step {
    width: 38px;
    height: 38px;
  }

  .btn-player-toggle {
    width: 44px;
    height: 44px;
  }

  /* Right: "전체" Button and Speed Toggle */
  .player-controls-side {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0 !important;
  }

  .btn-speed-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 9px;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    background: var(--surface-color);
    border: 1px solid var(--surface-border);
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    transition: all 0.2s ease;
  }

  .btn-speed-toggle:hover,
  .btn-speed-toggle:active {
    color: var(--text-main);
    background: var(--surface-color-alt);
    border-color: rgba(99, 102, 241, 0.4);
  }

  /* Right: "전체" Button (Icon-only on mobile to save space) and Speed Toggle */
  #btn-player-playall {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    gap: 0;
    flex-shrink: 0 !important;
  }

  #btn-player-playall svg {
    width: 18px;
    height: 18px;
  }

  #btn-player-playall .playall-text {
    display: none !important;
  }

  @media (max-width: 400px) {
    .player-controls-side {
      gap: 4px;
    }

    #btn-player-playall {
      width: 34px;
      height: 34px;
    }

    #btn-player-playall svg {
      width: 17px;
      height: 17px;
    }

    .btn-speed-toggle {
      height: 34px;
      padding: 0 7px;
      font-size: 0.76rem;
    }
  }

  /* Hide progress scrubber on mobile */
  .player-progress-row {
    display: none !important;
  }

  /* Sentence Cards: Conversational Avatar Grid */
  .quiz-sentence-card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 10px 12px;
    padding: 14px 14px;
    scroll-margin-top: 140px;
  }

  .sentence-speaker-col {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    width: 42px;
    gap: 3px;
    padding-top: 2px;
  }

  .sentence-speaker-avatar-wrap {
    width: 40px;
    height: 40px;
  }

  .speaker-online-dot {
    width: 10px;
    height: 10px;
  }

  .sentence-speaker-name {
    font-size: 0.68rem;
  }

  .sentence-card-content {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
  }

  /* Hide keyword badge on mobile screen for cleaner compact layout */
  .sentence-keyword-badge {
    display: none !important;
  }

  .sentence-card-actions {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
    width: 100%;
    display: flex;
    justify-content: flex-end;
    margin-top: 2px;
  }

  .sentence-card-actions .btn-card-play {
    flex: 1;
  }
}

/* ==========================================================================
   Lesson Finish Card (Step 4 Completion)
   ========================================================================== */

.lesson-finish-card {
  margin-top: 36px;
  margin-bottom: 24px;
  padding: 32px 24px 28px;
  text-align: center;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
}

[data-theme="light"] .lesson-finish-card {
  background: #FFFFFF;
  border-color: rgba(226, 232, 240, 0.9);
  box-shadow: 0 10px 30px -8px rgba(15, 23, 42, 0.08);
}

.finish-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 14px;
}

[data-theme="light"] .finish-card-badge {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.finish-card-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 10px;
}

.finish-card-desc {
  font-size: 0.94rem;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.6;
  margin: 0 0 24px;
}

.finish-card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-finish-complete {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 0.98rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.35);
  transition: all 0.25s ease;
}

.btn-finish-complete:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(16, 185, 129, 0.45);
}

.btn-finish-catalog {
  display: inline-flex;
  align-items: center;
  padding: 13px 22px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--surface-hover);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-finish-catalog:hover {
  background: var(--surface-color);
  border-color: var(--accent-indigo);
  color: var(--accent-indigo);
}

/* ==========================================================================
   Step 2 (Key Sentences) Completion Card -> Next Step (Step 3: Interactive Video)
   ========================================================================== */

.step-completion-card {
  margin-top: 36px;
  margin-bottom: 24px;
  padding: 32px 24px 28px;
  text-align: center;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
}

[data-theme="light"] .step-completion-card {
  background: #FFFFFF;
  border-color: rgba(226, 232, 240, 0.9);
  box-shadow: 0 10px 30px -8px rgba(15, 23, 42, 0.08);
}

.step-complete-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary-light);
  border: 1px solid rgba(99, 102, 241, 0.3);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 14px;
}

[data-theme="light"] .step-complete-badge {
  background: rgba(99, 102, 241, 0.1);
  color: #4338CA;
}

.step-complete-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 10px;
}

.step-complete-desc {
  font-size: 0.94rem;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.6;
  margin: 0 0 24px;
}

.step-complete-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-goto-step3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 0.98rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.35);
  transition: all 0.25s ease;
}

.btn-goto-step3:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.45);
}

.btn-goto-step3.deactivated,
.btn-goto-step3:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  background: var(--surface-card, #334155) !important;
  color: var(--text-muted, #94A3B8) !important;
  box-shadow: none !important;
  transform: none !important;
  border: 1px solid var(--border-color, rgba(148, 163, 184, 0.2)) !important;
}

[data-theme="light"] .btn-goto-step3.deactivated,
[data-theme="light"] .btn-goto-step3:disabled {
  background: #E2E8F0 !important;
  color: #64748B !important;
  border-color: #CBD5E1 !important;
}

.btn-goto-step3.deactivated svg,
.btn-goto-step3:disabled svg {
  display: none;
}

/* Deep Dive next step button */
.btn-goto-deep-dive {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%) !important;
  color: #FFFFFF !important;
  font-weight: 700;
  font-size: 0.98rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.35) !important;
  transition: all 0.25s ease;
}

.btn-goto-deep-dive:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(245, 158, 11, 0.5) !important;
}

/* ==========================================================================
   Step 2.5: Deep Dive (심화 학습) Section Styles
   ========================================================================== */
.step-tab-btn .step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
}

.deep-dive-section-wrapper {
  width: 100%;
  margin: 0 auto 40px;
  animation: fadeIn 0.3s ease-out;
}

.deep-dive-card {
  background-color: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .deep-dive-card {
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.06);
}

.deep-dive-header {
  margin-bottom: 28px;
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 20px;
}

.deep-dive-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.badge-peanut {
  background: rgba(245, 158, 11, 0.18);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.45);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 0;
  white-space: nowrap;
}

[data-theme="light"] .badge-peanut {
  background: rgba(217, 119, 6, 0.12);
  color: #B45309;
  border-color: rgba(217, 119, 6, 0.35);
}

.btn-deep-dive-share {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  background: var(--surface-color-alt);
  border: 1px solid var(--surface-border);
  border-radius: 9999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-deep-dive-share:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-deep-dive-share.copied {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}

[data-theme="light"] .btn-deep-dive-share {
  background: #FFFFFF;
  border-color: rgba(15, 23, 42, 0.15);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .btn-deep-dive-share:hover {
  background: #EEF2FF;
  border-color: var(--primary);
  color: var(--primary);
}

/* Deep Dive Share Nudge Card */
.deep-dive-share-nudge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.08) 0%, rgba(245, 158, 11, 0.07) 100%);
  border: 1px dashed rgba(244, 63, 94, 0.35);
  border-radius: 14px;
  margin: 28px 0 24px;
}

[data-theme="light"] .deep-dive-share-nudge {
  background: linear-gradient(135deg, #FFF1F2 0%, #FFFBEB 100%);
  border: 1px dashed #FDA4AF;
  box-shadow: 0 2px 10px rgba(244, 63, 94, 0.06);
}

.share-nudge-body {
  display: flex;
  align-items: center;
  gap: 12px;
}

.share-nudge-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  line-height: 1;
}

.share-nudge-headline {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 3px;
}

.share-nudge-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.btn-share-nudge,
#btn-deep-dive-share-nudge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 0.86rem;
  font-weight: 700;
  color: #FFFFFF !important;
  background: linear-gradient(135deg, #F43F5E 0%, #E11D48 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
  box-shadow: 0 3px 12px rgba(244, 63, 94, 0.38);
}

.btn-share-nudge:hover,
#btn-deep-dive-share-nudge:hover {
  background: linear-gradient(135deg, #FB7185 0%, #F43F5E 100%);
  box-shadow: 0 5px 16px rgba(244, 63, 94, 0.48);
  transform: translateY(-1px);
}

.btn-share-nudge.copied,
#btn-deep-dive-share-nudge.copied {
  background: #10B981 !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

[data-theme="light"] .btn-share-nudge,
[data-theme="light"] #btn-deep-dive-share-nudge {
  background: linear-gradient(135deg, #E11D48 0%, #BE123C 100%);
  color: #FFFFFF !important;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.32);
}

[data-theme="light"] .btn-share-nudge:hover,
[data-theme="light"] #btn-deep-dive-share-nudge:hover {
  background: linear-gradient(135deg, #BE123C 0%, #9F1239 100%);
  box-shadow: 0 6px 18px rgba(225, 29, 72, 0.42);
}

[data-theme="light"] .btn-share-nudge.copied,
[data-theme="light"] #btn-deep-dive-share-nudge.copied {
  background: #059669 !important;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

@media (max-width: 640px) {
  .deep-dive-share-nudge {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
  }
  .btn-share-nudge {
    justify-content: center;
    width: 100%;
  }
}

.deep-dive-heading {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.35;
  margin: 0 0 6px;
  letter-spacing: -0.015em;
}

.deep-dive-subheading {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
  font-weight: 500;
}

.deep-dive-block {
  margin-bottom: 30px;
}

.deep-dive-block-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
}

.deep-dive-scene-box {
  background: var(--surface-color-alt);
  border: 1px solid var(--surface-border);
  border-left: 4px solid #F59E0B;
  border-radius: var(--radius-lg);
  padding: 20px;
}

.deep-dive-scene-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.deep-dive-time-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

[data-theme="light"] .deep-dive-time-badge {
  background: rgba(217, 119, 6, 0.12);
  color: #B45309;
}

.deep-dive-dialogue {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.dialogue-bubble {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.dialogue-speaker {
  font-size: 0.76rem;
  font-weight: 700;
  color: #818CF8;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

[data-theme="light"] .dialogue-speaker {
  color: #4F46E5;
}

.dialogue-en {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.45;
}

.dialogue-kr {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.deep-dive-scene-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
  padding-top: 10px;
  border-top: 1px dashed var(--surface-border);
}

.deep-dive-breakdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .deep-dive-breakdown-grid {
    grid-template-columns: 1fr;
  }
}

.breakdown-section-header {
  margin: 22px 0 10px;
}

.breakdown-section-header:first-of-type {
  margin-top: 6px;
}

.breakdown-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 4px;
}

.breakdown-section-subtitle {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.breakdown-card {
  background: var(--surface-color-alt);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.breakdown-card.highlight {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.05);
}

[data-theme="light"] .breakdown-card.highlight {
  border-color: rgba(217, 119, 6, 0.35);
  background: rgba(217, 119, 6, 0.04);
}

.breakdown-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.breakdown-pattern {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 1.06rem;
  font-weight: 700;
  color: var(--text-main);
  min-width: 0;
  word-break: break-word;
}

.breakdown-tense-badge {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  font-size: 0.74rem;
  padding: 3px 8px;
  line-height: 1.2;
}

.breakdown-meaning {
  font-size: 0.9rem;
  font-weight: 700;
  color: #F59E0B;
}

[data-theme="light"] .breakdown-meaning {
  color: #B45309;
}

.breakdown-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.deep-dive-takeaway {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(234, 88, 12, 0.08) 100%);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-size: 0.94rem;
  color: var(--text-main);
  line-height: 1.6;
}

.deep-dive-example-card {
  background: var(--surface-color-alt);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  transition: all 0.2s ease;
}

.deep-dive-example-card:hover {
  border-color: rgba(245, 158, 11, 0.4);
}

.example-content {
  flex: 1;
}

.example-en {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.45;
  margin: 0 0 4px;
}

.example-en mark {
  background: rgba(245, 158, 11, 0.25);
  color: inherit;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

[data-theme="light"] .example-en mark {
  background: rgba(217, 119, 6, 0.18);
  color: #B45309;
}

.example-kr {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 6px;
}

.example-situation {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
}

[data-theme="light"] .example-situation {
  background: rgba(15, 23, 42, 0.06);
}

.deep-dive-bottom-card {
  margin-top: 32px;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--surface-color-alt);
  border: 1px solid var(--surface-border);
  text-align: center;
}

.deep-dive-bottom-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* Mobile Responsive Optimization for Deep Dive */
@media (max-width: 480px) {
  .deep-dive-scene-box {
    padding: 16px 14px;
  }

  .breakdown-card {
    padding: 16px 14px;
  }

  .breakdown-pattern {
    font-size: 0.94rem;
  }
}

@media (max-width: 380px) {
  .deep-dive-scene-box {
    padding: 14px 12px;
  }

  .breakdown-card {
    padding: 14px 12px;
  }

  .breakdown-pattern {
    font-size: 0.86rem;
  }

  .breakdown-tense-badge {
    font-size: 0.70rem;
    padding: 2px 6px;
  }

  .deep-dive-time-badge {
    font-size: 0.72rem;
    padding: 2px 6px;
  }
}

/* ==========================================================================
   Desktop / Bigger Screen Typography Enhancement (Step 2: Key Sentences & Deep Dive)
   Optimized for senior readability and larger monitors (>= 769px)
   ========================================================================== */
@media (min-width: 769px) {
  /* Navigation Tabs */
  .step-tab-btn {
    font-size: 0.95rem;
    padding: 9px 18px;
    gap: 8px;
  }

  /* Step 2: Key Sentences */
  .sentence-en-text {
    font-size: 1.28rem;
    line-height: 1.55;
  }

  .sentence-kr-text {
    font-size: 1.06rem;
    line-height: 1.55;
  }

  .sentence-explanation-text {
    font-size: 0.96rem;
    line-height: 1.55;
    padding: 8px 12px;
  }

  .sentence-speaker-name {
    font-size: 0.92rem;
  }

  /* Deep Dive: 심화 학습 */
  .deep-dive-heading {
    font-size: 1.75rem;
    line-height: 1.4;
  }

  .deep-dive-subheading {
    font-size: 1.08rem;
  }

  .deep-dive-block-title {
    font-size: 1.25rem;
  }

  .dialogue-en {
    font-size: 1.15rem;
    line-height: 1.55;
  }

  .dialogue-kr {
    font-size: 1.02rem;
    line-height: 1.55;
  }

  .deep-dive-scene-desc {
    font-size: 1.04rem;
    line-height: 1.65;
  }

  .breakdown-expr {
    font-size: 1.25rem;
  }

  .breakdown-core-kr {
    font-size: 1.15rem;
  }

  .breakdown-desc {
    font-size: 1.02rem;
    line-height: 1.65;
  }

  .breakdown-example {
    font-size: 1.02rem;
    line-height: 1.6;
  }

  .deep-dive-takeaway {
    font-size: 1.05rem;
    line-height: 1.7;
    padding: 20px 24px;
  }

  .takeaway-rule-title {
    font-size: 1.15rem;
  }

  .takeaway-rule-desc {
    font-size: 1.02rem;
    line-height: 1.6;
  }

  .example-en {
    font-size: 1.15rem;
  }

  .example-kr {
    font-size: 1.02rem;
  }

  .example-desc {
    font-size: 0.95rem;
  }

  .share-nudge-headline {
    font-size: 1.08rem;
  }

  .share-nudge-sub {
    font-size: 0.94rem;
  }

  .btn-share-nudge,
  #btn-deep-dive-share-nudge {
    font-size: 0.95rem;
    padding: 10px 22px;
  }
}