@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/fraunces.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('/fonts/figtree.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --cream: #f6f0e4;
  --paper: #fffaf0;
  --ink: #1b2421;
  --soft: #5d6a64;
  --line: #e4dac6;
  --emerald: #0e4d43;
  --emerald-2: #156a5c;
  --sage: #bfd3c6;
  --terra: #c9573a;
  --saffron: #e8a33d;
  --radius: 22px;
  --shadow: 0 1px 0 rgba(27, 36, 33, 0.04), 0 18px 40px -24px rgba(14, 77, 67, 0.45);
  --display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --body: 'Figtree', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation; /* no double-tap zoom delay on phones */
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--cream) url('/img/zellige.svg') 0 0 / 220px;
  color: var(--ink);
  font: 400 17px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
:focus-visible {
  outline: 3px solid var(--saffron);
  outline-offset: 3px;
  border-radius: 8px;
}
[hidden] {
  display: none !important;
}

.display {
  font: 560 clamp(2.1rem, 6.2vw, 3.4rem) / 1.04 var(--display);
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
}
.display em {
  font-style: italic;
  color: var(--terra);
}
.lead {
  color: var(--soft);
  font-size: 1.08rem;
  margin: 0 0 1.6em;
  max-width: 34em;
}
.eyebrow {
  margin: 0 0 0.5em;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--emerald-2);
}
.muted {
  color: var(--soft);
}
.fine {
  margin: 2.2em 0 0;
  font-size: 0.8rem;
  color: var(--soft);
  text-align: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  font: 600 1.05rem var(--display);
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, var(--saffron) 0 32%, transparent 34%), var(--emerald);
  box-shadow: 0 0 0 4px rgba(14, 77, 67, 0.12);
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 1.5em;
  border-radius: 999px;
  font-weight: 650;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:active {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.55;
}
.btn-primary {
  background: var(--emerald);
  color: #fdf8ec;
  box-shadow: 0 10px 24px -12px var(--emerald);
}
.btn-primary:hover {
  background: var(--emerald-2);
}
.btn-ghost {
  background: var(--paper);
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.btn-link {
  color: var(--soft);
  text-decoration: underline;
  text-underline-offset: 4px;
  min-height: 44px;
}
.mini {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--emerald-2);
  padding: 0.3em 0;
}

/* boot + toast */
.boot {
  display: grid;
  place-items: center;
  min-height: 100dvh;
}
.boot-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--emerald);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    transform: scale(1.8);
    opacity: 0.35;
  }
}
.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(92vw, 460px);
  padding: 0.9em 1.2em;
  border-radius: 16px;
  background: var(--ink);
  color: #fdf8ec;
  font-size: 0.95rem;
  box-shadow: 0 20px 40px -18px rgba(0, 0, 0, 0.5);
}

/* onboarding */
.onboard {
  min-height: 100dvh;
  display: grid;
}
.onboard-art {
  display: none;
  background: var(--emerald);
  overflow: hidden;
}
.onboard-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.onboard-body {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: clamp(22px, 5vw, 56px);
  display: flex;
  flex-direction: column;
}
.dots {
  display: flex;
  gap: 8px;
  margin: 2.2em 0 2em;
}
.dots i {
  height: 5px;
  flex: 1;
  border-radius: 9px;
  background: var(--line);
  transition: background 0.3s;
}
.dots .done {
  background: var(--sage);
}
.dots .on {
  background: var(--emerald);
}
.step {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2em;
  animation: rise 0.45s ease both;
}
.step > .btn-primary {
  align-self: stretch;
  margin-top: 1.4em;
}
.step > .btn-link {
  align-self: center;
  margin-top: 0.4em;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
.form {
  display: grid;
  gap: 1.1em;
  width: 100%;
}
.field {
  display: grid;
  gap: 0.4em;
}
.field > span {
  font-weight: 650;
  font-size: 0.92rem;
}
.field i {
  font-style: normal;
  font-weight: 400;
  color: var(--soft);
}
.field small,
.switch small {
  color: var(--soft);
  font-size: 0.84rem;
}
.field input {
  min-height: 54px;
  padding: 0 1em;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  width: 100%;
}
.field input:focus {
  outline: none;
  border-color: var(--emerald);
  box-shadow: 0 0 0 4px rgba(14, 77, 67, 0.12);
}
.switch {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.9em;
  align-items: center;
  padding: 0.9em 1em;
  border-radius: 16px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
}
.track {
  width: 46px;
  height: 28px;
  border-radius: 99px;
  background: var(--line);
  position: relative;
  transition: background 0.2s;
}
.track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s;
}
.switch input:checked + .track {
  background: var(--emerald);
}
.switch input:checked + .track::after {
  transform: translateX(18px);
}
.switch input:focus-visible + .track {
  outline: 3px solid var(--saffron);
  outline-offset: 3px;
}
.switch-text {
  display: grid;
}
.mic-test {
  width: 100%;
  display: grid;
  gap: 0.9em;
  justify-items: start;
  padding: 1.2em;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1.5px solid var(--line);
}
.meter {
  width: 100%;
  height: 14px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}
.meter span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--emerald), var(--saffron));
  transition: width 0.08s linear;
}
.hint {
  margin: 0;
  color: var(--soft);
}
.hint.ok {
  color: var(--emerald-2);
  font-weight: 650;
}
.hint.bad {
  color: var(--terra);
}
.how {
  list-style: none;
  counter-reset: how;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.7em;
  width: 100%;
}
.how li {
  counter-increment: how;
  display: grid;
  grid-template-columns: 40px 1fr;
  column-gap: 0.9em;
  padding: 0.9em 1em;
  border-radius: 16px;
  background: var(--paper);
  border: 1.5px solid var(--line);
}
.how li::before {
  content: counter(how);
  grid-row: span 2;
  align-self: center;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sage);
  color: var(--emerald);
  font: 600 1.1rem var(--display);
}
.how span {
  color: var(--soft);
  font-size: 0.93rem;
}

/* home */
.home {
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 18px clamp(16px, 4vw, 36px) 48px;
}
.top {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0 18px;
}
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--emerald);
  color: #fdf8ec;
  font: 600 1.1rem var(--display);
}
.menu {
  position: absolute;
  z-index: 5;
  right: 0;
  top: 58px;
  width: 250px;
  padding: 8px;
  border-radius: 18px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
}
.menu p {
  margin: 0;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--soft);
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu button {
  text-align: left;
  padding: 12px;
  border-radius: 12px;
}
.menu button:hover {
  background: var(--cream);
}
.menu .danger {
  color: var(--terra);
}
.hello {
  display: grid;
  gap: 18px;
  align-items: end;
  margin: 10px 0 22px;
}
.hello .display {
  margin: 0;
}
.stats {
  display: flex;
  gap: 10px;
  margin: 0;
}
.stats div {
  flex: 1;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--paper);
  border: 1.5px solid var(--line);
}
.stats dt {
  font-size: 0.74rem;
  color: var(--soft);
  white-space: nowrap;
}
.stats dd {
  margin: 2px 0 0;
  font: 600 1.6rem/1 var(--display);
  color: var(--emerald);
}
.stats small {
  font-size: 0.6em;
  color: var(--soft);
}
.grid {
  display: grid;
  gap: 16px;
}
.next {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  background: var(--emerald);
  color: #fdf8ec;
  display: grid;
  box-shadow: var(--shadow);
}
.next img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--cream);
}
.next-body {
  padding: 22px 22px 24px;
}
.next .eyebrow {
  color: var(--saffron);
}
.next h2 {
  font: 560 1.9rem/1.08 var(--display);
  margin: 0 0 0.3em;
}
.next p {
  margin: 0 0 1.2em;
  color: #d6e6dd;
}
.next .btn-primary {
  background: var(--saffron);
  color: var(--ink);
  box-shadow: none;
  width: 100%;
}
.level {
  padding: 22px;
  border-radius: 28px;
  background: var(--paper);
  border: 1.5px solid var(--line);
}
.level-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}
.level-head p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--soft);
}
.badge {
  flex: none;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--terra);
  color: #fff8ec;
  font: 600 1.5rem var(--display);
}
.bars {
  display: grid;
  gap: 9px;
}
.bar {
  display: grid;
  grid-template-columns: 7.2em 1fr 1.6em;
  gap: 10px;
  align-items: center;
  font-size: 0.86rem;
}
.bar b {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.bar-track {
  height: 9px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}
.bar-track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--emerald), var(--saffron));
  transition: width 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.tabs {
  display: flex;
  gap: 6px;
  margin: 28px 0 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs button {
  flex: none;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 99px;
  font-weight: 650;
  font-size: 0.93rem;
  color: var(--soft);
}
.tabs .on {
  background: var(--ink);
  color: var(--cream);
}
.lessons {
  display: grid;
  gap: 10px;
}
.lesson {
  display: grid;
  grid-template-columns: 30px 48px 1fr auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 14px 16px;
  border-radius: 20px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
}
.lesson:hover {
  transform: translateY(-2px);
  border-color: var(--sage);
  box-shadow: var(--shadow);
}
.lesson-n {
  font: 600 1.05rem var(--display);
  color: var(--soft);
  text-align: center;
}
.lesson-ico {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--cream);
  color: var(--emerald);
}
.ico {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.lesson-text {
  display: grid;
  min-width: 0;
}
.lesson-text small {
  color: var(--soft);
  font-size: 0.86rem;
}
.lesson-meta {
  font-size: 0.82rem;
  color: var(--soft);
  white-space: nowrap;
}
.lesson-meta em {
  font-style: normal;
  font-weight: 700;
  color: var(--emerald);
}
.chip {
  padding: 5px 10px;
  border-radius: 99px;
  background: var(--saffron);
  color: var(--ink) !important;
}
.lesson.is-next {
  border-color: var(--saffron);
}
.lesson.is-done .lesson-n {
  color: var(--emerald-2);
}
.lesson.is-done .lesson-ico {
  background: var(--sage);
}
.panel,
.empty {
  padding: 20px;
  border-radius: 22px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  margin-bottom: 12px;
}
.empty {
  text-align: center;
  color: var(--soft);
}
.panel h3 {
  font: 560 1.25rem var(--display);
  margin: 0 0 0.6em;
}
.diag,
.ticks,
.cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.diag li {
  display: grid;
  gap: 2px;
  padding-left: 14px;
  border-left: 3px solid var(--saffron);
}
.diag q,
.diag span {
  color: var(--soft);
  font-size: 0.92rem;
}
.diag s,
.fix s {
  color: var(--terra);
  text-decoration-thickness: 1.5px;
}
.ticks li::before {
  content: '✓ ';
  color: var(--emerald-2);
  font-weight: 700;
}
.cards {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.note,
.fix {
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  display: grid;
  gap: 4px;
}
.note p,
.fix p {
  margin: 0;
  font: 500 1.08rem/1.35 var(--display);
}
.note small,
.fix small,
.card-in small {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--emerald-2);
}

/* live session */
.live {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 0 clamp(14px, 4vw, 24px) max(14px, env(safe-area-inset-bottom));
}
.live-top {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  text-align: center;
  padding: 12px 0;
}
.live-top div {
  display: grid;
}
.live-top small {
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--line);
}
.live-dot {
  justify-self: end;
  width: 10px;
  height: 10px;
  margin-right: 14px;
  border-radius: 50%;
  background: var(--line);
}
.live-dot.on {
  background: #2fa36b;
  box-shadow: 0 0 0 5px rgba(47, 163, 107, 0.18);
}
.stage {
  --lv: 0;
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 22px 0 12px;
}
.orb {
  position: relative;
  width: clamp(110px, 26vw, 150px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--saffron), var(--terra) 46%, var(--emerald) 100%);
  transform: scale(calc(1 + var(--lv) * 0.1));
  transition: transform 0.09s linear;
  box-shadow: 0 24px 50px -22px var(--emerald);
}
.orb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.orb span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--emerald);
  opacity: calc(0.12 + var(--lv) * 0.5);
  transform: scale(calc(1.14 + var(--lv) * 0.3));
  transition: transform 0.12s linear, opacity 0.12s linear;
}
.orb span + span {
  border-color: var(--saffron);
  transform: scale(calc(1.3 + var(--lv) * 0.55));
}
.stage[data-mode='listen'] .orb span {
  border-color: var(--terra);
}
.stage[data-mode='wait'] .orb {
  animation: pulse 1.2s ease-in-out infinite;
}
.status {
  margin: 0;
  font: 500 1.15rem var(--display);
  color: var(--emerald);
}
.talk {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 24px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  scroll-behavior: smooth;
}
.talk-hint {
  margin: auto;
  text-align: center;
  color: var(--soft);
  max-width: 22em;
}
.say {
  margin: 0;
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 18px;
  animation: rise 0.3s ease both;
}
.say-coach {
  align-self: flex-start;
  background: var(--cream);
  border-bottom-left-radius: 6px;
}
.say-me {
  align-self: flex-end;
  background: var(--emerald);
  color: #fdf8ec;
  border-bottom-right-radius: 6px;
}
.card-in {
  align-self: stretch;
  padding: 14px 16px;
  border-radius: 18px;
  display: grid;
  gap: 4px;
  animation: rise 0.35s ease both;
}
.card-in p {
  margin: 0;
  font: 500 1.08rem/1.35 var(--display);
}
.card-in.fix {
  background: #fbe9e1;
  border: 1.5px solid #f0c8b9;
}
.card-in.note {
  background: #fdf1d6;
  border: 1.5px solid #f1d9a1;
}
.card-in.result {
  background: var(--sage);
  border: 0;
  gap: 12px;
}
.quick {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0;
  scrollbar-width: none;
}
.quick button {
  flex: none;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 99px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  font-size: 0.9rem;
  font-weight: 600;
}
.quick button:active {
  background: var(--sage);
}
.live-bar {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
}
.mic {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 18px;
  border-radius: 99px;
  background: var(--terra);
  color: #fff8ec;
  font-weight: 650;
}
.mic.on {
  background: var(--emerald);
}

@media (min-width: 900px) {
  .onboard {
    grid-template-columns: 1fr 1fr;
  }
  .onboard-phone-art {
    display: none;
  }
  .onboard-art {
    display: block;
  }
  .onboard-art.no-img {
    background: var(--emerald) url('/img/zellige.svg') 0 0 / 260px;
  }
  .onboard-body {
    justify-content: center;
  }
  .hello {
    grid-template-columns: 1fr auto;
  }
  .stats div {
    min-width: 130px;
  }
  .grid {
    grid-template-columns: 1.25fr 1fr;
  }
  .next {
    grid-template-columns: 1fr 1.1fr;
  }
  .next img {
    height: 100%;
    aspect-ratio: auto;
  }
  .next .btn-primary {
    width: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* phones: illustration on top of the first screen, primary action within thumb reach */
.onboard-phone-art {
  width: 100%;
  height: clamp(130px, 24dvh, 220px);
  object-fit: cover;
  object-position: 50% 28%;
  border-radius: 24px;
  margin-top: 1.2em;
}
@media (max-width: 899px) {
  .dots {
    margin: 1.4em 0 1.4em;
  }
  .live-bar .btn {
    padding: 0 1em;
    font-size: 0.95rem;
  }
  .mic span {
    display: none;
  }
  .mic {
    width: 60px;
    justify-content: center;
    padding: 0;
  }
  .lesson {
    grid-template-columns: 26px 44px 1fr;
  }
  .lesson-meta {
    grid-column: 3;
  }
}
@media (max-width: 899px) {
  .how {
    gap: 0.5em;
  }
  .how li {
    padding: 0.65em 0.9em;
  }
  .how span {
    font-size: 0.88rem;
    line-height: 1.35;
  }
  .step .display {
    font-size: clamp(1.9rem, 8vw, 2.4rem);
  }
}
