:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --beginner-ink: #221b39;
  --beginner-muted: #605574;
  --beginner-violet: #5236bc;
  --beginner-line: #e4ddf0;
  --beginner-page: #fbfaff;
}

.beginner-page {
  margin: 0;
  min-width: 0;
  min-height: 100dvh;
  color: var(--beginner-ink);
  background: var(--beginner-page);
  -webkit-font-smoothing: antialiased;
}

.beginner-page *, .beginner-page *::before, .beginner-page *::after { box-sizing: border-box; }
.beginner-page [hidden] { display: none !important; }
.beginner-page :is(h1, h2, p, dl, dd) { margin: 0; }
.beginner-page button { font-family: inherit; }
.beginner-page a { color: inherit; text-decoration: none; }
.beginner-page :is(a, button):not(.kv-sidebar a):focus-visible { outline: 2px solid #7555dc; outline-offset: 3px; }
.beginner-page :is(a, button):not(.kv-sidebar a):focus:not(:focus-visible) { outline: 0; }
.beginner-page svg { display: block; flex: none; }
.beginner-lesson-glyphs { position: absolute; inset: 0 auto auto 0; overflow: hidden; pointer-events: none; }

@media (max-width: 1023px) {
  body.beginner-lesson-page > .beginner-topbar { display: none; }
  .beginner-page > .kum-mobile-top { flex: none; }
}

.beginner-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 57px;
  padding: env(safe-area-inset-top, 0px) 28px 0;
  border-bottom: 1px solid #eee8f5;
  background: #fff;
}

.beginner-top-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 650;
}

.beginner-top-back--mobile { display: none; }

.beginner-top-profile {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: auto;
}

.beginner-top-profile::before {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #f0eaf9;
  content: "";
}

.beginner-top-profile svg { position: relative; }
.beginner-top-profile:hover::before { background: #e8dcf8; }

.beginner-main {
  width: min(1020px, calc(100% - clamp(44px, 9vw, 128px)));
  margin-inline: auto;
  padding-block: 32px max(26px, env(safe-area-inset-bottom, 0px));
}

@media (min-width: 1024px) {
  .beginner-page { padding-left: var(--kv-sidebar-width); }
  .beginner-page > .kv-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1;
    width: var(--kv-sidebar-width);
    height: 100dvh;
    overflow-y: auto;
  }
}

.beginner-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 25px;
}

.beginner-page h1 {
  font-size: clamp(25px, 2.35vw, 31px);
  font-weight: 770;
  letter-spacing: -.028em;
  line-height: 1.18;
}

.beginner-lesson-number { display: none; }
.beginner-titlebar h1::before { content: "Урок 1. "; }

.beginner-scene-count {
  flex: none;
  color: var(--beginner-muted);
  font-size: 14px;
  font-weight: 650;
}

.beginner-catalog.kv-root {
  width: min(1020px, calc(100% - clamp(44px, 9vw, 128px)));
  background: transparent;
}

.beginner-catalog h1 { margin-bottom: 26px; }
.beginner-catalog .kv-card-art { background: #efeaff; }
.beginner-catalog .kv-card { transition: border-color 150ms ease, box-shadow 150ms ease; }

.beginner-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: clamp(380px, 68vh, 492px);
  overflow: hidden;
  border: 1px solid var(--beginner-line);
  border-radius: 17px;
  background: #fff;
}

.beginner-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 15px;
  min-width: 0;
  padding: 20px;
}

.beginner-content[data-scene="1"] { gap: 16px; }

.beginner-prompt-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 12px;
  min-width: 0;
}

.beginner-prompt { font-size: 18px; font-weight: 720; line-height: 1.35; }
.beginner-content[data-scene="13"] .beginner-prompt { font-size: 24px; }

.beginner-question-count {
  flex: none;
  color: var(--beginner-muted);
  font-size: 13px;
  font-weight: 650;
}

.beginner-text, .beginner-note { color: var(--beginner-muted); font-size: 15px; line-height: 1.48; }
.beginner-toolbar--heading > div > .beginner-text { margin-top: 4px; }
.beginner-content[data-scene="1"] .beginner-note { text-align: center; }

.beginner-toolbar, .beginner-compare {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}

.beginner-toolbar--center { justify-content: center; }
.beginner-toolbar--heading { justify-content: space-between; align-items: flex-start; }
.beginner-toolbar--heading .beginner-button { flex-shrink: 0; max-width: 100%; }
.beginner-toolbar--heading .beginner-prompt-row { min-height: 34px; align-items: center; }

.beginner-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  min-width: 0;
  max-width: 100%;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--beginner-violet);
  font-size: 14px;
  font-weight: 690;
  line-height: 1.3;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.beginner-button span { min-width: 0; text-wrap: pretty; }
.beginner-button .beginner-icon { width: 17px; height: 17px; }
.beginner-button--primary { min-width: 95px; background: #eee7fc; }
.beginner-button--outline { border-color: #c5b3e6; background: #fff; }
.beginner-button--ghost { background: transparent; }
.beginner-button:hover:not(:disabled) { background: #e8dcfa; }
.beginner-button:active:not(:disabled) { background: #ddccf8; }
.beginner-button:disabled { opacity: .5; cursor: default; }

.beginner-grid {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.beginner-grid[data-layout="pairs"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.beginner-grid[data-layout="five"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.beginner-grid[data-layout="choices"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.beginner-grid[data-layout="two"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.beginner-grid:is([data-layout="alphabet"], [data-layout="keyboard"]) { grid-template-columns: repeat(9, minmax(0, 1fr)); }

.beginner-tile {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: clamp(132px, 28vh, 222px);
  padding: 22px 8px 12px;
  border: 1px solid #e5dcf2;
  border-radius: 13px;
  background: #f5f0fc;
  color: var(--beginner-violet);
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
  touch-action: manipulation;
}

.beginner-tile:hover:not([aria-disabled="true"]) { background: #f1e7fb; border-color: #cebbef; }
.beginner-tile[aria-disabled="true"] { cursor: default; }
.beginner-tile:is([data-state="playing"], [data-playing]) {
  border-color: #865be0;
  background: #efe5fc;
  box-shadow: 0 0 0 1px #865be033;
}

.beginner-tile[data-state="correct"], .beginner-slot[data-state="correct"] {
  border-color: #65a981;
  background: #eaf8ee;
}

.beginner-tile[data-state="wrong"], .beginner-slot[data-state="wrong"] {
  border-color: #ce777f;
  background: #fceff1;
}

.beginner-tile .beginner-audio-icon {
  position: absolute;
  top: 10px;
  right: 11px;
  width: 19px;
  height: 19px;
  color: #675587;
}

.beginner-tile[data-state="playing"] .beginner-audio-icon { color: #5830ca; }

.beginner-mark {
  position: absolute;
  right: 10px;
  bottom: 9px;
  color: #6040ce;
  pointer-events: none;
}

.beginner-mark .beginner-icon { width: 17px; height: 17px; }
.beginner-tile[data-state="correct"] .beginner-mark { color: #267545; }
.beginner-tile[data-state="wrong"] .beginner-mark { color: #a93446; }
.beginner-tile:is([data-state="correct"], [data-state="wrong"]) .beginner-mark { top: 9px; bottom: auto; }

.beginner-glyph {
  display: grid;
  width: 100%;
  max-width: 220px;
  min-width: 0;
  place-items: center;
  justify-self: center;
  color: #57329f;
  text-align: center;
  user-select: none;
}

.beginner-glyph[data-kind="upper"], .beginner-glyph[data-kind="lower"] { max-width: 112px; }
.beginner-glyph-image { display: block; width: 100%; height: auto; max-height: 141px; object-fit: contain; }
.beginner-glyph-text { font-size: 43px; font-weight: 780; line-height: 1; }
.beginner-glyph:not([data-fallback]) .beginner-glyph-text { display: none; }

.beginner-content:is([data-scene="5"], [data-scene="6"], [data-scene="9"], [data-scene="11"]) .beginner-grid .beginner-tile {
  min-height: clamp(115px, 23vh, 167px);
}

.beginner-content[data-scene="11"] .beginner-grid .beginner-glyph-image { max-height: 93px; }
.beginner-compare .beginner-tile {
  min-height: 60px;
  width: 132px;
  padding: 4px 22px 4px 6px;
}

.beginner-compare .beginner-glyph-image { max-height: 60px; }
.beginner-compare .beginner-audio-icon { width: 15px; height: 15px; top: 10px; right: 8px; }
.beginner-compare .beginner-mark { bottom: 4px; right: 7px; }
.beginner-compare--note { flex-wrap: nowrap; }
.beginner-compare-forms { display: flex; flex: 0 0 90px; align-items: center; }
.beginner-compare-forms .beginner-glyph { width: 45px; }

.beginner-grid[data-layout="alphabet"] .beginner-tile { min-height: 61px; padding: 6px 2px; }
.beginner-grid[data-layout="alphabet"] .beginner-glyph-text { font-size: 22px; }
.beginner-grid[data-layout="alphabet"] .beginner-audio-icon { display: none; }
.beginner-grid[data-layout="alphabet"] .beginner-mark { right: 4px; bottom: 3px; }
.beginner-grid[data-layout="alphabet"] .beginner-mark .beginner-icon { width: 11px; height: 11px; }
.beginner-tile[data-review] { border-color: #9272dc; box-shadow: inset 0 0 0 1px #9272dc44; }
.beginner-grid[data-layout="keyboard"] .beginner-tile { min-height: 42px; padding: 4px; }
.beginner-grid[data-layout="keyboard"] .beginner-glyph-text { font-size: 17px; }

.beginner-specimen {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 178px;
  padding: 9px 8px 7px;
  border-radius: 12px;
  background: #f5effc;
}

.beginner-specimen-letters {
  --specimen-width: 151px;
  --specimen-baseline: 103px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, var(--specimen-width)));
  justify-content: center;
  gap: clamp(20px, 7vw, 90px);
  width: min(100%, 630px);
}

.beginner-specimen-letters::before {
  position: absolute;
  z-index: 1;
  inset: var(--specimen-baseline) 3% auto;
  height: 1px;
  background: #a28ac9;
  content: "";
  pointer-events: none;
}

.beginner-specimen-item {
  z-index: 1;
  display: grid;
  grid-template-rows: 130px auto;
  justify-items: center;
  align-items: center;
  min-width: 0;
}

.beginner-specimen-item .beginner-glyph { max-width: 123.8px; }
.beginner-specimen-item .beginner-glyph-image { height: 130px; max-height: none; }
.beginner-specimen-label { font-size: 14px; font-weight: 650; color: var(--beginner-muted); }

.beginner-content[data-scene="11"] .beginner-specimen { min-height: 108px; padding: 0; background: transparent; }
.beginner-content[data-scene="11"] .beginner-specimen-letters { --specimen-width: 117px; --specimen-baseline: 84px; gap: 22px; }
.beginner-content[data-scene="11"] .beginner-specimen-item { grid-template-rows: 107px; }
.beginner-content[data-scene="11"] .beginner-specimen-item .beginner-glyph { max-width: 102px; }
.beginner-content[data-scene="11"] .beginner-specimen-item .beginner-glyph-image { height: 107px; }
.beginner-specimen[data-single] .beginner-specimen-letters { grid-template-columns: var(--specimen-width); }

.beginner-feedback-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 13px; }

.beginner-feedback {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: #504767;
  font-size: 15px;
  line-height: 1.4;
}

.beginner-feedback[data-state="correct"] { color: #256b43; font-weight: 660; }
.beginner-feedback .beginner-icon { width: 18px; height: 18px; margin-top: 1px; }

.beginner-audio-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  color: #9a3544;
  font-size: 14px;
}

.beginner-slots { display: flex; justify-content: center; gap: 11px; }

.beginner-slot {
  display: grid;
  place-items: center;
  width: min(85px, 26%);
  height: 66px;
  padding: 0;
  border: 1px solid #dfd3f1;
  border-radius: 11px;
  color: #56329e;
  background: #f3ecfb;
  font-size: 34px;
  font-weight: 750;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.beginner-slot:is([aria-pressed="true"], [data-playing]) { border-color: #8e64e4; }
.beginner-slot[data-playing] { background: #eae0f9; }
.beginner-slot[aria-disabled="true"] { cursor: default; }

.beginner-metrics > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e8def3;
  font-size: 15px;
  line-height: 1.36;
}

.beginner-metrics dd { color: #492584; font-weight: 700; }
.beginner-metrics dd > small { display: inline; margin-left: .4em; font-size: inherit; font-weight: 550; }

.beginner-recommendation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 9px 13px;
  color: #6132ad;
  font-size: 17px;
  font-weight: 730;
}

.beginner-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-height: 58px;
  padding: 8px 20px;
  border-top: 1px solid #eee7f4;
}

.beginner-footer-left, .beginner-footer-right { display: flex; align-items: center; gap: 6px; }
.beginner-footer-right { justify-content: flex-end; margin-left: auto; }
.beginner-footer > .beginner-button { margin-left: auto; }
.beginner-footer .beginner-button--ghost { padding-inline: 5px; }

@keyframes beginner-reveal {
  from { opacity: .15; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes beginner-fade {
  from { opacity: .64; }
  to { opacity: 1; }
}

.beginner-specimen-item[data-motion="reveal"] { animation: beginner-reveal 215ms ease-out; }
.beginner-feedback[data-motion] { animation: beginner-fade 170ms ease-out; }
.beginner-content[data-motion="scene"] { animation: beginner-fade 160ms ease-out; }

@keyframes beginner-sound-pulse {
  0%, 100% { opacity: 1; }
  45% { opacity: .5; }
}

.beginner-tile[data-state="playing"] .beginner-audio-icon,
.beginner-button[data-playing] .beginner-icon,
.beginner-specimen[data-playing] .beginner-glyph { animation: beginner-sound-pulse 820ms ease-in-out infinite; }

@media (max-width: 1023px) {
  .beginner-topbar { min-height: calc(53px + env(safe-area-inset-top, 0px)); margin-left: 0; padding-inline: 16px; }
  .beginner-top-back--mobile { display: inline-flex; }
  .beginner-main, .beginner-catalog.kv-root { width: min(790px, calc(100% - 26px)); padding-top: 22px; }
  .beginner-card { min-height: 0; }
  .beginner-catalog .kv-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 660px) {
  .beginner-main { padding-bottom: max(22px, env(safe-area-inset-bottom, 0px)); }
  .beginner-titlebar {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 8px;
    align-items: baseline;
    margin: 0 3px 19px;
  }
  .beginner-titlebar > div { display: contents; }
  .beginner-lesson-number { display: block; grid-area: 1 / 1; color: var(--beginner-muted); font-size: 14px; font-weight: 650; }
  .beginner-titlebar .beginner-scene-count { grid-area: 1 / 2; font-size: 13px; }
  .beginner-titlebar h1 { grid-area: 2 / 1 / 3 / 3; }
  .beginner-titlebar h1::before { content: none; }
  .beginner-page h1 { font-size: clamp(20px, 6vw, 24px); }

  .beginner-catalog .kv-grid { grid-template-columns: minmax(0, 330px); gap: 12px; }
  .beginner-catalog h1 { margin-bottom: 16px; }
  .beginner-catalog .kv-card-title { font-size: 16px; }
  .beginner-content { padding: 13px; gap: 11px; }
  .beginner-content[data-scene="1"] { min-height: 355px; gap: 11px; }
  .beginner-content[data-scene="4"] { min-height: 258px; }
  .beginner-content[data-scene="7"] { min-height: 340px; }
  .beginner-content[data-scene="11"] { min-height: 322px; }
  .beginner-content[data-scene="1"] .beginner-note { text-align: left; }
  .beginner-content[data-scene="13"] .beginner-prompt { font-size: 21px; }

  .beginner-prompt { font-size: 16px; }
  .beginner-text, .beginner-note, .beginner-feedback { font-size: 14px; }
  .beginner-prompt-row { flex-wrap: wrap; }
  .beginner-question-count { font-size: 12px; }
  .beginner-toolbar--heading { flex-direction: column; align-items: flex-start; gap: 7px; }
  .beginner-toolbar--heading .beginner-prompt-row { min-height: 0; }
  .beginner-button { min-height: 44px; padding-inline: 9px; font-size: 14px; }
  .beginner-footer {
    min-height: 61px;
    padding: 8px 13px;
  }

  .beginner-grid { gap: 8px; }
  .beginner-grid[data-layout="pairs"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .beginner-grid[data-layout="five"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .beginner-grid[data-layout="five"] .beginner-tile { grid-column: span 2; }
  .beginner-grid[data-layout="five"] .beginner-tile:nth-child(4) { grid-column: 2 / span 2; }

  .beginner-tile { min-height: 125px; padding: 19px 6px 9px; border-radius: 12px; }
  .beginner-grid[data-layout="five"] .beginner-tile { min-height: 102px; }
  .beginner-grid[data-layout="choices"] .beginner-tile { min-height: 100px; }
  .beginner-grid[data-layout="two"] .beginner-tile { min-height: 117px; }
  .beginner-tile .beginner-audio-icon { top: 7px; right: 8px; width: 16px; height: 16px; }
  .beginner-tile .beginner-mark { bottom: 5px; right: 7px; }
  .beginner-tile .beginner-mark .beginner-icon { width: 15px; height: 15px; }

  .beginner-glyph-image { max-height: 91px; }
  .beginner-grid[data-layout="five"] .beginner-glyph-image { max-height: 70px; }
  .beginner-glyph-text { font-size: 32px; }

  .beginner-content:is([data-scene="5"], [data-scene="6"], [data-scene="9"], [data-scene="11"]) .beginner-grid .beginner-tile {
    min-height: 102px;
  }

  .beginner-compare { gap: 7px; }
  .beginner-compare .beginner-tile { min-height: 53px; flex: 0 1 min(132px, 47%); }
  .beginner-compare .beginner-glyph-image { max-height: 49px; }
  .beginner-compare--note { align-items: center; }

  .beginner-specimen { min-height: 161px; }
  .beginner-specimen-letters { --specimen-width: 125px; --specimen-baseline: 94px; gap: 12px; }
  .beginner-specimen-item { grid-template-rows: 119px auto; }
  .beginner-specimen-item .beginner-glyph { max-width: 113px; }
  .beginner-specimen-item .beginner-glyph-image { height: 119px; }
  .beginner-specimen-label { font-size: 13px; }

  .beginner-grid:is([data-layout="alphabet"], [data-layout="keyboard"]) {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
  }
  .beginner-grid[data-layout="alphabet"] .beginner-tile { min-height: 46px; padding-inline: 1px; }
  .beginner-grid[data-layout="alphabet"] .beginner-glyph-text { font-size: 17px; }
  .beginner-grid[data-layout="keyboard"] .beginner-tile { min-height: 44px; padding-inline: 1px; }
  .beginner-grid[data-layout="keyboard"] .beginner-glyph-text { font-size: 16px; }

  .beginner-metrics > div { grid-template-columns: 1.05fr 1fr; gap: 8px; font-size: 14px; padding: 11px 0; }
  .beginner-metrics dd { text-align: right; }
  .beginner-metrics dd > small { display: block; margin: 2px 0 0; }
  .beginner-recommendation { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 356px) {
  .beginner-content[data-scene="1"] { min-height: 372px; }
  .beginner-grid:is([data-layout="alphabet"], [data-layout="keyboard"]) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .beginner-grid[data-layout="alphabet"] .beginner-glyph-text { font-size: 16px; }
  .beginner-toolbar--compare { column-gap: 3px; }
  .beginner-toolbar--compare .beginner-button { padding-inline: 6px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .beginner-page *, .beginner-page *::before, .beginner-page *::after {
    animation: none !important;
    transition: none !important;
  }
}
