@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600&family=Manrope:wght@400;500;700;800&display=swap");

:root {
  --bg: #f5efe4;
  --bg-alt: #e6efe9;
  --panel: rgba(255, 252, 247, 0.8);
  --panel-strong: rgba(255, 252, 247, 0.94);
  --line: rgba(47, 39, 30, 0.1);
  --line-strong: rgba(47, 39, 30, 0.16);
  --ink: #201914;
  --muted: #675a4c;
  --muted-soft: rgba(103, 90, 76, 0.76);
  --accent: #bd6a3b;
  --accent-soft: rgba(189, 106, 59, 0.12);
  --teal: #176a67;
  --teal-soft: rgba(23, 106, 103, 0.12);
  --danger: #c55346;
  --danger-soft: rgba(197, 83, 70, 0.12);
  --shadow: 0 16px 42px rgba(77, 54, 28, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --measure: 18ch;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(189, 106, 59, 0.16), transparent 28%),
    radial-gradient(circle at right 12% top 16%, rgba(23, 106, 103, 0.12), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
  overflow-x: hidden;
}

button {
  font: inherit;
}

.backdrop,
.wash,
.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
}

.wash {
  filter: blur(60px);
  opacity: 0.42;
}

.wash-a {
  inset: -12rem auto auto -8rem;
  width: 24rem;
  height: 24rem;
  background: rgba(189, 106, 59, 0.3);
  border-radius: 999px;
}

.wash-b {
  inset: auto -7rem -12rem auto;
  width: 22rem;
  height: 22rem;
  background: rgba(23, 106, 103, 0.2);
  border-radius: 999px;
}

.grain {
  background-image:
    linear-gradient(rgba(47, 39, 30, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 39, 30, 0.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.42), transparent 86%);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(430px, calc(100% - 20px));
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 0 calc(24px + env(safe-area-inset-bottom));
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.page-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-bottom: 10px;
  padding: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.page-nav::-webkit-scrollbar {
  display: none;
}

.page-nav-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.6rem 0.88rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  transition:
    transform 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.page-nav-link:hover {
  transform: translateY(-1px);
}

.page-nav-link.is-current {
  background: var(--ink);
  color: #fff;
}

.hero,
.practice,
.focus,
.transcript,
.progress-strip {
  margin-bottom: 10px;
}

.hero,
.practice,
.focus,
.transcript {
  padding: 15px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.hero-copy {
  min-width: 0;
}

.hero-actions {
  display: flex;
  justify-content: flex-end;
}

.eyebrow,
.section-kicker,
.metric-label {
  margin: 0 0 0.42rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.03em;
}

h1 {
  font-family: "Fraunces", "Georgia", serif;
  font-size: clamp(1.45rem, 6.1vw, 1.9rem);
  line-height: 0.96;
}

h2,
h3 {
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.15;
}

.lede,
.metric-note,
.section-note,
.rating-key,
.card-caption,
.sentence-original,
.focus-meta,
.nav-status,
.sentence-summary {
  color: var(--muted);
}

.lede {
  max-width: 24ch;
  margin: 0.34rem 0 0;
  font-size: 0.88rem;
  line-height: 1.3;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 0.58rem 0.82rem;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(47, 39, 30, 0.08);
  cursor: pointer;
}

.progress-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 7px 8px;
}

.metric-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 8px 6px;
}

.metric-card + .metric-card {
  border-left: 1px solid rgba(47, 39, 30, 0.08);
}

.metric-card strong {
  font-size: 0.98rem;
  line-height: 1.1;
}

.metric-note,
.rating-key,
.section-note,
.focus-meta,
.sentence-original,
.sentence-summary {
  font-size: 0.89rem;
  line-height: 1.45;
}

.metric-note {
  font-size: 0.78rem;
  line-height: 1.2;
}

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

.state-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.state-new {
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(47, 39, 30, 0.08);
}

.state-needs-work {
  background: var(--danger-soft);
  color: var(--danger);
}

.state-steady {
  background: var(--teal-soft);
  color: var(--teal);
}

.practice {
  background: var(--panel-strong);
}

.practice-header {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.practice-meta-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chunk-heading {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--muted);
}

.practice-tools {
  display: grid;
  gap: 7px;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: inset 0 0 0 1px rgba(47, 39, 30, 0.06);
}

.view-chip {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.82rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition:
    background 160ms ease,
    color 160ms ease;
}

.view-chip.is-active {
  background: var(--ink);
  color: #fff;
}

.practice-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  font-size: 0.84rem;
  color: var(--muted);
}

.summary-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
}

.summary-item strong {
  color: var(--ink);
}

.summary-separator {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(47, 39, 30, 0.22);
}

.practice-card {
  width: 100%;
  border: 0;
  border-radius: 24px;
  padding: 11px 13px 15px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 252, 247, 0.72));
  color: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow:
    inset 0 0 0 1px rgba(47, 39, 30, 0.06),
    0 10px 24px rgba(73, 54, 27, 0.05);
}

.practice-card.is-english {
  background: linear-gradient(180deg, rgba(23, 106, 103, 0.08), rgba(255, 255, 255, 0.92));
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 6px;
}

.card-caption {
  font-size: 0.8rem;
  line-height: 1.2;
  color: var(--muted-soft);
}

.card-body {
  display: grid;
  gap: 9px;
}

.card-line,
.english-line,
.assist-line {
  margin: 0;
}

.card-line,
.english-line {
  max-width: var(--measure);
  font-size: clamp(2.05rem, 8.9vw, 2.6rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: manual;
}

.card-line {
  font-weight: 800;
  color: var(--ink);
  word-spacing: 0.04em;
}

.card-line.is-syllables-only {
  color: var(--teal);
}

.word-token {
  display: inline;
  padding: 0.02em 0.08em 0.08em;
  border-radius: 0.2em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition:
    color 180ms ease,
    background-color 180ms ease;
}

.word-tone-0 {
  color: #231d18;
  background: rgba(47, 39, 30, 0.05);
}

.word-tone-1 {
  color: #8b4d31;
  background: rgba(189, 106, 59, 0.12);
}

.word-tone-2 {
  color: #1d6667;
  background: rgba(23, 106, 103, 0.11);
}

.word-token.is-assist,
.word-token.is-syllables {
  font-weight: 700;
}

.word-token.is-assist.word-tone-0,
.word-token.is-syllables.word-tone-0 {
  color: #355b5a;
  background: rgba(47, 39, 30, 0.04);
}

.word-token.is-assist.word-tone-1,
.word-token.is-syllables.word-tone-1 {
  color: #946146;
  background: rgba(189, 106, 59, 0.1);
}

.word-token.is-assist.word-tone-2,
.word-token.is-syllables.word-tone-2 {
  color: #176a67;
  background: rgba(23, 106, 103, 0.1);
}

.word-punctuation {
  color: rgba(47, 39, 30, 0.72);
}

.assist-line {
  max-width: calc(var(--measure) + 1ch);
  padding-top: 8px;
  border-top: 1px solid rgba(47, 39, 30, 0.08);
  font-size: 1.01rem;
  line-height: 1.52;
  color: var(--teal);
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: manual;
}

.english-line {
  color: var(--ink);
}

.nav-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid rgba(47, 39, 30, 0.08);
}

.nav-status {
  text-align: center;
  font-size: 0.88rem;
}

.rating-panel {
  display: grid;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(47, 39, 30, 0.08);
}

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

.rating-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.rating-button {
  min-height: 58px;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
  box-shadow: inset 0 0 0 1px rgba(47, 39, 30, 0.08);
}

.rating-button:hover,
.focus-item:hover,
.transcript-chunk:hover {
  transform: translateY(-1px);
}

.rating-button.is-active {
  background: var(--ink);
  color: #fff;
}

.rating-number {
  display: block;
  font-size: 1.06rem;
  font-weight: 800;
}

.rating-copy {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  color: inherit;
  opacity: 0.72;
}

.focus-list,
.transcript-list {
  display: grid;
  gap: 10px;
}

.focus-item,
.transcript-chunk {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.68);
  text-align: left;
  color: inherit;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(47, 39, 30, 0.06);
}

.focus-item {
  display: grid;
  gap: 6px;
}

.focus-top,
.transcript-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.focus-title,
.sentence-title {
  font-weight: 800;
  color: var(--ink);
}

.focus-title,
.chunk-copy {
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: manual;
}

.focus-item.is-needs-work,
.transcript-chunk.is-needs-work,
.transcript-section.is-needs-work {
  background: linear-gradient(180deg, rgba(197, 83, 70, 0.08), rgba(255, 255, 255, 0.82));
}

.focus-item.is-steady,
.transcript-chunk.is-steady,
.transcript-section.is-steady {
  background: linear-gradient(180deg, rgba(23, 106, 103, 0.08), rgba(255, 255, 255, 0.8));
}

.focus-item.is-current,
.transcript-chunk.is-current {
  box-shadow:
    inset 0 0 0 2px rgba(23, 106, 103, 0.22),
    0 8px 20px rgba(23, 106, 103, 0.06);
}

.transcript-section {
  padding: 15px 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 0 0 1px rgba(47, 39, 30, 0.05);
}

.sentence-head {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.sentence-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.sentence-title {
  font-size: 0.92rem;
}

.sentence-original,
.chunk-copy {
  margin: 0;
  line-height: 1.48;
  color: var(--ink);
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: manual;
}

.sentence-chunks {
  display: grid;
  gap: 8px;
}

.transcript-chunk {
  display: grid;
  gap: 8px;
}

.chunk-index,
.chunk-score {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.empty-state {
  margin: 0;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
}

@media (max-width: 389px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .progress-strip {
    grid-template-columns: 1fr;
  }

  .metric-card + .metric-card {
    border-left: 0;
    border-top: 1px solid rgba(47, 39, 30, 0.08);
  }

  .practice-meta-top,
  .rating-head,
  .nav-row {
    grid-template-columns: 1fr;
  }

  .practice-meta-top,
  .rating-head {
    display: grid;
  }

  .nav-row {
    text-align: center;
  }

  .page-nav-link {
    min-height: 36px;
    padding: 0.54rem 0.78rem;
  }

  h1 {
    font-size: clamp(1.34rem, 6vw, 1.62rem);
  }

  .lede {
    font-size: 0.84rem;
  }
}
