:root {
  --bg: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f4f7fc;
  --text: #1b2430;
  --muted: #647082;
  --border: #e4eaf3;
  --accent: #3b6ef6;
  --accent-2: #0ea5a5;
  --danger: #e5484d;
  --user: #e8f0ff;
  --assistant: #e9f8f2;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 6px 20px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, 0.12);
  --radius: 14px;
}

* { box-sizing: border-box; }

/* Author display rules (e.g. .voice-expand{display:flex}) would otherwise
   defeat the HTML `hidden` attribute — keep it authoritative. */
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ============ Landing / Home ============ */
.hero {
  background: linear-gradient(135deg, #4f7cf7 0%, #3b6ef6 40%, #0ea5a5 100%);
  color: #fff;
  padding: 44px 20px 52px;
  text-align: center;
}
.hero-inner { max-width: 760px; margin: 0 auto; }
.hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  margin-bottom: 18px;
}
.hero h1 { font-size: 2.1rem; margin: 0 0 12px; letter-spacing: 0.5px; }
.hero p { font-size: 1.05rem; line-height: 1.7; margin: 0; opacity: 0.95; }
.hero p strong { font-weight: 700; }

.home-main { max-width: 980px; margin: -32px auto 0; padding: 0 20px 40px; }
.section-title {
  font-size: 1.15rem;
  color: var(--text);
  font-weight: 700;
  margin: 30px 4px 16px;
}
.section-title:first-child { margin-top: 0; }

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.loading { color: var(--muted); padding: 20px; }

.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
}
.course-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.cc-top {
  --cc: #3b6ef6;
  background: linear-gradient(135deg, color-mix(in srgb, var(--cc) 92%, #000) 0%, var(--cc) 100%);
  padding: 18px 18px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
}
.cc-emoji { font-size: 1.9rem; }
.cc-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  background: rgba(255, 255, 255, 0.22);
  padding: 3px 9px;
  border-radius: 6px;
}
.cc-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.cc-body h3 { margin: 0; font-size: 1.15rem; }
.cc-sub { color: var(--muted); font-size: 0.85rem; }
.cc-task {
  margin: 2px 0 4px;
  font-size: 0.85rem;
  line-height: 1.55;
  color: #46505f;
}
.cc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.chip {
  font-size: 0.72rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: #46505f;
  padding: 3px 9px;
  border-radius: 999px;
}
.cc-go { margin-top: 12px; color: var(--accent); font-weight: 600; font-size: 0.9rem; }
.course-card.free .cc-top { background: linear-gradient(135deg, #8a93a3, #6b7280); }

.home-footer { text-align: center; color: var(--muted); padding: 10px 20px 40px; }

/* ============ History (homepage) ============ */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  transition: box-shadow 0.12s, transform 0.12s;
}
.history-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.hi-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.hi-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.92rem;
  min-width: 0;
}
.hi-title > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hi-badge {
  --cc: #3b6ef6;
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cc);
  background: color-mix(in srgb, var(--cc) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--cc) 30%, transparent);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.hi-badge.free { --cc: #6b7280; }
.hi-meta { font-size: 0.76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.hi-continue {
  flex: 0 0 auto;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 8px;
}
.hi-continue:hover { background: var(--surface-2); }
.hi-delete {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 0.8rem;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}
.hi-delete:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: #fff; }

/* ============ Dialogue / Course page ============ */
.app { max-width: 820px; margin: 0 auto; padding: 20px 16px 48px; }
.has-actionbar .app { padding-bottom: 110px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  padding: 8px 0;
}
.topbar .back {
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.topbar .back:hover { color: var(--accent); }
.topbar h1 {
  font-size: 1.15rem;
  margin: 0;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status {
  font-size: 0.78rem;
  padding: 4px 11px;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 600;
}
.status.idle { background: #eef1f6; color: #6b7686; }
.status.connecting { background: #fff3d6; color: #a9760a; }
.status.live { background: #def7ec; color: #057a55; }
.status.error { background: #fde3e3; color: #c0322f; }

/* Mic status banner */
.mic-status {
  font-size: 0.82rem;
  padding: 9px 13px;
  border-radius: 10px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
}
.mic-status.ok { background: #def7ec; color: #057a55; border-color: #b6ecd4; }
.mic-status.warn { background: #fef0c7; color: #b54708; border-color: #fbe39a; }
.mic-status.info { background: #e8f0ff; color: #2547a8; border-color: #cfe0ff; }

/* Course context panel */
.course-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.cp-head { display: flex; gap: 14px; align-items: flex-start; }
.cp-emoji { font-size: 2rem; line-height: 1; }
.cp-code {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
}
.cp-headtext h2 { margin: 2px 0; font-size: 1.25rem; }
.cp-sub { color: var(--muted); font-size: 0.85rem; }
.cp-task {
  margin: 12px 0 10px;
  line-height: 1.6;
  font-size: 0.92rem;
  color: #3a4453;
  background: var(--surface-2);
  padding: 10px 12px;
  border-radius: 10px;
}
.cp-aspects { display: flex; flex-wrap: wrap; gap: 7px; }
.cp-goal { margin: 12px 0 0; font-size: 0.85rem; color: var(--muted); line-height: 1.55; }
.cp-prompt { margin-top: 12px; }
.cp-prompt summary { cursor: pointer; font-size: 0.82rem; color: var(--muted); }
.cp-prompt pre {
  margin: 10px 0 0;
  max-height: 220px;
  overflow: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.76rem;
  line-height: 1.5;
  white-space: pre-wrap;
  color: #46505f;
}

/* Settings (free mode) */
.settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.settings label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}
.settings .instructions { grid-column: 1 / -1; }
.settings select,
.settings textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 400;
  resize: vertical;
}
.settings select:focus,
.settings textarea:focus,
#voiceSearch:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
.model-price {
  font-size: 0.78rem;
  color: var(--accent-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

/* Voice picker (collapsed row by default; expands to search + cards) */
.voices-field {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.voice-current {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 4px 2px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  box-shadow: none;
}
.voice-current:hover .vc-toggle { color: var(--accent); }
.vc-label {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}
.voice-current .vc-main { display: flex; flex-direction: column; gap: 2px; }
.voice-current .vc-name { font-size: 0.92rem; }
.voice-current .vc-desc {
  margin-top: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.vc-toggle {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.voice-expand { display: flex; flex-direction: column; gap: 10px; }
.voices-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}
.voices-head b { color: var(--accent-2); }
#voiceSearch {
  flex: 1;
  max-width: 240px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 7px 11px;
  font-size: 0.85rem;
}
.voice-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 9px;
  max-height: 240px;
  overflow-y: auto;
  padding: 2px;
}
.voice-card {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 11px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
.voice-card:hover { background: #eef3fb; }
.voice-card.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, #fff);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.vc-main { flex: 1; min-width: 0; }
.vc-name { font-size: 0.88rem; color: var(--text); font-weight: 600; }
.vc-tag {
  font-size: 0.68rem;
  color: var(--muted);
  background: #e7edf6;
  padding: 1px 6px;
  border-radius: 5px;
  margin-left: 6px;
  font-weight: 500;
}
.vc-desc { font-size: 0.74rem; color: var(--muted); line-height: 1.4; margin-top: 3px; }
.vc-play {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 0.9rem;
  border-radius: 50%;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.vc-play:hover { border-color: var(--accent); color: var(--accent); }
.vc-play.playing { background: var(--accent); color: #fff; border-color: transparent; }
.voices-field.locked { opacity: 0.6; pointer-events: none; }
.voice-empty { color: var(--muted); font-size: 0.82rem; padding: 14px; grid-column: 1 / -1; }

/* ============ Prompt Studio ============ */
.studio-intro { color: var(--muted); font-size: 0.9rem; line-height: 1.6; margin: 0 0 8px; }
.hidden { display: none !important; }

.tabs {
  display: flex;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 16px;
}
.tab {
  flex: 1;
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  padding: 10px 8px;
  font-size: 0.9rem;
  font-weight: 600;
}
.tab.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.tab-panel { margin-bottom: 16px; }
.preset-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.preset-card {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.preset-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.pc-emoji { font-size: 1.6rem; }
.pc-text { display: flex; flex-direction: column; min-width: 0; }
.pc-text b { font-size: 0.92rem; }
.pc-text small { color: var(--muted); font-size: 0.76rem; margin-top: 2px; }

.studio-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.studio-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}
.studio-form .wide { grid-column: 1 / -1; }
.studio-form select,
.studio-form input[type="text"],
.studio-form textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 400;
}
.studio-form select:focus,
.studio-form input:focus,
.studio-form textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
.focus-set { grid-column: 1 / -1; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.focus-set legend { font-size: 0.82rem; color: var(--muted); font-weight: 600; padding: 0 6px; }
.focus-chips { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.focus-chip { display: flex; align-items: center; gap: 5px; font-size: 0.85rem; color: var(--text); font-weight: 400; cursor: pointer; }

.studio-actions { display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.gen-status { font-size: 0.82rem; color: var(--muted); }
.result-area {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  padding: 14px 16px;
  font-size: 0.9rem;
  line-height: 1.6;
  font-family: inherit;
  resize: vertical;
}
.result-area:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }

/* Buttons */
button {
  border: none;
  border-radius: 11px;
  padding: 11px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.15s ease, opacity 0.2s ease;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--accent); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 35%, transparent); }
button.danger { background: #fff; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--border)); }

/* Fixed bottom action bar — keeps the talk control next to the latest messages. */
.actionbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(16, 24, 40, 0.08);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  z-index: 50;
}
.actionbar-inner {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.connect-btn { flex: 1; padding: 14px; }
.end-btn { flex: 0 0 auto; padding: 14px 18px; }
/* Before connecting: only the connect button (scoped to the action bar so it
   doesn't hide other .talk-styled buttons like the Studio start button). */
body:not(.connected) .actionbar .talk,
body:not(.connected) .actionbar .end-btn { display: none; }
/* After connecting: talk button takes over, connect hidden. */
body.connected .actionbar .connect-btn { display: none; }
body.connected .voices-field,
body.connected .settings { display: none !important; }
/* In-conversation: shrink the course panel to a slim title bar so the
   transcript is the visual focus; tapping it re-expands the lesson task. */
body.connected .cp-prompt,
body.connected .cp-task,
body.connected .cp-aspects,
body.connected .cp-goal { display: none; }
body.connected .course-panel { padding: 10px 14px; margin-bottom: 12px; cursor: pointer; }
body.connected .cp-emoji { font-size: 1.3rem; }
body.connected .cp-head { align-items: center; }
body.connected .cp-headtext h2 { font-size: 0.98rem; margin: 0; }
body.connected .cp-sub { display: none; }
body.connected .course-panel.expanded .cp-task { display: block; }
body.connected .course-panel.expanded .cp-aspects { display: flex; }
body.connected .course-panel.expanded .cp-goal { display: block; }

button.talk {
  position: relative;
  flex: 1;
  min-width: 0;
  padding: 16px 20px;
  font-size: 1.05rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
/* idle and responding look identical: tapping during a reply interrupts it,
   which to the user is simply "点击说话". */
button.talk.idle,
button.talk.responding { background: #057a55; color: #fff; border-color: transparent; box-shadow: 0 4px 14px rgba(5, 122, 85, 0.3); }
button.talk.recording {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.45); }
  50% { box-shadow: 0 0 0 12px rgba(229, 72, 77, 0); }
}

/* Mic level lives INSIDE the talk button (thin strip along the bottom),
   visible only while recording — no separate control fighting for space. */
.talk .meter {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 5px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
  display: none;
}
button.talk.recording .meter { display: block; }
#meterFill {
  display: block;
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 999px;
  transition: width 0.08s linear;
}

.hint { color: var(--muted); font-size: 0.82rem; margin: 4px 0 14px; line-height: 1.5; }
body.connected .hint { display: none; }

.cost-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: var(--shadow);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.84rem;
  color: var(--muted);
}
.cost-bar b { color: var(--accent-2); font-variant-numeric: tabular-nums; }
.cost-note { color: #a9760a; }

.transcript {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  min-height: 40vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* No conversation yet -> no empty white box taking half the screen. */
.transcript:empty { display: none; }
/* Once connected, let the transcript fill the viewport so the latest messages
   sit right above the pinned action bar — no more scrolling to find the button. */
body.connected .transcript { min-height: calc(100vh - 230px); }
.msg {
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 85%;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.94rem;
}
.msg.user { align-self: flex-end; background: var(--user); border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--assistant); border-bottom-left-radius: 4px; }
.msg .role { display: block; font-size: 0.7rem; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.msg.pending { opacity: 0.7; }
.msg.sys-error {
  align-self: center;
  max-width: 95%;
  background: #fde3e3;
  color: #b42318;
  border: 1px solid #f7c8c8;
  font-size: 0.85rem;
}
.msg .turn-cost { display: block; margin-top: 6px; font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bubble-audio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  margin-top: 6px;
  font-size: 0.7rem;
  border-radius: 50%;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
.bubble-audio:hover { border-color: var(--accent); color: var(--accent); }
.bubble-audio.playing { background: var(--accent); color: #fff; border-color: transparent; }

footer { margin-top: 20px; color: var(--muted); }
footer code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

@media (max-width: 640px) {
  .settings,
  .studio-form { grid-template-columns: 1fr; }
  .hero { padding: 32px 18px 38px; }
  .hero h1 { font-size: 1.6rem; }
  .hero p { font-size: 0.95rem; }
  .home-main { padding: 0 14px 32px; }
  .course-grid { grid-template-columns: 1fr; gap: 14px; }
  .voice-list { grid-template-columns: 1fr; max-height: 200px; }
  .app { padding: 14px 12px 32px; }
  .has-actionbar .app { padding-bottom: 104px; }
  .topbar h1 { font-size: 1.05rem; }
  .course-panel { padding: 14px 16px; }
  .cp-headtext h2 { font-size: 1.12rem; }
  .preset-row { grid-template-columns: 1fr; }
  .cost-bar { font-size: 0.78rem; gap: 10px; padding: 8px 12px; }
  .hi-continue { display: none; } /* 整行可点，小屏不重复放“继续” */
  /* Bigger touch targets in the pinned bar on phones. */
  button.talk { padding: 18px 14px; font-size: 1.1rem; }
  .connect-btn { padding: 16px; font-size: 1.05rem; }
  body.connected .transcript { min-height: calc(100vh - 210px); }
}
