/* AI conversation practice. The bubbles themselves come from the Lesson 16
   .dialog-story-* rules in styles.css; this is the page around them. */

/* .chat-composer and friends set display, which would beat the hidden
   attribute; ai-chat.js relies on hidden to put the page into its states. */
.chat-wrap [hidden] { display: none !important; }

.chat-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.chat-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.chat-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--warm-muted, #706f63);
  margin-bottom: 4px;
}

.chat-title {
  font: 700 28px 'Playfair Display', Georgia, serif;
  line-height: 1.2;
}

.chat-head-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.chat-quota {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.chat-quota.is-low { color: #a24528; font-weight: 600; }

.chat-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}

/* Taller than the Lesson 16 thread: this is the whole page, not one exercise. */
.chat-thread {
  max-height: min(56vh, 520px);
  min-height: 240px;
  margin-bottom: 16px;
}

.chat-empty {
  display: block;
  padding: 28px 12px;
  text-align: center;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-muted);
}

.chat-composer { display: flex; gap: 10px; align-items: stretch; }
.chat-input { flex: 1; min-width: 0; }
.chat-send { flex: none; min-height: 44px; padding: 0 22px; }
.chat-send[disabled] { opacity: .55; cursor: default; }

.chat-message { margin-top: 10px; }

/* Speak an AI reply with the browser's own voice — no request, no per-character
   cost, and it keeps ElevenLabs to generating files offline as CLAUDE.md says. */
.chat-speak {
  margin-left: 6px;
  border: 0;
  background: none;
  padding: 2px 4px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  opacity: .65;
  vertical-align: baseline;
}

.chat-speak:hover { opacity: 1; }
.chat-speak.is-speaking { opacity: 1; }
.chat-speak[disabled] { opacity: .3; cursor: default; }

.chat-foot {
  margin-top: 18px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

.chat-foot a { color: var(--accent); font-weight: 600; }

.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;
}

/* The .lesson-topbar chrome collapses at 700px, so the page follows it. */
@media (max-width: 700px) {
  .chat-wrap { padding: 22px 16px 52px; }
  .chat-title { font-size: 23px; }
  .chat-panel { padding: 16px 14px; border-radius: 12px; }
  .chat-thread { max-height: 52vh; }

  .chat-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .chat-head-side { justify-content: space-between; }
}

@media (max-width: 420px) {
  .chat-composer { flex-direction: column; }
  .chat-send { width: 100%; }
}
