/* ==========================================================================
   Особенная погода — a weather-driven Russian reader
   Light, soft, glassy. One accent colour per scene of the story.
   ========================================================================== */

:root {
  --ink:      #1e2d3a;
  --ink-2:    #46596a;
  --ink-3:    #6b8092;
  --ink-4:    #8ea1b0;
  --paper:    #fbfcfd;
  --card:     rgba(255, 255, 255, .74);
  --card-solid:#ffffff;
  --line:     rgba(30, 45, 58, .10);
  --line-2:   rgba(30, 45, 58, .06);

  --sun:      #e0a038;
  --sun-soft: #f6d79a;
  --rain:     #3f7f9e;
  --rose:     #d0736a;
  --leaf:     #6f9a63;
  --good:     #3f8a63;
  --bad:      #c05a52;

  --accent:   #6c8ca6;
  --sky-a:    #e9f1f7;
  --sky-b:    #d2e0ea;

  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --shadow-sm: 0 1px 2px rgba(30,45,58,.05), 0 3px 10px rgba(30,45,58,.05);
  --shadow-md: 0 2px 6px rgba(30,45,58,.06), 0 14px 34px rgba(30,45,58,.09);
  --shadow-lg: 0 6px 18px rgba(30,45,58,.09), 0 30px 60px rgba(30,45,58,.12);

  --ui: "Golos Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --ru: "PT Serif", Georgia, "Times New Roman", serif;

  --maxw: 880px;
  --pad: clamp(1rem, 4vw, 2.2rem);
  --player-h: 84px;
}

/* scene palettes ---------------------------------------------------------- */
body[data-scene="fog"]     { --accent:#6c8ca6; --sky-a:#e9f1f7; --sky-b:#cfdfea; }
body[data-scene="drizzle"] { --accent:#5787a6; --sky-a:#e2edf5; --sky-b:#c4d7e6; }
body[data-scene="rain"]    { --accent:#3f7a9c; --sky-a:#dbe8f2; --sky-b:#b3cbdd; }
body[data-scene="sun"]     { --accent:#c1842a; --sky-a:#fdf4e2; --sky-b:#f6e0b8; }
body[data-scene="rainbow"] { --accent:#8a6fa8; --sky-a:#f8f2ec; --sky-b:#e3eaf0; }
body[data-scene="dusk"]    { --accent:#6d6191; --sky-a:#efeaf5; --sky-b:#d5cee2; }

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--ui);
  color: var(--ink);
  background: var(--sky-b);
  line-height: 1.5;
  overflow-x: hidden;
  padding-bottom: calc(var(--player-h) + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9em;
       background: rgba(30,45,58,.06); padding: .1em .38em; border-radius: 5px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 10px;
  text-decoration: none; transition: top .18s;
}
.skip:focus { top: 12px; }

:where(button, a, input, select, summary):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ==========================================================================
   Ambient sky
   ========================================================================== */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }

.sky__wash {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 50% -10%, color-mix(in srgb, var(--sky-a) 92%, #fff) 0%, transparent 62%),
    linear-gradient(180deg, var(--sky-a) 0%, var(--sky-b) 100%);
  transition: background 1.4s ease;
}
.sky__sun {
  position: absolute; left: 50%; top: -14vmax; width: 62vmax; height: 62vmax;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255,225,170,.55) 0%, rgba(255,225,170,.18) 38%, transparent 66%);
  opacity: 0; transition: opacity 1.6s ease; filter: blur(6px);
}
.sky__fog, .sky__rain { position: absolute; inset: 0; opacity: 0; transition: opacity 1.4s ease; }
.sky__fog i {
  position: absolute; display: block; border-radius: 999px;
  background: rgba(255,255,255,.62); filter: blur(26px);
}
.sky__fog i:nth-child(1) { left: -20%; top: 12%; width: 74%; height: 16vh; animation: drift 42s linear infinite; }
.sky__fog i:nth-child(2) { left: -10%; top: 40%; width: 88%; height: 13vh; opacity: .8; animation: drift 58s linear infinite reverse; }
.sky__fog i:nth-child(3) { left: -30%; top: 68%; width: 70%; height: 18vh; opacity: .65; animation: drift 70s linear infinite; }

@keyframes drift {
  from { transform: translate3d(0,0,0); }
  to   { transform: translate3d(42vw,0,0); }
}

.sky__rain i {
  position: absolute; inset: -20% -10% 0;
  background-image: repeating-linear-gradient(102deg, rgba(90,140,175,.30) 0 1.4px, transparent 1.4px 9px);
  background-size: 100% 220px;
  animation: rainfall 1.1s linear infinite;
}
.sky__rain i:nth-child(2) { opacity: .55; animation-duration: 1.5s; background-size: 100% 300px; }
.sky__rain i:nth-child(3) { opacity: .35; animation-duration: 1.9s; background-size: 100% 380px; }

@keyframes rainfall {
  from { background-position: 0 -220px; }
  to   { background-position: -40px 0; }
}

.sky__bow {
  position: absolute; left: 50%; bottom: -62vmax; width: 128vmax; height: 128vmax;
  transform: translateX(-50%);
  border-radius: 50%;
  background: conic-gradient(from 180deg,
    rgba(208,115,106,.30), rgba(224,160,56,.30), rgba(111,154,99,.28),
    rgba(63,127,158,.30), rgba(138,111,168,.28), rgba(208,115,106,.30));
  -webkit-mask: radial-gradient(circle, transparent 58%, #000 61%, #000 64%, transparent 67%);
          mask: radial-gradient(circle, transparent 58%, #000 61%, #000 64%, transparent 67%);
  filter: blur(26px);
  opacity: 0; transition: opacity 1.8s ease;
}

body[data-scene="fog"]     .sky__fog  { opacity: 1; }
body[data-scene="drizzle"] .sky__fog  { opacity: .5; }
body[data-scene="drizzle"] .sky__rain { opacity: .55; }
body[data-scene="rain"]    .sky__rain { opacity: 1; }
body[data-scene="sun"]     .sky__sun  { opacity: 1; }
body[data-scene="rainbow"] .sky__bow  { opacity: 1; }
body[data-scene="rainbow"] .sky__sun  { opacity: .5; }
body[data-scene="dusk"]    .sky__rain { opacity: .45; }

/* ==========================================================================
   Top bar
   ========================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  background: rgba(255,255,255,.62);
  border-bottom: 1px solid var(--line-2);
}
.topbar__inner {
  max-width: 1180px; margin: 0 auto;
  padding: .55rem var(--pad);
  display: flex; align-items: center; gap: 1rem; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; min-width: 0; }
.brand__mark { display: grid; place-items: center; flex: none; }
.brand__text { display: grid; min-width: 0; }
.brand__text strong {
  font-family: var(--ru); font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand__text small { font-size: .7rem; color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; }

.tabs { display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: transparent; cursor: pointer;
  padding: .55rem .8rem; border-radius: 999px;
  font-size: .87rem; font-weight: 500; color: var(--ink-2);
  white-space: nowrap; min-height: 40px;
  transition: background .18s, color .18s;
}
.tab:hover { background: rgba(255,255,255,.7); color: var(--ink); }
.tab[aria-current="page"] {
  background: var(--ink); color: #fff; font-weight: 600;
  box-shadow: 0 2px 8px rgba(30,45,58,.22);
}

/* ==========================================================================
   Layout
   ========================================================================== */
main { padding: clamp(1rem, 3vw, 2rem) var(--pad) 3rem; }
.view { max-width: var(--maxw); margin: 0 auto; animation: rise .4s cubic-bezier(.2,.7,.3,1) both; }
.view[hidden] { display: none; }
#view-vocab { max-width: 1120px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.viewhead { margin-bottom: 1.4rem; }
.viewhead h1 { font-family: var(--ru); font-size: clamp(1.7rem, 1.2rem + 2vw, 2.4rem); }
.viewhead p { color: var(--ink-2); margin-top: .5rem; max-width: 62ch; font-size: .95rem; }

.subhead {
  font-family: var(--ru); font-size: 1.22rem; margin: 2.2rem 0 .9rem;
  display: flex; align-items: center; gap: .6rem;
}
.subhead::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.subhead__note { color: var(--ink-3); font-size: .88rem; margin: -.4rem 0 .9rem; }
.muted { color: var(--ink-3); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  display: grid; grid-template-columns: minmax(0, 210px) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2rem); align-items: center;
  background: var(--card);
  border: 1px solid rgba(255,255,255,.85);
  border-radius: var(--r-lg);
  padding: clamp(1rem, 3vw, 1.6rem);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin-bottom: 1.1rem;
}
.hero__art img { border-radius: var(--r-md); width: 100%; height: auto; box-shadow: var(--shadow-sm); }
.eyebrow {
  font-size: .7rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin-bottom: .45rem;
}
.hero h1 { font-family: var(--ru); font-size: clamp(1.8rem, 1.2rem + 2.6vw, 2.7rem); }
.hero__sub { color: var(--ink-2); margin-top: .35rem; font-size: .98rem; }
.hero__meta { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem .9rem;
              padding: 0; margin: .85rem 0 0; font-size: .8rem; color: var(--ink-3); }
.hero__meta li { display: flex; align-items: baseline; gap: .3rem; }
.hero__meta strong { color: var(--ink); font-size: .95rem; }
.hero__hint {
  margin-top: .8rem; font-size: .84rem; color: var(--ink-2);
  border-left: 2px solid var(--accent); padding-left: .7rem;
}

/* ==========================================================================
   Read bar
   ========================================================================== */
.readbar { margin: 0 0 .7rem; }
.readbar__progress {
  height: 5px; border-radius: 99px; background: rgba(30,45,58,.09); overflow: hidden;
}
.readbar__progress span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #fff));
  border-radius: 99px; transition: width .4s cubic-bezier(.2,.7,.3,1);
}
.readbar__row { display: flex; align-items: center; justify-content: space-between; margin-top: .5rem; gap: .6rem; }
.scene-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .74rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  padding: .25rem .6rem; border-radius: 99px;
}
.scene-chip__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.readbar__pos { font-size: .78rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Story
   ========================================================================== */
.story {
  background: var(--card);
  border: 1px solid rgba(255,255,255,.85);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: clamp(.7rem, 2.4vw, 1.5rem);
}
.story__para { margin: 0 0 .3rem; }
.story__para + .story__para { margin-top: .55rem; }

.sent {
  display: grid; grid-template-columns: 1.85rem minmax(0,1fr) 2rem;
  gap: .55rem; align-items: start;
  width: 100%; text-align: left;
  background: transparent; border: 0; cursor: pointer;
  padding: .72rem .7rem .72rem .55rem;
  border-radius: var(--r-sm);
  position: relative;
  transition: background .2s, box-shadow .2s, transform .2s;
  -webkit-tap-highlight-color: transparent;
}
.sent::before {
  content: ""; position: absolute; left: 0; top: 12%; bottom: 12%; width: 3px;
  border-radius: 99px; background: var(--accent);
  opacity: 0; transform: scaleY(.4); transition: opacity .25s, transform .25s;
}
.sent:hover { background: rgba(255,255,255,.72); }
.sent:active { transform: scale(.995); }

.sent__num {
  font-size: .7rem; font-weight: 600; color: var(--ink-4);
  font-variant-numeric: tabular-nums; padding-top: .55rem; text-align: right;
  transition: color .2s;
}
.sent__body { min-width: 0; }
.sent__ru {
  display: block;
  font-family: var(--ru);
  font-size: clamp(1.06rem, .97rem + .55vw, 1.28rem);
  line-height: 1.62;
  color: var(--ink);
  letter-spacing: .002em;
  hyphens: auto;
}
.sent__en {
  display: block;
  font-size: clamp(.82rem, .78rem + .18vw, .9rem);
  line-height: 1.5;
  color: var(--ink-3);
  margin-top: .22rem;
  max-width: 62ch;
  transition: opacity .25s;
}
body.hide-en .sent__en { display: none; }

.sent__play {
  align-self: center; justify-self: center;
  width: 1.9rem; height: 1.9rem; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, #fff);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  opacity: .85; transition: opacity .2s, transform .2s, background .2s, color .2s;
  flex: none;
}
.sent:hover .sent__play { opacity: 1; transform: scale(1.06); }
.sent__play svg { width: 15px; height: 15px; }

.sent.is-playing {
  background: color-mix(in srgb, var(--accent) 13%, #fff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent),
              0 6px 20px color-mix(in srgb, var(--accent) 16%, transparent);
}
.sent.is-playing::before { opacity: 1; transform: scaleY(1); }
.sent.is-playing .sent__num { color: var(--accent); }
.sent.is-playing .sent__play {
  opacity: 1; background: var(--accent); color: #fff; transform: scale(1.06);
  border-color: transparent;
  animation: softpulse 1.8s ease-in-out infinite;
}

@keyframes softpulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 42%, transparent); }
  60% { box-shadow: 0 0 0 7px transparent; }
}

.sent.is-done .sent__num { color: color-mix(in srgb, var(--accent) 55%, var(--ink-4)); }

.endcard {
  margin-top: 1.2rem; padding: 1.4rem clamp(1rem,3vw,1.7rem);
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, rgba(255,255,255,.85), rgba(255,255,255,.55));
  border: 1px solid rgba(255,255,255,.9);
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.endcard h2 { font-family: var(--ru); font-size: 1.25rem; }
.endcard p { color: var(--ink-2); font-size: .92rem; margin: .5rem auto 1rem; max-width: 46ch; }
.endcard__actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: .62rem 1.1rem;
  border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink);
  font-size: .88rem; font-weight: 600; cursor: pointer;
  transition: transform .16s, box-shadow .16s, background .16s, border-color .16s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--ink); color: #fff; border-color: transparent; }
.btn--ghost { background: transparent; box-shadow: none; border-color: var(--line); color: var(--ink-2); }
.btn--ghost:hover { background: #fff; }

/* ==========================================================================
   Player
   ========================================================================== */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; align-items: center; gap: clamp(.5rem, 2vw, 1.1rem);
  padding: .55rem clamp(.7rem, 2.4vw, 1.4rem);
  padding-bottom: calc(.55rem + env(safe-area-inset-bottom));
  background: rgba(252,253,254,.86);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 30px rgba(30,45,58,.07);
}
.player__now { display: flex; align-items: center; gap: .5rem; min-width: 0; flex: 1 1 120px; }
.player__pulse {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--ink-4); transition: background .3s;
}
body.is-playing .player__pulse {
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent);
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70% { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.player__label {
  font-size: .78rem; color: var(--ink-2); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.player__controls { display: flex; align-items: center; gap: .25rem; }
.ctl {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background .16s, color .16s, transform .16s;
}
.ctl:hover { background: rgba(30,45,58,.07); color: var(--ink); }
.ctl:active { transform: scale(.94); }
.ctl--main {
  width: 48px; height: 48px; background: var(--ink); color: #fff;
  box-shadow: 0 3px 12px rgba(30,45,58,.25);
}
.ctl--main:hover { background: #16232d; color: #fff; transform: scale(1.04); }
.ctl--main .ico-pause { display: none; }
.ctl--main.is-playing .ico-play { display: none; }
.ctl--main.is-playing .ico-pause { display: block; }

.player__right { display: flex; align-items: center; gap: .45rem; margin-left: auto; }
.speed { display: flex; align-items: center; gap: .3rem; }
.speed__label { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-4); }
.speed select {
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: .38rem 1.5rem .38rem .6rem;
  font-size: .8rem; font-weight: 600; color: var(--ink); cursor: pointer;
  min-height: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236b8092' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .55rem center;
}
.toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  min-height: 38px; padding: .35rem .75rem;
  border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-3);
  font-size: .78rem; font-weight: 600; cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
}
.toggle[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent);
}

/* ==========================================================================
   Vocabulary
   ========================================================================== */
.vocab-tools { display: grid; gap: .75rem; margin-bottom: 1rem; }
.search {
  position: relative; display: flex; align-items: center; gap: .55rem;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: .1rem .3rem .1rem 1rem; box-shadow: var(--shadow-sm);
  color: var(--ink-3);
}
.search input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  padding: .78rem 0; font-size: .95rem; color: var(--ink); font-family: var(--ui);
}
.search input::placeholder { color: var(--ink-4); }
.search__clear {
  border: 0; background: rgba(30,45,58,.07); color: var(--ink-2);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 1rem;
  display: grid; place-items: center; flex: none; margin-right: .2rem;
}

.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: rgba(255,255,255,.72);
  border-radius: 999px; padding: .42rem .8rem; cursor: pointer;
  font-size: .8rem; font-weight: 500; color: var(--ink-2);
  min-height: 38px; transition: background .16s, color .16s, border-color .16s;
  display: inline-flex; align-items: center; gap: .4rem;
}
.chip:hover { background: #fff; color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--ink); color: #fff; border-color: transparent;
}
.chip small { opacity: .6; font-variant-numeric: tabular-nums; }

.vocab-count { font-size: .8rem; color: var(--ink-3); margin-bottom: .8rem; }

.vocab-grid {
  display: grid; gap: .9rem;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  align-items: stretch;
}

.card {
  background: var(--card-solid);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow .2s, transform .2s, border-color .2s;
  animation: rise .35s cubic-bezier(.2,.7,.3,1) both;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card.is-known { border-color: color-mix(in srgb, var(--good) 35%, transparent); }

.card__media { position: relative; background: #eef4f8; }
.card__media img { width: 100%; height: auto; aspect-ratio: 320 / 200; object-fit: cover; }
.card__say {
  position: absolute; right: .55rem; bottom: .55rem;
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.94); color: var(--accent);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 3px 12px rgba(30,45,58,.18);
  transition: transform .16s, background .16s, color .16s;
}
.card__say:hover { transform: scale(1.06); background: var(--accent); color: #fff; }
.card__say.is-playing { background: var(--accent); color: #fff; }
.card__say svg { width: 18px; height: 18px; }

.card__known {
  position: absolute; left: .55rem; top: .55rem;
  width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.9); color: var(--ink-4);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 2px 8px rgba(30,45,58,.14);
  transition: background .16s, color .16s, transform .16s;
}
.card__known:hover { transform: scale(1.06); }
.card__known[aria-pressed="true"] { background: var(--good); color: #fff; }

.card__body { padding: .8rem .9rem 1rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.card__top { display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap; }
.card__ru {
  font-family: var(--ru); font-size: 1.3rem; font-weight: 700;
  line-height: 1.15; letter-spacing: -.01em;
}
.card__form {
  font-size: .72rem; color: var(--ink-3);
  background: rgba(30,45,58,.05); padding: .1rem .4rem; border-radius: 5px;
  font-family: var(--ru);
}
.card__gloss { font-size: .92rem; color: var(--ink-2); font-weight: 500; }
.card__pos { font-size: .7rem; color: var(--ink-4); text-transform: uppercase; letter-spacing: .05em; }
.card__note {
  font-size: .82rem; line-height: 1.5; color: var(--ink-2);
  margin-top: .15rem; flex: 1;
}
.card__ex {
  font-family: var(--ru); font-size: .82rem; line-height: 1.45;
  color: var(--ink-3); font-style: italic;
  border-left: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding-left: .55rem; margin-top: .3rem;
}
.empty { text-align: center; color: var(--ink-3); padding: 3rem 1rem; }

/* ==========================================================================
   Practice
   ========================================================================== */
.scorecard {
  display: flex; align-items: center; gap: 1rem;
  background: var(--card); border: 1px solid rgba(255,255,255,.9);
  border-radius: var(--r-md); padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm); backdrop-filter: blur(10px);
  margin-bottom: 1rem;
}
.scorecard__ring {
  width: 62px; height: 62px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-size: .92rem; font-weight: 700; color: var(--accent);
  background:
    radial-gradient(closest-side, #fff 74%, transparent 75%),
    conic-gradient(var(--accent) calc(var(--pct, 0) * 1%), rgba(30,45,58,.09) 0);
  font-variant-numeric: tabular-nums;
}
.scorecard__body { flex: 1; min-width: 0; }
.scorecard__body strong { font-size: .95rem; }
.scorecard__body p { font-size: .8rem; color: var(--ink-3); margin-top: .15rem; }

.setnav { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.2rem; }

.set { margin-bottom: 2rem; }
.set__head { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .3rem; }
.set__head h2 { font-family: var(--ru); font-size: 1.15rem; }
.set__head span { font-size: .75rem; color: var(--ink-4); }
.set__intro { font-size: .85rem; color: var(--ink-3); margin-bottom: .9rem; }

.q {
  background: var(--card-solid); border: 1px solid var(--line-2);
  border-radius: var(--r-md); padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm); margin-bottom: .75rem;
}
.q__prompt {
  font-size: .98rem; font-weight: 600; margin-bottom: .75rem;
  display: flex; align-items: flex-start; gap: .55rem;
}
.q__n {
  flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: rgba(30,45,58,.06); color: var(--ink-3);
  display: grid; place-items: center; font-size: .72rem; font-weight: 700;
  margin-top: .05rem;
}
.q__ru { font-family: var(--ru); }
.q__gap { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
          font-family: var(--ru); font-size: 1.06rem; line-height: 1.8; }
.q__blank {
  display: inline-block; min-width: 4.2rem; border-bottom: 2px dashed var(--accent);
  text-align: center; color: var(--accent); font-weight: 700;
}
.q__blank.is-filled { border-bottom-style: solid; }
.q__listen {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: .5rem .9rem; cursor: pointer; font-size: .84rem; font-weight: 600;
  color: var(--ink-2); min-height: 42px; margin-bottom: .7rem;
  box-shadow: var(--shadow-sm);
}
.q__listen:hover { color: var(--ink); border-color: var(--ink-4); }

.opts { display: grid; gap: .4rem; }
.opt {
  display: flex; align-items: center; gap: .6rem; text-align: left;
  border: 1px solid var(--line); background: #fff;
  border-radius: var(--r-sm); padding: .68rem .8rem;
  font-size: .9rem; cursor: pointer; min-height: 46px;
  transition: border-color .16s, background .16s, transform .12s;
}
.opt:hover:not(:disabled) { border-color: var(--ink-4); background: #fcfdfe; }
.opt:disabled { cursor: default; }
.opt__key {
  flex: none; width: 1.35rem; height: 1.35rem; border-radius: 6px;
  background: rgba(30,45,58,.06); color: var(--ink-3);
  display: grid; place-items: center; font-size: .7rem; font-weight: 700;
}
.opt.is-correct { border-color: color-mix(in srgb, var(--good) 55%, transparent);
                  background: color-mix(in srgb, var(--good) 9%, #fff); }
.opt.is-correct .opt__key { background: var(--good); color: #fff; }
.opt.is-wrong { border-color: color-mix(in srgb, var(--bad) 50%, transparent);
                background: color-mix(in srgb, var(--bad) 8%, #fff); }
.opt.is-wrong .opt__key { background: var(--bad); color: #fff; }

.fb {
  margin-top: .75rem; padding: .7rem .85rem; border-radius: var(--r-sm);
  font-size: .84rem; line-height: 1.55;
  display: flex; gap: .55rem; align-items: flex-start;
  animation: rise .3s ease both;
}
.fb--ok { background: color-mix(in srgb, var(--good) 10%, #fff);
          color: color-mix(in srgb, var(--good) 80%, var(--ink)); }
.fb--no { background: color-mix(in srgb, var(--bad) 9%, #fff);
          color: color-mix(in srgb, var(--bad) 75%, var(--ink)); }
.fb__icon { flex: none; font-weight: 700; }

/* ==========================================================================
   Guide
   ========================================================================== */
.accordion { display: grid; gap: .55rem; }
.acc {
  background: var(--card-solid); border: 1px solid var(--line-2);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm); overflow: hidden;
}
.acc[open] { box-shadow: var(--shadow-md); }
.acc summary {
  cursor: pointer; padding: .9rem 1.1rem; list-style: none;
  display: flex; align-items: center; gap: .7rem; min-height: 52px;
}
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after {
  content: ""; margin-left: auto; width: 8px; height: 8px; flex: none;
  border-right: 2px solid var(--ink-4); border-bottom: 2px solid var(--ink-4);
  transform: rotate(45deg) translateY(-2px); transition: transform .2s;
}
.acc[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.acc__head { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.acc__title { font-family: var(--ru); font-size: 1rem; font-weight: 700; line-height: 1.3; }
.acc__ru { font-size: .68rem; color: var(--accent); font-weight: 600;
           letter-spacing: .05em; text-transform: uppercase; }
.acc__body { padding: 0 1.1rem 1.1rem; }
.acc__body > p { font-size: .9rem; line-height: 1.6; color: var(--ink-2); margin-bottom: .8rem; }

.exlist { display: grid; gap: .45rem; }
.ex {
  display: flex; gap: .7rem; align-items: baseline;
  padding: .5rem .65rem; border-radius: var(--r-xs);
  background: rgba(30,45,58,.025); border-left: 2px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.ex__ru { font-family: var(--ru); font-size: .95rem; flex: 1 1 auto; }
.ex__en { font-size: .8rem; color: var(--ink-3); flex: 1 1 auto; }
.ex__tag {
  font-size: .66rem; font-weight: 700; color: var(--accent); flex: none;
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  padding: .12rem .4rem; border-radius: 4px; white-space: nowrap;
}
@media (max-width: 560px) { .ex { flex-wrap: wrap; } .ex__en { flex-basis: 100%; } }

.phrases { display: grid; gap: .6rem; }
.phrase {
  display: flex; align-items: center; gap: .8rem;
  background: var(--card-solid); border: 1px solid var(--line-2);
  border-radius: var(--r-md); padding: .8rem .9rem; box-shadow: var(--shadow-sm);
}
.phrase__body { flex: 1; min-width: 0; }
.phrase__ru { font-family: var(--ru); font-size: 1.02rem; }
.phrase__en { font-size: .84rem; color: var(--ink-3); margin-top: .1rem; }
.phrase__note { font-size: .78rem; color: var(--ink-4); margin-top: .25rem; }
.phrase__play {
  flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: color-mix(in srgb, var(--accent) 12%, #fff); color: var(--accent);
  display: grid; place-items: center; cursor: pointer;
  transition: background .16s, color .16s, transform .16s;
}
.phrase__play:hover { background: var(--accent); color: #fff; transform: scale(1.05); }
.phrase__play.is-playing { background: var(--accent); color: #fff; }

.about-audio {
  background: var(--card-solid); border: 1px solid var(--line-2);
  border-radius: var(--r-md); padding: 1rem 1.1rem; box-shadow: var(--shadow-sm);
}
.about-audio p { font-size: .88rem; line-height: 1.6; color: var(--ink-2); }
.about-audio p + p { margin-top: .6rem; }

/* ==========================================================================
   Footer
   ========================================================================== */
.foot {
  max-width: var(--maxw); margin: 0 auto; padding: 2rem var(--pad) 3rem;
  font-size: .76rem; color: var(--ink-3); line-height: 1.6;
}
.foot p + p { margin-top: .4rem; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 780px) {
  :root { --player-h: 104px; }
  .hero { grid-template-columns: 1fr; gap: .9rem; padding: 1rem; }
  .hero__art { max-width: 190px; margin: 0 auto; }

  .topbar__inner { flex-direction: column; align-items: stretch; gap: .15rem; padding: .4rem var(--pad) .3rem; }
  .brand { justify-content: center; gap: .45rem; }
  .brand__text { justify-items: center; }
  .brand__text strong { font-size: .95rem; }
  .brand__text small { font-size: .64rem; }
  .brand__mark svg { width: 28px; height: 28px; }
  .tabs { justify-content: center; gap: 0; }
  .tab { padding: .45rem .6rem; font-size: .8rem; min-height: 36px; }

  .player {
    flex-wrap: wrap; gap: .15rem .4rem;
    padding: .4rem clamp(.6rem, 2.4vw, 1rem);
    padding-bottom: calc(.4rem + env(safe-area-inset-bottom));
  }
  .player__now { flex: 1 1 auto; order: 1; min-width: 0; }
  .player__right { order: 2; margin-left: auto; }
  .player__controls { order: 3; flex: 1 1 100%; justify-content: center; gap: .05rem; }
  .player__label { font-size: .74rem; }
  .ctl { width: 44px; height: 44px; }
  .ctl--main { width: 50px; height: 50px; }
  .speed__label { display: none; }
  .toggle span { display: none; }
  .toggle { padding: .3rem .5rem; min-height: 34px; }
  .toggle svg { width: 19px; height: 19px; }
  .speed select { min-height: 34px; padding: .25rem 1.4rem .25rem .55rem; }

  /* keep the filter row on one scrollable line instead of five wrapped rows */
  .chips {
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad) .25rem;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }

  .card__media img { max-height: 190px; object-fit: cover; }
}

@media (max-width: 420px) {
  .sent { grid-template-columns: 1.35rem minmax(0,1fr) 1.9rem; padding: .65rem .4rem; }
  .sent__num { font-size: .64rem; padding-top: .5rem; }
  .sent__play { width: 1.7rem; height: 1.7rem; }
  .sent__play svg { width: 13px; height: 13px; }
  .vocab-grid { grid-template-columns: 1fr; }
  .hero__meta { font-size: .74rem; }
}

@media (min-width: 900px) {
  .story { padding: 1.8rem 2rem; }
}

/* ==========================================================================
   Motion preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .sky__fog, .sky__rain { display: none; }
}

@media print {
  .sky, .player, .topbar, .endcard__actions, .vocab-tools { display: none !important; }
  body { padding: 0; background: #fff; }
  .story { box-shadow: none; border: 0; background: #fff; }
}
