:root {
  color-scheme: light;
  --bg: #f7f3ea;
  --surface: #fffdf8;
  --ink: #1f211f;
  --muted: #6c7069;
  --line: #ded8ca;
  --accent: #0f766e;
  --accent-2: #b45309;
  --bad: #b91c1c;
  --good: #166534;
  --shadow: 0 14px 30px rgba(31, 33, 31, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.09), transparent 320px),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 760;
  cursor: pointer;
  touch-action: manipulation;
}

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

.app-shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 16px calc(20px + env(safe-area-inset-bottom));
}

.hero {
  padding: 28px 0 18px;
}

.eyebrow,
.position,
.drill-label,
.lesson-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero h1 {
  margin: 8px 0 10px;
  max-width: 11ch;
  font-size: clamp(2.4rem, 16vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero-copy {
  margin: 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.stack {
  display: grid;
  gap: 14px;
}

.lesson-grid {
  display: grid;
  gap: 12px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.76);
}

.segmented button {
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: var(--accent);
  color: white;
}

.lesson-card,
.panel,
.prompt-panel,
.phrase-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow);
}

.lesson-card {
  display: grid;
  gap: 10px;
  width: 100%;
  min-height: 0;
  padding: 16px;
  color: var(--ink);
  text-align: left;
}

.lesson-card__top,
.row,
.nav-actions,
.primary-actions,
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lesson-card__top,
.toggle-row {
  justify-content: space-between;
}

.lesson-title {
  font-size: 1.1rem;
  font-weight: 850;
}

.percent {
  color: var(--accent);
  font-weight: 850;
}

.lesson-focus,
.panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9e2d4;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.panel {
  padding: 16px;
}

.panel h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.compact {
  display: grid;
  gap: 14px;
}

.topbar {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  background: var(--bg);
  backdrop-filter: blur(12px);
}

.topbar h1 {
  margin: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1rem;
}

.icon-button,
.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.icon-button {
  width: 48px;
  padding: 0;
  font-size: 1.8rem;
}

.lesson-view {
  display: grid;
  gap: 14px;
  padding-top: 8px;
}

.image-tile {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 120px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e6efe9;
  color: var(--ink);
  object-fit: cover;
  text-align: center;
}

.image-tile.large {
  min-height: 310px;
}

.image-placeholder {
  gap: 8px;
  padding: 16px;
}

.placeholder-kind,
.placeholder-slot,
.item-kind,
.media-slot {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.placeholder-slot {
  max-width: 100%;
  overflow-wrap: anywhere;
  text-transform: none;
}

.placeholder-mark {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border: 2px solid rgba(15, 118, 110, 0.25);
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.65);
  color: var(--accent);
  font-size: 2.3rem;
  font-weight: 850;
}

.phrase-panel,
.prompt-panel {
  padding: 14px 16px;
  text-align: center;
}

.item-kind {
  margin: 0 0 10px;
}

.georgian {
  margin: 0;
  font-size: clamp(2.5rem, 13vw, 4.3rem);
  font-weight: 850;
  line-height: 1.08;
}

.translit {
  margin: 8px 0 0;
  color: var(--accent-2);
  font-weight: 750;
}

.english {
  margin: 8px 0 0;
  color: var(--muted);
}

.media-slot {
  margin: 14px 0 0;
  text-transform: none;
}

.primary-actions,
.nav-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.nav-actions {
  grid-template-columns: repeat(3, 1fr);
}

.feedback {
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 750;
}

.feedback.good {
  color: var(--good);
}

.feedback.bad {
  color: var(--bad);
}

.drill-view {
  padding-top: 8px;
}

.practice-meter {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.practice-meter .bar {
  grid-column: 1 / -1;
}

.drill-text {
  margin: 8px 0 4px;
  font-size: clamp(2.4rem, 14vw, 4.4rem);
  font-weight: 850;
  line-height: 1.05;
}

.prompt-panel .listen-button {
  margin-top: 12px;
}

.audio-prompt-mark {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin: 18px auto 4px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #e6efe9;
  color: var(--accent);
  font-size: 3rem;
  font-weight: 850;
}

.prompt-image {
  margin-top: 12px;
}

.speak-panel {
  display: grid;
  gap: 12px;
}

.speak-panel .prompt-image {
  min-height: 240px;
  margin-top: 0;
}

.speak-target {
  min-height: 86px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(230, 239, 233, 0.55);
}

.speak-target .georgian {
  color: var(--muted);
  font-size: clamp(2rem, 10vw, 3.4rem);
}

.speak-target.is-revealed .georgian {
  color: var(--ink);
}

.speak-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 8px;
}

.speak-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.option-card {
  min-height: 172px;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

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

.option-card:disabled {
  cursor: default;
  opacity: 1;
}

.option-card.is-correct {
  border-color: rgba(22, 101, 52, 0.5);
  background: rgba(220, 252, 231, 0.88);
}

.option-card.is-wrong {
  border-color: rgba(185, 28, 28, 0.5);
  background: rgba(254, 226, 226, 0.88);
}

.option-card .image-tile {
  height: 100%;
  min-height: 154px;
  border: 0;
  box-shadow: none;
}

.option-card.text-option {
  display: grid;
  place-items: center;
  min-height: 138px;
}

.option-text {
  display: block;
  font-size: clamp(1.7rem, 8vw, 2.6rem);
  font-weight: 850;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.text-option .option-text {
  font-size: clamp(1.24rem, 5.4vw, 2.1rem);
}

.complete-panel {
  display: grid;
  gap: 8px;
  text-align: center;
}

.score {
  margin: 0;
  color: var(--accent);
  font-size: clamp(3rem, 16vw, 5rem);
  font-weight: 900;
  line-height: 0.95;
}

.center {
  justify-content: center;
}

.danger {
  color: var(--bad);
}

code {
  padding: 2px 4px;
  border-radius: 4px;
  background: #eee7da;
}

@media (min-width: 680px) {
  .lesson-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero h1 {
    max-width: 14ch;
  }

  .option-card {
    min-height: 220px;
  }

  .option-card .image-tile {
    min-height: 202px;
  }
}
