@import url("https://fonts.googleapis.com/css2?family=Literata:opsz,wght@7..72,500;700&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
  /* ─── Sentences-specific palette ────────────────────────── */
  --bg-cream: #fff7ef;
  --bg-mint: #eaf7f3;
  --card: rgba(255, 255, 255, 0.82);
  --card-strong: rgba(255, 255, 255, 0.96);
  --ink: #173040;
  --ink-soft: #48616f;
  --coral: #f46d52;
  --coral-soft: rgba(244, 109, 82, 0.16);
  --mint: #2a9d8f;
  --mint-soft: rgba(42, 157, 143, 0.16);
  --sand: #e6b85c;
  --sand-soft: rgba(230, 184, 92, 0.2);
  --ink-accent: #25485f;
  --ink-soft-fill: rgba(37, 72, 95, 0.1);
  --danger: #d1495b;
  --danger-soft: rgba(209, 73, 91, 0.12);
  --shadow: 0 24px 60px rgba(52, 81, 102, 0.14);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --border: rgba(23, 48, 64, 0.08);

  /* ─── Shared design system aliases ─────────────────────── */
  --bg: var(--bg-cream);
  --panel: var(--card);
  --panel-strong: var(--card-strong);
  --line: var(--border);
  --muted: var(--ink-soft);
  --accent: var(--coral);
  --accent-soft: var(--coral-soft);
  --radius-xl: var(--radius-lg);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(244, 109, 82, 0.18), transparent 32%),
    radial-gradient(circle at right 15% top 20%, rgba(42, 157, 143, 0.18), transparent 28%),
    linear-gradient(145deg, var(--bg-cream), var(--bg-mint));
  overflow-x: hidden;
}

button,
textarea,
input,
select {
  font: inherit;
}

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

.background-orb,
.background-grid {
  position: fixed;
  inset: auto;
  pointer-events: none;
}

.background-orb {
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  filter: blur(42px);
  opacity: 0.38;
}

.orb-a {
  top: -10rem;
  right: -7rem;
  background: rgba(244, 109, 82, 0.36);
}

.orb-b {
  bottom: -10rem;
  left: -6rem;
  background: rgba(42, 157, 143, 0.25);
}

.background-grid {
  inset: 0;
  background-image:
    linear-gradient(rgba(23, 48, 64, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 48, 64, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 90%);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 32px));
  margin: 28px auto 44px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
}

.reveal {
  animation: rise-in 0.7s ease both;
}

.reveal:nth-child(2) {
  animation-delay: 0.08s;
}

.reveal:nth-child(3) {
  animation-delay: 0.16s;
}

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  margin-bottom: 24px;
}

.page-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.72rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.75);
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

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

.page-nav-link.nav-launcher {
  background: transparent;
  color: var(--coral);
  font-weight: 600;
  border: 1px solid var(--coral);
}

.page-nav-link.nav-launcher:hover {
  background: var(--coral);
  color: #fff;
}

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

.hero {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  padding: 30px;
  margin-bottom: 24px;
}

.eyebrow,
.section-label,
.setting-label,
.tile-label,
.metric-label,
.attempt-label,
.hvpt-picker-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Literata", serif;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  line-height: 0.96;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1;
}

h3 {
  font-size: 1.2rem;
}

.hero-text,
.metric-detail,
.focus-caption,
.tile-foot,
.feedback-message,
.layout-hint,
.setting-note,
.english-gloss,
.result-body,
.result-line,
.focus-meta,
.add-hint,
.hvpt-status,
.row-english {
  color: var(--ink-soft);
}

.hero-text {
  max-width: 52ch;
  font-size: 1.05rem;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
  margin-top: 22px;
}

.hero-session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-menu {
  position: relative;
  margin-left: auto;
}

.hero-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  list-style: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(23, 48, 64, 0.08);
}

.hero-menu-toggle::-webkit-details-marker {
  display: none;
}

.hero-menu[open] .hero-menu-toggle {
  background: rgba(37, 72, 95, 0.1);
}

.hero-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(23, 48, 64, 0.08);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 36px rgba(23, 48, 64, 0.12);
  backdrop-filter: blur(16px);
  z-index: 6;
}

.hero-menu-button {
  width: 100%;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    opacity 0.18s ease;
}

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

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  transform: none;
  opacity: 0.5;
  box-shadow: none;
}

.button-primary {
  background: linear-gradient(135deg, var(--coral), #ff9068);
  color: white;
  box-shadow: 0 14px 28px rgba(244, 109, 82, 0.26);
}

.button-secondary {
  background: linear-gradient(135deg, var(--mint), #52b7ab);
  color: white;
  box-shadow: 0 14px 28px rgba(42, 157, 143, 0.24);
}

.button-ghost {
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
}

.button-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.button-compact {
  min-height: 36px;
  padding: 8px 13px;
  font-size: 0.9rem;
  box-shadow: none;
}

.hero-metrics {
  display: grid;
  gap: 16px;
}

.metric-block,
.setting-card,
.result-card,
.focus-item,
.sentence-row {
  border-radius: var(--radius-md);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.58)),
    rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(23, 48, 64, 0.08);
}

.metric-block {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 22px;
}

.metric-block strong {
  font-size: 1.35rem;
}

.top-grid,
.library-grid {
  display: grid;
  gap: 24px;
  margin-bottom: 24px;
}

.top-grid {
  grid-template-columns: 1.08fr 0.92fr;
}

.library-grid {
  grid-template-columns: 1fr;
}

.practice,
.session,
.library {
  padding: 24px;
}

.practice-header,
.session-header,
.panel-header,
.prompt-meta,
.library-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.quick-start-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(244, 109, 82, 0.18);
  background:
    linear-gradient(135deg, rgba(244, 109, 82, 0.12), rgba(42, 157, 143, 0.1)),
    rgba(255, 255, 255, 0.72);
}

.quick-start-panel strong,
.quick-start-panel span {
  display: block;
}

.quick-start-panel span {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.4;
}

.quick-start-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.practice-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.practice-session-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill,
.countdown-pill,
.session-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
}

.status-pill.idle,
.countdown-pill {
  background: rgba(37, 72, 95, 0.08);
  color: var(--ink-accent);
}

.status-pill.preview {
  background: var(--sand-soft);
  color: #8e650f;
}

.status-pill.typing {
  background: var(--mint-soft);
  color: #1b6e66;
}

.status-pill.paused {
  background: rgba(37, 72, 95, 0.1);
  color: var(--ink-accent);
}

.status-pill.review {
  background: var(--coral-soft);
  color: #b84833;
}

.session-badge {
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink-accent);
}

.control-stack {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.mode-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mode-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  border: 0;
  min-height: 60px;
  padding: 0.7rem 0.9rem;
  border-radius: 18px;
  background: rgba(37, 72, 95, 0.06);
  color: var(--ink-soft);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

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

.mode-chip-title {
  font-family: "Literata", serif;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.mode-chip-hint {
  font-size: 0.76rem;
  line-height: 1.25;
  color: var(--ink-soft);
}

.mode-chip.is-active {
  background: linear-gradient(135deg, rgba(244, 109, 82, 0.2), rgba(42, 157, 143, 0.2));
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(23, 48, 64, 0.1), 0 10px 22px rgba(23, 48, 64, 0.08);
}

.mode-chip.is-active .mode-chip-hint {
  color: var(--ink-accent);
}

.learning-path-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(23, 48, 64, 0.08);
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.35;
}

.learning-path-strip strong {
  flex: 0 0 auto;
  color: var(--coral);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
}

.settings-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid rgba(23, 48, 64, 0.08);
  background: rgba(255, 255, 255, 0.62);
}

.setting-card {
  display: grid;
  gap: 6px;
  padding: 0 12px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.setting-card + .setting-card:not(.hidden) {
  border-left: 1px solid rgba(23, 48, 64, 0.08);
}

.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.stepper strong {
  min-width: 3ch;
  text-align: center;
  font-size: 1.1rem;
}

.stepper-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(37, 72, 95, 0.08);
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.stepper-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.prompt-stage {
  margin-top: 20px;
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(23, 48, 64, 0.08);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.66));
}

.prompt-stage.preview {
  box-shadow: inset 0 0 0 1px rgba(230, 184, 92, 0.24);
}

.prompt-stage.typing {
  box-shadow: inset 0 0 0 1px rgba(42, 157, 143, 0.2);
}

.prompt-stage.review {
  box-shadow: inset 0 0 0 1px rgba(244, 109, 82, 0.2);
}

.english-gloss {
  margin: 0.65rem 0 0;
  font-size: 0.98rem;
  min-height: 1.2rem;
}

.sentence-display {
  margin-top: 14px;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.4;
  min-height: 4.4rem;
  font-family: "Literata", serif;
}

.sentence-display .token-highlight {
  color: var(--coral);
}

.sentence-display .listen-placeholder {
  display: inline-block;
  font-size: 1.1rem;
  color: var(--ink-soft);
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0;
}

.masked-word {
  display: inline-block;
  position: relative;
  width: calc(var(--letters) * 0.68ch + 1.1rem);
  min-width: 3.2rem;
  height: 1.08em;
  border-radius: 12px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(37, 72, 95, 0.16) 0,
      rgba(37, 72, 95, 0.16) 7px,
      transparent 7px,
      transparent 12px
    ),
    rgba(42, 157, 143, 0.08);
  box-shadow: inset 0 -3px 0 rgba(244, 109, 82, 0.34);
  vertical-align: -0.14em;
}

.masked-word::after {
  content: "?";
  position: absolute;
  inset: auto 0 0.02em;
  text-align: center;
  color: rgba(23, 48, 64, 0.42);
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
}

.hidden-words-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.hidden-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(42, 157, 143, 0.14);
  color: #1d6f67;
  font-weight: 700;
}

.audio-stage {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, rgba(42, 157, 143, 0.15), rgba(255, 255, 255, 0.7));
  border: 1px solid rgba(42, 157, 143, 0.22);
}

.audio-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--mint), #52b7ab);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(42, 157, 143, 0.24);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.audio-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.audio-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.audio-glyph {
  font-size: 0.9rem;
}

.audio-replay-info {
  font-size: 0.88rem;
  color: var(--ink-accent);
  font-weight: 600;
}

.audio-clue-button {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink-accent);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}

.audio-clue-button:hover {
  transform: translateY(-1px);
  background: #fff;
}

.hidden {
  display: none !important;
}

.is-hidden {
  display: none !important;
}

.input-label {
  display: block;
  margin-top: 20px;
  font-weight: 700;
}

.entry-panel {
  display: grid;
}

.sentence-input,
.add-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(23, 48, 64, 0.12);
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
}

.sentence-input {
  min-height: 110px;
  margin-top: 10px;
  resize: vertical;
}

.sentence-input:focus,
.add-input:focus,
.hvpt-select:focus {
  outline: 2px solid rgba(42, 157, 143, 0.24);
  outline-offset: 2px;
}

.sentence-input:disabled {
  opacity: 0.68;
}

.attempt-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.attempt-stat {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(23, 48, 64, 0.08);
}

.attempt-stat strong {
  display: block;
  font-size: 1.2rem;
}

.practice-feedback {
  margin-top: 14px;
  min-height: 1.5rem;
}

.feedback-message,
.layout-hint {
  margin: 0;
  line-height: 1.5;
  font-size: 0.94rem;
}

.layout-hint {
  margin-top: 6px;
  color: var(--danger);
}

.practice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.practice-actions.is-hidden {
  display: none;
}

.result-card {
  margin-top: 20px;
  padding: 20px;
}

.result-card.is-review {
  background:
    linear-gradient(160deg, rgba(244, 109, 82, 0.08), rgba(255, 255, 255, 0.9)),
    rgba(255, 255, 255, 0.7);
}

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.result-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.result-body,
.result-line {
  margin: 0.75rem 0 0;
  line-height: 1.5;
}

.result-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.result-metric {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.7);
}

.result-metric span {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

.result-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.05rem;
}

.result-diff {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.diff-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
}

.diff-label {
  margin-top: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.7rem;
  color: var(--ink-soft);
}

.diff-line {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(23, 48, 64, 0.08);
  background: rgba(255, 255, 255, 0.72);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Literata", serif;
  font-size: 1.05rem;
  line-height: 1.6;
}

.diff-char {
  border-radius: 6px;
}

.diff-char.is-match {
  background: rgba(42, 157, 143, 0.16);
  color: #165a53;
}

.diff-char.is-miss {
  background: rgba(209, 73, 91, 0.18);
  color: #942e3d;
}

.diff-char.is-gap {
  background: rgba(37, 72, 95, 0.08);
  color: var(--ink-soft);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.stat-tile {
  padding: 18px;
  border-radius: var(--radius-md);
  color: var(--ink);
}

.accent-coral {
  background: linear-gradient(160deg, rgba(244, 109, 82, 0.2), rgba(255, 255, 255, 0.92));
}

.accent-mint {
  background: linear-gradient(160deg, rgba(42, 157, 143, 0.18), rgba(255, 255, 255, 0.92));
}

.accent-sand {
  background: linear-gradient(160deg, rgba(230, 184, 92, 0.24), rgba(255, 255, 255, 0.92));
}

.accent-ink {
  background: linear-gradient(160deg, rgba(37, 72, 95, 0.16), rgba(255, 255, 255, 0.92));
}

.stat-tile strong {
  display: block;
  font-size: 1.35rem;
}

.tile-foot {
  display: block;
  font-size: 0.85rem;
  margin-top: 4px;
}

.focus-panel {
  margin-top: 18px;
}

.focus-sentences {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.focus-item {
  padding: 14px 16px;
}

.focus-item strong {
  display: block;
  font-family: "Literata", serif;
  font-size: 1rem;
  line-height: 1.4;
}

.focus-meta {
  margin-top: 6px;
  font-size: 0.94rem;
}

.focus-empty {
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink-soft);
  font-size: 0.94rem;
  border: 1px dashed rgba(23, 48, 64, 0.12);
}

.focus-caption {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

/* ─── Library (sentence bank + add form + HVPT picker) ─── */

.library {
  display: grid;
  gap: 18px;
}

.library-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.order-toggle,
.source-tabs {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(37, 72, 95, 0.06);
  border: 1px solid rgba(23, 48, 64, 0.08);
}

.order-chip,
.source-tab {
  border: 0;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.order-chip.is-active,
.source-tab.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(23, 48, 64, 0.08);
}

.source-row {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(23, 48, 64, 0.08);
}

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

.hvpt-picker-label {
  margin: 0;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}

.hvpt-select {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(23, 48, 64, 0.14);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  min-width: 120px;
}

.hvpt-status {
  grid-column: 1 / -1;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.add-form {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(23, 48, 64, 0.08);
}

.add-form-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 10px;
}

.add-input {
  min-height: 44px;
}

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

.library-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
  color: var(--ink-soft);
  flex-wrap: wrap;
}

.library-queue {
  color: var(--coral);
  font-weight: 700;
}

.sentence-list {
  display: grid;
  gap: 10px;
  max-height: 540px;
  overflow-y: auto;
  padding-right: 4px;
}

.sentence-list::-webkit-scrollbar {
  width: 8px;
}

.sentence-list::-webkit-scrollbar-thumb {
  background: rgba(23, 48, 64, 0.14);
  border-radius: 999px;
}

.library-empty {
  margin: 0;
  padding: 22px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.48);
  color: var(--ink-soft);
  text-align: center;
  border: 1px dashed rgba(23, 48, 64, 0.14);
}

.sentence-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.sentence-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(23, 48, 64, 0.08);
}

.sentence-row.is-current {
  background:
    linear-gradient(160deg, rgba(244, 109, 82, 0.12), rgba(255, 255, 255, 0.94)),
    rgba(255, 255, 255, 0.78);
  box-shadow:
    0 18px 30px rgba(23, 48, 64, 0.12),
    inset 0 0 0 1px rgba(244, 109, 82, 0.24);
}

.sentence-row.is-queued {
  box-shadow: inset 0 0 0 1px rgba(42, 157, 143, 0.28);
}

.sentence-row-body {
  flex: 1;
  min-width: 0;
}

.row-russian {
  margin: 0;
  font-size: 1rem;
  line-height: 1.4;
  font-family: "Literata", serif;
}

.row-english {
  margin: 4px 0 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

.row-meter {
  margin-top: 8px;
  height: 6px;
  border-radius: 999px;
  background: rgba(37, 72, 95, 0.08);
  overflow: hidden;
}

.row-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), #79ccc2);
}

.row-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.row-section {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.row-section.is-new {
  background: rgba(37, 72, 95, 0.08);
  color: var(--ink-accent);
}

.row-section.is-progress {
  background: var(--sand-soft);
  color: #8e650f;
}

.row-section.is-mastered {
  background: var(--mint-soft);
  color: #1b6e66;
}

.sentence-row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  border: 0;
  background: rgba(37, 72, 95, 0.08);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

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

.row-play {
  background: rgba(42, 157, 143, 0.18);
  color: #165a53;
}

.row-pick {
  background: rgba(244, 109, 82, 0.18);
  color: #a3402f;
}

.row-delete {
  background: var(--danger-soft);
  color: var(--danger);
}

.row-current {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  min-height: 36px;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
}

.sentence-row.is-queued .row-current {
  background: var(--mint);
}

@keyframes rise-in {
  from {
    transform: translateY(14px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

  .mode-picker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .mode-picker {
    grid-template-columns: 1fr;
  }

  .mode-chip {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .mode-chip-hint {
    text-align: right;
  }

  .hvpt-picker {
    grid-template-columns: 1fr 1fr;
  }

  .add-form-row {
    grid-template-columns: 1fr;
  }

  .library-header {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 720px) {
  .app-shell {
    display: flex;
    flex-direction: column;
    width: min(100% - 20px, 1240px);
    margin-top: 12px;
  }

  .page-nav {
    order: 1;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-bottom: 12px;
    padding: 8px;
    scroll-padding-inline: 8px;
    -webkit-overflow-scrolling: touch;
  }

  .page-nav-link {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0.55rem 0.8rem;
    font-size: 0.88rem;
  }

  .top-grid {
    order: 2;
    margin-bottom: 14px;
  }

  .hero {
    order: 3;
    margin-bottom: 14px;
  }

  .library-grid {
    order: 4;
  }

  .hero,
  .practice,
  .session,
  .library {
    padding: 16px;
  }

  .hero {
    gap: 16px;
  }

  .hero h1 {
    font-size: 1.85rem;
    line-height: 1.02;
  }

  .hero-text {
    margin-bottom: 0;
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .hero-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .metric-block {
    padding: 14px;
  }

  .metric-block strong {
    font-size: 1.05rem;
  }

  .quick-start-panel {
    grid-template-columns: 1fr;
    margin-top: 14px;
  }

  .quick-start-actions {
    justify-content: stretch;
  }

  .quick-start-actions .button {
    flex: 1 1 150px;
  }

  .control-stack {
    margin-top: 14px;
  }

  .prompt-stage {
    margin-top: 14px;
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .settings-row {
    padding: 10px;
  }

  .attempt-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .attempt-stat,
  .setting-card {
    padding: 0 8px;
  }

  .attempt-label {
    margin-bottom: 6px;
    font-size: 0.64rem;
    letter-spacing: 0.12em;
    line-height: 1.25;
  }

  .attempt-stat strong {
    font-size: 1.05rem;
  }

  .stepper {
    gap: 8px;
  }

  .stepper-button {
    width: 34px;
    height: 34px;
  }

  .sentence-input {
    min-height: 96px;
  }

  .practice-actions,
  .result-actions {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  }

  .practice-actions {
    position: static;
    z-index: 4;
    border: 1px solid rgba(23, 48, 64, 0.08);
    backdrop-filter: none;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 10px;
    padding: 10px;
    margin-top: 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: none;
  }

  .practice-actions .button,
  .result-actions .button {
    width: 100%;
    min-height: 48px;
    padding-inline: 14px;
  }

  .practice-actions.keyboard-open {
    position: static;
    box-shadow: none;
    backdrop-filter: none;
  }

  .hero-actions,
  .hero-session-actions {
    width: 100%;
  }

  .hero-menu {
    margin-left: 0;
  }

  .hero-menu-panel {
    left: 0;
    right: auto;
    max-width: calc(100vw - 40px);
  }

  .sentence-display {
    font-size: 1.15rem;
    min-height: 3.6rem;
  }

  .learning-path-strip {
    align-items: flex-start;
    gap: 8px;
    font-size: 0.82rem;
  }

  .diff-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .diff-label {
    margin-top: 0;
  }

  .audio-stage {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .audio-button,
  .audio-clue-button {
    justify-content: center;
  }

  .sentence-row {
    flex-direction: column;
  }

  .sentence-row-actions {
    align-self: flex-end;
  }
}

@media (max-width: 430px) {
  .app-shell {
    width: min(100% - 14px, 1240px);
  }

  .practice,
  .session,
  .hero,
  .library {
    padding: 14px;
    border-radius: 22px;
  }

  .practice-header,
  .prompt-meta,
  .result-header {
    gap: 10px;
  }

  .status-pill,
  .countdown-pill,
  .session-badge {
    min-height: 32px;
    padding-inline: 0.72rem;
    font-size: 0.82rem;
  }

  .mode-chip {
    min-height: 50px;
    padding: 0.62rem 0.72rem;
    border-radius: 15px;
  }

  .mode-chip-hint {
    font-size: 0.68rem;
    max-width: 15ch;
  }

  .settings-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .setting-card + .setting-card:not(.hidden) {
    border-left: 0;
    border-top: 1px solid rgba(23, 48, 64, 0.08);
    padding-top: 8px;
  }

  .hero-metrics,
  .attempt-strip {
    grid-template-columns: 1fr;
  }

  .result-actions,
  .practice-actions {
    grid-template-columns: 1fr;
  }
}
