:root {
  --font-sans: "Poppins", "Avenir Next", Arial, sans-serif;
  --background: oklch(0.85 0.065 274);
  --foreground: oklch(0.22 0.08 280);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.22 0.08 280);
  --primary: oklch(0.33 0.225 269);
  --primary-foreground: oklch(1 0 0);
  --secondary: oklch(0.96 0.018 274);
  --secondary-foreground: oklch(0.33 0.225 269);
  --muted: oklch(0.95 0.015 275);
  --muted-foreground: oklch(0.48 0.055 278);
  --accent: oklch(0.91 0.04 273);
  --accent-foreground: oklch(0.27 0.13 273);
  --border: oklch(0.91 0.035 274);
  --input: oklch(0.88 0.035 274);
  --ring: oklch(0.43 0.2 269);
  --progress-track: oklch(0.91 0.03 274);
  --success: oklch(0.5 0.14 157);
  --success-soft: oklch(0.96 0.035 157);
  --success-border: oklch(0.8 0.09 157);
  --danger: oklch(0.53 0.19 25);
  --danger-soft: oklch(0.97 0.025 20);
  --danger-border: oklch(0.84 0.08 20);
  --cyan-soft: oklch(0.87 0.1 200);
  --lime-soft: oklch(0.91 0.13 126);
  --yellow-soft: #ffbe18;
  --orange-soft: oklch(0.83 0.14 73);
  --emerald-soft: oklch(0.9 0.11 158);
  --shadow-card: 0 10px 28px color-mix(in oklab, var(--foreground) 8%, transparent);
  --shadow-raised: 0 18px 45px color-mix(in oklab, var(--foreground) 13%, transparent);
}

@layer base {
  * {
    border-color: var(--border);
  }
  html {
    scroll-behavior: smooth;
  }
  body {
    margin: 0;
    background: var(--background);
    color: var(--foreground);
    font-family: var(--font-sans);
    letter-spacing: 0;
  }
  button,
  input {
    font: inherit;
  }
  button {
    cursor: pointer;
  }
  button:focus-visible,
  input:focus-visible {
    outline: 3px solid color-mix(in oklab, var(--ring) 28%, transparent);
    outline-offset: 2px;
  }
}

.btn-primary {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border: 0;
  border-radius: 0.75rem;
  padding: 0.7rem 1.15rem;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.85rem;
  font-weight: 700;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.btn-primary svg { width: 1rem; height: 1rem; }
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--foreground);
  box-shadow: 0 8px 18px color-mix(in oklab, var(--primary) 22%, transparent);
}
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.6rem 0.95rem;
  background: var(--card);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease;
}

.btn-secondary svg { width: 0.95rem; height: 0.95rem; }
.btn-secondary:hover { border-color: var(--primary); background: var(--secondary); }

.progress-track {
  height: 0.5rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--progress-track);
}
.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.5s ease;
}
.subject-symbol,
.inline-symbol {
  display: inline-grid;
  place-items: center;
  line-height: 1;
}
.subject-symbol { font-size: 1.35rem; }
.inline-symbol { font-size: 1rem; }
.diagram-glyph {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: clamp(4rem, 10vw, 7rem);
  line-height: 1;
}
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 78px;
  padding: 0 max(4vw, 24px);
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--card) 94%, transparent);
  backdrop-filter: blur(16px);
}
.brand-button {
  justify-self: start;
  border: 0;
  background: transparent;
  padding: 0;
}
.brand-button img {
  display: block;
  width: 188px;
  height: 44px;
  object-fit: contain;
  object-position: left center;
}
.brand-logo-dark {
  display: none !important;
}
.app-header nav {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.nav-link {
  position: relative;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
  padding: 0 1rem;
  font-size: 0.84rem;
  font-weight: 600;
}
.nav-link::after {
  content: "";
  position: absolute;
  right: 1rem;
  bottom: 2px;
  left: 1rem;
  height: 3px;
  border-radius: 3px;
  background: transparent;
}
.nav-link:hover,
.nav-link.is-active {
  color: var(--foreground);
}
.nav-link.is-active::after {
  background: var(--primary);
}
.avatar-button {
  justify-self: end;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid var(--card);
  border-radius: 50%;
  background: var(--accent);
  font-size: 1.3rem;
  box-shadow: 0 0 0 2px var(--primary);
}
.app-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 46px 0 80px;
}
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 28px;
}
.page-heading h1,
.lesson-heading h1,
.subject-header h1,
.result-card h1 {
  margin: 0.25rem 0 0.5rem;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: 0;
}
.page-heading p,
.subject-header p,
.lesson-heading p {
  max-width: 680px;
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.92rem;
  line-height: 1.65;
}
.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.eyebrow-light {
  color: color-mix(in oklab, var(--primary-foreground) 72%, transparent);
}
.streak-chip {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid color-mix(in oklab, var(--orange-soft) 70%, var(--border));
  border-radius: 999px;
  background: var(--card);
  padding: 0.65rem 0.9rem;
  color: var(--foreground);
  font-size: 0.78rem;
}
.streak-chip svg {
  width: 1rem;
  color: var(--danger);
}
.continue-card {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(220px, 0.45fr);
  overflow: hidden;
  border-radius: 8px;
  background: var(--foreground);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-raised);
}
.continue-copy {
  padding: clamp(28px, 5vw, 52px);
}
.continue-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.1rem 0 0.8rem;
}
.continue-title span {
  font-size: 0.75rem;
  color: color-mix(in oklab, var(--primary-foreground) 66%, transparent);
}
.continue-title h2 {
  margin: 0.15rem 0 0;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  letter-spacing: 0;
}
.continue-copy > p:not(.eyebrow) {
  max-width: 580px;
  margin: 0 0 1.4rem;
  color: color-mix(in oklab, var(--primary-foreground) 72%, transparent);
  line-height: 1.65;
}
.continue-progress {
  max-width: 570px;
  margin-bottom: 1.5rem;
}
.continue-progress > div,
.card-progress > div {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.55rem;
  font-size: 0.75rem;
}
.continue-card .bg-progress-track {
  background: color-mix(in oklab, var(--primary-foreground) 18%, transparent);
}
.continue-card .bg-primary {
  background: var(--primary-foreground);
}
.continue-card .btn-primary {
  background: var(--card);
  color: var(--primary);
}
.continue-art {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1rem;
  background: var(--primary);
}
.continue-art svg {
  width: 5rem;
  height: 5rem;
  stroke-width: 1.25;
}
.continue-art span {
  font-size: 0.78rem;
  font-weight: 600;
}
.section-block {
  margin-top: 42px;
}
.section-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 18px;
}
.section-heading-row h2,
.learning-path h2,
.stats-panel h2 {
  margin: 0.3rem 0 0;
  font-size: 1.45rem;
  letter-spacing: 0;
}
.subject-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.subject-card {
  display: flex;
  min-height: 315px;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  padding: 24px;
  box-shadow: var(--shadow-card);
}
.subject-card-top {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.subject-icon {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  color: var(--foreground);
}
.subject-icon svg {
  width: 23px;
  height: 23px;
}
.subject-icon-large {
  width: 76px;
  height: 76px;
}
.subject-icon-large svg {
  width: 36px;
  height: 36px;
}
.subject-symbol-image {
  display: block;
  width: 62%;
  height: 62%;
  object-fit: contain;
}
.subject-cyan {
  background: var(--cyan-soft);
}
.subject-lime {
  background: var(--lime-soft);
}
.subject-yellow {
  background: var(--yellow-soft);
}
.subject-orange {
  background: var(--orange-soft);
}
.subject-emerald {
  background: var(--emerald-soft);
}
.grade-badge,
.heading-badges span {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  border-radius: 999px;
  background: var(--secondary);
  padding: 0.25rem 0.65rem;
  color: var(--secondary-foreground);
  font-size: 0.68rem;
  font-weight: 700;
}
.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  margin-left: auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--muted-foreground);
}
.icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: fill 0.2s ease, transform 0.2s ease;
}
.icon-button.is-pinned {
  background: var(--accent);
  color: var(--primary);
}
.icon-button.is-pinned svg {
  fill: color-mix(in oklab, var(--primary) 18%, transparent);
}
.icon-button:hover svg {
  transform: translateY(-1px);
}
.subject-card h3 {
  margin: 1.25rem 0 0.4rem;
  font-size: 1.3rem;
}
.subject-card > p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.82rem;
  line-height: 1.6;
}
.card-progress {
  margin: auto 0 1.1rem;
  padding-top: 1.5rem;
}
.subject-card .btn-secondary {
  width: 100%;
}
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 24px;
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 0.4rem 0;
  font-size: 0.78rem;
  font-weight: 700;
}
.back-button svg {
  width: 16px;
}
.subject-header {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1.6rem;
  margin-bottom: 34px;
}
.subject-header .h-2 {
  max-width: 600px;
  margin-top: 1.2rem;
}
.heading-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.heading-badges > span:last-child {
  background: var(--card);
}
.learning-path {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  padding: 28px;
  box-shadow: var(--shadow-card);
}
.path-row {
  position: relative;
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 1rem;
  padding: 16px 0;
}
.path-row:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 60px;
  bottom: -16px;
  left: 22px;
  width: 2px;
  background: var(--border);
}
.path-state {
  z-index: 1;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 2px solid var(--primary);
  border-radius: 50%;
  background: var(--card);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 700;
}
.path-state svg {
  width: 19px;
}
.path-state.complete {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}
.path-content {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding: 0 0 18px;
}
.path-content h3 {
  margin: 0.25rem 0;
  font-size: 1rem;
}
.path-content p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.78rem;
}
.path-label {
  color: var(--primary);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.path-action {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 1rem;
}
.path-action > span {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 700;
}
.test-row {
  margin-top: 8px;
}
.test-row .path-content {
  border-bottom: 0;
}
.test-row.is-locked {
  opacity: 0.62;
}
.test-row.is-locked .path-state {
  border-color: var(--muted-foreground);
  color: var(--muted-foreground);
}
.lesson-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 24px;
}
.lesson-heading > span {
  font-size: 0.78rem;
  font-weight: 700;
}
.topic-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 4px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  padding: 4px;
  box-shadow: var(--shadow-card);
}
.topic-tabs button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted-foreground);
  padding: 0.65rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}
.topic-tabs button svg {
  width: 17px;
}
.topic-tabs button span {
  display: grid;
  min-width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 999px;
  background: var(--secondary);
  font-size: 0.62rem;
}
.topic-tabs button.is-active {
  background: var(--primary);
  color: var(--primary-foreground);
}
.topic-tabs button.is-active span {
  background: color-mix(in oklab, var(--primary-foreground) 18%, transparent);
}
.theory-card,
.task-card,
.result-card,
.profile-card,
.stats-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow-card);
}
.theory-card {
  margin-bottom: 22px;
  padding: clamp(24px, 4vw, 40px);
}
.card-kicker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.card-kicker svg {
  width: 17px;
}
.theory-card h2 {
  margin: 1rem 0 0.7rem;
  font-size: 1.45rem;
}
.theory-card > p {
  color: var(--muted-foreground);
  line-height: 1.75;
}
.example-box {
  margin-top: 1.4rem;
  border-left: 4px solid var(--primary);
  background: var(--secondary);
  padding: 1rem 1.2rem;
}
.example-box strong {
  font-size: 0.75rem;
}
.example-box p {
  margin: 0.3rem 0 0;
  font-size: 0.83rem;
}
.theory-document {
  overflow: hidden;
  padding: 0;
}
.theory-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(250px, 0.65fr);
  gap: 2.5rem;
  align-items: center;
  padding: clamp(28px, 5vw, 52px);
}
.theory-intro h2 {
  max-width: 680px;
  margin: 1rem 0 0.8rem;
  font-size: clamp(1.6rem, 3vw, 2.35rem);
}
.theory-intro p {
  max-width: 680px;
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.9rem;
  line-height: 1.8;
}
.topic-diagram {
  display: grid;
  min-height: 210px;
  place-items: center;
  border-radius: 14px;
}
.topic-diagram svg {
  width: min(100%, 300px);
  color: var(--foreground);
}
.topic-diagram svg > * {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.topic-diagram .diagram-dot,
.topic-diagram .diagram-fill {
  fill: currentColor;
  stroke: none;
}
.theory-section,
.worked-example {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 1rem;
  margin: 0 clamp(28px, 5vw, 52px);
  border-top: 1px solid var(--border);
  padding: 28px 0;
}
.theory-section-number {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--secondary);
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 700;
}
.theory-section h3,
.worked-example h3 {
  margin: 0.35rem 0 0.45rem;
  font-size: 1rem;
}
.theory-section p,
.worked-example p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.84rem;
  line-height: 1.7;
}
.formula-box {
  display: grid;
  gap: 0.45rem;
  margin: 0 clamp(28px, 5vw, 52px) 28px;
  border-left: 4px solid var(--primary);
  border-radius: 0 8px 8px 0;
  background: var(--secondary);
  padding: 1.2rem 1.4rem;
}
.formula-box span {
  color: var(--muted-foreground);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.formula-box strong {
  color: var(--foreground);
  font-size: clamp(1.15rem, 2.5vw, 1.65rem);
}
.theory-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--muted);
  padding: 24px clamp(28px, 5vw, 52px);
}
.theory-footer p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.78rem;
}
.tasks-panel {
  animation: reveal 0.2s ease both;
}
.theory-quick-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 12px;
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 0.4rem 0;
  font-size: 0.76rem;
  font-weight: 700;
}
.theory-quick-link svg {
  width: 15px;
}
.theory-quick-link.bottom {
  margin: 12px 0 0;
}
.task-card {
  padding: clamp(24px, 4vw, 40px);
}
.task-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.7rem;
}
.task-top > div {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.task-top p,
.task-top > strong {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.72rem;
}
.difficulty {
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.65rem;
  font-weight: 700;
}
.difficulty-baastase {
  background: var(--success-soft);
  color: var(--success);
}
.difficulty-keskmine {
  background: var(--orange-soft);
  color: var(--foreground);
}
.difficulty-keeruline {
  background: var(--danger-soft);
  color: var(--danger);
}
.task-card > h2 {
  max-width: 760px;
  margin: 2rem 0 1.3rem;
  font-size: 1.35rem;
  line-height: 1.45;
}
.answer-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}
.answer-options.compact {
  margin-top: 1rem;
}
.answer-option {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  color: var(--foreground);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}
.answer-option input {
  position: absolute;
  opacity: 0;
}
.answer-option > span {
  flex: 1;
}
.answer-option svg {
  width: 17px;
  color: var(--muted-foreground);
}
.answer-option.selected {
  border-color: var(--primary);
  background: var(--secondary);
}
.answer-option.selected svg {
  fill: var(--primary);
  color: var(--primary);
}
.input-answer {
  display: block;
  max-width: 460px;
}
.input-answer > span,
.field-label > span {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
}
.input-answer input,
.test-input,
.input-with-icon input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--input);
  border-radius: 8px;
  background: var(--card);
  color: var(--foreground);
  padding: 0 0.9rem;
}
.hint-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.35rem;
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 0.35rem 0;
  font-size: 0.78rem;
  font-weight: 700;
}
.hint-toggle svg {
  width: 16px;
  transition: transform 0.2s ease;
}
.hint-toggle svg.is-open {
  transform: rotate(180deg);
}
.hint-box {
  display: flex;
  gap: 0.7rem;
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--muted);
  padding: 0.9rem 1rem;
  animation: reveal 0.25s ease both;
}
.hint-box svg {
  flex: 0 0 auto;
  width: 17px;
  color: var(--primary);
}
.hint-box p {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.55;
}
.feedback-banner {
  display: flex;
  gap: 0.8rem;
  margin-top: 1rem;
  border: 1px solid;
  border-radius: 8px;
  padding: 1rem;
  animation: feedback-in 0.35s ease both;
}
.feedback-banner > svg {
  flex: 0 0 auto;
  width: 21px;
}
.feedback-banner strong {
  font-size: 0.82rem;
}
.feedback-banner p {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  line-height: 1.5;
}
.feedback-banner.correct {
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success);
}
.feedback-banner.incorrect {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger);
}
.task-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
  margin-top: 1.5rem;
}
.test-list {
  display: grid;
  gap: 14px;
}
.test-question {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  padding: 24px;
  box-shadow: var(--shadow-card);
}
.question-number {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 700;
}
.test-question h2 {
  margin: 0.35rem 0 1rem;
  font-size: 1rem;
  line-height: 1.5;
}
.test-input {
  max-width: 400px;
}
.test-submit {
  position: sticky;
  bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in oklab, var(--card) 94%, transparent);
  padding: 14px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-raised);
}
.test-submit span {
  font-size: 0.75rem;
  font-weight: 600;
}
.result-card {
  max-width: 800px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 52px);
  text-align: center;
}
.result-ring {
  display: grid;
  width: 150px;
  height: 150px;
  margin: 0 auto 1.5rem;
  place-items: center;
  align-content: center;
  border: 10px solid var(--accent);
  border-radius: 50%;
}
.result-ring strong {
  color: var(--primary);
  font-size: 2rem;
}
.result-ring span {
  font-size: 0.7rem;
  color: var(--muted-foreground);
}
.result-card > p {
  color: var(--muted-foreground);
}
.mistake-list {
  margin: 2rem 0;
  text-align: left;
}
.mistake-list h2 {
  font-size: 1rem;
}
.review-row {
  display: flex;
  gap: 0.7rem;
  border-top: 1px solid var(--border);
  padding: 0.9rem 0;
}
.review-row svg {
  flex: 0 0 auto;
  width: 18px;
}
.review-row strong,
.review-row span {
  display: block;
  font-size: 0.75rem;
}
.review-row span {
  margin-top: 0.2rem;
  color: var(--muted-foreground);
}
.review-row.right svg {
  color: var(--success);
}
.review-row.wrong svg {
  color: var(--danger);
}
.profile-layout {
  display: grid;
  grid-template-columns: 1fr 0.85fr;
  gap: 20px;
}
.profile-card,
.stats-panel {
  padding: clamp(24px, 4vw, 36px);
}
.profile-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}
.profile-avatar-large {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  font-size: 2rem;
}
.profile-title h2 {
  margin: 0;
  font-size: 1.25rem;
}
.profile-title p {
  margin: 0.2rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.75rem;
}
.field-label {
  display: block;
  margin-bottom: 1.5rem;
}
.input-with-icon {
  position: relative;
}
.input-with-icon svg {
  position: absolute;
  top: 50%;
  left: 0.9rem;
  width: 16px;
  color: var(--muted-foreground);
  transform: translateY(-50%);
}
.input-with-icon input {
  padding-left: 2.5rem;
}
.profile-card fieldset {
  margin: 0 0 1.5rem;
  border: 0;
  padding: 0;
}
.profile-card legend {
  margin-bottom: 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
}
.avatar-picker {
  display: flex;
  gap: 0.7rem;
}
.avatar-choice {
  position: relative;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  cursor: pointer;
}
.avatar-choice input {
  position: absolute;
  opacity: 0;
}
.avatar-choice span {
  font-size: 1.55rem;
}
.avatar-choice > svg {
  position: absolute;
  right: -2px;
  bottom: -1px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 3px;
}
.avatar-choice.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--accent);
}
.save-note {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.8rem 0 0;
  color: var(--success);
  font-size: 0.72rem;
}
.save-note svg {
  width: 15px;
}
.stats-panel h2 {
  margin: 0 0 1.3rem;
}
.stat-card {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 0.9rem;
  align-items: center;
  border-top: 1px solid var(--border);
  padding: 1.2rem 0;
}
.stat-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--primary);
}
.stat-icon.warm {
  background: var(--orange-soft);
  color: var(--danger);
}
.stat-icon.green {
  background: var(--success-soft);
  color: var(--success);
}
.stat-icon svg {
  width: 20px;
}
.stat-card span,
.stat-card strong,
.stat-card p {
  display: block;
}
.stat-card span {
  color: var(--muted-foreground);
  font-size: 0.7rem;
}
.stat-card strong {
  margin: 0.15rem 0 0.4rem;
  font-size: 1.2rem;
}
.stat-card p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.68rem;
}
.stat-card .h-2 {
  max-width: 240px;
}

@keyframes feedback-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes reveal {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 860px) {
  .subject-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .continue-card {
    grid-template-columns: 1fr;
  }
  .continue-art {
    min-height: 130px;
  }
  .profile-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .app-header {
    grid-template-columns: 1fr auto;
    min-height: auto;
    padding: 12px 16px 0;
  }
  .brand-button img {
    width: 142px;
  }
  .app-header nav {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: space-around;
    margin-top: 8px;
    border-top: 1px solid var(--border);
  }
  .nav-link {
    flex: 1;
    padding: 0 0.4rem;
    font-size: 0.7rem;
  }
  .nav-link::after {
    right: 25%;
    left: 25%;
  }
  .avatar-button {
    width: 38px;
    height: 38px;
  }
  .app-shell {
    width: calc(100% - 28px);
    padding: 30px 0 80px;
  }
  .page-heading {
    align-items: flex-start;
  }
  .page-heading h1,
  .lesson-heading h1,
  .subject-header h1,
  .result-card h1 {
    font-size: 2rem;
  }
  .streak-chip {
    display: none;
  }
  .continue-copy {
    padding: 25px 20px;
  }
  .continue-art {
    display: none;
  }
  .continue-title {
    align-items: flex-start;
  }
  .continue-card .btn-primary {
    width: 100%;
  }
  .section-heading-row {
    align-items: flex-start;
  }
  .section-heading-row .btn-secondary {
    min-width: 0;
    min-height: 38px;
    padding: 0.5rem 0.7rem;
    font-size: 0.66rem;
    white-space: nowrap;
  }
  .subject-grid {
    grid-template-columns: 1fr;
  }
  .subject-card {
    min-height: 285px;
  }
  .subject-header {
    grid-template-columns: 1fr;
  }
  .subject-icon-large {
    width: 62px;
    height: 62px;
  }
  .lesson-heading {
    align-items: flex-start;
  }
  .topic-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .topic-tabs button {
    padding-inline: 0.6rem;
  }
  .theory-intro {
    grid-template-columns: 1fr;
    gap: 1.3rem;
    padding: 24px 20px;
  }
  .topic-diagram {
    min-height: 150px;
  }
  .topic-diagram svg {
    max-height: 140px;
  }
  .theory-section,
  .worked-example {
    margin-inline: 20px;
  }
  .formula-box {
    margin-inline: 20px;
  }
  .theory-footer {
    display: grid;
    padding: 20px;
  }
  .theory-footer .btn-primary {
    width: 100%;
  }
  .learning-path {
    padding: 20px 16px;
  }
  .path-row {
    grid-template-columns: 40px 1fr;
    gap: 0.7rem;
  }
  .path-row:not(:last-child)::before {
    left: 19px;
  }
  .path-state {
    width: 40px;
    height: 40px;
  }
  .path-content {
    display: grid;
  }
  .path-action {
    justify-content: space-between;
  }
  .test-row .path-content > .btn-primary {
    width: 100%;
  }
  .answer-options {
    grid-template-columns: 1fr;
  }
  .task-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .task-actions button {
    width: 100%;
  }
  .test-question {
    grid-template-columns: 1fr;
    padding: 20px 16px;
  }
  .question-number {
    width: 32px;
    height: 32px;
  }
  .test-submit {
    bottom: 16px;
    justify-content: space-between;
  }
  .test-submit .btn-primary {
    min-width: 0;
    padding-inline: 0.8rem;
  }
}

/* Avalik avaleht ja registreerimine */
.is-landing {
  background: #fff;
}
.landing-root {
  min-height: 100vh;
  overflow: hidden;
  background: #fff;
  color: #15154b;
}
.landing-root button,
.landing-root a {
  font-family: var(--font-sans);
}
.landing-header {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  min-height: 104px;
  align-items: center;
  gap: 24px;
  padding: 0 clamp(34px, 4vw, 70px);
  border-bottom: 1px solid #eceefa;
  background: #fff;
}
.landing-brand {
  justify-self: start;
  border: 0;
  background: transparent;
  padding: 0;
}
.landing-brand img {
  display: block;
  width: 270px;
  height: 58px;
  object-fit: contain;
  object-position: left center;
}
.landing-header nav {
  display: flex;
  align-items: center;
  gap: clamp(28px, 5vw, 68px);
}
.landing-header nav a {
  color: #15154b;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}
.landing-actions {
  display: flex;
  justify-self: end;
  align-items: center;
  gap: 12px;
}
.landing-login,
.landing-register,
.landing-primary {
  min-height: 48px;
  border-radius: 14px;
  padding: 0 22px;
  font-size: 0.85rem;
  font-weight: 700;
}
.landing-login {
  border: 1px solid #d0d4e5;
  background: #fff;
  color: #15154b;
}
.landing-register {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  border: 0;
  background: #d0d4ff;
  color: #15154b;
}
.landing-register span,
.landing-primary span {
  font-size: 1.15rem;
}
.landing-hero {
  display: grid;
  grid-template-columns: minmax(440px, 0.92fr) minmax(560px, 1.08fr);
  min-height: 690px;
  overflow: hidden;
  background: #cbd2ff;
}
.landing-hero-copy {
  position: relative;
  z-index: 2;
  align-self: center;
  max-width: 520px;
  padding: 66px 30px 78px clamp(48px, 7vw, 112px);
}
.landing-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 26px;
  color: #0866c7;
  font-size: 0.9rem;
  font-weight: 700;
}
.landing-kicker span {
  width: 13px;
  height: 13px;
  border: 5px solid #e4e7ff;
  border-radius: 50%;
  background: #15154b;
  box-sizing: content-box;
}
.landing-hero h1 {
  margin: 0;
  color: #15154b;
  font-size: clamp(3.35rem, 4.5vw, 4.55rem);
  font-weight: 600;
  letter-spacing: -0.065em;
  line-height: 1.02;
}
.landing-hero h1 strong {
  color: #0765c6;
  font-weight: 600;
}
.landing-lead {
  max-width: 430px;
  margin: 34px 0 26px;
  font-size: 1.02rem;
  line-height: 1.45;
}
.landing-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  border: 0;
  background: #0709a7;
  color: #fff;
  box-shadow: 0 12px 26px rgb(7 9 167 / 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.landing-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgb(7 9 167 / 0.23);
}
.landing-hero-copy > small {
  display: block;
  margin-top: 12px;
  color: #60658b;
  font-size: 0.68rem;
}
.landing-visual {
  position: relative;
  min-height: 690px;
}
.landing-orbit {
  position: absolute;
  width: min(37vw, 560px);
  aspect-ratio: 1;
  top: 50%;
  left: 47%;
  border-radius: 50%;
  background: #858de4;
  transform: translate(-50%, -43%);
}
.landing-device {
  position: absolute;
  width: min(42vw, 610px);
  min-height: 675px;
  top: 82px;
  left: 5%;
  overflow: hidden;
  border: 7px solid #080912;
  border-radius: 30px;
  background: #fff;
  box-shadow: 0 30px 70px rgb(21 21 75 / 0.22);
  transform: rotate(-9deg);
  transform-origin: center;
}
.device-top {
  display: flex;
  height: 104px;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
}
.device-top > b {
  flex: 1;
  color: #67658f;
  font-size: 1.05rem;
  text-align: center;
}
.device-top span {
  color: #0709a7;
  font-size: 1.45rem;
}
.device-stripe {
  height: 28px;
  background: #0709a7;
}
.device-body {
  padding: 30px 36px 55px;
  background: #dce1ff;
}
.device-body > p {
  margin: 0 0 6px;
  color: #555b8b;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.device-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid #b9c1ed;
}
.device-row > span {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: #fff07a;
  color: #15154b;
  font-size: 1.2rem;
}
.device-row small,
.device-row b {
  display: block;
}
.device-row small {
  color: #666b92;
  font-size: 0.65rem;
}
.device-row b {
  margin-top: 2px;
  font-size: 0.82rem;
}
.device-row em {
  color: #0709a7;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 700;
}
.device-course-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px -36px 0;
  padding: 18px 36px 12px;
  border-top: 24px solid #0709a7;
  color: #15154b;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.device-course-divider small {
  color: #0765c6;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0;
}
.device-course-row:nth-of-type(6) > span {
  background: #d8f593;
}
.device-course-row:nth-of-type(7) > span {
  background: #6cd8ea;
}
.landing-section {
  padding: 100px clamp(24px, 8vw, 150px);
}
.landing-section-heading {
  max-width: 680px;
  margin: 0 auto 46px;
  text-align: center;
}
.landing-section-heading > p,
.landing-method > div > p {
  margin: 0 0 10px;
  color: #0765c6;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}
.landing-section-heading h2,
.landing-method h2,
.landing-final h2 {
  margin: 0;
  color: #15154b;
  font-size: clamp(2rem, 3.5vw, 3.2rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.landing-section-heading > span {
  display: block;
  margin-top: 14px;
  color: #666b88;
  font-size: 0.92rem;
  line-height: 1.7;
}
.landing-step-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  max-width: 1180px;
  margin: 0 auto;
}
.landing-step-grid article {
  position: relative;
  min-height: 220px;
  border: 1px solid #e4e6f3;
  border-radius: 24px;
  padding: 30px;
  background: #fff;
  box-shadow: 0 16px 50px rgb(21 21 75 / 0.06);
}
.landing-step-grid article i {
  position: absolute;
  top: 24px;
  right: 25px;
  color: #c2c7dd;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 700;
}
.landing-step-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 16px;
  background: #e6e9ff;
  color: #0709a7;
  font-size: 1.25rem;
  font-weight: 800;
}
.landing-step-grid h3 {
  margin: 24px 0 8px;
  font-size: 1.12rem;
}
.landing-step-grid p,
.landing-subject-card p,
.landing-method > p,
.landing-final p {
  margin: 0;
  color: #666b88;
  font-size: 0.84rem;
  line-height: 1.7;
}
.landing-subjects {
  background: #f5f6ff;
}
.landing-subject-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  max-width: 1120px;
  margin: 0 auto;
}
.landing-subject-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 120px;
  border: 1px solid #e0e3f2;
  border-radius: 20px;
  padding: 22px;
  background: #fff;
}
.landing-subject-card .subject-icon {
  flex: none;
}
.landing-subject-card h3 {
  margin: 0;
  font-size: 1.05rem;
}
.landing-subject-card p {
  margin: 4px 0;
  font-size: 0.72rem;
}
.landing-subject-card div > span {
  color: #8589a2;
  font-size: 0.65rem;
  font-weight: 600;
}
.landing-subject-card > b {
  color: #0709a7;
  font-size: 1.2rem;
}
.landing-method {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 70px;
  padding: 90px clamp(32px, 10vw, 190px);
  background: #15154b;
}
.landing-method h2,
.landing-method > p,
.landing-method > div > p {
  color: #fff;
}
.landing-method > div > p {
  color: #aeb8ff;
}
.landing-method > p {
  font-size: 0.95rem;
  opacity: 0.78;
}
.landing-final {
  padding: 100px 24px;
  text-align: center;
}
.landing-final-mark {
  width: 70px;
  height: 70px;
  margin-bottom: 26px;
  object-fit: cover;
  object-position: left;
  border-radius: 16px;
}
.landing-final p {
  margin: 16px 0 26px;
  font-size: 0.92rem;
}
.landing-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 26px;
  min-height: 100px;
  padding: 0 clamp(24px, 7vw, 120px);
  border-top: 1px solid #e8e9f1;
  color: #7a7e96;
  font-size: 0.68rem;
}
.landing-footer img {
  width: 170px;
  height: 42px;
  object-fit: contain;
}
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(21 21 75 / 0.58);
  backdrop-filter: blur(9px);
}
.auth-dialog {
  position: relative;
  width: min(100%, 430px);
  border-radius: 26px;
  padding: 38px;
  background: #fff;
  box-shadow: 0 30px 90px rgb(10 10 50 / 0.32);
  text-align: left;
}
.auth-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #f0f1fb;
  color: #15154b;
  font-size: 1.4rem;
}
.auth-logo {
  width: 185px;
  height: 44px;
  object-fit: contain;
  object-position: left;
}
.auth-eyebrow {
  margin: 28px 0 8px !important;
  color: #0765c6 !important;
  font-size: 0.67rem !important;
  font-weight: 800;
  letter-spacing: 0.14em;
}
.auth-dialog h2 {
  margin: 0;
  font-size: 1.75rem;
}
.auth-dialog > p:not(.auth-eyebrow) {
  margin: 10px 0 24px;
  color: #666b88;
  font-size: 0.8rem;
  line-height: 1.6;
}
.auth-dialog form,
.auth-dialog label {
  display: grid;
  gap: 8px;
}
.auth-dialog form {
  gap: 16px;
}
.auth-dialog label span {
  font-size: 0.7rem;
  font-weight: 700;
}
.auth-dialog input {
  min-height: 50px;
  box-sizing: border-box;
  border: 1px solid #d7d9e8;
  border-radius: 12px;
  padding: 0 14px;
  color: #15154b;
  background: #fff;
}
.auth-dialog form .landing-primary {
  width: 100%;
  margin-top: 4px;
}
.auth-error {
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff0f0;
  color: #9f2d2d;
  font-size: 0.72rem;
}
.auth-switch {
  width: 100%;
  border: 0;
  padding: 18px 0 8px;
  background: transparent;
  color: #0709a7;
  font-size: 0.72rem;
  font-weight: 700;
}
.auth-dialog > small {
  display: block;
  color: #8a8da2;
  font-size: 0.62rem;
  line-height: 1.5;
  text-align: center;
}
.profile-logout {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 600;
}

@media (max-width: 980px) {
  .landing-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .landing-header nav {
    display: none;
  }
  .landing-hero {
    grid-template-columns: 1fr 1fr;
  }
  .landing-hero-copy {
    padding-left: 40px;
  }
  .landing-hero h1 {
    font-size: clamp(3rem, 5vw, 3.8rem);
  }
  .landing-device {
    left: 8%;
    width: 620px;
  }
  .landing-orbit {
    left: 45%;
    width: 560px;
  }
}

@media (max-width: 760px) {
  .landing-header {
    min-height: 76px;
    padding: 0 18px;
  }
  .landing-brand img {
    width: 168px;
    height: 42px;
  }
  .landing-brand,
  .landing-actions,
  .landing-hero-copy {
    min-width: 0;
  }
  .landing-login {
    display: none;
  }
  .landing-register {
    min-height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 0.72rem;
  }
  .landing-register span {
    display: none;
  }
  .landing-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .landing-hero-copy {
    width: 100%;
    max-width: 520px;
    padding: 60px 24px 46px;
    box-sizing: border-box;
  }
  .landing-kicker {
    font-size: 0.7rem;
  }
  .landing-hero h1 {
    font-size: clamp(2.8rem, 13vw, 3.7rem);
  }
  .landing-lead {
    width: 100%;
    max-width: 100%;
    margin-top: 26px;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
  }
  .landing-visual {
    min-height: 420px;
  }
  .landing-orbit {
    width: 390px;
    top: 48%;
    left: 50%;
  }
  .landing-device {
    width: 410px;
    min-height: 390px;
    top: 34px;
    left: 16%;
    border-width: 5px;
    border-radius: 24px;
  }
  .device-top {
    height: 78px;
    padding: 0 22px;
  }
  .device-top > b {
    font-size: 0.85rem;
  }
  .device-stripe {
    height: 20px;
  }
  .device-body {
    padding: 25px 26px 40px;
  }
  .device-course-divider {
    margin-inline: -26px;
    padding-inline: 26px;
  }
  .device-row {
    grid-template-columns: 40px 1fr auto;
    padding: 11px 0;
  }
  .device-row > span {
    width: 36px;
    height: 36px;
  }
  .landing-section {
    padding: 74px 20px;
  }
  .landing-step-grid,
  .landing-subject-grid,
  .landing-method {
    grid-template-columns: 1fr;
  }
  .landing-step-grid {
    gap: 14px;
  }
  .landing-step-grid article {
    min-height: auto;
  }
  .landing-subject-grid {
    gap: 12px;
  }
  .landing-method {
    gap: 28px;
    padding: 70px 24px;
  }
  .landing-final {
    padding: 74px 20px;
  }
  .landing-footer {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 28px 24px;
    text-align: center;
  }
  .landing-footer img {
    margin: 0 auto;
  }
  .auth-dialog {
    padding: 32px 24px 26px;
  }
}

@media (max-width: 430px) {
  .landing-header {
    gap: 10px;
    padding-inline: 14px;
  }
  .landing-brand img {
    width: 142px;
  }
  .landing-register {
    min-width: 78px;
    padding: 0 10px;
    font-size: 0.65rem;
  }
  .landing-hero-copy {
    padding: 48px 20px 42px;
  }
  .landing-hero h1 {
    font-size: 2.85rem;
  }
  .landing-visual {
    min-height: 365px;
  }
  .landing-orbit {
    width: 330px;
  }
  .landing-device {
    left: 12%;
    width: 370px;
  }
  .landing-subject-card {
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
/* Teema 1 laiendused: alateemade navigatsioon, teooriatabelid ja uued ülesandetüübid. */
.subtopic-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 clamp(28px, 5vw, 52px) 4px;
  padding: 18px 0 0;
}
.subtopic-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--foreground);
  padding: 0.5rem 0.85rem;
  font-size: 0.74rem;
  font-weight: 600;
  text-align: left;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}
.subtopic-chip span {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--secondary);
  color: var(--primary);
  font-size: 0.62rem;
  font-weight: 700;
}
.subtopic-chip:hover {
  border-color: var(--primary);
}
.subtopic-chip.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
}
.subtopic-chip.is-active span {
  background: rgb(255 255 255 / 0.22);
  color: var(--primary-foreground);
}
.tasks-panel .subtopic-nav {
  margin-left: 0;
  margin-right: 0;
  padding-top: 0;
}
.theory-body {
  padding-bottom: 6px;
}
.theory-subtopic-title {
  margin: 22px clamp(28px, 5vw, 52px) 0;
  padding-left: 50px;
  font-size: 1.08rem;
  line-height: 1.4;
}
.theory-list {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted-foreground);
  font-size: 0.84rem;
  line-height: 1.7;
}
.theory-list li + li {
  margin-top: 0.4rem;
}
.theory-steps {
  margin: 0.6rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted-foreground);
  font-size: 0.84rem;
  line-height: 1.7;
}
.theory-steps li + li {
  margin-top: 0.45rem;
}
.theory-result {
  margin-top: 0.6rem !important;
  color: var(--foreground) !important;
  font-weight: 600;
}
.theory-figure {
  margin: 0 clamp(28px, 5vw, 52px);
  padding: 20px 0 0;
}
.theory-figure figcaption {
  margin-top: 0.5rem;
  color: var(--muted-foreground);
  font-size: 0.72rem;
}
.theory-image img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 1rem);
  object-fit: contain;
}
.theory-table-wrap {
  margin: 0 clamp(28px, 5vw, 52px);
  padding: 24px 0 4px;
  overflow-x: auto;
}
.theory-table-wrap h3 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
}
.theory-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.theory-table th,
.theory-table td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.7rem;
  text-align: left;
}
.theory-table th {
  background: var(--secondary);
  color: var(--primary);
  font-size: 0.72rem;
}
.recall-box,
.deeper-box {
  margin: 20px clamp(28px, 5vw, 52px) 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--secondary);
  padding: 18px 20px;
}
.recall-head {
  display: flex;
  gap: 0.75rem;
}
.recall-head svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
  flex: none;
}
.recall-head span,
.deeper-box > span {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--primary);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.recall-head p,
.deeper-box p {
  margin: 0;
  color: var(--foreground);
  font-size: 0.84rem;
  line-height: 1.7;
}
.deeper-box h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}
.deeper-box p + p {
  margin-top: 0.5rem;
}
.formula-box p {
  margin: 0.5rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.76rem;
  line-height: 1.6;
}
.difficulty-1 {
  background: var(--success-soft);
  color: var(--success);
}
.difficulty-2 {
  background: var(--orange-soft);
  color: var(--foreground);
}
.difficulty-3 {
  background: var(--danger-soft);
  color: var(--danger);
}
.difficulty-4 {
  background: var(--primary);
  color: var(--primary-foreground);
}
.task-type-badge {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.3rem 0.6rem;
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--muted-foreground);
}
.task-image {
  margin: 0.9rem 0 0;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-lg, 1rem);
  border: 1px solid var(--border);
  background: #fff;
}
.task-image img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}
.task-title {
  margin: 0.9rem 0 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--foreground);
}
.task-skill {
  margin: 0.8rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.72rem;
  font-weight: 600;
}
.task-intro {
  margin: 0.7rem 0 0;
  padding-left: 1.1rem;
  color: var(--foreground);
  font-size: 0.82rem;
  line-height: 1.7;
}
.task-done-note {
  margin: 0.8rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.72rem;
}
.feedback-explanation {
  margin-top: 0.4rem;
}
.matching-grid {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}
.matching-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  padding: 0.7rem 0.8rem;
  font-size: 0.82rem;
}
.matching-row select {
  min-height: 42px;
  border: 1px solid var(--input);
  border-radius: 8px;
  background: var(--card);
  color: var(--foreground);
  padding: 0 0.6rem;
  font-size: 0.8rem;
}
.ordering-area {
  margin-top: 1rem;
}
.ordering-hint {
  margin: 0 0 0.6rem;
  color: var(--muted-foreground);
  font-size: 0.74rem;
}
.ordering-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.ordering-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--foreground);
  padding: 0.5rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.ordering-chip.is-used {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
}
.ordering-result {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.8rem 0 0;
  padding-left: 1.2rem;
  color: var(--foreground);
  font-size: 0.82rem;
}
.input-answer textarea {
  width: 100%;
  min-height: 110px;
  border: 1px solid var(--input);
  border-radius: 8px;
  background: var(--card);
  color: var(--foreground);
  padding: 0.7rem 0.9rem;
  font: inherit;
}
.model-answer {
  margin-top: 0.6rem;
}
.model-answer .btn-secondary {
  margin-top: 0.7rem;
}
.hint-box > div p + p {
  margin-top: 0.4rem;
}

@media (max-width: 620px) {
  .subtopic-chip {
    font-size: 0.7rem;
  }
  .matching-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .theory-subtopic-title {
    font-size: 1rem;
  }
}

/* 2026 interface polish: consistent surfaces, safer geometry and mobile navigation. */
:root {
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 30px;
  --shadow-card: 0 10px 30px color-mix(in oklab, var(--foreground) 7%, transparent);
  --shadow-raised: 0 24px 60px color-mix(in oklab, var(--foreground) 15%, transparent);
}

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

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

body {
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

.app-root {
  min-height: 100vh;
  background:
    radial-gradient(circle at 9% 8%, color-mix(in oklab, var(--card) 35%, transparent), transparent 26rem),
    linear-gradient(180deg, color-mix(in oklab, var(--background) 92%, #fff) 0, var(--background) 36rem);
}

.app-header {
  min-height: 80px;
  border-bottom-color: color-mix(in oklab, var(--border) 76%, transparent);
  box-shadow: 0 8px 30px color-mix(in oklab, var(--foreground) 4%, transparent);
}

.nav-link,
.avatar-button,
.brand-button,
.icon-button,
.back-button,
.theory-quick-link,
.hint-toggle {
  touch-action: manipulation;
}

.nav-link {
  border-radius: 10px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link:hover {
  background: var(--secondary);
}

.avatar-button {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.avatar-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 0 2px var(--primary), 0 8px 18px color-mix(in oklab, var(--primary) 18%, transparent);
}

.app-shell {
  width: min(1160px, calc(100% - 48px));
}

.page-heading {
  margin-bottom: 32px;
}

.page-heading h1,
.lesson-heading h1,
.subject-header h1,
.result-card h1 {
  letter-spacing: -0.035em;
}

.continue-card {
  position: relative;
  isolation: isolate;
  border: 1px solid color-mix(in oklab, var(--primary-foreground) 10%, transparent);
  border-radius: var(--radius-xl);
  box-shadow: 0 26px 64px color-mix(in oklab, var(--foreground) 20%, transparent);
}

.continue-copy {
  position: relative;
  z-index: 2;
}

.continue-art {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.continue-art::before,
.continue-art::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  background: color-mix(in oklab, var(--primary-foreground) 9%, transparent);
}

.continue-art::before {
  width: 230px;
  height: 230px;
  top: -105px;
  right: -95px;
}

.continue-art::after {
  width: 150px;
  height: 150px;
  bottom: -75px;
  left: -60px;
}

.subject-card,
.learning-path,
.theory-card,
.task-card,
.result-card,
.profile-card,
.stats-panel {
  border-radius: var(--radius-lg);
}

.subject-card {
  min-height: 300px;
  padding: 26px;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.subject-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in oklab, var(--primary) 28%, var(--border));
  box-shadow: 0 20px 42px color-mix(in oklab, var(--foreground) 11%, transparent);
}

.subject-card .btn-secondary {
  border-radius: var(--radius-sm);
}

.learning-path {
  padding: clamp(22px, 3vw, 32px);
}

.path-content {
  min-width: 0;
}

.path-content > div:first-child,
.continue-title > div,
.subject-header > div,
.profile-title > div,
.stat-card > div:last-child {
  min-width: 0;
}

.path-content h3,
.path-content p,
.continue-title h2,
.subject-card h3,
.subject-card p,
.profile-title h2,
.profile-title p {
  overflow-wrap: anywhere;
}

.topic-tabs,
.answer-option,
.input-answer input,
.input-answer textarea,
.matching-row,
.matching-row select {
  border-radius: var(--radius-sm);
}

.test-submit {
  border-radius: var(--radius-md);
}

.auth-overlay {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.auth-dialog {
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  border: 1px solid rgb(255 255 255 / 0.62);
}

.landing-header {
  min-height: 96px;
  border-bottom-color: #e9ebf5;
}

.landing-header nav a {
  position: relative;
}

.landing-header nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -8px;
  left: 0;
  height: 2px;
  border-radius: 999px;
  background: #0709a7;
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.landing-header nav a:hover::after,
.landing-header nav a:focus-visible::after {
  transform: scaleX(1);
}

.landing-login,
.landing-register {
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.landing-login:hover,
.landing-register:hover {
  transform: translateY(-2px);
  border-color: #9da5c4;
  box-shadow: 0 10px 24px rgb(21 21 75 / 0.1);
}

.landing-hero {
  min-height: min(690px, calc(100vh - 96px));
  background:
    radial-gradient(circle at 72% 42%, rgb(255 255 255 / 0.2), transparent 25rem),
    #cbd2ff;
}

.landing-hero-copy {
  padding-top: clamp(56px, 7vw, 90px);
  padding-bottom: clamp(56px, 7vw, 90px);
}

.landing-device {
  border-width: 6px;
  border-radius: 34px;
  box-shadow: 0 34px 80px rgb(21 21 75 / 0.24);
}

.landing-step-grid article,
.landing-subject-card {
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.landing-step-grid article:hover,
.landing-subject-card:hover {
  transform: translateY(-5px);
  border-color: #c8ccef;
  box-shadow: 0 22px 50px rgb(21 21 75 / 0.1);
}

.landing-subject-card > b {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #eef0ff;
}

.landing-method {
  position: relative;
  overflow: hidden;
}

.landing-method::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -210px;
  bottom: -280px;
  border: 80px solid rgb(174 184 255 / 0.09);
  border-radius: 50%;
}

.landing-method > * {
  position: relative;
  z-index: 1;
}

.landing-final .landing-primary {
  min-width: 220px;
}

@media (max-width: 980px) {
  .app-shell {
    width: min(100% - 36px, 1160px);
  }

  .landing-hero {
    min-height: 650px;
  }

  .landing-device {
    left: 3%;
    width: min(620px, 56vw);
  }
}

@media (max-width: 760px) {
  .landing-header {
    min-height: 72px;
  }

  .landing-hero {
    min-height: auto;
  }

  .landing-hero-copy {
    margin-inline: auto;
    padding: 52px 22px 42px;
  }

  .landing-visual {
    min-height: 410px;
  }

  .landing-orbit {
    width: min(88vw, 390px);
  }

  .landing-device {
    width: min(430px, calc(100vw - 42px));
    min-height: 390px;
    top: 34px;
    left: 50%;
    border-width: 5px;
    border-radius: 26px;
    transform: translateX(-50%) rotate(-5deg);
    transform-origin: center;
  }

  .landing-section-heading {
    margin-bottom: 34px;
  }

  .landing-step-grid article,
  .landing-subject-card {
    border-radius: var(--radius-md);
  }

  .landing-method {
    gap: 22px;
  }
}

@media (max-width: 620px) {
  .app-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 68px;
    padding: 10px 14px;
    background: var(--card);
    backdrop-filter: none;
  }

  .brand-button img {
    width: min(150px, 46vw);
    height: 40px;
  }

  .avatar-button {
    width: 40px;
    height: 40px;
  }

  .app-header nav {
    position: fixed;
    z-index: 60;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 12px;
    grid-column: auto;
    width: auto;
    margin: 0;
    border: 1px solid color-mix(in oklab, var(--border) 82%, transparent);
    border-radius: 18px;
    background: color-mix(in oklab, var(--card) 94%, transparent);
    padding: 6px;
    box-shadow: 0 16px 38px color-mix(in oklab, var(--foreground) 18%, transparent);
    backdrop-filter: blur(18px);
  }

  .nav-link {
    min-height: 48px;
    border-radius: 13px;
    font-size: 0.7rem;
  }

  .nav-link:hover,
  .nav-link.is-active {
    background: var(--secondary);
  }

  .nav-link::after {
    right: 30%;
    bottom: 4px;
    left: 30%;
    height: 2px;
  }

  .app-shell {
    width: calc(100% - 28px);
    padding: 28px 0 116px;
  }

  .page-heading {
    display: block;
    margin-bottom: 26px;
  }

  .page-heading h1,
  .lesson-heading h1,
  .subject-header h1,
  .result-card h1 {
    font-size: clamp(1.85rem, 9vw, 2.35rem);
    line-height: 1.08;
  }

  .continue-card,
  .subject-card,
  .learning-path,
  .theory-card,
  .task-card,
  .result-card,
  .profile-card,
  .stats-panel {
    border-radius: var(--radius-md);
  }

  .continue-copy {
    padding: 24px 20px 22px;
  }

  .continue-title {
    gap: 0.8rem;
  }

  .continue-title h2 {
    font-size: clamp(1.45rem, 7vw, 1.9rem);
    line-height: 1.16;
  }

  .continue-title .subject-icon {
    width: 46px;
    height: 46px;
  }

  .continue-title .subject-symbol {
    font-size: 1.65rem;
  }

  .section-block {
    margin-top: 36px;
  }

  .section-heading-row {
    gap: 0.8rem;
  }

  .section-heading-row h2,
  .learning-path h2,
  .stats-panel h2 {
    font-size: 1.3rem;
    line-height: 1.25;
  }

  .subject-card {
    min-height: 270px;
    padding: 22px;
  }

  .subject-card:hover,
  .landing-step-grid article:hover,
  .landing-subject-card:hover {
    transform: none;
  }

  .path-content {
    gap: 0.9rem;
  }

  .path-action {
    width: 100%;
  }

  .path-action .btn-secondary {
    min-width: 104px;
  }

  .lesson-heading {
    display: grid;
  }

  .lesson-heading > span {
    justify-self: start;
    border-radius: 999px;
    background: var(--card);
    padding: 0.45rem 0.7rem;
  }

  .topic-tabs button {
    min-width: 0;
  }

  .task-card,
  .profile-card,
  .stats-panel {
    padding: 22px 18px;
  }

  .task-actions {
    gap: 10px;
  }

  .test-submit {
    bottom: 84px;
  }

  .avatar-picker {
    flex-wrap: wrap;
  }

  .auth-overlay {
    align-items: end;
    padding: 12px;
  }

  .auth-dialog {
    width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: 24px;
    padding: 30px 22px 22px;
  }

  .landing-section {
    padding: 68px 18px;
  }

  .landing-section-heading h2,
  .landing-method h2,
  .landing-final h2 {
    font-size: clamp(1.9rem, 9vw, 2.6rem);
  }

  .landing-step-grid article {
    padding: 24px;
  }

  .landing-subject-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    min-width: 0;
  }

  .landing-subject-card > div {
    min-width: 0;
  }

  .landing-subject-card h3,
  .landing-subject-card p {
    overflow-wrap: anywhere;
  }

  .landing-footer {
    padding-bottom: max(28px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 430px) {
  .landing-header {
    padding-inline: 12px;
  }

  .landing-brand img {
    width: min(140px, 42vw);
  }

  .landing-register {
    min-width: 0;
    min-height: 40px;
    padding-inline: 12px;
  }

  .landing-hero-copy {
    padding: 46px 18px 36px;
  }

  .landing-hero h1 {
    font-size: clamp(2.65rem, 13vw, 3.25rem);
  }

  .landing-kicker {
    gap: 9px;
    font-size: 0.68rem;
    line-height: 1.45;
  }

  .landing-kicker span {
    flex: 0 0 auto;
  }

  .landing-visual {
    min-height: 390px;
  }

  .landing-device {
    width: calc(100vw - 50px);
    transform: translateX(-50%) rotate(-2.5deg);
  }

  .device-top {
    padding-inline: 18px;
  }

  .device-body {
    padding-inline: 20px;
  }

  .device-course-divider {
    margin-inline: -20px;
    padding-inline: 20px;
  }

  .device-row {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
  }

  .device-row > div {
    min-width: 0;
  }

  .device-row b,
  .device-row small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .landing-subject-card {
    padding: 17px;
  }

  .auth-logo {
    width: 168px;
  }
}

@media (max-width: 360px) {
  .app-shell {
    padding-top: 22px;
  }

  .page-heading {
    margin-bottom: 20px;
  }

  .page-heading h1,
  .lesson-heading h1,
  .subject-header h1,
  .result-card h1 {
    font-size: 1.8rem;
  }

  .page-heading p,
  .subject-header p,
  .lesson-heading p {
    font-size: 0.82rem;
    line-height: 1.55;
  }

  .continue-copy {
    padding: 20px 18px;
  }

  .continue-title {
    margin: 0.8rem 0 0.6rem;
  }

  .continue-title h2 {
    font-size: 1.5rem;
  }

  .continue-copy > p:not(.eyebrow) {
    margin-bottom: 1rem;
    line-height: 1.5;
  }

  .continue-progress {
    margin-bottom: 1rem;
  }

  .nav-link {
    min-height: 44px;
    font-size: 0.66rem;
  }
}

@media (hover: none) {
  .btn-primary:hover:not(:disabled),
  .landing-primary:hover,
  .landing-login:hover,
  .landing-register:hover,
  .avatar-button:hover {
    transform: none;
  }
}

/* Dashboard and profile refinements based on the production layout review. */
.continue-card {
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.48fr);
}

.continue-art {
  gap: 0;
  padding: 34px 28px;
  text-align: center;
}

.continue-art::before {
  width: 260px;
  height: 260px;
  top: -120px;
  right: -110px;
}

.continue-art::after {
  width: 190px;
  height: 190px;
  bottom: -100px;
  left: -80px;
}

.continue-art-label {
  margin-bottom: 20px;
  color: color-mix(in oklab, var(--primary-foreground) 72%, transparent);
  font-size: 0.64rem !important;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.continue-art-icon {
  display: grid !important;
  width: 116px;
  height: 116px;
  margin-bottom: 20px;
  place-items: center;
  border: 1px solid color-mix(in oklab, var(--primary-foreground) 28%, transparent);
  border-radius: 32px;
  background: color-mix(in oklab, var(--primary-foreground) 15%, transparent);
  color: var(--primary-foreground);
  font-size: 4rem !important;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18), 0 22px 42px rgb(0 0 0 / 0.13);
  transform: rotate(-4deg);
}

.continue-art strong {
  display: block;
  color: var(--primary-foreground);
  font-size: 1.2rem;
  line-height: 1.2;
}

.continue-art-note {
  margin-top: 8px;
  color: color-mix(in oklab, var(--primary-foreground) 66%, transparent);
  font-size: 0.7rem !important;
  font-weight: 600;
}

.profile-layout {
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  align-items: start;
  gap: 24px;
}

.profile-card,
.stats-panel {
  overflow: hidden;
  padding: clamp(28px, 3.5vw, 42px);
}

.profile-title {
  margin-bottom: 2.25rem;
  padding-bottom: 1.6rem;
  border-bottom: 1px solid var(--border);
}

.profile-avatar-large {
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  font-size: 2.2rem;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--primary) 10%, transparent);
}

.profile-title h2 {
  font-size: 1.35rem;
  line-height: 1.25;
}

.profile-title p {
  font-size: 0.78rem;
}

.field-label {
  width: 100%;
}

.input-with-icon {
  width: 100%;
  max-width: 100%;
}

.input-with-icon > span {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 1rem;
  color: var(--muted-foreground);
  font-size: 0.95rem;
  transform: translateY(-50%);
  pointer-events: none;
}

.input-with-icon input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 54px;
  border-radius: var(--radius-sm);
  padding-left: 2.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-with-icon input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 10%, transparent);
}

.avatar-picker {
  flex-wrap: wrap;
}

.avatar-choice {
  width: 62px;
  height: 62px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.avatar-choice:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0.25rem;
}

.profile-actions .btn-primary,
.profile-actions .profile-logout {
  min-height: 46px;
  padding-inline: 1.15rem;
}

.avatar-choice i {
  position: absolute;
  right: -2px;
  bottom: -1px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 2px solid var(--card);
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 800;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.avatar-choice:has(input:checked) i {
  opacity: 1;
  transform: scale(1);
}

.continue-art-symbol.subject-symbol-image {
  width: 62%;
  height: 62%;
}

.continue-art-icon .continue-art-symbol:not(.subject-symbol-image) {
  font-size: inherit !important;
  font-weight: 400;
}

.diagram-glyph.subject-symbol-image {
  width: 44%;
  height: 44%;
  object-fit: contain;
}

.stats-panel h2 {
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}

.stat-card {
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 1rem;
  min-height: 112px;
  padding: 1.25rem 0;
}

.stat-icon {
  width: 54px;
  height: 54px;
  font-size: 1.25rem;
}

.stat-card strong {
  font-size: 1.35rem;
}

.auth-dialog {
  width: min(100%, 460px);
}

.auth-dialog input:focus {
  border-color: #0709a7;
  outline: 3px solid rgb(7 9 167 / 0.1);
  outline-offset: 1px;
}

@media (max-width: 980px) {
  .continue-card {
    grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.55fr);
  }

  .continue-art-icon {
    width: 102px;
    height: 102px;
    font-size: 3.5rem !important;
  }
}

@media (max-width: 860px) {
  .continue-card {
    grid-template-columns: 1fr;
  }

  .continue-art {
    display: flex;
    min-height: 150px;
    flex-direction: row;
    justify-content: center;
    gap: 18px;
  }

  .continue-art-label {
    display: none;
  }

  .continue-art-icon {
    width: 78px;
    height: 78px;
    margin: 0;
    border-radius: 24px;
    font-size: 2.7rem !important;
  }

  .continue-art-note {
    margin: 0;
  }

  .profile-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .continue-art {
    display: none;
  }

  .profile-card,
  .stats-panel {
    padding: 22px 18px;
  }

  .profile-title {
    margin-bottom: 1.6rem;
    padding-bottom: 1.25rem;
  }

  .profile-avatar-large {
    width: 66px;
    height: 66px;
    font-size: 1.9rem;
  }

  .profile-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-actions .btn-primary,
  .profile-actions .profile-logout {
    width: 100%;
  }

  .stat-card {
    min-height: 100px;
  }
}

/* Theme selector and dark learning workspace. The public landing stays light. */
:root {
  --feature-surface: #15154b;
}

.continue-card {
  background: var(--feature-surface);
  color: #fff;
}

.theme-fieldset {
  margin-top: 0.2rem !important;
  padding-top: 1.35rem !important;
  border-top: 1px solid var(--border) !important;
}

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

.theme-choice {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.theme-choice:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.theme-choice:has(input:checked) {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 13%, transparent);
}

.theme-choice:has(input:focus-visible) {
  outline: 3px solid color-mix(in oklab, var(--ring) 28%, transparent);
  outline-offset: 2px;
}

.theme-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-choice > span:last-child {
  min-width: 0;
}

.theme-choice strong,
.theme-choice small {
  display: block;
}

.theme-choice strong {
  color: var(--foreground);
  font-size: 0.78rem;
}

.theme-choice small {
  margin-top: 2px;
  color: var(--muted-foreground);
  font-size: 0.6rem;
  line-height: 1.35;
}

.theme-preview {
  position: relative;
  display: block;
  width: 64px;
  height: 48px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08);
}

.theme-preview::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 12px;
  background: rgb(255 255 255 / 0.72);
}

.theme-preview i,
.theme-preview b {
  position: absolute;
  display: block;
  border-radius: 4px;
}

.theme-preview i {
  top: 18px;
  left: 7px;
  width: 30px;
  height: 22px;
  background: currentcolor;
  opacity: 0.9;
}

.theme-preview b {
  top: 18px;
  right: 7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #7772ff;
}

.theme-preview-light {
  background: #cbd2ff;
  color: #fff;
}

.theme-preview-dark {
  border-color: #454967;
  background: #15172c;
  color: #292d4c;
}

.theme-preview-dark::before {
  background: #252842;
}

.stats-panel {
  position: sticky;
  top: 104px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --background: oklch(0.17 0.035 276);
  --foreground: oklch(0.96 0.015 275);
  --card: oklch(0.225 0.04 276);
  --card-foreground: oklch(0.96 0.015 275);
  --primary: oklch(0.68 0.18 279);
  --primary-foreground: oklch(0.99 0.005 275);
  --secondary: oklch(0.27 0.042 276);
  --secondary-foreground: oklch(0.9 0.04 278);
  --muted: oklch(0.255 0.035 276);
  --muted-foreground: oklch(0.72 0.04 276);
  --accent: oklch(0.3 0.07 277);
  --accent-foreground: oklch(0.94 0.03 277);
  --border: oklch(0.34 0.04 276);
  --input: oklch(0.4 0.045 276);
  --ring: oklch(0.74 0.16 279);
  --progress-track: oklch(0.31 0.04 276);
  --success: oklch(0.73 0.14 157);
  --success-soft: oklch(0.28 0.06 157);
  --success-border: oklch(0.42 0.1 157);
  --danger: oklch(0.73 0.16 25);
  --danger-soft: oklch(0.27 0.065 25);
  --danger-border: oklch(0.42 0.1 25);
  --cyan-soft: oklch(0.38 0.09 202);
  --lime-soft: oklch(0.39 0.105 126);
  --orange-soft: oklch(0.4 0.105 72);
  --emerald-soft: oklch(0.37 0.09 158);
  --feature-surface: oklch(0.145 0.045 278);
  --shadow-card: 0 14px 34px rgb(0 0 0 / 0.2);
  --shadow-raised: 0 24px 60px rgb(0 0 0 / 0.32);
}

html[data-theme="dark"] body {
  background: var(--background);
}

html[data-theme="dark"] .app-root {
  background:
    radial-gradient(circle at 10% 4%, rgb(115 105 255 / 0.11), transparent 30rem),
    radial-gradient(circle at 90% 85%, rgb(69 196 209 / 0.055), transparent 28rem),
    var(--background);
}

html[data-theme="dark"] .app-header {
  border-bottom-color: rgb(255 255 255 / 0.08);
  background: color-mix(in oklab, var(--card) 92%, transparent);
  box-shadow: 0 12px 34px rgb(0 0 0 / 0.18);
}

html[data-theme="dark"] .brand-button {
  background: transparent;
  padding: 0;
}

html[data-theme="dark"] .brand-logo-light {
  display: none;
}

html[data-theme="dark"] .brand-logo-dark {
  display: block !important;
}

html[data-theme="dark"] .nav-link:hover,
html[data-theme="dark"] .nav-link.is-active {
  background: color-mix(in oklab, var(--primary) 12%, var(--card));
}

html[data-theme="dark"] .avatar-button {
  border-color: var(--card);
  background: var(--secondary);
}

html[data-theme="dark"] .continue-card {
  border-color: rgb(255 255 255 / 0.08);
  background: var(--feature-surface);
  box-shadow: 0 28px 70px rgb(0 0 0 / 0.35);
}

html[data-theme="dark"] .continue-card .btn-primary {
  background: #fff;
  color: #171449;
}

html[data-theme="dark"] .continue-art {
  background: linear-gradient(155deg, #7168ff 0%, #5046e6 46%, #342bbf 100%);
}

html[data-theme="dark"] .subject-card:hover {
  border-color: color-mix(in oklab, var(--primary) 48%, var(--border));
  box-shadow: 0 22px 46px rgb(0 0 0 / 0.28);
}

html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .profile-logout,
html[data-theme="dark"] .avatar-choice,
html[data-theme="dark"] .theme-choice {
  background: color-mix(in oklab, var(--card) 92%, var(--secondary));
}

html[data-theme="dark"] .input-with-icon input,
html[data-theme="dark"] .input-answer input,
html[data-theme="dark"] .input-answer textarea,
html[data-theme="dark"] .test-input,
html[data-theme="dark"] .matching-row select {
  background: var(--secondary);
}

html[data-theme="dark"] .streak-chip {
  border-color: color-mix(in oklab, var(--orange-soft) 52%, var(--border));
  background: var(--card);
}

html[data-theme="dark"] .theory-image img,
html[data-theme="dark"] .task-image {
  background: #fff;
}

html[data-theme="dark"] .theme-preview-light {
  border-color: #747894;
}

html[data-theme="dark"] ::selection {
  background: color-mix(in oklab, var(--primary) 42%, transparent);
  color: #fff;
}

/* Tume kujundus kasutab õpperakenduse lillat aktsenti läbivalt, kuid jätab sisu rahulikuks. */
html[data-theme="dark"] .nav-link.is-active::after {
  background: linear-gradient(90deg, #7168ff, #a49eff);
  box-shadow: 0 0 12px rgb(113 104 255 / 0.55);
}

html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .section-heading-row .eyebrow {
  color: #9189ff;
}

html[data-theme="dark"] .progress-fill,
html[data-theme="dark"] .bg-primary {
  background: linear-gradient(90deg, #6258f2, #948cff);
  box-shadow: 0 0 14px rgb(113 104 255 / 0.28);
}

html[data-theme="dark"] .btn-primary:not(.continue-card .btn-primary) {
  background: linear-gradient(135deg, #7168ff, #574ce3);
  box-shadow: 0 10px 24px rgb(78 67 217 / 0.24);
}

html[data-theme="dark"] .btn-primary:not(.continue-card .btn-primary):hover:not(:disabled) {
  background: linear-gradient(135deg, #8b84ff, #685df0);
  box-shadow: 0 13px 30px rgb(93 82 235 / 0.34);
}

html[data-theme="dark"] .theme-choice.is-selected,
html[data-theme="dark"] .avatar-choice.is-selected {
  border-color: #8178ff;
  box-shadow: 0 0 0 2px rgb(129 120 255 / 0.18), 0 12px 28px rgb(64 53 195 / 0.18);
}

html[data-theme="dark"] .subject-card {
  background: linear-gradient(145deg, var(--card), color-mix(in oklab, var(--card) 94%, #5d55ef));
}

/* Meta-teksti üldreegel ei tohi õppaine märki pisikeseks suruda. */
.continue-title .subject-symbol {
  color: currentColor;
  font-size: 2rem;
}

html[data-theme="dark"] .continue-title .subject-symbol {
  color: #dffcff;
  text-shadow: 0 0 14px rgb(106 235 241 / 0.35);
}

/* Vaikne kosmosemotiiv seob õppevaate kooli visuaalse identiteediga. */
.app-root {
  position: relative;
  isolation: isolate;
  overflow-x: clip;
}

.app-root::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 80px 0 0;
  background-image:
    radial-gradient(circle, rgb(106 89 255 / 0.66) 0 1px, transparent 1.7px),
    radial-gradient(circle, rgb(126 110 255 / 0.48) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgb(91 72 235 / 0.56) 0 1.5px, transparent 2.1px);
  background-position: 14px 18px, 72px 54px, 28px 96px;
  background-size: 137px 137px, 193px 193px, 251px 251px;
  mask-image: linear-gradient(to bottom, transparent, #000 16%, #000 76%, transparent);
  opacity: 0.7;
  pointer-events: none;
}

.app-shell {
  position: relative;
  z-index: 1;
}

.page-heading {
  position: relative;
  isolation: isolate;
}

.page-heading::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -34px;
  right: 2%;
  width: 190px;
  height: 88px;
  border: 1px solid color-mix(in oklab, var(--primary) 24%, transparent);
  border-bottom-color: transparent;
  border-left-color: transparent;
  border-radius: 50%;
  opacity: 0.75;
  transform: rotate(-9deg);
  pointer-events: none;
}

.page-heading::before {
  content: "✦";
  position: absolute;
  z-index: -1;
  top: -17px;
  right: 11%;
  color: rgb(112 96 255 / 0.78);
  font-size: 0.75rem;
  text-shadow: 58px 35px 0 rgb(112 96 255 / 0.45);
  pointer-events: none;
}

html[data-theme="dark"] .app-root::before {
  opacity: 0.82;
}

@media (max-width: 860px) {
  .stats-panel {
    position: static;
  }
}

@media (max-width: 620px) {
  .theme-picker {
    grid-template-columns: minmax(0, 1fr);
  }

  html[data-theme="dark"] .app-header {
    background: var(--card);
  }

  html[data-theme="dark"] .app-header nav {
    border-color: var(--border);
    background: color-mix(in oklab, var(--card) 94%, transparent);
  }

  .page-heading::after {
    right: -58px;
    width: 150px;
    opacity: 0.5;
  }

  .page-heading::before {
    right: 8%;
  }
}
/* Server save status stays visible even when the current view re-renders. */
#sync-notice { position: fixed; bottom: 16px; left: 16px; right: 16px; margin: auto; width: fit-content; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: #17154b; color: white; font-size: 13px; z-index: 10000; box-shadow: 0 4px 18px #0002; }
#sync-notice:empty { display: none; }
@media (max-width: 760px) {
  .landing-header { padding-block: 8px; }
  .landing-actions { flex-direction: column; align-items: stretch; gap: 5px; }
  .landing-login { display: inline-flex; align-items: center; justify-content: center; }
  .landing-actions .landing-login,
  .landing-actions .landing-register { min-height: 34px; padding: 0 12px; font-size: 0.72rem; }
}
