/**
 * RhyRhy English - Daily Popcorn English Phrase Feature Styles (Issue #44)
 */

/* ==========================================================================
   Navbar Popcorn Flying & Popping Animation (Issue #44)
   ========================================================================== */

.popcorn-flyer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.popcorn-flyer-backdrop.active {
  opacity: 1;
}

.popcorn-nav-flyer {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%) scale(1);
  will-change: transform, left, top, width, height;
  filter: drop-shadow(0 4px 14px rgba(245, 158, 11, 0.45));
  transition: left 0.38s cubic-bezier(0.2, 0.8, 0.25, 1),
              top 0.38s cubic-bezier(0.2, 0.8, 0.25, 1),
              width 0.38s cubic-bezier(0.2, 0.8, 0.25, 1),
              height 0.38s cubic-bezier(0.2, 0.8, 0.25, 1),
              transform 0.38s cubic-bezier(0.2, 0.8, 0.25, 1);
}

.popcorn-nav-flyer .popcorn-flyer-hd-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.popcorn-nav-flyer.flying-to-center {
  width: 140px;
  height: 140px;
  transform: translate(-50%, -50%) scale(1.35) rotate(-6deg);
  filter: drop-shadow(0 14px 40px rgba(245, 158, 11, 0.7));
}

.popcorn-nav-flyer.pop-burst {
  animation: flyer-pop 0.26s cubic-bezier(0.175, 0.885, 0.32, 1.4) forwards;
}

@keyframes flyer-pop {
  0% {
    width: 140px;
    height: 140px;
    transform: translate(-50%, -50%) scale(1.35) rotate(-6deg);
    opacity: 1;
  }
  40% {
    width: 140px;
    height: 140px;
    transform: translate(-50%, -50%) scale(1.8) rotate(8deg);
    opacity: 1;
  }
  100% {
    width: 140px;
    height: 140px;
    transform: translate(-50%, -50%) scale(2.4) rotate(14deg);
    opacity: 0;
  }
}

/* ==========================================================================
   Burst Particles (Realistic Popping Popcorn Pieces - Issue #47)
   ========================================================================== */

.popcorn-particle {
  position: fixed;
  pointer-events: none;
  z-index: 10000;
  width: 36px;
  height: 36px;
  user-select: none;
  animation: particle-burst 0.65s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.popcorn-particle .popcorn-particle-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.35));
}

@keyframes particle-burst {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.4) rotate(0deg);
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2) rotate(var(--rot));
  }
}

/* ==========================================================================
   Daily Phrase Modal Dialog
   ========================================================================== */

.daily-phrase-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--modal-overlay-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.daily-phrase-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.daily-phrase-card {
  width: 100%;
  max-width: 520px;
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.92) translateY(16px);
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.2);
  box-sizing: border-box;
}

.daily-phrase-overlay.open .daily-phrase-card {
  transform: scale(1) translateY(0);
}

/* Modal Header */
.daily-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--surface-border);
  background: rgba(245, 158, 11, 0.05);
}

.daily-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.daily-header-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #D97706;
  background: rgba(245, 158, 11, 0.15);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

[data-theme="dark"] .daily-header-tag {
  color: #FBBF24;
  background: rgba(245, 158, 11, 0.2);
}

.daily-header-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-daily-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-daily-close:hover {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-main);
}

/* Modal Body */
.daily-body {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: calc(85vh - 120px);
  overflow-y: auto;
}

/* Korean Meaning Box */
.daily-kr-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.daily-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
}

.daily-kr-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  word-break: keep-all;
}

/* English Sentence with Cloze Mask */
.daily-en-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.daily-en-sentence {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.6;
  background: var(--surface-color-alt);
  border: 1px solid var(--surface-border);
  padding: 16px;
  border-radius: var(--radius-md);
  position: relative;
  word-break: keep-all;
}

/* Interactive Cloze Mask */
.daily-mask {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 2px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  vertical-align: middle;
  margin: 0 3px;
  border: 1.5px dashed #F59E0B;
  background: rgba(245, 158, 11, 0.12);
  color: transparent;
  user-select: none;
}

.daily-mask::after {
  content: '??? (터치하여 확인)';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #D97706;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  pointer-events: none;
}

[data-theme="dark"] .daily-mask::after {
  color: #FBBF24;
}

.daily-mask:hover:not(.revealed) {
  background: rgba(245, 158, 11, 0.22);
  transform: scale(1.02);
}

/* Revealed State */
.daily-mask.revealed {
  background: rgba(245, 158, 11, 0.22);
  border-style: solid;
  border-color: #F59E0B;
  color: #D97706;
  animation: phrase-reveal-pop 0.38s cubic-bezier(0.175, 0.885, 0.32, 1.25);
}

[data-theme="dark"] .daily-mask.revealed {
  color: #FDE68A;
  background: rgba(245, 158, 11, 0.3);
}

.daily-mask.revealed::after {
  display: none;
}

@keyframes phrase-reveal-pop {
  0% {
    transform: scale(0.9);
  }
  50% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

/* Audio Player Row */
.daily-audio-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface-color-alt);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  gap: 12px;
}

.daily-audio-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.btn-daily-play {
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-daily-play:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-daily-play:active {
  transform: scale(0.96);
}

.btn-daily-play.playing {
  background: #10B981;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

/* Explanation Box (Hidden until revealed) */
.daily-explanation-box {
  display: none;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-main);
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.daily-explanation-box.show {
  display: block;
}

.daily-explanation-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #D97706;
  margin-bottom: 6px;
}

[data-theme="dark"] .daily-explanation-title {
  color: #FBBF24;
}

/* Action Buttons Footer */
.daily-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--surface-border);
  background: var(--surface-color);
}

.daily-actions-main-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-daily-reveal {
  flex: 1;
  height: 44px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 3px 12px rgba(245, 158, 11, 0.3);
}

.btn-daily-reveal:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.btn-daily-reveal.revealed {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
  box-shadow: none;
  cursor: default;
}

.btn-daily-save {
  flex: 1;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--surface-color-alt);
  color: var(--text-main);
  border: 1.5px solid var(--surface-border);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-daily-save:hover {
  background: rgba(79, 70, 229, 0.08);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-daily-save.saved {
  background: rgba(16, 185, 129, 0.12);
  border-color: #10B981;
  color: #059669;
}

[data-theme="dark"] .btn-daily-save.saved {
  color: #34D399;
}

.btn-daily-lesson-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background-color 0.15s ease;
  text-align: center;
}

.btn-daily-lesson-link:hover {
  background: rgba(79, 70, 229, 0.08);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Standalone Card in daily.html */
.daily-phrase-card.standalone-card {
  transform: none !important;
  max-width: 520px;
  width: 100%;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .popcorn-particle {
    font-size: 24px;
  }
}

@media (max-width: 540px) {
  .daily-phrase-card {
    border-radius: 16px;
  }

  .daily-kr-text {
    font-size: 1.1rem;
  }

  .daily-en-sentence {
    font-size: 1rem;
  }

  .daily-actions-main-row {
    flex-direction: column;
  }

  .btn-daily-reveal,
  .btn-daily-save {
    width: 100%;
  }
}

/* ==========================================================================
   Stage 1: Popcorn Knowledge Check Card ("이 표현을 아시나요?")
   ========================================================================== */

.popcorn-check-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 520px;
  padding: 40px 24px 36px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: card-appear 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes card-appear {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.popcorn-check-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.popcorn-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #D97706;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

[data-theme="dark"] .popcorn-badge {
  color: #FBBF24;
}

.popcorn-id-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-subtle);
  letter-spacing: 0.05em;
}

.popcorn-check-content {
  margin-bottom: 30px;
  width: 100%;
}

.popcorn-check-prompt {
  display: inline-block;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  background: rgba(79, 70, 229, 0.08);
}

[data-theme="dark"] .popcorn-check-prompt {
  color: #818CF8;
  background: rgba(99, 102, 241, 0.15);
}

.popcorn-expression-banner {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  margin: 0;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 10px rgba(245, 158, 11, 0.2);
}

.popcorn-check-hint {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

.popcorn-check-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 12px;
}

.btn-popcorn-action {
  height: 50px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.btn-popcorn-known {
  background: var(--surface-color-alt);
  border: 1.5px solid var(--border-color);
  color: var(--text-muted);
}

.btn-popcorn-known:hover {
  background: rgba(16, 185, 129, 0.12);
  border-color: #10B981;
  color: #059669;
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-popcorn-known:hover {
  color: #34D399;
}

.btn-popcorn-learn {
  background: linear-gradient(135deg, #4F46E5 0%, #4338CA 100%);
  border: none;
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-popcorn-learn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}

/* ==========================================================================
   Stage 2: Conversation Study Experience & Multi-Audio Playback
   ========================================================================== */

.popcorn-conversation-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 540px;
  padding: 24px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: card-appear 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.popcorn-card-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popcorn-lesson-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
  letter-spacing: -0.01em;
}

.popcorn-target-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.popcorn-target-banner .target-word {
  color: #D97706;
  font-weight: 800;
}

[data-theme="dark"] .popcorn-target-banner .target-word {
  color: #FBBF24;
}

/* Master Audio Bar */
.popcorn-audio-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface-color-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.btn-popcorn-play-all {
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.28);
}

.btn-popcorn-play-all:hover {
  background: var(--primary-hover, #4338CA);
  transform: translateY(-1px);
}

.btn-popcorn-play-all.playing {
  background: #E11D48;
}

.popcorn-audio-equalizer {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 18px;
}

.popcorn-audio-equalizer span {
  display: inline-block;
  width: 3px;
  height: 6px;
  background: var(--primary-light);
  border-radius: 2px;
  transition: height 0.15s ease;
}

.popcorn-audio-equalizer.active span:nth-child(1) {
  animation: eqWave 0.5s ease infinite alternate 0.1s;
}
.popcorn-audio-equalizer.active span:nth-child(2) {
  animation: eqWave 0.6s ease infinite alternate 0.25s;
}
.popcorn-audio-equalizer.active span:nth-child(3) {
  animation: eqWave 0.45s ease infinite alternate 0.05s;
}
.popcorn-audio-equalizer.active span:nth-child(4) {
  animation: eqWave 0.7s ease infinite alternate 0.3s;
}

@keyframes eqWave {
  0% { height: 4px; }
  100% { height: 18px; }
}

/* Dialogue Bubble Container */
.popcorn-dialogue-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dialogue-bubble {
  background: var(--surface-color-alt);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.dialogue-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.dialogue-bubble.speaker-a {
  border-left: 4px solid var(--primary);
}

.dialogue-bubble.speaker-a:hover {
  border-color: var(--primary);
}

.dialogue-bubble.speaker-b {
  border-left: 4px solid #F59E0B;
}

.dialogue-bubble.speaker-b:hover {
  border-color: #F59E0B;
}

.dialogue-bubble.has-target-expression {
  background: rgba(245, 158, 11, 0.04);
}

[data-theme="dark"] .dialogue-bubble.has-target-expression {
  background: rgba(245, 158, 11, 0.08);
}

.dialogue-bubble.playing {
  transform: translateY(-2px) scale(1.015);
  z-index: 2;
}

/* Speaker A (Wayne / Purple): Indigo Playing Glow */
.dialogue-bubble.speaker-a.playing {
  border-color: #4F46E5 !important;
  border-left-width: 5px !important;
  background: #EEF2FF !important;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3), 0 8px 24px rgba(79, 70, 229, 0.16) !important;
}

[data-theme="dark"] .dialogue-bubble.speaker-a.playing {
  border-color: #818CF8 !important;
  border-left-width: 5px !important;
  background: #1E1B4B !important;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.4), 0 8px 28px rgba(99, 102, 241, 0.35) !important;
}

.dialogue-bubble.speaker-a.playing .speaker-avatar-img {
  box-shadow: 0 0 0 2.5px #6366F1;
  transform: scale(1.08);
}

.dialogue-bubble.speaker-a.playing .btn-line-audio {
  background: rgba(79, 70, 229, 0.16);
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.15);
}

/* Speaker B (Kelly / Orange): Amber Playing Glow */
.dialogue-bubble.speaker-b.playing {
  border-color: #F59E0B !important;
  border-left-width: 5px !important;
  background: #FFFBEB !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.35), 0 8px 24px rgba(245, 158, 11, 0.18) !important;
}

[data-theme="dark"] .dialogue-bubble.speaker-b.playing {
  border-color: #FBBF24 !important;
  border-left-width: 5px !important;
  background: #2D1A05 !important;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.4), 0 8px 28px rgba(245, 158, 11, 0.32) !important;
}

.dialogue-bubble.speaker-b.playing .speaker-avatar-img {
  box-shadow: 0 0 0 2.5px #F59E0B;
  transform: scale(1.08);
}

.dialogue-bubble.speaker-b.playing .btn-line-audio {
  background: rgba(245, 158, 11, 0.18);
  border-color: #F59E0B;
  color: #D97706;
  transform: scale(1.15);
}

[data-theme="dark"] .dialogue-bubble.speaker-b.playing .btn-line-audio {
  color: #FBBF24;
}

.dialogue-bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.speaker-tag {
  display: flex;
  align-items: center;
  gap: 10px;
}

.speaker-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.speaker-b .speaker-avatar-img {
  border-color: #F59E0B;
}

.speaker-avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 800;
  color: #FFFFFF;
  background: var(--primary);
  flex-shrink: 0;
}

.speaker-b .speaker-avatar-fallback {
  background: #D97706;
}

.speaker-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: #FFFFFF;
}

.speaker-a .speaker-avatar {
  background: var(--primary);
}

.speaker-b .speaker-avatar {
  background: #D97706;
}

.speaker-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.btn-line-audio {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--surface-color);
  border: 1.5px solid var(--surface-border);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.line-audio-svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  transition: transform 0.2s ease;
}

.dialogue-bubble:hover .btn-line-audio,
.btn-line-audio:hover {
  transform: scale(1.08);
}

.dialogue-bubble.speaker-a:hover .btn-line-audio,
.speaker-a .btn-line-audio:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.1);
}

.dialogue-bubble.speaker-b:hover .btn-line-audio,
.speaker-b .btn-line-audio:hover {
  color: #D97706;
  border-color: #F59E0B;
  background: rgba(245, 158, 11, 0.1);
}

[data-theme="dark"] .dialogue-bubble.speaker-b:hover .btn-line-audio,
[data-theme="dark"] .speaker-b .btn-line-audio:hover {
  color: #FBBF24;
  border-color: #FBBF24;
}

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

.popcorn-highlight {
  background: rgba(245, 158, 11, 0.25);
  color: inherit;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 800;
  border-bottom: 2px solid #F59E0B;
}

[data-theme="dark"] .popcorn-highlight {
  background: rgba(245, 158, 11, 0.35);
  border-bottom-color: #FBBF24;
}

.dialogue-text-kr {
  display: none;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-muted);
  border-top: 1px dashed var(--border-color);
  padding-top: 6px;
}

/* Revealed Korean & Explanation */
.popcorn-conversation-card.revealed .dialogue-text-kr {
  display: block;
  animation: slideDown 0.25s ease-out;
}

.popcorn-explanation-card {
  display: none;
  background: rgba(79, 70, 229, 0.06);
  border: 1.5px solid rgba(79, 70, 229, 0.25);
  border-radius: var(--radius-md);
  padding: 16px;
  gap: 8px;
}

[data-theme="dark"] .popcorn-explanation-card {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.35);
}

.popcorn-conversation-card.revealed .popcorn-explanation-card {
  display: flex;
  flex-direction: column;
  animation: slideDown 0.3s ease-out;
}

.popcorn-explanation-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--primary);
}

[data-theme="dark"] .popcorn-explanation-header {
  color: #818CF8;
}

.popcorn-explanation-body {
  font-size: 0.93rem;
  line-height: 1.65;
  color: var(--text-main);
  word-break: keep-all;
}

.popcorn-exp-paragraph {
  margin: 0 0 10px 0;
}

.popcorn-exp-paragraph:last-child {
  margin-bottom: 0;
}

.popcorn-exp-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 12px 0 6px 0;
}

.popcorn-exp-list {
  margin: 6px 0 12px 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popcorn-exp-item {
  color: var(--text-main);
  line-height: 1.55;
}

.popcorn-exp-sublist {
  margin: 6px 0 4px 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style-type: circle;
}

.popcorn-exp-subitem {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

[data-theme="dark"] .popcorn-exp-subitem {
  color: #CBD5E1;
}

.popcorn-exp-bold {
  font-weight: 700;
  color: #4338CA;
}

[data-theme="dark"] .popcorn-exp-bold {
  color: #A5B4FC;
}

.popcorn-exp-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
  background: rgba(99, 102, 241, 0.12);
  color: #4F46E5;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .popcorn-exp-code {
  background: rgba(99, 102, 241, 0.2);
  color: #C7D2FE;
  border-color: rgba(99, 102, 241, 0.35);
}

.popcorn-exp-em {
  font-style: italic;
  color: var(--text-muted);
}

/* Action Controls Row */
.popcorn-study-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-popcorn-reveal {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #FFFFFF;
  border: none;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.btn-popcorn-reveal:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.45);
}

.btn-popcorn-reveal.revealed {
  background: var(--surface-color-alt);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  box-shadow: none;
}

.btn-popcorn-save {
  background: var(--surface-color-alt);
  color: var(--text-main);
  border: 1.5px solid var(--border-color);
}

.btn-popcorn-save:hover {
  background: rgba(79, 70, 229, 0.08);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-popcorn-save.saved {
  background: rgba(16, 185, 129, 0.12);
  border-color: #10B981;
  color: #059669;
}

[data-theme="dark"] .btn-popcorn-save.saved {
  color: #34D399;
}

.btn-popcorn-next {
  height: 52px;
  background: linear-gradient(135deg, #4F46E5 0%, #4338CA 50%, #3730A3 100%);
  color: #FFFFFF;
  border: none;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .btn-popcorn-next {
  background: linear-gradient(135deg, #6366F1 0%, #4F46E5 60%, #4338CA 100%);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.45);
}

.btn-popcorn-next:hover {
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 8px 26px rgba(79, 70, 229, 0.5);
  filter: brightness(1.06);
}

.btn-popcorn-next:active {
  transform: translateY(0) scale(0.99);
}

.btn-popcorn-next::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transform: skewX(-20deg);
  transition: left 0.65s ease;
}

.btn-popcorn-next:hover::after {
  left: 140%;
}

/* ==========================================================================
   Completion Card (Empty Popcorn Bucket & Daily Limit)
   ========================================================================== */

.popcorn-completion-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 36px 24px 32px;
  text-align: center;
  max-width: 520px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.25);
  animation: card-appear 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.popcorn-empty-illustration {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding-top: 4px;
}

.popcorn-empty-img {
  width: 210px;
  max-width: 70%;
  height: auto;
  border-radius: 20px;
  object-fit: cover;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
  border: 2px solid var(--border-color);
  animation: floatPopcorn 3.5s ease-in-out infinite;
  transition: transform 0.3s ease;
}

[data-theme="dark"] .popcorn-empty-img {
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

@keyframes floatPopcorn {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.popcorn-empty-fallback {
  font-size: 64px;
  line-height: 1;
}

.popcorn-completion-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.completion-badge {
  margin-bottom: 2px;
}

.completion-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.completion-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
  word-break: keep-all;
}

.completion-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 360px;
  margin-top: 6px;
}

.btn-popcorn-home {
  background: linear-gradient(135deg, #4F46E5 0%, #4338CA 100%);
  color: #FFFFFF;
  text-decoration: none;
  border: none;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.32);
}

.btn-popcorn-home:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
  color: #FFFFFF;
}

.btn-popcorn-reset {
  background: var(--surface-color-alt);
  color: var(--text-muted);
  border: 1.5px solid var(--border-color);
}

.btn-popcorn-reset:hover {
  background: rgba(79, 70, 229, 0.08);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

/* Mobile Adjustments */
@media (max-width: 540px) {
  .popcorn-check-card,
  .popcorn-conversation-card {
    padding: 20px 16px;
    border-radius: 16px;
  }

  .popcorn-expression-banner {
    font-size: 1.65rem;
  }

  .popcorn-check-actions {
    grid-template-columns: 1fr;
  }
}

