/* Fluent — design system. Dark, editorial, restrained. */

:root {
  --bg: #0f1117;
  --panel: #151823;
  --panel-2: #1c202d;
  --input: #11141d;
  --text: #e9ebf1;
  --muted: #8f97ab;
  --accent: #2dd4bf;
  --accent-ink: #062e29;
  --gold: #e3c384;
  --danger: #ef7a72;
  --user: #26324f;
  --tutor: #1d222e;
  --border: #262b3a;
  --border-soft: #1e2330;
  --radius: 14px;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(45, 212, 191, 0.25); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); font-size: 14px; }

/* ---------------------------------------------------------------- ribbon */
.ribbon {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 12px 28px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark,
.mode-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--accent);
}

.brand-mark { width: 21px; height: 21px; }

.wordmark {
  font-family: var(--font-display);
  font-size: 21px;
  letter-spacing: 0.01em;
}

.main-nav { display: flex; gap: 22px; }

.main-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 4px 0;
  transition: color 0.15s;
}

.main-nav a:hover { color: var(--text); }

.main-nav a.active {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.auth-area {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-name { font-size: 14px; color: var(--text); }

/* ---------------------------------------------------------------- buttons */
button {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, opacity 0.15s;
}

button:hover:not(:disabled) { border-color: #39415a; }
button:disabled { opacity: 0.45; cursor: default; }

button.primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 600;
}
button.primary:hover:not(:disabled) { background: #3ce0cb; border-color: transparent; }

button.primary.small { padding: 7px 15px; }
button.wide { width: 100%; }

button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
button.ghost:hover:not(:disabled) { color: var(--text); border-color: transparent; }

button.danger {
  background: transparent;
  border-color: rgba(239, 122, 114, 0.4);
  color: var(--danger);
}
button.danger:hover:not(:disabled) { border-color: var(--danger); }

.button-link { color: var(--accent); text-decoration: none; }

/* ---------------------------------------------------------------- layout */
main {
  max-width: 880px;
  margin: 0 auto;
  padding: 8px 24px 88px;
}

.banner {
  max-width: 880px;
  margin: 18px auto 0;
  padding: 12px 20px;
  border: 1px solid rgba(227, 195, 132, 0.35);
  background: rgba(227, 195, 132, 0.07);
  color: var(--gold);
  border-radius: var(--radius);
  font-size: 14px;
}

.banner code { color: var(--text); }

.hero { padding: 56px 0 10px; }

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(34px, 6vw, 46px);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
}

.hero.compact { padding: 42px 0 6px; }
.hero.compact h1 { font-size: clamp(28px, 5vw, 36px); }

.subtitle {
  color: var(--muted);
  font-size: 16.5px;
  line-height: 1.65;
  max-width: 580px;
  margin: 0;
}

.section-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: var(--muted);
  margin: 40px 0 14px;
}

h1 { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; }

.list-heading {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 24px;
  margin: 36px 0 14px;
}

/* ---------------------------------------------------------------- setup */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.mode-card:hover {
  border-color: rgba(45, 212, 191, 0.45);
  transform: translateY(-1px);
}

.mode-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 28px rgba(45, 212, 191, 0.07);
}

.mode-icon { width: 26px; height: 26px; }

.mode-name { font-size: 16.5px; font-weight: 600; }

.mode-desc { font-size: 14px; color: var(--muted); line-height: 1.55; }

#script-box { margin-top: 20px; }

#script-box label,
.setup-row label {
  display: block;
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

textarea,
select,
input {
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
}

textarea { width: 100%; resize: vertical; }

textarea:focus,
select:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
}

.setup-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  margin-top: 26px;
}

.setup-row label { margin-bottom: 0; align-self: center; }

.setup-row #start-btn,
.setup-row .primary { margin-left: auto; }

.trial-note {
  font-size: 13.5px;
  color: var(--muted);
  margin: 14px 0 0;
  max-width: 560px;
}

/* ---------------------------------------------------------------- about */
.about {
  margin-top: 88px;
  padding-top: 44px;
  border-top: 1px solid var(--border-soft);
}

.about h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 26px;
  margin: 36px 0 12px;
}

.about h2:first-child { margin-top: 0; }

.about p {
  color: var(--muted);
  font-size: 15px;
  max-width: 660px;
  margin: 0 0 14px;
}

.about em { color: var(--text); font-style: italic; }
.about strong { color: var(--text); }

.about details {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 10px;
}

.about summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 550;
}

.about details p { margin: 12px 0 2px; }

.site-footer {
  margin: 64px 0 10px;
  text-align: center;
}

.site-footer p { color: var(--muted); font-size: 13px; }
.site-footer a { color: var(--accent); text-decoration: none; }

/* ---------------------------------------------------------------- live */
.live-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 30px 0 16px;
}

.chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  color: var(--muted);
  background: var(--panel);
}

.chip.status.live { color: var(--accent); border-color: rgba(45, 212, 191, 0.5); }
.chip.status.err { color: var(--danger); border-color: rgba(239, 122, 114, 0.5); }
.chip.status.warn { color: var(--gold); border-color: rgba(227, 195, 132, 0.5); }

.transcript {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  height: 46vh;
  min-height: 300px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.transcript-hint { color: var(--muted); margin: auto; text-align: center; }

.turn {
  max-width: 86%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  background: var(--tutor);
  align-self: flex-start;
}

.turn.user { background: var(--user); align-self: flex-end; }

.turn .who {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}

.live-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.live-hint { color: var(--muted); font-size: 13.5px; margin-top: 12px; }

/* ---------------------------------------------------------------- summary */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}

.metric .value { font-size: 24px; font-weight: 650; }
.metric .label { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin: 18px 0;
}

.card h2 { font-size: 17.5px; margin: 0 0 10px; }
.card p { margin: 0 0 10px; font-size: 14.5px; }

.cta-card {
  border-color: rgba(45, 212, 191, 0.35);
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.06), rgba(45, 212, 191, 0)) , var(--panel);
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

audio { width: 100%; margin: 12px 0 8px; }

#download-audio { display: inline-block; text-decoration: none; color: var(--muted); }
#download-audio:hover { color: var(--text); }

.report h2 { font-size: 16px; margin: 20px 0 8px; }
.report h3 { font-size: 15px; margin: 16px 0 6px; }
.report p { font-size: 14.5px; line-height: 1.65; margin: 8px 0; }
.report ul { margin: 8px 0; padding-left: 20px; }
.report li { font-size: 14.5px; margin: 5px 0; }
.report code {
  background: var(--panel-2);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 13px;
}

/* ---------------------------------------------------------------- progress */
.profile-card .profile-heading {
  display: block;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 16px;
}

.profile-heading::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: 1px;
  background: var(--muted);
}

.profile-heading.issues::before { background: var(--danger); }
.profile-heading.improving::before { background: var(--accent); }
.profile-heading.focus::before { background: var(--gold); }

.profile-card ul { margin: 8px 0; padding-left: 20px; }
.profile-card li { font-size: 14.5px; margin: 4px 0; }

.session-list { display: flex; flex-direction: column; gap: 10px; }

.session-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.session-item:hover { border-color: rgba(45, 212, 191, 0.45); }

.session-item .meta { color: var(--muted); font-size: 13px; }

.tag {
  display: inline-block;
  text-transform: capitalize;
  font-size: 12px;
  color: var(--accent);
  border: 1px solid rgba(45, 212, 191, 0.4);
  border-radius: 999px;
  padding: 2px 11px;
}

.tag.subtle { color: var(--muted); border-color: var(--border); }

/* ---------------------------------------------------------------- dialogs */
dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 720px;
  width: 92%;
  padding: 26px 30px;
}

dialog::backdrop {
  background: rgba(5, 6, 10, 0.65);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

dialog h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 24px;
  margin: 0 0 10px;
}

.trial-dialog { max-width: 440px; }
.trial-dialog p { font-size: 14.5px; line-height: 1.65; }

.auth-dialog { max-width: 400px; }

.auth-dialog form {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
}

.auth-dialog .field span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.auth-dialog input { width: 100%; }

.auth-note { color: var(--accent); font-size: 13.5px; margin: 0; }

.auth-switch { font-size: 13.5px; color: var(--muted); margin: 4px 0 0; }
.auth-switch a { color: var(--accent); text-decoration: none; }

.dialog-x {
  position: absolute;
  top: -8px;
  right: -12px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 15px;
  padding: 8px;
}

.dialog-x:hover { color: var(--text); border: none; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 720px) {
  .ribbon { padding-left: 18px; padding-right: 18px; gap: 16px; }
  .wordmark { font-size: 19px; }
  .main-nav { gap: 14px; }
  .main-nav a { font-size: 13.5px; }
  .hero { padding-top: 40px; }
  .mode-grid { grid-template-columns: 1fr; }
  .setup-row { flex-direction: column; align-items: stretch; }
  .setup-row label { align-self: flex-start; }
  .setup-row #start-btn { margin-left: 0; width: 100%; }
  .turn { max-width: 100%; }
}
