:root {
  --bg: #f3efe6;
  --bg-deep: #e7e0d2;
  --ink: #1a2420;
  --ink-muted: #5a675f;
  --brand: #0c4a3e;
  --brand-soft: #1a6b5a;
  --accent: #c45c26;
  --accent-soft: #f0d5c4;
  --card: #fffdf8;
  --line: #d4cdc0;
  --ok: #2f6b4f;
  --warn: #9a4a1c;
  --radius: 12px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;
  --shadow: 0 12px 40px rgba(26, 36, 32, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, #dfece7 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #f2ddd0 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.45;
}

body {
  min-height: 100vh;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
select,
input {
  font: inherit;
}

#app,
.shell {
  min-height: 100vh;
}

.shell {
  display: grid;
  grid-template-rows: auto 1fr;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.75rem;
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  z-index: 5;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  color: var(--brand);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
}

.nav a {
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 0.95rem;
}

.nav a.is-active,
.nav a:hover {
  color: var(--brand);
  text-decoration: none;
}

.lang-switch {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.lang-switch select {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  color: var(--ink);
}

.hero {
  padding: 1.5rem 0 2rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.05;
  margin: 0 0 0.75rem;
  color: var(--brand);
  letter-spacing: -0.03em;
}

.hero p {
  margin: 0 0 1.5rem;
  max-width: 34rem;
  color: var(--ink-muted);
  font-size: 1.1rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.25rem;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--brand);
  color: #f7faf8;
}

.btn-primary:hover {
  background: var(--brand-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--line));
}

.btn-accent {
  background: var(--accent);
  color: #fff8f3;
}

.btn-soft {
  background: var(--accent-soft);
  color: var(--warn);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.9rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  margin: 0 0 0.85rem;
  color: var(--brand);
}

.muted {
  color: var(--ink-muted);
}

.stack {
  display: grid;
  gap: 0.85rem;
}

.topic {
  padding: 0.25rem 0 1.25rem;
}

.topic-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.set-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.set-list a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.set-list a:hover {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
}

.set-kind {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  font-weight: 700;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.35rem;
  box-shadow: var(--shadow);
}

.player {
  display: grid;
  gap: 1.25rem;
}

.phrase-stage {
  min-height: 8.5rem;
  display: grid;
  align-content: center;
  gap: 0.65rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  background:
    linear-gradient(160deg, #f7f3ea, #eef5f1 70%);
  border: 1px dashed var(--line);
}

.phrase-line {
  font-size: 1.45rem;
  font-weight: 600;
  margin: 0;
}

.phrase-line.known {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink-muted);
}

.phrase-guide {
  margin: 0.15rem 0 0;
  font-size: 0.95rem;
  font-weight: 500;
  font-style: italic;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

.phrase-line.known + .phrase-guide {
  font-size: 0.85rem;
}

.side-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--brand);
}

.transport {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
}

.chip.is-on {
  background: color-mix(in srgb, var(--brand) 12%, white);
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  color: var(--brand);
}

.progress {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.92rem;
  color: var(--ink-muted);
}

.meter {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-deep);
  overflow: hidden;
}

.meter > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  width: var(--pct, 0%);
}

.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.field label {
  font-weight: 650;
  font-size: 0.92rem;
}

.field input[type="range"] {
  width: 100%;
}

.field-voice .voice-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.field-voice select {
  width: 100%;
  min-width: 0;
}

.field-hint {
  margin: 0;
  font-size: 0.85rem;
}

.voice-sample {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--brand) 6%, transparent);
  border: 1px solid var(--line);
  word-break: break-word;
}

.mode-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.mode-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.mode-card.is-selected {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.mode-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.mode-card p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.status-banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--brand) 10%, white);
  color: var(--brand);
  font-weight: 600;
}

.error-banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: #fde8e4;
  color: #8a2e1d;
}

.nested {
  margin: 0.4rem 0 0.8rem 1rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--line);
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .mode-pick {
    grid-template-columns: 1fr;
  }

  .phrase-line {
    font-size: 1.25rem;
  }
}
