:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #68736d;
  --soft: #f7f2e8;
  --paper: #fffdf8;
  --line: #ded6c9;
  --green: #1f7a5a;
  --green-dark: #14543e;
  --blue: #315c8c;
  --saffron: #e2953b;
  --rose: #bd4f5a;
  --shadow: 0 18px 50px rgba(45, 36, 22, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(31, 122, 90, 0.08), transparent 38%),
    linear-gradient(315deg, rgba(226, 149, 59, 0.13), transparent 34%),
    var(--soft);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button {
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.lab-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.lab-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
}

.header-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.back-link,
.primary-button,
.prompt {
  min-height: 42px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 800;
}

.back-link {
  padding: 10px 13px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.primary-button {
  padding: 10px 15px;
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  box-shadow: 0 10px 24px rgba(31, 122, 90, 0.18);
}

.primary-button.is-active {
  background: var(--rose);
  border-color: var(--rose);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2rem, 4vw, 4rem);
}

h2 {
  font-size: 1.35rem;
}

.intro {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1.04rem;
}

.lab-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
  align-items: start;
}

.chart-card,
.side-card {
  border: 1px solid rgba(108, 92, 68, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
}

.chart-card {
  padding: 18px;
}

.side-card {
  padding: 22px;
}

.chart-topline {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 16px;
}

.status {
  min-width: 112px;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.status.is-active {
  border-color: rgba(31, 122, 90, 0.35);
  background: rgba(31, 122, 90, 0.09);
  color: var(--green-dark);
}

#vowelChart {
  width: 100%;
  height: auto;
  min-height: 420px;
}

.axis-label {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.target circle {
  fill: rgba(226, 149, 59, 0.14);
  stroke: rgba(226, 149, 59, 0.55);
  stroke-width: 2;
}

.target text {
  fill: var(--ink);
  font-size: 22px;
  font-weight: 900;
  text-anchor: middle;
  font-family: "Noto Sans Devanagari", "Kohinoor Devanagari", "Mangal", sans-serif;
  pointer-events: none;
}

.target .ipa-label {
  fill: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 800;
}

.prompt-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.prompt {
  width: 100%;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.prompt span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.prompt:hover {
  border-color: var(--green);
}

.meter {
  margin-top: 22px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.meter > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.meter-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 32, 27, 0.1);
}

.meter-bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--saffron));
  transition: width 80ms linear;
}

.error-message {
  min-height: 24px;
  margin: 16px 0 0;
  color: #a73535;
  font-weight: 800;
}

.note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 900px) {
  .lab-header,
  .lab-grid {
    grid-template-columns: 1fr;
  }

  .primary-button {
    width: 100%;
  }

  #vowelChart {
    min-height: 300px;
  }
}
