/* Conversation practice: a scene, a chat with Noor, and an answer box that
   takes typing or speech. Built on the practice room's card and tokens. */
.conversation-page {
  --mic-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='3' width='6' height='11' rx='3'/%3E%3Cpath d='M5 11a7 7 0 0 0 14 0M12 18v3M9 21h6'/%3E%3C/svg%3E");
}

/* Buttons below set their own display; the hidden attribute must still win. */
.conversation-page [hidden] { display: none !important; }

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.conv-title-nl { display: inline !important; margin: 0 !important; font: inherit !important; color: inherit !important; }

/* --- progress --- */
.conv-progress { display: grid; justify-items: end; gap: 8px; }
.conv-progress-label { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--text-muted); }
.conv-progress-label strong { color: var(--workbook-ink); }
.conv-steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.conv-steps li { width: 18px; height: 6px; border-radius: 3px; background: var(--border); }
.conv-steps li.is-current { background: var(--accent); }
.conv-steps li.is-done { background: var(--workbook-ink); }

/* --- scene --- */
.conv-scene { margin: 0 0 18px; }
.conv-scene img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 12px; background: #F6F0E6; }
.conv-scene figcaption { margin-top: 12px; font-size: 13px; line-height: 1.7; color: var(--text-muted); }
.conv-start { max-width: 320px; }

/* --- buttons --- */
.conv-primary { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 11px 22px; background: var(--workbook-ink); color: var(--card); border: 1px solid var(--workbook-ink); border-radius: 9px; font: 700 13px 'DM Sans', sans-serif; text-decoration: none; cursor: pointer; }
.conv-primary:hover { background: var(--text); color: var(--card); }
.conv-secondary { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 18px; background: var(--workbook-soft); color: var(--workbook-ink); border: 1px solid var(--workbook-ink); border-radius: 9px; font: 600 13px 'DM Sans', sans-serif; text-decoration: none; cursor: pointer; }
.conv-secondary:hover { background: var(--workbook-sage); }
.conv-text-button { display: inline-flex; align-items: center; min-height: 40px; padding: 0; background: none; border: 0; color: var(--workbook-ink); font: 600 12px 'DM Sans', sans-serif; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.conv-text-button.playing { color: var(--accent); }
.conversation-page button:focus-visible, .conversation-page a:focus-visible, .conv-answer input:focus-visible { outline: 2px solid var(--workbook-ink); outline-offset: 3px; }

/* --- chat --- */
.conv-chat { display: flex; flex-direction: column; gap: 12px; }
.conv-chat:not(:empty) { margin: 6px 0 18px; }
.conv-bubble { max-width: 78%; padding: 12px 15px; border-radius: 14px; animation: fadeIn .25s ease; }
.conv-who { display: block; margin-bottom: 4px; font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); }
.conv-line { font-size: 16px; line-height: 1.55; overflow-wrap: anywhere; }
.conv-line .play-btn { margin-left: 4px; }
.conv-bubble.is-partner { align-self: flex-start; background: var(--workbook-sage); border: 1px solid var(--workbook-sage-border); border-bottom-left-radius: 4px; }
.conv-bubble.is-partner .conv-line { font-weight: 600; color: var(--workbook-ink); }
.conv-bubble-tools { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.conv-slow { min-height: 32px; padding: 0 11px; border: 1px solid var(--workbook-sage-border); border-radius: 16px; background: var(--card); color: var(--workbook-ink); font: 600 11px 'DM Sans', sans-serif; cursor: pointer; }
.conv-slow:hover, .conv-slow.playing { color: var(--accent); border-color: var(--accent); background: var(--accent-light); }
.conv-en { margin-top: 6px; font-size: 13px; line-height: 1.6; color: var(--text-muted); }
.conv-bubble.is-you { align-self: flex-end; background: var(--card); border: 1px solid var(--border); border-bottom-right-radius: 4px; }
.conv-bubble.is-you.is-ok, .conv-bubble.is-you.is-almost { border-color: var(--good); }
.conv-bubble.is-you.is-retry { border-style: dashed; border-color: var(--bad); }
.conv-bubble.is-you.is-retry .conv-line { color: var(--text-muted); }
.conv-bubble.is-you.is-shown { border-style: dashed; }
.conv-note { display: flex; gap: 7px; margin-top: 6px; font-size: 12px; line-height: 1.6; color: var(--text-muted); }
.is-ok .conv-note, .is-almost .conv-note { color: var(--good); }
.is-retry .conv-note { color: var(--bad); }
.conv-mark { flex: none; font-weight: 700; }
.conv-lesson-link { color: var(--accent); font-weight: 600; }

/* --- answer box --- */
.conv-answer { padding: 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--workbook-soft); }
.conv-task-label { font-size: 10px; font-weight: 700; letter-spacing: .11em; color: var(--accent); }
.conv-task { margin: 4px 0 12px; font-size: 15px; font-weight: 600; line-height: 1.5; }
.conv-input-row { display: flex; gap: 10px; }
.conv-input-row input { flex: 1; min-width: 0; min-height: 50px; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); font: 500 16px 'DM Sans', sans-serif; }
.conv-input-row input:focus { border-color: var(--workbook-ink); outline: none; }
.conv-mic { flex: none; width: 50px; height: 50px; border: 1.5px solid var(--workbook-ink); border-radius: 50%; background: var(--card); color: var(--workbook-ink); cursor: pointer; position: relative; }
.conv-mic::before { content: ''; position: absolute; inset: 0; margin: auto; width: 22px; height: 22px; background: currentColor; mask: var(--mic-icon) center / contain no-repeat; -webkit-mask: var(--mic-icon) center / contain no-repeat; }
.conv-mic:hover { background: var(--workbook-sage); }
.conv-mic.is-listening { background: var(--accent); border-color: var(--accent); color: var(--card); animation: convPulse 1.2s ease-in-out infinite; }
@keyframes convPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(227, 91, 44, .35); } 50% { box-shadow: 0 0 0 8px rgba(227, 91, 44, 0); } }
.conv-voice-status { min-height: 20px; margin-top: 8px; font-size: 12px; line-height: 1.6; color: var(--workbook-ink); }
.conv-voice-notice { margin: 4px 0 12px; padding: 14px; border: 1px solid var(--workbook-sage-border); border-radius: 10px; background: var(--card); font-size: 12.5px; line-height: 1.7; }
.conv-voice-notice a { color: var(--accent); }
.conv-voice-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.conv-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 6px; }
.conv-actions .conv-primary { min-width: 140px; }
.conv-secondary-actions { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.conv-feedback { font-size: 13px; line-height: 1.7; border-radius: 9px; }
.conv-feedback:not(:empty) { margin-top: 12px; padding: 13px 15px; }
.conv-feedback.is-hint { background: var(--accent-light); color: var(--accent-dark); }
.conv-feedback .play-btn { width: 30px; height: 30px; min-width: 30px; }
.conv-feedback-more { margin: 6px 0 4px; }
.conv-no-voice { margin-top: 10px; font-size: 11px; color: var(--text-muted); }

/* --- summary --- */
.conv-summary { margin-top: 8px; padding: 22px; border: 2px solid var(--good); border-left-width: 5px; border-radius: 12px; background: var(--zone-green-bg); }
.conv-summary-title { font: 700 22px/1.3 'Playfair Display', Georgia, serif; color: var(--text); }
.conv-summary-score { margin-top: 6px; font-size: 14px; }
.conv-summary-copy { margin-top: 10px; font-size: 13px; line-height: 1.7; color: var(--text-muted); }
.conv-review { display: grid; gap: 10px; margin: 14px 0 0; padding: 0; list-style: none; counter-reset: turn; }
.conv-review li { padding: 13px 15px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); }
.conv-review-q { font-size: 12px; color: var(--text-muted); }
.conv-review-you { margin-top: 4px; font-size: 13px; }
.conv-review-you span:first-child { color: var(--text-muted); }
.conv-review-fix { margin-top: 4px; font-size: 13px; color: var(--good); }
.conv-say { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 8px; }
.conv-say-line { font-size: 15px; font-weight: 700; color: var(--workbook-ink); margin-right: 2px; }
.conv-record, .conv-mine { min-height: 36px; padding: 0 14px; border: 1px solid var(--workbook-ink); border-radius: 18px; background: var(--card); color: var(--workbook-ink); font: 600 12px 'DM Sans', sans-serif; cursor: pointer; }
.conv-record::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.conv-record.is-recording { background: var(--accent); border-color: var(--accent); color: var(--card); }
.conv-record.is-recording::before { background: var(--card); border-radius: 1px; }
.conv-summary-lessons { margin-top: 14px; font-size: 13px; }
.conv-summary-lessons a { color: var(--accent); font-weight: 600; }
.conv-summary-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* --- help: the shared practice help card, holding the phrase list --- */
.conv-help .help-content h3 .en { font-style: normal; color: var(--text-muted); }
.conv-phrase-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; }
.conv-phrase-list dt { font-size: 14px; font-weight: 600; line-height: 1.5; }
.conv-phrase-list dd { margin: 2px 0 0; font-size: 12px; line-height: 1.6; color: var(--text-muted); }
.conv-phrase-list .play-btn { width: 30px; height: 30px; min-width: 30px; }
.conv-phrases-link { margin-top: 18px; font-size: 13px; }
.conv-phrases-link a { color: var(--accent); }

@media (max-width: 700px) {
  .conv-progress { justify-items: start; }
  /* A taller crop on phones keeps Noor large enough to read; she stands right of centre. */
  .conv-scene img { aspect-ratio: 4 / 3; object-fit: cover; object-position: 78% 50%; }
  .conv-scene figcaption { font-size: 12.5px; }
  .conv-start { width: 100%; max-width: none; }
  .conv-bubble { max-width: 92%; padding: 11px 13px; }
  .conv-line { font-size: 15px; }
  .conv-answer { padding: 14px; margin: 0 -4px; }
  .conv-actions { flex-direction: column; align-items: stretch; }
  .conv-actions .conv-primary { width: 100%; }
  .conv-secondary-actions { justify-content: center; }
  .conv-text-button { min-height: 44px; }
  .conv-slow { min-height: 36px; }
  .conv-voice-actions > * { flex: 1 1 140px; }
  .conv-summary { padding: 16px; }
  .conv-summary-actions > * { flex: 1 1 100%; }
  .conv-record, .conv-mine { min-height: 40px; }
  .conv-phrase-list { grid-template-columns: 1fr; }
}
