/* Нүүр (/): the landing page on the public layout. Bands of copy beside a
   working stage — the boards are the one board in the visitor's board theme,
   the rest is built from the design tokens. */
@layer page {
  /* The bands run edge to edge, so the layout's own width and padding step aside. */
  [data-doc='landing'] .pub-main { max-width: none; padding: 0; }

  .ld {
    --ld-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ld-gutter: clamp(16px, 4vw, 32px);
    position: relative;
  }
  .ld p { margin: 0; }
  .ld-wrap { width: min(100% - 2 * var(--ld-gutter), 1160px); margin-inline: auto; }

  /* The pause control floats with the page, so motion can be stopped from anywhere. */
  .ld-pause {
    position: fixed;
    right: var(--sp-4);
    bottom: var(--sp-4);
    z-index: 20;
    box-shadow: var(--shadow-2);
  }
  /* On a phone the control is its icon alone; its name stays for screen readers. */
  @media (max-width: 699.98px) {
    .ld-pause { width: var(--control-h); padding: 0; }
    .ld-pause__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  }
  /* Paused: every demo takes the reduced path, and nothing on the page moves. */
  [data-motion='off'] .ld *,
  [data-motion='off'] .ld *::before,
  [data-motion='off'] .ld *::after { animation: none !important; transition: none !important; }

  /* ---- Hero: the board is the headline ---------------------------------- */
  .ld-hero { position: relative; isolation: isolate; padding: clamp(28px, 6vw, 72px) 0 clamp(36px, 6vw, 80px); }
  .ld-hero .ld-wrap { display: grid; gap: clamp(28px, 5vw, 64px); align-items: center; }
  .ld-hero-copy { display: grid; gap: var(--sp-4); max-width: 34rem; }
  .ld-hero h1 { font-size: clamp(2.2rem, 5.4vw, 3.6rem); line-height: 1.1; text-wrap: balance; }
  .ld-hero-lede { color: var(--muted); font-size: var(--fs-18); }
  .ld-hero-cta { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
  .ld-hero-note { color: var(--muted); font-size: var(--fs-15); }
  /* The ground: a big checkerboard fading out — the subject itself, once. */
  .ld-ground { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
  .ld-ground::before {
    content: '';
    position: absolute;
    inset: -12% -5% 0;
    background: repeating-conic-gradient(var(--primary-soft) 0 25%, transparent 0 50%) 0 0 / 96px 96px;
    /* A mask reads only alpha; any opaque paint will do. */
    -webkit-mask-image: radial-gradient(ellipse 70% 62% at 72% 40%, var(--text) 0%, transparent 100%);
    mask-image: radial-gradient(ellipse 70% 62% at 72% 40%, var(--text) 0%, transparent 100%);
  }
  @media (min-width: 900px) {
    .ld-hero .ld-wrap { grid-template-columns: minmax(0, 1fr) minmax(360px, 520px); }
  }

  /* The stage: a board, its caption, and the board-theme chips. */
  .ld-stage { position: relative; width: min(100%, 520px); margin-inline: auto; }
  .ld-stage--puzzle, .ld-stage--lesson { width: min(100%, 460px); }
  .ld-board { position: relative; padding: var(--sp-2); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-2); }
  .ld-caption { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-height: var(--control-h); margin-top: var(--sp-2); color: var(--muted); font-size: var(--fs-15); }
  .ld-caption-move { min-width: 5.5ch; margin-left: auto; color: var(--text); font-family: var(--font-num); font-weight: var(--fw-heavy); text-align: right; }
  .ld-caption-move.is-fresh { animation: ld-pop 320ms var(--ld-spring); }
  .ld-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--control-h);
    padding: 0 var(--sp-1);
    border: 0;
    background: none;
    color: var(--primary);
    font: inherit;
    font-weight: var(--fw-heavy);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
  }

  .ld-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--sp-2); margin-top: var(--sp-3); }
  .ld-theme {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    min-height: var(--control-h);
    padding: var(--sp-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: var(--fs-13);
    font-weight: var(--fw-bold);
    line-height: 1.15;
    text-align: center;
    overflow-wrap: anywhere;
    cursor: pointer;
  }
  .ld-theme:hover { background: var(--surface-2); }
  .ld-theme[aria-pressed='true'] { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
  /* A strip of the theme's squares, from its own stylesheet (the strip is a .chess-board in that theme). */
  .ld-theme .ld-theme__sw {
    flex: none;
    width: 100%;
    height: 12px;
    aspect-ratio: auto;
    border: 0;
    border-radius: var(--r-xs);
    box-shadow: none;
    background: repeating-linear-gradient(90deg, var(--sq-light) 0 12px, var(--sq-dark) 12px 24px);
  }

  /* ---- Bands: copy beside a stage, alternating sides on wide screens ----- */
  .ld-section { padding: clamp(48px, 8vw, 104px) 0; }
  .ld-section--alt { border-block: 1px solid var(--line); background: var(--surface); }
  .ld-section__grid { display: grid; gap: clamp(28px, 4vw, 56px); align-items: center; }
  .ld-section__copy { display: grid; gap: var(--sp-4); }
  .ld-section__copy h2 { max-width: 22ch; font-size: clamp(1.7rem, 3.4vw, 2.4rem); line-height: 1.15; text-wrap: balance; }
  .ld-section__copy > p { max-width: 34rem; color: var(--muted); font-size: var(--fs-16); }
  .ld-section__copy--wide h2 { max-width: none; }
  .ld-section__copy--wide > p { max-width: 44rem; }
  @media (min-width: 900px) {
    .ld-section__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
    .ld-section__grid--flip .ld-section__copy { order: 2; }
    .ld-section__grid--flip .ld-section__stage { order: 1; }
  }

  /* Small shared bits: tags, pills, avatars, stickers. */
  .ld-tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    color: var(--muted);
    font-size: var(--fs-12);
    font-weight: var(--fw-heavy);
    vertical-align: middle;
  }
  .ld-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--surface);
    box-shadow: var(--shadow-1);
    font-weight: var(--fw-heavy);
    white-space: nowrap;
  }
  .ld-pill--num { font-family: var(--font-num); font-size: var(--fs-20); }
  .ld-stars { color: var(--gold); letter-spacing: 0.06em; }
  .ld-avatar { display: inline-block; flex: none; width: 72px; height: 72px; }
  .ld-avatar svg { display: block; width: 100%; height: 100%; border-radius: 50%; }
  .ld-avatar--sm { width: 40px; height: 40px; }
  .ld-avatar--xs { width: 28px; height: 28px; }
  .ld-avatar--big { width: min(56vw, 220px); height: min(56vw, 220px); }
  .ld-avatar--big.is-roll { animation: ld-roll 520ms var(--ld-spring); }
  .ld-sticker {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 6;
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--r-md);
    background: var(--primary);
    color: var(--on-primary);
    box-shadow: var(--shadow-2);
    font-size: clamp(1.1rem, 3.2vw, 1.5rem);
    font-weight: var(--fw-heavy);
    line-height: 1.15;
    text-align: center;
    transform: translate(-50%, -50%) rotate(-4deg);
    pointer-events: none;
    animation: ld-sticker-in 480ms var(--ld-spring);
  }
  .ld-sticker--win { background: var(--good); color: var(--surface); }
  .ld-sticker--oops { background: var(--bad); color: var(--on-bad); font-size: var(--fs-16); }
  .ld-puzzlehead, .ld-lesson__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-3); }
  .ld-streak { border-color: var(--bad); }
  .ld-streak.is-bump { animation: ld-pop 420ms var(--ld-spring); }
  .ld-dots { display: inline-flex; gap: 6px; }
  .ld-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); transition: background var(--dur) var(--ease), transform 300ms var(--ld-spring); }
  .ld-dots i.is-done { background: var(--good); transform: scale(1.2); }

  /* ---- Play: the eight bots and the three ways in ----------------------- */
  .ld-modes { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
  .ld-mode {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    min-height: var(--control-h);
    padding: 0 var(--sp-4);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-pill);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: var(--fw-bold);
    cursor: pointer;
  }
  .ld-mode[aria-pressed='true'] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
  .ld-modecard { min-height: 84px; padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
  .ld-modecard p { color: var(--muted); }
  .ld-challenge { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
  .ld-challenge__text { flex: 1 1 160px; line-height: 1.35; }
  .ld-challenge__text > span:last-child { display: block; }
  .ld-clocks { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }
  .ld-clock {
    flex: 1;
    padding: var(--sp-2) 0;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--bg);
    color: var(--muted);
    font-family: var(--font-num);
    font-size: var(--fs-20);
    font-weight: var(--fw-heavy);
    text-align: center;
  }
  .ld-clock.is-on { border-color: var(--good); color: var(--text); box-shadow: inset 0 0 0 1px var(--good); }
  .ld-flipdemo { display: inline-flex; gap: var(--sp-2); margin-top: var(--sp-2); font-size: var(--fs-24); animation: ld-flip 4s ease-in-out infinite; }

  .ld-bots { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); }
  .ld-bot {
    --bob: 0ms;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-height: var(--control-h);
    padding: var(--sp-2) var(--sp-1);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: var(--fs-12);
    font-weight: var(--fw-bold);
    line-height: 1.2;
    cursor: pointer;
  }
  .ld-bot:hover { background: var(--surface-2); }
  .ld-bot[aria-selected='true'] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
  .ld-bot__emoji { display: block; font-size: 1.7rem; line-height: 1; animation: ld-bob 3.2s ease-in-out infinite; animation-delay: var(--bob); }
  .ld-bot__elo { color: var(--muted); font-family: var(--font-num); }

  .ld-botstage {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: var(--sp-3);
    margin-top: var(--sp-3);
    padding: var(--sp-4);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-1);
  }
  /* The eval bar: black's share dark, white's light, in either theme. */
  .ld-eval { --ld-black: var(--text); --ld-white: var(--surface); }
  :root[data-theme='dark'] .ld-eval { --ld-black: var(--bg); --ld-white: var(--text); }
  .ld-eval { position: relative; grid-row: 1 / span 3; min-height: 120px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--ld-black); }
  .ld-eval__fill { position: absolute; right: 0; bottom: 0; left: 0; height: 50%; background: var(--ld-white); transition: height 900ms var(--ease); }
  .ld-eval__label { position: absolute; bottom: 6px; left: 50%; color: var(--ld-black); font-size: 0.6rem; font-weight: var(--fw-heavy); transform: translateX(-50%); writing-mode: vertical-rl; }
  .ld-botstage__card { display: flex; align-items: center; gap: var(--sp-3); }
  .ld-botstage__emoji { font-size: 3rem; line-height: 1; animation: ld-pop 420ms var(--ld-spring); }
  .ld-botstage__card b { font-size: var(--fs-18); }
  .ld-botstage__elo { margin-left: var(--sp-2); color: var(--muted); font-family: var(--font-num); font-weight: var(--fw-heavy); }
  .ld-botstage__card p { color: var(--muted); }
  .ld-meter { height: 8px; overflow: hidden; border-radius: var(--r-pill); background: var(--surface-2); }
  .ld-meter span { display: block; width: 40%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--good), var(--gold), var(--bad)); transition: width 700ms var(--ease); }
  .ld-hintline { color: var(--muted); font-size: var(--fs-13); font-weight: var(--fw-bold); }

  /* ---- Puzzles: the daily one, the streak, the race, the friends board --- */
  .ld-leader { display: grid; gap: 6px; margin: var(--sp-3) 0 0; padding: 0; list-style: none; counter-reset: place; }
  .ld-leader li { display: flex; align-items: center; gap: var(--sp-2); padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font-weight: var(--fw-bold); }
  .ld-leader li::before { width: 1.4em; color: var(--muted); font-weight: var(--fw-heavy); content: counter(place); counter-increment: place; }
  .ld-leader li b { margin-left: auto; font-family: var(--font-num); }
  .ld-leader li.is-me { border-color: var(--gold); background: var(--surface-2); }
  .ld-leader__head { margin-top: var(--sp-4); color: var(--muted); font-weight: var(--fw-bold); }

  .ld-race {
    position: relative;
    overflow: hidden;
    padding: var(--sp-4);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-1);
  }
  .ld-race__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
  .ld-race__timer { padding: 2px 10px; border-radius: var(--r-xs); background: var(--surface-2); font-family: var(--font-num); font-size: var(--fs-18); font-weight: var(--fw-heavy); }
  .ld-race__timer.is-low { color: var(--bad); }
  .ld-race__count {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    background: var(--surface);
    color: var(--primary);
    font-size: 4rem;
    font-weight: var(--fw-heavy);
  }
  .ld-race__count.is-tick { animation: ld-count 900ms var(--ld-spring); }
  .ld-lane { display: grid; grid-template-columns: 40px auto 1fr auto; align-items: center; gap: var(--sp-2); padding: 6px 0; }
  .ld-lane__name { min-width: 4ch; font-weight: var(--fw-heavy); }
  .ld-lane__bar { height: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--bg); }
  .ld-lane__bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--primary); transition: width 600ms var(--ease); }
  .ld-lane--them .ld-lane__bar span { background: var(--bad); }
  .ld-lane__pips { display: inline-flex; gap: 4px; }
  .ld-lane__pips i { width: 12px; height: 12px; border-radius: 4px; background: var(--line-strong); }
  .ld-lane__pips i.is-on { background: var(--good); animation: ld-pop 320ms var(--ld-spring); }
  .ld-lane__pips i.is-skip { background: var(--bad); }
  .ld-race__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-height: var(--control-h); margin-top: var(--sp-2); font-weight: var(--fw-heavy); }

  /* ---- Learn: the ten courses and a lesson step ------------------------- */
  .ld-courses { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-2); margin: 0; padding: 0; list-style: none; counter-reset: course; }
  .ld-course {
    position: relative;
    display: grid;
    gap: 6px;
    padding: var(--sp-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    font-size: var(--fs-13);
    line-height: 1.25;
    opacity: 0;
    transform: translateY(8px);
  }
  .ld-course.is-in { animation: ld-rise 480ms var(--ease) forwards; animation-delay: calc(var(--i) * 70ms); }
  .ld-course::before { position: absolute; top: 8px; left: 10px; z-index: 1; color: var(--primary); font-family: var(--font-num); font-size: var(--fs-18); font-weight: var(--fw-heavy); content: counter(course); counter-increment: course; }
  .ld-course__art { aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--r-sm); background: var(--bg); }
  .ld-course__art svg { display: block; width: 100%; height: 100%; }
  .ld-course b { display: block; font-weight: var(--fw-heavy); }
  .ld-course small { color: var(--muted); font-weight: var(--fw-bold); }
  /* The lesson's caption says "the green square", whatever the theme. */
  #lessonBoard .chess-board { --sq-hint: color-mix(in srgb, var(--good) 55%, transparent); }

  /* ---- Grow: the six tiers, a climber, the real Elo maths ---------------- */
  .ld-growctl { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
  .ld-growctl__vs { width: 100%; color: var(--muted); font-weight: var(--fw-bold); }
  .ld-switch { display: inline-flex; gap: 2px; justify-self: start; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface-2); }
  .ld-switch button { min-height: var(--control-h); padding: 0 var(--sp-4); border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted); font: inherit; font-weight: var(--fw-heavy); cursor: pointer; }
  .ld-switch button[aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

  .ld-stairs { position: relative; overflow: hidden; padding: var(--sp-6) var(--sp-3) 44px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); }
  .ld-tiers { display: grid; grid-template-columns: repeat(6, 1fr); align-items: end; gap: 6px; height: 220px; margin: 0; padding: 0; list-style: none; }
  .ld-tier {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    height: calc(28% + var(--i) * 14%);
    padding-top: var(--sp-2);
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: var(--r-md) var(--r-md) 0 0;
    background: color-mix(in srgb, var(--primary) calc(6% + var(--i) * 4%), var(--surface));
    color: var(--text);
    font-size: 0.7rem;
    font-weight: var(--fw-heavy);
    text-align: center;
    transition: background 400ms var(--ease), color 400ms var(--ease);
  }
  .ld-tier i { color: var(--text); font-size: 1.4rem; font-style: normal; line-height: 1; }
  .ld-tier small { display: block; font-size: 0.62rem; font-weight: var(--fw-bold); }
  .ld-tier.is-here { background: color-mix(in srgb, var(--gold) 45%, var(--surface)); color: var(--text); }
  .ld-climber {
    position: absolute;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: calc(100% / 6);
    transform: translate(calc(var(--x) * 100%), calc(-1 * var(--y)));
    transition: transform 700ms var(--ld-spring);
    pointer-events: none;
  }
  .ld-climber .ld-avatar { width: 64px; height: 64px; }
  .ld-climber.is-hop .ld-avatar { animation: ld-hop 600ms var(--ld-spring); }
  .ld-climber .ld-pill { padding: 4px 10px; font-size: var(--fs-13); }
  .ld-delta { min-height: 1.2em; color: var(--good); font-weight: var(--fw-heavy); opacity: 0; }
  .ld-delta.is-neg { color: var(--bad); }
  .ld-delta.is-show { animation: ld-delta 1400ms ease-out forwards; }
  .ld-floor { position: absolute; right: var(--sp-3); bottom: 14px; left: var(--sp-3); padding-top: 4px; border-top: 2px dashed var(--line-strong); color: var(--muted); font-size: var(--fs-12); font-weight: var(--fw-bold); text-align: right; }
  .ld-stairs .ld-tiers, .ld-stairs .ld-stars, .ld-stairs #tierName { transition: opacity 400ms var(--ease); }
  .ld-stairs[data-view='adult'] .ld-tiers { opacity: 0.25; filter: grayscale(1); }
  .ld-stairs[data-view='adult'] .ld-stars, .ld-stairs[data-view='adult'] #tierName { display: none; }
  .ld-stairs[data-view='adult'] .ld-climber .ld-pill { font-family: var(--font-num); font-size: var(--fs-20); }

  /* ---- Look: the avatar, the mascots, the board themes ------------------ */
  .ld-look { display: grid; gap: var(--sp-6); margin-top: var(--sp-6); }
  .ld-look__avatar { display: grid; justify-items: center; align-content: start; gap: var(--sp-3); }
  .ld-look__ctl { display: grid; justify-items: center; gap: var(--sp-2); }
  .ld-parts, .ld-families, .ld-palette { display: flex; flex-wrap: wrap; gap: 6px; }
  .ld-parts { justify-content: center; }
  .ld-part, .ld-family {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: var(--control-h);
    min-height: var(--control-h);
    padding: 0 var(--sp-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-pill);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: var(--fs-13);
    font-weight: var(--fw-bold);
    cursor: pointer;
  }
  .ld-part:hover, .ld-family:hover { background: var(--surface-2); }
  .ld-family[aria-pressed='true'] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
  .ld-look__pieces { display: grid; align-content: start; gap: var(--sp-3); }
  /* The mascots stand on two ranks of the chosen theme, in its side colours (the rank is a .chess-board in that theme). */
  .ld-rank.chess-board {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    width: auto;
    aspect-ratio: auto;
    padding: var(--sp-2);
    border-radius: var(--r-lg);
    background: repeating-conic-gradient(var(--sq-dark) 0 25%, var(--sq-light) 0 50%) 0 0 / calc(100% / 3) 200%;
  }
  .ld-rank .chess-board__piece, .ld-tcard__board .chess-board__piece { position: static; width: 100%; height: auto; aspect-ratio: 1; transform: none; transition: none; }
  .ld-rank .chess-board__piece.is-ripple .scb-art svg { animation: ld-land 480ms var(--ld-spring); animation-delay: calc(var(--i) * 45ms); }
  /* A 24 px colour in a 44 px target; the chosen one is ringed. */
  .ld-swatch { width: var(--control-h); height: var(--control-h); padding: 8px; border: 2px solid transparent; border-radius: 50%; background: var(--c) content-box; cursor: pointer; }
  .ld-swatch[aria-pressed='true'] { border-color: var(--text); }
  .ld-count { color: var(--muted); font-weight: var(--fw-bold); }
  .ld-count b { margin-right: 4px; color: var(--text); font-family: var(--font-num); font-size: var(--fs-20); }

  .ld-quad { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-3); margin-top: var(--sp-7); }
  .ld-tcard {
    display: grid;
    grid-template-columns: 88px 1fr;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
  }
  .ld-tcard:hover { background: var(--surface-2); }
  .ld-tcard[aria-pressed='true'] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
  /* A two-by-two corner of the theme's board: its frame, squares and pieces. */
  .ld-tcard__board.chess-board { display: grid; grid-template-columns: 1fr 1fr; background: repeating-conic-gradient(var(--sq-dark) 0 25%, var(--sq-light) 0 50%) 0 0 / 100% 100%; }
  .ld-tcard__text { display: grid; gap: 2px; }
  .ld-tcard__text b { font-size: var(--fs-16); }
  .ld-tcard__text span { color: var(--muted); font-size: var(--fs-13); line-height: 1.35; }
  .ld-tcard__text small { color: var(--primary); font-size: var(--fs-12); font-weight: var(--fw-heavy); }
  @media (min-width: 700px) {
    .ld-look { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  }

  /* ---- Friends: a phone that loops the social product, and the rules ---- */
  .ld-policy { display: grid; gap: var(--sp-2); padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
  .ld-policy__row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .ld-role, .ld-act {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: var(--control-h);
    padding: 0 var(--sp-3) 0 var(--sp-1);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-pill);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: var(--fs-13);
    font-weight: var(--fw-heavy);
    cursor: pointer;
  }
  .ld-act { padding: 0 var(--sp-3); font-style: italic; font-weight: var(--fw-bold); }
  .ld-role[aria-pressed='true'], .ld-act[aria-pressed='true'] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
  .ld-role .ld-avatar { width: 30px; height: 30px; }
  .ld-verdict { display: flex; align-items: center; gap: var(--sp-2); min-height: 46px; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: var(--good-soft); color: var(--text); font-weight: var(--fw-heavy); }
  .ld-verdict.is-no { background: var(--bad-soft); }
  .ld-verdict__mark { display: inline-grid; flex: none; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--good); color: var(--surface); animation: ld-pop 360ms var(--ld-spring); }
  .ld-verdict.is-no .ld-verdict__mark { background: var(--bad); color: var(--on-bad); }

  .ld-phone { width: min(100%, 340px); margin-inline: auto; padding: var(--sp-2); border-radius: 34px; background: var(--side-bg); box-shadow: var(--shadow-2); }
  .ld-phone__bar { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-2) var(--sp-3) 6px; color: var(--side-text); font-weight: var(--fw-heavy); }
  .ld-bell { position: relative; }
  .ld-bell b { position: absolute; top: -6px; right: -8px; min-width: 16px; padding: 0 4px; border-radius: var(--r-pill); background: var(--bad); color: var(--on-bad); font-size: 0.65rem; line-height: 16px; text-align: center; animation: ld-pop 360ms var(--ld-spring); }
  .ld-bell.is-ring { animation: ld-ring-bell 700ms ease-in-out; }
  .ld-phone__screen { display: grid; align-content: start; gap: var(--sp-2); min-height: 380px; overflow: hidden; padding: var(--sp-3); border-radius: 24px; background: var(--bg); color: var(--text); }
  .ld-phone__dots { display: flex; justify-content: center; gap: var(--sp-1); padding: var(--sp-1) 0 0; }
  /* Each dot is a 44 px target around a 10 px mark. */
  .ld-phone__dots button { position: relative; width: var(--control-h); height: var(--control-h); padding: 0; border: 0; background: none; cursor: pointer; }
  .ld-phone__dots button::after { content: ''; position: absolute; top: 50%; left: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--side-text); opacity: 0.4; transform: translate(-50%, -50%); }
  .ld-phone__dots button[aria-current='true']::after { opacity: 1; }
  .ld-beat__title { color: var(--muted); font-weight: var(--fw-heavy); }
  .ld-row {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    font-size: var(--fs-13);
    line-height: 1.3;
    animation: ld-row-in 460ms var(--ease) both;
    animation-delay: var(--d, 0ms);
  }
  .ld-row .ld-avatar { width: 34px; height: 34px; }
  .ld-row .btn { margin-left: auto; }
  .ld-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
  .ld-dot.is-on { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
  .ld-live { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--bad); color: var(--on-bad); font-size: var(--fs-12); font-weight: var(--fw-heavy); }
  .ld-live::before { width: 6px; height: 6px; border-radius: 50%; background: var(--on-bad); content: ''; animation: ld-blink-dot 1.2s infinite; }
  .ld-miniboard { overflow: hidden; border-radius: var(--r-sm); }
  .ld-code { display: inline-flex; gap: 4px; min-height: 40px; padding: 6px 10px; border: 1px dashed var(--line-strong); border-radius: var(--r-sm); background: var(--bg); font-family: var(--font-num); font-size: var(--fs-18); font-weight: var(--fw-heavy); letter-spacing: 0.1em; }
  .ld-code span { animation: ld-pop 240ms var(--ld-spring) both; animation-delay: var(--d, 0ms); }

  /* ---- Start: two doors, one for each account type ---------------------- */
  .ld-start { text-align: center; }
  .ld-start h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
  .ld-accounts { display: grid; gap: var(--sp-3); margin-top: var(--sp-6); }
  .ld-account {
    display: grid;
    justify-items: center;
    gap: var(--sp-2);
    padding: var(--sp-6) var(--sp-5);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    box-shadow: var(--shadow-1);
    transition: transform 260ms var(--ld-spring), box-shadow 260ms var(--ease);
  }
  .ld-account:hover { box-shadow: var(--shadow-2); transform: translateY(-4px); }
  .ld-account--kid { border-top: 4px solid var(--gold); }
  .ld-account--adult { border-top: 4px solid var(--primary); }
  .ld-account__art { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: 6px; }
  .ld-account b { font-size: var(--fs-18); }
  .ld-account > span:not(.ld-account__art):not(.btn) { max-width: 26rem; color: var(--muted); }
  .ld-account .btn { margin-top: var(--sp-2); }
  .ld-start__login { margin-top: var(--sp-5); color: var(--muted); font-weight: var(--fw-bold); }
  .ld-start__login a { display: inline-flex; align-items: center; min-height: var(--control-h); font-weight: var(--fw-heavy); }
  @media (min-width: 700px) {
    .ld-accounts { grid-template-columns: 1fr 1fr; }
  }

  .ld-colophon { display: grid; justify-items: center; gap: var(--sp-1); padding: var(--sp-6) var(--ld-gutter); color: var(--muted); font-size: var(--fs-13); font-weight: var(--fw-bold); text-align: center; }

  @media (max-width: 600px) {
    .ld-climber #tierName { display: none; }
  }
  @media (max-width: 420px) {
    .ld-bots { gap: 6px; }
    .ld-bot { padding: var(--sp-1) 2px; font-size: 0.7rem; }
    .ld-tiers { height: 180px; }
    .ld-climber .ld-avatar { width: 52px; height: 52px; }
  }

  @keyframes ld-pop { 0% { transform: scale(0.7); } 100% { transform: scale(1); } }
  @keyframes ld-roll { 0% { transform: rotate(-8deg) scale(0.85); } 100% { transform: rotate(0) scale(1); } }
  @keyframes ld-land { 0% { transform: scale(1.16, 0.76) translateY(3%); } 45% { transform: scale(0.92, 1.1) translateY(-2%); } 100% { transform: scale(1, 1) translateY(0); } }
  @keyframes ld-sticker-in { 0% { opacity: 0; transform: translate(-50%, -50%) rotate(-12deg) scale(0.4); } 100% { opacity: 1; transform: translate(-50%, -50%) rotate(-4deg) scale(1); } }
  @keyframes ld-flip { 0%, 40% { transform: rotate(0); } 50%, 90% { transform: rotate(180deg); } 100% { transform: rotate(360deg); } }
  @keyframes ld-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
  @keyframes ld-count { 0% { opacity: 0; transform: scale(0.5); } 30% { opacity: 1; transform: scale(1.15); } 100% { opacity: 1; transform: scale(1); } }
  @keyframes ld-rise { to { opacity: 1; transform: translateY(0); } }
  @keyframes ld-hop { 0% { transform: translateY(0) scale(1, 1); } 30% { transform: translateY(-18px) scale(0.95, 1.08); } 60% { transform: translateY(0) scale(1.08, 0.92); } 100% { transform: translateY(0) scale(1, 1); } }
  @keyframes ld-delta { 0% { opacity: 0; transform: translateY(6px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
  @keyframes ld-ring-bell { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-18deg); } 40% { transform: rotate(14deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(4deg); } }
  @keyframes ld-row-in { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; transform: translateY(0); } }
  @keyframes ld-blink-dot { 50% { opacity: 0.3; } }

  @media (prefers-reduced-motion: reduce) {
    .ld *, .ld *::before, .ld *::after { animation: none !important; transition: none !important; }
    .ld-course { opacity: 1; transform: none; }
  }
  [data-motion='off'] .ld-course { opacity: 1; transform: none; }
  .ld-notyou { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin: var(--sp-2) 0 0; color: var(--muted); }
}
