:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --text: #1d1b19;
  --muted: #6b6560;
  --line: #e2ddd6;
  --accent: #c2185b;
  --heading: #1b2559;
  --accent-text: #ffffff;
  --coach: #efeae3;
  --learner: #fbe9ee;
  --good: #1f7a4d;
  --warn: #a15c00;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161514;
    --surface: #211f1d;
    --text: #f1ede8;
    --muted: #a59e96;
    --line: #37332f;
    --accent: #f06d8d;
    --heading: #f1ede8;
    --accent-text: #1b0d12;
    --coach: #2b2825;
    --learner: #3a2129;
    --good: #6fd3a0;
    --warn: #f0b660;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
}

.brand {
  border: 0;
  background: none;
  padding: 0;
  font-weight: 700;
  font-size: 1rem;
  color: var(--heading);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* The logo is dark blue, so it sits on white in both light and dark themes. */
.brand img {
  background: #ffffff;
  border-radius: 6px;
  padding: 2px 4px;
  box-sizing: content-box;
}

h1,
h2 {
  color: var(--heading);
}

.status {
  font-size: 0.8rem;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--warn);
  color: var(--warn);
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

h1 {
  font-size: 1.5rem;
  line-height: 1.25;
  margin: 0 0 8px;
}

h2 {
  font-size: 1.1rem;
  margin: 32px 0 12px;
}

h3 {
  font-size: 1rem;
  margin: 0 0 4px;
}

.lead,
.muted {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 600;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
}

.card p {
  margin: 0 0 8px;
}

.card p:last-child {
  margin-bottom: 0;
}

.track summary,
.brief summary {
  cursor: pointer;
  font-weight: 600;
}

.track .summary-text {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 2px;
}

.scenario-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
}

.scenario {
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.scenario:hover,
.scenario:focus-visible {
  border-color: var(--accent);
}

.scenario small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

button {
  font: inherit;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

a.button {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: none;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

.session-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.session-head button {
  flex-shrink: 0;
}

.chips {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chips li {
  font-size: 0.82rem;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
  min-height: 120px;
}

.bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble.coach {
  background: var(--coach);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.bubble.learner {
  background: var(--learner);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.bubble .who {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 2px;
}

.composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 8px 0 12px;
}

textarea {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}

.error {
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 10px 12px;
}

.scores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.score {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.score .value {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.1;
}

.score .value small {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
}

.score .label {
  font-size: 0.85rem;
  font-weight: 600;
}

.score .note {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 4px 0 0;
}

.pair {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.pair:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.pair .said {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--line);
}

.pair .better {
  color: var(--good);
  font-weight: 600;
}

.pair .why {
  font-size: 0.88rem;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 6px 8px 6px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.table-wrap {
  overflow-x: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

.picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  font-size: 0.9rem;
  color: var(--muted);
}

select {
  font: inherit;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  max-width: 100%;
}

.small {
  font-size: 0.88rem;
}

.switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 4px;
}

.switch button {
  border: 0;
  border-radius: 0;
  background: var(--surface);
}

.switch button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

#mode-note {
  margin: 8px 0 16px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.plan-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  gap: 6px;
}

.plan-list button {
  width: 100%;
  text-align: left;
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.plan-list .done {
  color: var(--muted);
}

.plan-list .mark {
  color: var(--good);
  font-weight: 700;
  min-width: 1em;
}

.timer {
  margin: 0 0 4px;
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.timer.over {
  color: var(--warn);
  font-weight: 600;
}

.bubble audio {
  display: block;
  margin-top: 8px;
  max-width: 100%;
  height: 36px;
}

.options button {
  border-color: var(--accent);
}

.composer-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#mic[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.feedback {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  overflow-wrap: anywhere;
}

.feedback.right {
  border-color: var(--good);
}

.feedback.wrong {
  border-color: var(--warn);
}

.feedback .verdict {
  font-weight: 700;
}

.feedback.right .verdict {
  color: var(--good);
}

.feedback.wrong .verdict {
  color: var(--warn);
}

.feedback p {
  margin: 4px 0 0;
}

.feedback .row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.feedback button,
.compare button {
  padding: 6px 12px;
  font-size: 0.9rem;
}

.compare summary {
  cursor: pointer;
  font-weight: 600;
}

.compare .label {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 10px 0 2px;
}

.bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bar-right button {
  padding: 6px 12px;
  font-size: 0.9rem;
}

.form {
  display: grid;
  gap: 12px;
}

.form label {
  display: grid;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--muted);
}

input {
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  min-width: 0;
}

.form .error,
.form .muted {
  margin: 0;
}

.form button {
  justify-self: start;
}

button.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  text-decoration: underline;
}

#admin-table button,
#admin-table select {
  padding: 4px 8px;
  font-size: 0.85rem;
  margin: 0 4px 4px 0;
}

#admin-table td {
  white-space: nowrap;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  padding: 16px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}

a {
  color: var(--accent);
}

a.brand {
  text-decoration: none;
}

.legal h2 {
  margin-top: 24px;
}
