:root {
  color-scheme: light;
  font-family: Inter, "Noto Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --navy-900: #0b2740;
  --navy-700: #123b5d;
  --blue-500: #2f6f9f;
  --green-600: #1e7a4c;
  --green-100: #f1f8f4;
  --orange-500: #e97a1f;
  --ink-900: #1e2933;
  --ink-600: #5b6875;
  --border-300: #d8e0e8;
  --surface-100: #f7f9fc;
  --white: #fff;
  --error-600: #b42318;
  --error-100: #fff1f0;
  --warning-100: #fff6e5;
  --info-100: #eef5fb;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--surface-100); color: var(--ink-900); }
button, audio, input { font: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--blue-500); outline-offset: 3px; }
.page-shell { width: min(100%, 780px); margin: 0 auto; padding: 20px 16px 48px; }
.brand-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; color: var(--navy-900); font-weight: 700; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; background: var(--navy-700); color: var(--white); }
.brand-name { font-size: 18px; }
.spike-label { margin-left: auto; padding: 5px 9px; border: 1px solid var(--border-300); border-radius: 999px; color: var(--ink-600); font-size: 12px; }
.card { padding: 24px 20px; border: 1px solid var(--border-300); border-radius: 16px; background: var(--white); }
.eyebrow, .step-label { margin: 0 0 6px; color: var(--blue-500); font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
h1, h2, p, li, dd { overflow-wrap: anywhere; }
h1 { margin: 0; color: var(--navy-900); font-size: clamp(30px, 8vw, 44px); line-height: 1.08; }
h2 { margin: 0; color: var(--navy-900); font-size: 21px; line-height: 1.3; }
.lead { margin: 14px 0 22px; color: var(--ink-600); font-size: 18px; line-height: 1.55; }
.banner { margin: 16px 0; padding: 14px 16px; border-radius: 10px; line-height: 1.45; }
.banner-info { border-left: 4px solid var(--blue-500); background: var(--info-100); }
.banner-success { border-left: 4px solid var(--green-600); background: var(--green-100); }
.banner-error { border-left: 4px solid var(--error-600); background: var(--error-100); }
.privacy-panel, .api-panel, .recorder-panel, .review-panel, .selected-panel, .transcript-panel, .diagnostics { margin-top: 20px; padding: 18px; border: 1px solid var(--border-300); border-radius: 14px; }
.privacy-panel { background: var(--info-100); }
.privacy-panel ol { padding-left: 22px; line-height: 1.55; }
.section-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.limit-badge { flex: 0 0 auto; max-width: 45%; padding: 5px 9px; border-radius: 999px; background: var(--warning-100); color: #7a4b00; font-size: 12px; font-weight: 700; text-align: center; }
.badge-success { background: var(--green-100); color: var(--green-600); }
.badge-error { background: var(--error-100); color: var(--error-600); }
label { display: block; margin: 16px 0 7px; color: var(--navy-900); font-weight: 700; }
input[type="url"] { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--border-300); border-radius: 10px; color: var(--ink-900); }
.helper-text { margin: 8px 0 14px; color: var(--ink-600); font-size: 14px; line-height: 1.45; }
.metadata-box { margin-top: 14px; padding: 12px; border-radius: 10px; background: var(--surface-100); color: var(--ink-600); line-height: 1.45; }
.prompt { margin: 18px 0; padding: 16px; border-left: 4px solid var(--orange-500); background: var(--surface-100); font-size: 18px; line-height: 1.55; }
.status-line { min-height: 48px; padding: 12px 14px; border-radius: 10px; background: var(--surface-100); color: var(--ink-600); line-height: 1.4; }
.timer-row { display: flex; min-height: 92px; align-items: center; justify-content: center; gap: 12px; }
.timer { font-variant-numeric: tabular-nums; color: var(--navy-900); font-size: 40px; font-weight: 700; }
.recording-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--error-600); box-shadow: 0 0 0 6px rgb(180 35 24 / 12%); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.85); opacity: .65; } }
.action-stack { display: grid; gap: 12px; margin-top: 16px; }
.button { min-height: 50px; width: 100%; padding: 12px 16px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; font-weight: 700; }
.button:disabled { cursor: not-allowed; opacity: .45; }
.button-primary { background: var(--navy-700); color: var(--white); }
.button-primary:hover:not(:disabled) { background: var(--navy-900); }
.button-secondary { border-color: var(--navy-700); background: var(--white); color: var(--navy-700); }
.button-danger { background: var(--error-600); color: var(--white); }
audio { width: 100%; margin-top: 18px; }
.metadata-list { display: grid; gap: 10px; margin: 18px 0 0; }
.metadata-list div { display: grid; grid-template-columns: minmax(120px, .8fr) minmax(0, 1.2fr); gap: 12px; padding-bottom: 9px; border-bottom: 1px solid var(--border-300); }
.metadata-list dt { color: var(--ink-600); font-weight: 600; }
.metadata-list dd { margin: 0; color: var(--ink-900); }
blockquote { margin: 18px 0; padding: 18px; border-left: 4px solid var(--green-600); border-radius: 0 10px 10px 0; background: var(--green-100); color: var(--navy-900); font-size: 21px; line-height: 1.5; }
.diagnostics summary { cursor: pointer; color: var(--navy-700); font-weight: 700; }
.event-log { max-height: 260px; overflow: auto; padding: 12px; border-radius: 10px; background: var(--navy-900); color: #eaf4fb; font-size: 12px; white-space: pre-wrap; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
[hidden] { display: none !important; }
@media (min-width: 640px) {
  .page-shell { padding: 32px 24px 64px; }
  .card { padding: 32px; }
  .action-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-stack .button:only-child { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

.lesson-panel, .feedback-panel { margin-top: 20px; padding: 18px; border: 1px solid var(--border-300); border-radius: 14px; }
select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid var(--border-300);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink-900);
  font: inherit;
}
textarea { min-height: 132px; resize: vertical; line-height: 1.55; }
select:focus-visible, textarea:focus-visible { outline: 3px solid var(--blue-500); outline-offset: 3px; }
.feedback-card { margin-top: 16px; padding: 16px; border: 1px solid var(--border-300); border-radius: 12px; }
.feedback-card h3 { margin: 0 0 8px; color: var(--navy-900); font-size: 17px; }
.feedback-card p { margin: 0; line-height: 1.55; }
.research-correction {
  display: grid;
  gap: 8px;
}

.research-correction p {
  margin: 0;
}

.research-correction-pronunciation {
  border-left: 4px solid var(--blue-500);
  background: var(--info-100);
}

.research-correction-grammar {
  border-left: 4px solid var(--orange-500);
  background: var(--warning-100);
}

.research-correction-vocabulary {
  border-left: 4px solid var(--green-600);
  background: var(--green-100);
}

.research-correction-fluency {
  border-left: 4px solid var(--navy-700);
  background: var(--surface-100);
}

#researchFeedbackStatus {
  margin-top: 16px;
}
.feedback-positive { border-left: 4px solid var(--green-600); background: var(--green-100); }
.feedback-improvement { border-left: 4px solid var(--blue-500); background: var(--info-100); }
.feedback-answer { border-color: var(--navy-700); background: var(--white); }
.feedback-answer blockquote { margin-bottom: 0; }
.feedback-vocabulary { border-left: 4px solid var(--orange-500); background: var(--warning-100); }

.practice-panel, .completion-panel {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--border-300);
  border-radius: 14px;
}
.guided-reading {
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--border-300);
  border-radius: 12px;
  background: var(--white);
  color: var(--navy-900);
  font-size: clamp(21px, 5vw, 25px);
  line-height: 1.6;
}
.guided-phrase { display: inline; }
.pause-mark { padding: 0 .28em; color: var(--orange-500); font-weight: 800; }
.pause-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 12px 0; color: var(--ink-600); font-size: 14px; }
.pause-legend span { white-space: nowrap; }
.ai-disclosure { padding-left: 12px; border-left: 3px solid var(--blue-500); }
.before-after { display: grid; gap: 12px; margin-top: 16px; }
.before-after article { padding: 16px; border: 1px solid var(--border-300); border-radius: 12px; background: var(--surface-100); }
.before-after h3 { margin: 0 0 8px; color: var(--navy-900); }
.before-after p { margin: 0; line-height: 1.55; }
@media (min-width: 640px) { .before-after { grid-template-columns: 1fr 1fr; } }

.consent-row { display: flex; align-items: flex-start; gap: 0.75rem; margin: 1rem 0; }
.consent-row input { width: 1.25rem; height: 1.25rem; margin-top: 0.15rem; }
.diagnostics-inline { margin: 1rem 0; }
.diagnostics-inline summary { cursor: pointer; font-weight: 700; }

.lesson-goal-card {
  border-left: 4px solid var(--blue-500);
  background: var(--info-100);
}

.lesson-goal-card p {
  margin: 0;
  line-height: 1.55;
}

.lesson-goal-try {
  margin-top: 12px !important;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--white);
  color: var(--navy-900);
}

.lesson-goal-try strong {
  margin-right: 4px;
}


/* Public Demo hardening -------------------------------------------------- */
.public-demo-mode .developer-only {
  display: none !important;
}

.public-demo-mode #apiConfigPanel {
  margin-top: 12px;
}

.public-demo-mode #feedbackPanel .action-stack {
  margin-top: 18px;
}

.public-demo-mode #publicTryAgainButton {
  width: 100%;
}
