/* ── Eyebrow ─────────────────────────────────────────────────────────────── */

.dialogue-eyebrow {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0 0 6px;
  text-align: center;
}

/* ── Chat area ───────────────────────────────────────────────────────────── */

.chat-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px 2px 12px;
  margin-bottom: 20px;
  scroll-behavior: smooth;
}

/* ── Bubble wrap ─────────────────────────────────────────────────────────── */

.chat-bubble-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-bubble-wrap--rasa  { flex-direction: row; }
.chat-bubble-wrap--jonas { flex-direction: row-reverse; }

.chat-bubble-wrap--new {
  animation: bubbleIn 0.32s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Avatar ──────────────────────────────────────────────────────────────── */

.chat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-family: "Nunito", sans-serif;
  font-size: 0.8rem;
  font-weight: 900;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-font-smoothing: antialiased;
}

.chat-avatar--rasa  { background: var(--primary); }
.chat-avatar--jonas { background: #9b6ff5; }

/* ── Bubble ──────────────────────────────────────────────────────────────── */

.chat-bubble {
  max-width: 72%;
  padding: 11px 16px;
  font-family: "Nunito", sans-serif;
  font-size: clamp(0.95rem, 3vw, 1.1rem);
  font-weight: 700;
  line-height: 1.45;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-bubble--prompt {
  padding: 13px 16px;
}

.bubble-text { flex: 1; }

/* ── Play button ─────────────────────────────────────────────────────────── */

.bubble-play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  padding: 0;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.bubble-play-btn svg {
  width: 0.45em;
  height: 0.45em;
  margin-left: 0.05em;
}

.bubble-play-btn:hover { background: #fff; transform: scale(1.08); }

.bubble-play-btn--prompt { background: rgba(255, 255, 255, 0.85); }

.bubble-play-btn.is-playing {
  animation: playPulse 0.9s ease infinite;
}

@keyframes playPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.12); }
}

.chat-bubble--rasa {
  background: rgba(47, 159, 232, 0.09);
  border: 1.5px solid rgba(47, 159, 232, 0.2);
  border-radius: 18px 18px 18px 4px;
}

.chat-bubble--jonas {
  background: rgba(155, 111, 245, 0.09);
  border: 1.5px solid rgba(155, 111, 245, 0.2);
  border-radius: 18px 18px 4px 18px;
}

/* ── Options label ───────────────────────────────────────────────────────── */

.chat-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}

/* ── Option buttons ──────────────────────────────────────────────────────── */

.chat-options {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.chat-opt {
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  font-family: "Nunito", sans-serif;
  font-size: clamp(0.9rem, 2.5vw, 1rem);
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
  text-align: left;
  border: 2px solid rgba(6, 38, 61, 0.1);
  border-bottom: 4px solid rgba(6, 38, 61, 0.16);
  cursor: pointer;
  transition: transform 0.1s ease, border-bottom-width 0.08s ease,
              background 0.15s, border-color 0.15s, color 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.chat-opt:hover:not(:disabled) {
  background: rgba(47, 159, 232, 0.07);
  border-color: rgba(47, 159, 232, 0.28);
  border-bottom-color: rgba(47, 159, 232, 0.42);
  color: var(--primary);
  transform: translateY(-2px);
}

.chat-opt:active:not(:disabled) {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

.chat-opt:disabled { cursor: default; }

.chat-opt--correct {
  background: #f0fdf4;
  border-color: #22c55e;
  border-bottom-color: #16a34a;
  color: #15803d;
  animation: optPop 0.36s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.chat-opt--wrong {
  background: #fef2f2;
  border-color: #ef4444;
  border-bottom-color: #dc2626;
  color: #b91c1c;
  animation: optShake 0.42s ease both;
}

.chat-opt--dim { opacity: 0.28; }

@keyframes optPop {
  0%   { transform: scale(0.98); }
  60%  { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes optShake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-5px); }
  40%       { transform: translateX(5px); }
  60%       { transform: translateX(-3px); }
  80%       { transform: translateX(3px); }
}

/* ── Feedback panel ──────────────────────────────────────────────────────── */

.dialogue-feedback {
  border-radius: 16px;
  padding: 18px 20px;
  margin-top: 16px;
  border: 2px solid transparent;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.dialogue-feedback.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dialogue-feedback--correct { background: #dcfce7; border-top-color: #22c55e; }
.dialogue-feedback--wrong   { background: #fee2e2; border-top-color: #ef4444; }

.dialogue-feedback-inner {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.dialogue-feedback-left {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.dialogue-feedback-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}

.dialogue-feedback-msg {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.4;
}

.dialogue-feedback--correct .dialogue-feedback-msg { color: #15803d; }
.dialogue-feedback--wrong   .dialogue-feedback-msg { color: #b91c1c; }

.dialogue-continue {
  flex-shrink: 0;
  padding: 14px 30px;
  border-radius: 14px;
  border: none;
  font-size: 1rem;
  font-weight: 800;
  font-family: "Nunito", sans-serif;
  cursor: pointer;
  color: #fff;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s;
}

.dialogue-continue:hover  { transform: translateY(-2px); }
.dialogue-continue:active { transform: translateY(2px); box-shadow: none !important; }

.dialogue-feedback--correct .dialogue-continue { background: #22c55e; box-shadow: 0 4px 0 #16a34a; }
.dialogue-feedback--correct .dialogue-continue:hover { background: #16a34a; }
.dialogue-feedback--wrong   .dialogue-continue { background: #ef4444; box-shadow: 0 4px 0 #dc2626; }
.dialogue-feedback--wrong   .dialogue-continue:hover { background: #dc2626; }

/* ── Score modal ─────────────────────────────────────────────────────────── */

.score-encourage {
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 600;
  margin: 6px 0 0;
  text-align: center;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .game--dialogue .progress-row {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 6px;
  }

  .game--dialogue .progress-meta { text-align: center; }
  .game--dialogue .progress-track { width: 100%; flex: none; }

  .chat-area { max-height: 200px; }
  .dialogue-feedback { margin-top: 10px; padding: 16px 18px; }
  .dialogue-feedback-inner { gap: 12px; }
}

@media (max-width: 480px) {
  .chat-opt { padding: 12px 14px; }
  .dialogue-feedback { padding: 14px 16px; border-radius: 14px; }
  .dialogue-feedback-inner { flex-direction: column; align-items: stretch; gap: 10px; }
  .dialogue-continue { text-align: center; padding: 13px; }
}
