:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #f2f6fc;
  --text: #102a57;
  --text-muted: #53627a;
  --border: #e3e9f2;
  --primary: #0EA89A;
  --primary-strong: #0C8F84;
  --primary-soft: #E4F6F3;
  --ai-surface: #eef5ff;
  --user-surface: color-mix(in srgb, var(--primary) 14%, var(--surface));
  --success: #147a3a;
  --success-soft: #eaf8ef;
  --warning: #8a5f00;
  --warning-soft: #fff7dc;
  --danger: #b83232;
  --ember: #E85B44;
  --ember-soft: #FCEAE6;
  --sakura: #E85D89;
  --gold: #C9932A;
  --on-primary: #ffffff;
  --space-sm: 8px;
  --space-md: 16px;
  --font-body: 1rem;
  --font-label: 0.875rem;
  --font-meta: 0.8125rem;
  --font-display: "Be Vietnam Pro", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "Noto Sans JP", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --lang-accent: var(--primary);
  --shadow-sm: 0 4px 14px rgba(23, 62, 117, 0.07);
  --shadow-md: 0 18px 50px rgba(25, 55, 105, 0.16);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1421;
  --surface: #151f30;
  --surface-soft: #1b283b;
  --text: #f3f7ff;
  --text-muted: #9dacbf;
  --border: #2b3a50;
  --primary: #2FD9C4;
  --primary-strong: #3EE6D2;
  --primary-soft: #14332F;
  --ai-surface: #1b2b42;
  --user-surface: color-mix(in srgb, var(--primary) 22%, var(--surface));
  --success: #67d58c;
  --success-soft: #183629;
  --warning: #efc75a;
  --warning-soft: #3b321b;
  --danger: #ff8181;
  --ember: #FF6F5E;
  --ember-soft: #3A211C;
  --sakura: #FF8FB4;
  --gold: #E8B33D;
  --on-primary: #102a57;
  --lang-accent: var(--primary);
  --shadow-sm: 0 5px 18px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 22px 60px rgba(0, 0, 0, 0.4);
}

body[data-target-language="ja"] { --lang-accent: var(--sakura); }
body[data-target-language="zh-Hans"] { --lang-accent: var(--gold); }

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
body.overlay-open { overflow: hidden; }
button, select, input { font: inherit; }
button { color: inherit; }
button, select { touch-action: manipulation; }
svg { display: block; }
[hidden] { display: none !important; }

.ui-svg,
.header-icon svg,
.overlay-icon svg,
.setting-section-icon svg,
.dock-meta svg,
.talk-button > svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-mask {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: var(--icon-url) center / contain no-repeat;
  mask: var(--icon-url) center / contain no-repeat;
}
.icon-mask--settings { --icon-url: url("/assets/icons/settings.svg"); }
.icon-mask--mic { --icon-url: url("/assets/icons/mic.svg"); }
.icon-mask--x { --icon-url: url("/assets/icons/x.svg"); }
.icon-mask--volume { --icon-url: url("/assets/icons/volume-2.svg"); }
.icon-mask--chevron { --icon-url: url("/assets/icons/chevron-down.svg"); }
.icon-mask--info { --icon-url: url("/assets/icons/info.svg"); }
.icon-mask--rotate { --icon-url: url("/assets/icons/rotate-ccw.svg"); }

.app-shell {
  width: min(100%, 760px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 14px calc(190px + env(safe-area-inset-bottom));
}

.app-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 -14px 8px;
  padding: max(13px, env(safe-area-inset-top)) 18px 12px;
  border-bottom: 1px solid rgba(128, 150, 185, 0.14);
  background: color-mix(in srgb, var(--bg) 95%, transparent);
  backdrop-filter: blur(14px);
}

.brand-block { min-width: 0; }
.brand-mark { display: none; }
h1 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 750;
  letter-spacing: 0.02em;
}
.app-tagline {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}
body[data-app-mode="public"] .app-tagline { display: none; }

.header-icon,
.overlay-icon,
.inline-action,
.round-audio,
.replay-main {
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  cursor: pointer;
}

.header-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font-size: 22px;
}
.header-icon:hover { background: var(--surface-soft); }
.header-icon:focus-visible,
.overlay-icon:focus-visible,
.inline-action:focus-visible,
.score-button:focus-visible,
.round-audio:focus-visible,
.replay-main:focus-visible,
.problem-card:focus-visible,
.natural-card:focus-visible,
.talk-button:focus-visible {
  outline: 3px solid var(--primary-strong);
  outline-offset: 2px;
}

.conversation-card {
  min-height: 55dvh;
  padding-bottom: 16px;
}
.conversation {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.empty-state {
  padding: 76px 24px;
  color: var(--text-muted);
  text-align: center;
  font-size: 14px;
  line-height: 1.7;
}
.turn {
  width: 100%;
  scroll-margin-bottom: 176px;
}
.message-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0;
}
.ai-row { justify-content: flex-start; }
.user-row { justify-content: flex-end; }
.message-stack {
  display: flex;
  flex-direction: column;
  max-width: min(78%, 540px);
}
.user-stack { align-items: flex-end; }
.ai-stack { align-items: flex-start; }
.avatar {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}
.avatar .ui-svg { width: 20px; height: 20px; }
.ai-avatar {
  background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 55%, white), var(--primary));
  color: #fff;
}
.user-avatar {
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border));
  background: var(--surface);
  color: var(--text);
}
.message-meta {
  margin: 0 4px 5px;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}
.bubble {
  border: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
  border-radius: 19px;
  padding: 13px 15px;
}
.ai-bubble {
  border-top-left-radius: 7px;
  background: var(--ai-surface);
}
.user-bubble {
  border-top-right-radius: 7px;
  background: var(--user-surface);
}
.message-text,
.text {
  font-size: var(--font-body);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.user-message-text { white-space: normal; }

.inline-action,
.score-pill {
  vertical-align: middle;
  margin-left: 7px;
  transform: translateY(-1px);
}
.inline-action {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
}
.inline-action .ui-svg { width: 15px; height: 15px; }
.score-pill {
  position: relative;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.score-pill-ring { position: absolute; inset: 0; }
.score-pill-track { stroke: var(--border); }
.score-pill-num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  color: var(--text);
}
[data-score-tier="gold"] .score-pill-arc { stroke: var(--gold); }
[data-score-tier="gold"] .score-pill-num { color: var(--gold); }
[data-score-tier="teal"] .score-pill-arc { stroke: var(--primary); }
[data-score-tier="teal"] .score-pill-num { color: var(--primary); }
[data-score-tier="muted"] .score-pill-arc { stroke: var(--text-muted); }
.score-pill-arc { animation: score-pill-grow 700ms cubic-bezier(.22,.9,.3,1) both; }
@keyframes score-pill-grow { from { stroke-dashoffset: 94.2; } }
.pron-problem {
  font-weight: 750;
  text-decoration-line: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 3px;
  text-decoration-skip-ink: none;
}
.pron-problem.severity-yellow { text-decoration-color: var(--warning); }
.pron-problem.severity-red { text-decoration-color: var(--danger); }

.control-dock {
  position: fixed;
  z-index: 24;
  left: 50%;
  bottom: 0;
  width: min(100%, 760px);
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  padding: 9px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 -10px 35px rgba(37, 71, 122, 0.07);
  backdrop-filter: blur(16px);
}
.status {
  min-height: 18px;
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}
.status.error, .error { color: var(--danger); }
.voice-control-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.voice-waves {
  width: 58px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  color: var(--primary);
  opacity: 0.55;
}
.voice-waves-right { justify-content: flex-start; }
.voice-waves span {
  width: 3px;
  border-radius: 999px;
  background: currentColor;
}
.voice-waves span:nth-child(1) { height: 10px; }
.voice-waves span:nth-child(2) { height: 18px; }
.voice-waves span:nth-child(3) { height: 30px; }
.voice-waves span:nth-child(4) { height: 22px; }
.voice-waves span:nth-child(5) { height: 13px; }
.talk-button {
  position: relative;
  width: 76px;
  height: 76px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, color-mix(in srgb, var(--primary) 55%, white), var(--primary));
  color: #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-size: 30px;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  animation: talk-breathe 3.4s ease-in-out infinite;
}
.talk-button .talk-icon,
.talk-button > svg { width: 31px; height: 31px; }
.talk-button:disabled { cursor: default; opacity: 0.72; }
.talk-pressed,
.talk-recording {
  background: radial-gradient(circle at 32% 28%, color-mix(in srgb, var(--primary) 55%, white), var(--primary-strong));
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--primary) 18%, transparent), 0 10px 28px rgba(14, 168, 154, 0.3);
  animation: talk-breathe-fast 1.6s ease-in-out infinite;
}
.talk-speaking {
  background: radial-gradient(circle at 32% 28%, color-mix(in srgb, var(--ember) 55%, white), var(--ember));
}
.talk-recording::before, .talk-recording::after,
.talk-pressed::before, .talk-pressed::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--primary);
  border-radius: 50%;
  pointer-events: none;
  animation: talk-ripple 1.8s cubic-bezier(.24,.72,.4,1) infinite;
}
.talk-recording::after, .talk-pressed::after { animation-delay: 0.6s; }
@keyframes talk-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.045); } }
@keyframes talk-breathe-fast { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes talk-ripple { 0% { opacity: 0.5; transform: scale(0.9); } 100% { opacity: 0; transform: scale(1.6); } }
.reconnect-glyph { font-size: 34px; line-height: 1; }
.talk-label {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
}
.dock-meta {
  width: min(100%, 360px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 56px;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}
.dock-meta-item { display: inline-flex; align-items: center; gap: 5px; }
.dock-meta svg { width: 16px; height: 16px; }

.overlay-root {
  position: fixed;
  z-index: 50;
  inset: 0;
}
.overlay-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(7, 18, 38, 0.43);
  cursor: default;
}
.overlay-surface,
.settings-panel {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 0;
  width: min(100%, 480px);
  max-height: calc(100dvh - max(18px, env(safe-area-inset-top)));
  transform: translateX(-50%);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 25px 25px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.overlay-header,
.settings-head {
  min-height: 62px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 4px;
  padding: max(8px, env(safe-area-inset-top)) 10px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.overlay-header h2,
.settings-head strong {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}
.overlay-header h2 { text-align: center; }
.settings-head { grid-template-columns: 1fr 44px; padding-top: 10px; }
.settings-head strong { padding-left: 8px; }
.overlay-header-spacer { width: 44px; }
.overlay-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 21px;
}
.overlay-icon:hover { background: var(--surface-soft); }
.overlay-scroll {
  max-height: calc(100dvh - 82px - env(safe-area-inset-top));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px 18px calc(28px + env(safe-area-inset-bottom));
}
.overlay-section { margin-top: var(--space-md); }
.overlay-section:first-child { margin-top: 0; }
.overlay-section h3,
.replay-transcript h3,
.compare-card h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}
.score-hero-ring {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}
.score-ring-fg { animation: score-ring-grow 1.1s cubic-bezier(.22,.9,.3,1) both; }
@keyframes score-ring-grow { from { stroke-dashoffset: 326.7; } }
.score-hero-copy { display: flex; flex-direction: column; gap: 4px; }
.score-hero-copy span { color: var(--text); font-size: 13px; font-weight: 800; }
.score-hero-copy strong { color: var(--primary); font-family: var(--font-display); font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; letter-spacing: -0.015em; }
.score-hero-copy strong small { margin-left: 4px; color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.score-track {
  height: 7px;
  margin-top: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 65%, var(--surface));
  overflow: hidden;
}
.score-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--success);
}
.coach-metrics {
  padding: 2px 12px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}
.coach-metric { padding-top: 12px; }
.coach-metric-head { display: flex; justify-content: space-between; gap: 12px; color: var(--text-muted); font-size: 12px; }
.coach-metric-head strong { color: var(--success); font-size: 15px; }
.problem-list { display: grid; gap: 9px; }
.problem-card,
.natural-card {
  width: 100%;
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.problem-card.severity-red .problem-icon { color: var(--danger); }
.problem-icon,
.tip-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--warning-soft);
  color: var(--warning);
}
.problem-icon .ui-svg,
.tip-icon .ui-svg { width: 18px; height: 18px; }
.problem-copy { min-width: 0; flex: 1; display: grid; gap: 2px; }
.problem-copy strong { font-size: 17px; }
.problem-copy small { color: var(--text-muted); font-size: var(--font-meta); }
.problem-chevron { margin-left: auto; color: var(--primary); }
.problem-chevron .ui-svg { width: 18px; height: 18px; }
.natural-card span:first-child { min-width: 0; flex: 1; font-size: var(--font-body); font-weight: 600; line-height: 1.5; }
.coach-note,
.tip-card {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 18px;
  padding: 13px;
  border-radius: var(--radius-md);
  background: var(--success-soft);
  color: var(--text);
  font-size: var(--font-body);
  line-height: 1.55;
}
.coach-note .ui-svg { flex: 0 0 20px; width: 20px; height: 20px; color: var(--success); }

.compare-card,
.replay-transcript,
.heard-card {
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}
.compare-original { background: var(--ai-surface); }
.compare-corrected { background: var(--user-surface); }
.compare-sentence { color: var(--text); font-size: var(--font-body); line-height: 1.6; overflow-wrap: anywhere; }
.compare-sentence-row { display: flex; align-items: flex-start; gap: 10px; }
.compare-sentence-row .compare-sentence { flex: 1; min-width: 0; }
.compare-arrow { display: grid; place-items: center; height: 46px; color: #80aef5; }
.compare-arrow .ui-svg { width: 30px; height: 30px; }
.round-audio {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
}
.round-audio .ui-svg { width: 19px; height: 19px; }
.round-audio-large { width: 48px; height: 48px; flex-basis: 48px; }
.tip-card { background: var(--warning-soft); }
.tip-card strong { display: block; margin-bottom: 5px; font-size: 13px; }
.tip-card p { margin: 0; color: var(--text-muted); }
.word-practice { display: grid; gap: 16px; }
.word-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 6px 2px; }
.word-hero > div { min-width: 0; overflow-wrap: anywhere; }
.word-hero h3 { margin: 0; font-size: 1.875rem; line-height: 1.15; }
.word-hero p { margin: 5px 0 0; color: var(--text-muted); font-size: 17px; }
.heard-card { display: grid; gap: 4px; }
.heard-card span { color: var(--text-muted); font-size: 12px; }
.heard-card strong { font-size: 17px; }

.replay-view { text-align: center; }
.replay-transcript { text-align: left; }
.replay-transcript p { margin: 0; font-size: var(--font-body); line-height: 1.65; overflow-wrap: anywhere; }
.waveform {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin: 28px 0 6px;
  overflow: hidden;
}
.waveform span {
  width: 3px;
  height: var(--wave);
  min-height: 8px;
  max-height: 64px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 72%, white);
}
.replay-time { display: flex; justify-content: space-between; color: var(--text-muted); font-size: 11px; }
.replay-main {
  width: 64px;
  height: 64px;
  margin: 22px auto 0;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, color-mix(in srgb, var(--primary) 55%, white), var(--primary-strong));
  color: #fff;
  box-shadow: 0 8px 24px rgba(14, 168, 154, 0.28);
}
.replay-main .ui-svg { width: 28px; height: 28px; }
.replay-note {
  margin: 24px 0 0;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}

.settings-panel {
  z-index: 61;
  padding-bottom: env(safe-area-inset-bottom);
  overflow: auto;
}
.setting-section {
  margin: 0 var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}
.setting-section:last-of-type { border-bottom: 0; }
.setting-section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
}
.setting-section-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
}
.setting-section-icon svg { width: 17px; height: 17px; }
.setting-control-row,
.switch-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--text-muted);
  font-size: var(--font-label);
}
.setting-control-row > label { min-width: 0; overflow-wrap: anywhere; }
.setting-control-row select { min-width: 0; max-width: 100%; flex: 0 1 55%; }
.setting-volume-control { display: flex; align-items: center; flex: 0 1 55%; min-width: 0; gap: 10px; }
.setting-volume-control input { width: 100%; min-width: 0; margin: 0; accent-color: var(--primary); touch-action: pan-x; }
.setting-volume-control input:focus-visible { outline: 2px solid var(--primary-strong); outline-offset: 4px; }
.setting-volume-control output { flex: 0 0 46px; text-align: right; font-variant-numeric: tabular-nums; }
.settings-panel select:focus-visible { outline: 3px solid var(--primary-strong); outline-offset: 2px; }
.setting-control-row + .setting-control-row,
.setting-control-row + .switch-row,
.switch-row + .setting-control-row,
.switch-row + .switch-row { border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.setting-control-row select,
.settings-panel > select,
.settings-panel .dev-only select {
  min-width: 104px;
  min-height: 44px;
  padding: 6px 30px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
}
.lang-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border-radius: 50%;
  vertical-align: middle;
  background: var(--lang-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--lang-accent) 18%, transparent);
}

#target-language {
  border-color: color-mix(in srgb, var(--lang-accent) 30%, var(--border));
}

#target-language:focus-visible {
  outline-color: color-mix(in srgb, var(--lang-accent) 58%, transparent);
}
.switch-row { cursor: pointer; }
.switch-row > span:first-child { display: grid; gap: 3px; }
.switch-row strong { color: var(--text); font-size: 13px; }
.switch-row small { color: var(--text-muted); font-size: 11px; font-weight: 500; }
.switch-control {
  width: 46px;
  height: 26px;
  flex: 0 0 46px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  cursor: pointer;
  position: relative;
  transition: background 140ms ease, border-color 140ms ease;
}
.switch-control::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
  transition: transform 140ms ease;
}
.switch-control:checked { border-color: var(--primary); background: var(--primary); }
.switch-control:checked::after { transform: translateX(20px); }
.switch-control:focus-visible { outline: 3px solid var(--primary-strong); outline-offset: 2px; }
.setting-note { display: block; margin-top: 5px; line-height: 1.45; }
.muted { color: var(--text-muted); font-size: 13px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }

.dev-intro, .dev-diagnostics, .dev-only { display: none; }
.public-only { display: block; }
body[data-app-mode="public"] .dev-only,
body[data-app-mode="public"] .dev-intro,
body[data-app-mode="public"] .dev-diagnostics { display: none !important; }

body[data-app-mode="dev"] {
  --bg: #111111;
  --surface: #1c1c1c;
  --surface-soft: #262626;
  --text: #f5f5f5;
  --text-muted: #aaaaaa;
  --border: #333333;
  --primary: #f2f2f2;
  --primary-strong: #dddddd;
  --primary-soft: #2c2c2c;
  --ai-surface: #1c1c1c;
  --user-surface: #1c1c1c;
  --shadow-sm: none;
  --shadow-md: none;
  color-scheme: dark;
}
body[data-app-mode="dev"] .app-shell { max-width: 720px; padding: 18px 16px 60px; }
body[data-app-mode="dev"] .app-header {
  position: static;
  margin: 0;
  padding: 4px 2px 12px;
  border-bottom: 0;
  background: transparent;
  backdrop-filter: none;
}
body[data-app-mode="dev"] .app-tagline,
body[data-app-mode="dev"] .public-only,
body[data-app-mode="dev"] .talk-label { display: none !important; }
body[data-app-mode="dev"] .dev-only,
body[data-app-mode="dev"] .dev-intro,
body[data-app-mode="dev"] .dev-diagnostics { display: block; }
body[data-app-mode="dev"] .conversation-card,
body[data-app-mode="dev"] .control-dock,
body[data-app-mode="dev"] .settings-panel {
  position: static;
  width: auto;
  max-height: none;
  transform: none;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: none;
  backdrop-filter: none;
  overflow: visible;
}
body[data-app-mode="dev"] .control-dock { display: block; }
body[data-app-mode="dev"] .talk-button {
  width: 100%;
  height: auto;
  min-height: 88px;
  display: block;
  padding: 14px;
  border-radius: 18px;
  background: var(--primary);
  color: #111;
  box-shadow: none;
  font-size: 22px;
  line-height: normal;
  touch-action: auto;
  animation: none;
}
body[data-app-mode="dev"] .talk-recording::before,
body[data-app-mode="dev"] .talk-recording::after,
body[data-app-mode="dev"] .talk-pressed::before,
body[data-app-mode="dev"] .talk-pressed::after { display: none; }
body[data-app-mode="dev"] .status { margin: 8px 0; text-align: left; font-size: 14px; }
body[data-app-mode="dev"] .settings-panel[hidden] { display: block !important; }
body[data-app-mode="dev"] .setting-section { margin: 0; padding: 0; border: 0; }
body[data-app-mode="dev"] .setting-control-row,
body[data-app-mode="dev"] .switch-row { display: block; min-height: 0; margin-top: 12px; color: var(--text); }
body[data-app-mode="dev"] .setting-control-row > label { display: block; margin-bottom: 6px; font-weight: 700; }
body[data-app-mode="dev"] .setting-volume-control { width: 100%; }
body[data-app-mode="dev"] .setting-control-row select,
body[data-app-mode="dev"] .settings-panel .dev-only select { width: 100%; min-height: 42px; border-radius: 10px; background: var(--surface-soft); }
body[data-app-mode="dev"] .switch-row { display: flex; align-items: center; justify-content: space-between; }
body[data-app-mode="dev"] .overlay-root { display: none !important; }
.dev-turn { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.dev-turn:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.who { margin-top: 8px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.who-you { color: #6cb6ff; }
.who-ai { color: #a78bfa; }
.dev-coach { margin-top: 8px; color: #f2cc60; font-size: 13px; line-height: 1.45; }
.setup-state { display: flex; align-items: center; gap: 7px; margin-top: 8px; color: var(--text-muted); font-size: 13px; }
.setup-dot { width: 10px; height: 10px; border-radius: 50%; background: #e55353; }
.setup-dot.on { background: #39d353; }
#metric { margin-top: 10px; font-size: 24px; font-weight: 800; }

@media (min-width: 600px) {
  .overlay-surface,
  .settings-panel {
    top: 50%;
    bottom: auto;
    width: min(calc(100% - 32px), 460px);
    max-height: min(84dvh, 720px);
    transform: translate(-50%, -50%);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-lg);
  }
  .overlay-scroll { max-height: min(72dvh, 620px); }
  body[data-app-mode="dev"] .settings-panel { transform: none; }
}

@media (max-width: 380px) {
  .app-shell { padding-left: 10px; padding-right: 10px; }
  .app-header { margin-left: -10px; margin-right: -10px; padding-left: 14px; padding-right: 12px; }
  .message-stack { max-width: 81%; }
  .avatar { flex-basis: 34px; width: 34px; height: 34px; }
  .avatar .ui-svg { width: 18px; height: 18px; }
  .bubble { padding: 11px 12px; }
  .message-text { font-size: var(--font-body); }
  .voice-waves { width: 42px; gap: 3px; }
  .talk-button { width: 70px; height: 70px; }
  .dock-meta { gap: 38px; }
  .overlay-scroll { padding-left: 14px; padding-right: 14px; }
}

@media (max-width: 480px) {
  body[data-app-mode="public"] .setting-control-row { flex-direction: column; align-items: stretch; gap: var(--space-sm); }
  body[data-app-mode="public"] .setting-control-row select { width: 100%; flex-basis: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .switch-control, .switch-control::after { transition: none; }
  .talk-button, .talk-recording, .talk-pressed, .talk-speaking { animation: none !important; }
  .talk-recording::before, .talk-recording::after,
  .talk-pressed::before, .talk-pressed::after { display: none !important; }
  body[data-app-mode="public"] .voice-waves span { animation: none !important; }
  .score-ring-fg { animation: none; }
  .score-pill-arc { animation: none !important; }
}
