/*
 * Палитра и типографика унаследованы от лендинга: бумага, тушь, киноварь.
 * Карта повторяет форму match3-тропы, но не её леденцовую подачу — узлы
 * выглядят как печати на бумаге, закрытые острова уходят под размывку.
 */

:root {
  --paper: #f6f2ea;
  --paper-deep: #efe8db;
  --paper-raised: #fffdf8;
  --ink: #211b14;
  --ink-soft: #5c5347;
  --ink-faint: #9a9084;
  --cinnabar: #c03b1e;
  --cinnabar-dark: #9c2f16;
  --jade: #4a7c59;
  --amber: #c98a1e;
  --line: rgba(33, 27, 20, 0.14);
  --line-strong: rgba(33, 27, 20, 0.26);
  --serif: "Iowan Old Style", "Palatino", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --han: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --radius: 14px;
  --shadow: 0 2px 0 var(--line), 0 10px 24px rgba(33, 27, 20, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

.muted {
  color: var(--ink-soft);
}

#app {
  max-width: 620px;
  margin: 0 auto;
  padding: 0 16px calc(32px + env(safe-area-inset-bottom));
}

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: env(safe-area-inset-top);
}

.screen.boot,
.screen.error {
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ---------------------------------------------------------------- кнопки */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 16px;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn.primary {
  background: var(--cinnabar);
  color: var(--paper);
  box-shadow: 0 2px 0 var(--cinnabar-dark);
}

.btn.primary:hover:not(:disabled) {
  background: var(--cinnabar-dark);
}

.btn.ghost {
  background: var(--paper-raised);
  box-shadow: inset 0 0 0 1.5px var(--line);
}

.btn.small {
  padding: 9px 16px;
  font-size: 14px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.text-button {
  align-self: center;
  padding: 10px 4px;
  font-size: 15px;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button.muted {
  color: var(--ink-faint);
  font-size: 14px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  color: var(--ink-soft);
  flex: none;
}

.icon-button:hover {
  background: var(--paper-deep);
}

/* ---------------------------------------------------------------- шапка карты */

.map-header {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 14px 0 10px;
  background: linear-gradient(var(--paper) 72%, transparent);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 12px;
}

.brand-hanzi {
  font-family: var(--han);
  font-size: 24px;
  color: var(--cinnabar);
  line-height: 1;
}

.brand-hanzi.big {
  font-size: 64px;
}

.brand-name {
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 0.04em;
}

.status-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--paper-raised);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 4px;
}

.status-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.status-value {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1;
}

.status-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------------------------------------------------------------- карта */

.map {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-bottom: 40px;
}

.continue {
  align-self: stretch;
}

.stub-notice {
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(201, 138, 30, 0.12);
  box-shadow: inset 0 0 0 1.5px rgba(201, 138, 30, 0.4);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.stub-notice strong {
  color: var(--ink);
}

.signin-offer {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 13px 15px;
  border-radius: var(--radius);
  background: var(--paper-raised);
  box-shadow: var(--shadow);
}

.signin-offer-text {
  flex: 1 1 220px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.signin-offer-text strong {
  color: var(--ink);
}

.signin-offer-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.account-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-faint);
  padding: 0 2px;
}

.account-line-text::before {
  content: "✓ ";
  color: var(--jade);
  font-weight: 700;
}

.quiz-invite {
  background: var(--paper-raised);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.quiz-invite-text {
  color: var(--ink-soft);
  font-size: 15px;
}

.heatmap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.heatmap-title {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cinnabar);
  font-weight: 600;
}

.heatmap-bars {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper-deep);
}

.heat {
  flex: var(--weight) 0 0;
  min-width: 0;
}

.heat-known {
  background: var(--jade);
}
.heat-learning {
  background: var(--amber);
}
.heat-weak {
  background: var(--cinnabar);
}

.heatmap-legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--ink-faint);
}

.island {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.island-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.island-title {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
}

.island-progress {
  font-size: 13px;
  color: var(--ink-faint);
  white-space: nowrap;
}

/* Тропа: узлы смещаются по синусоиде, между ними — пунктир как след пути. */
.map-path {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.map-node {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  background: var(--paper-raised);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: translateX(var(--offset, 0));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.map-node::before {
  content: "";
  position: absolute;
  left: 34px;
  top: -10px;
  height: 10px;
  border-left: 2px dotted var(--line-strong);
}

.map-path > .map-node:first-child::before {
  display: none;
}

.map-node:hover:not(:disabled) {
  box-shadow: 0 2px 0 var(--line), 0 14px 30px rgba(33, 27, 20, 0.12);
}

.map-node:active:not(:disabled) {
  transform: translateX(var(--offset, 0)) translateY(1px);
}

.map-node-seal {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--cinnabar);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 20px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}

.map-node.state-locked .map-node-seal {
  background: var(--paper-deep);
  color: var(--ink-faint);
  box-shadow: inset 0 0 0 1.5px var(--line);
}

.map-node.state-gated .map-node-seal {
  background: var(--amber);
}

.map-node.state-completed .map-node-seal {
  background: var(--jade);
}

.map-node-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.map-node-title {
  font-weight: 600;
}

.map-node-sub,
.map-node-hint {
  font-size: 13px;
  color: var(--ink-faint);
}

.map-node:disabled {
  opacity: 0.72;
  cursor: default;
}

.stars {
  display: inline-flex;
  gap: 2px;
  font-size: 13px;
  color: var(--line-strong);
}

.star.filled {
  color: var(--amber);
}

/* Остров за облаками: видно, что курс продолжается, содержимое скрыто. */
.island-teaser {
  position: relative;
  min-height: 190px;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(180deg, var(--paper-deep), var(--paper));
  box-shadow: var(--shadow);
}

.island-teaser-body {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 44px 20px 28px;
  text-align: center;
}

.island-teaser-note {
  color: var(--ink-soft);
  font-size: 14px;
}

.clouds {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.cloud {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, rgba(255, 253, 248, 0.98), rgba(246, 242, 234, 0.55) 70%, transparent);
  filter: blur(1px);
  animation: drift 22s ease-in-out infinite alternate;
}

.cloud.c1 {
  width: 220px;
  height: 120px;
  left: -30px;
  top: 10px;
}
.cloud.c2 {
  width: 260px;
  height: 140px;
  right: -50px;
  top: 60px;
  animation-duration: 28s;
  animation-direction: alternate-reverse;
}
.cloud.c3 {
  width: 200px;
  height: 110px;
  left: 30%;
  bottom: -30px;
  animation-duration: 34s;
}

@keyframes drift {
  from {
    transform: translateX(-14px);
  }
  to {
    transform: translateX(14px);
  }
}

/* ---------------------------------------------------------------- урок */

.lesson,
.quiz {
  gap: 20px;
}

.lesson-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
}

.lesson-progress {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--paper-deep);
  overflow: hidden;
}

.lesson-progress-fill {
  display: block;
  height: 100%;
  background: var(--cinnabar);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.lesson-counter {
  font-size: 13px;
  color: var(--ink-faint);
  min-width: 48px;
  text-align: right;
}

.lesson-stage,
.quiz-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card {
  background: var(--paper-raised);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  text-align: center;
  transition: box-shadow 0.2s ease;
}

.card.is-correct {
  box-shadow: 0 2px 0 var(--jade), 0 10px 24px rgba(74, 124, 89, 0.18);
}

.card.is-wrong {
  box-shadow: 0 2px 0 var(--cinnabar), 0 10px 24px rgba(192, 59, 30, 0.18);
}

/* Картинка-якорь — главный носитель мнемоники, поэтому во всю ширину
   карточки, а не марка в углу. Память цепляется за образ, не за подпись. */
.intro-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 14px;
  background: var(--paper-deep);
}

.intro-hanzi,
.prompt-hanzi {
  font-family: var(--han);
  font-size: 56px;
  line-height: 1.1;
}

.prompt-hanzi.big {
  font-size: 68px;
}

.intro-pinyin {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pinyin,
.prompt-pinyin {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--cinnabar);
}

.pinyin-spoken {
  font-size: 13px;
  color: var(--ink-faint);
}

.intro-ru,
.prompt-ru {
  font-size: 19px;
}

.intro-tone {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.intro-mnemonic {
  color: var(--ink-soft);
  font-style: italic;
  max-width: 34ch;
}

.intro-hint {
  font-size: 14px;
  color: var(--ink-faint);
}

.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.prompt {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.prompt-task {
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.prompt-note {
  font-size: 13px;
  color: var(--ink-soft);
}

.prompt-sentence {
  font-family: var(--han);
  font-size: 30px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.option {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--paper);
  box-shadow: inset 0 0 0 1.5px var(--line);
  text-align: center;
  transition: box-shadow 0.15s ease, background 0.15s ease;
}

.option:hover {
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
}

.option.is-correct {
  background: rgba(74, 124, 89, 0.12);
  box-shadow: inset 0 0 0 2px var(--jade);
}

.option.is-wrong {
  background: rgba(192, 59, 30, 0.1);
  box-shadow: inset 0 0 0 2px var(--cinnabar);
}

.option-hanzi {
  font-family: var(--han);
  font-size: 26px;
}

.option-tone {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.option-pinyin {
  font-family: var(--serif);
  color: var(--cinnabar);
  font-size: 15px;
}

.option-tone .option-ru {
  font-size: 13px;
  color: var(--ink-faint);
}

/* сборка предложения */

.assemble-answer {
  min-height: 52px;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  border: 1.5px dashed var(--line-strong);
}

.assemble-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.token {
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--paper);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-family: var(--serif);
  font-size: 17px;
}

.token:disabled {
  opacity: 0.3;
}

.token.picked {
  background: var(--cinnabar);
  color: var(--paper);
  box-shadow: none;
}

.feedback {
  font-size: 15px;
  color: var(--ink-soft);
}

/* проговаривание */

.speak-controls,
.speak-self {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.speak-status {
  min-height: 22px;
  font-size: 15px;
  color: var(--ink-soft);
}

.mic {
  min-width: 200px;
}

/* итог */

.result {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.result-stars {
  display: flex;
  gap: 8px;
  font-size: 42px;
  color: var(--line-strong);
}

.result-stars .star.filled {
  color: var(--amber);
}

.result-title,
.result-level {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
}

.result-line {
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- плеер */

.player {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--paper);
  box-shadow: inset 0 0 0 1.5px var(--line);
}

.pl-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pl-play {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--cinnabar);
  color: var(--paper);
  display: grid;
  place-items: center;
  box-shadow: 0 2px 0 var(--cinnabar-dark);
  transition: background 0.15s ease, transform 0.1s ease;
}

.pl-play:hover:not(:disabled) {
  background: var(--cinnabar-dark);
}

.pl-play:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: none;
}

.pl-play:disabled {
  background: var(--line-strong);
  box-shadow: none;
  cursor: default;
}

.pl-icon {
  font-size: 15px;
  line-height: 1;
  /* Треугольник ▶ визуально смещён влево от центра круга. */
  margin-left: 2px;
}

.is-playing .pl-icon {
  font-size: 13px;
  margin-left: 0;
  letter-spacing: 1px;
}

/* Дорожка намеренно высокая: по ней придётся попадать пальцем на телефоне,
   отматывая к нужному слогу. */
.pl-track {
  position: relative;
  flex: 1;
  height: 22px;
  cursor: pointer;
  touch-action: none;
}

.pl-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 6px;
  margin-top: -3px;
  border-radius: 999px;
  background: var(--paper-deep);
  box-shadow: inset 0 0 0 1px var(--line);
}

.pl-played {
  position: absolute;
  left: 0;
  top: 50%;
  height: 6px;
  margin-top: -3px;
  width: 0;
  border-radius: 999px;
  background: var(--cinnabar);
}

.pl-knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--cinnabar);
  box-shadow: 0 0 0 3px var(--paper-raised);
}

.pl-track:focus-visible {
  outline: none;
}

.pl-track:focus-visible .pl-knob {
  box-shadow: 0 0 0 3px var(--paper-raised), 0 0 0 5px var(--cinnabar);
}

.pl-time {
  flex: none;
  min-width: 3.2em;
  text-align: right;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.pl-chips {
  display: flex;
  gap: 8px;
  padding-left: 56px;
}

.pl-chip {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--paper-raised);
  box-shadow: inset 0 0 0 1.5px var(--line);
  transition: box-shadow 0.15s ease, color 0.15s ease;
}

.pl-chip:hover {
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
}

.pl-chip.is-on {
  color: var(--cinnabar);
  box-shadow: inset 0 0 0 1.5px var(--cinnabar);
}

.player.is-broken .pl-track,
.player.is-broken .pl-chips {
  opacity: 0.4;
  pointer-events: none;
}

@media (max-width: 420px) {
  .pl-chips {
    padding-left: 0;
    justify-content: center;
  }
}

/* ---------------------------------------------------------------- paywall */

.paywall {
  gap: 18px;
  justify-content: center;
}

.paywall-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.paywall-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
}

.paywall-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.paywall-lead {
  text-align: center;
  color: var(--ink-soft);
}

.plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  padding: 20px 12px;
  border-radius: var(--radius);
  background: var(--paper-raised);
  box-shadow: inset 0 0 0 1.5px var(--line);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.plan:hover {
  transform: translateY(-2px);
}

.plan.featured {
  box-shadow: inset 0 0 0 2px var(--cinnabar);
}

.plan-period {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.plan-price {
  font-family: var(--serif);
  font-size: 27px;
}

.plan-permonth {
  font-size: 13px;
  color: var(--ink-faint);
}

.plan-badge {
  position: absolute;
  top: -9px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--cinnabar);
  color: var(--paper);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.paywall-points {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 15px;
}

.paywall-points li::before {
  content: "· ";
  color: var(--cinnabar);
  font-weight: 700;
}

.email-row {
  display: flex;
  gap: 8px;
}

.email-input,
.price-input {
  flex: 1;
  min-width: 0;
  padding: 13px 14px;
  border-radius: 12px;
  border: none;
  background: var(--paper-raised);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font: inherit;
  color: inherit;
}

.email-input:focus,
.price-input:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--cinnabar);
}

.checkout-title {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  text-align: center;
}

.email-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.consent-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  padding: 2px 0;
}

.consent-box {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  accent-color: var(--cinnabar);
  cursor: pointer;
}

.consent-text {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.4;
}

.consent-text a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.consent-text a:hover {
  color: var(--cinnabar);
}

.form-error {
  min-height: 20px;
  font-size: 14px;
  color: var(--cinnabar);
  text-align: center;
}

.paywall-fineprint {
  font-size: 13px;
  color: var(--ink-faint);
  text-align: center;
}

.paywall-thanks {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.thanks-mark {
  font-family: var(--han);
  font-size: 52px;
  color: var(--cinnabar);
}

.price-survey {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.price-question {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.price-question-text {
  font-size: 15px;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- прочее */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 15px;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 50;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.install-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--paper-raised);
  box-shadow: 0 8px 30px rgba(33, 27, 20, 0.18);
  font-size: 14px;
  z-index: 40;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 620px) {
  .map-node {
    padding: 14px 18px;
  }
  .intro-hanzi,
  .prompt-hanzi {
    font-size: 68px;
  }
}

/* -------------------------------------------------------------- оценка карточки */

/*
 * Оценка стоит внутри карточки, но отделена линией: это не часть урока, а
 * реплика в сторону. Кнопки намеренно тихие — яркая пара 👍/👎 посреди
 * разбора перетягивает внимание с материала на себя.
 */
.rate {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.rate-label {
  font-size: 13px;
  color: var(--ink-faint);
  margin-right: auto;
}

.rate-button {
  width: 40px;
  height: 34px;
  border: 0;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  border-radius: 999px;
  background: var(--paper-raised);
  box-shadow: inset 0 0 0 1.5px var(--line);
  /* Серые по умолчанию: цвет появляется только после выбора, иначе кнопки
     читаются как уже нажатые. */
  filter: grayscale(1);
  opacity: 0.62;
  transition: filter 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.rate-button:hover {
  opacity: 0.9;
}

.rate-button.is-on {
  filter: none;
  opacity: 1;
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  background: var(--paper-deep);
}

.rate-note {
  font-size: 12px;
  color: var(--ink-faint);
  min-width: 72px;
  text-align: right;
}

@media (prefers-reduced-motion: reduce) {
  .rate-button {
    transition: none;
  }
}

/* ------------------------------------------------------- сообщение об ошибке */

/*
 * Кнопка живёт поверх всего и намеренно тихая: она нужна в тот момент, когда
 * что-то сломалось, и не должна мозолить глаза всё остальное время.
 * Слева внизу — справа на телефоне большой палец и кнопки урока.
 */
.report-fab {
  position: fixed;
  left: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  padding: 7px 13px;
  border: 0;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-faint);
  background: var(--paper-raised);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1.5px var(--line), 0 2px 8px rgba(33, 27, 20, 0.08);
  opacity: 0.7;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.report-fab:hover,
.report-fab:focus-visible {
  opacity: 1;
  color: var(--ink-soft);
}

.report-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  background: rgba(33, 27, 20, 0.42);
}

.report-card {
  width: 100%;
  max-width: 520px;
  padding: 22px;
  background: var(--paper-raised);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.report-title {
  font-family: var(--serif);
  font-size: 22px;
  margin-bottom: 6px;
}

.report-lead {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.report-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  color: var(--ink-soft);
}

.report-input {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1.5px var(--line);
  resize: vertical;
}

.report-input:focus {
  outline: none;
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
}

.report-attach {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.report-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
}

.report-check input {
  accent-color: var(--cinnabar);
}

/* Раскрывающиеся блоки: показать, что именно уходит, но не занимать этим
   весь диалог — читать журнал станет один человек из двадцати. */
.report-details {
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--paper);
  border-radius: 10px;
  padding: 9px 12px;
  box-shadow: inset 0 0 0 1.5px var(--line);
}

.report-details summary {
  cursor: pointer;
  color: var(--ink-soft);
}

.report-shot-box {
  max-height: 300px;
  overflow: auto;
  margin: 10px 0 6px;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--line);
}

.report-shot {
  display: block;
  width: 100%;
}

.report-log {
  max-height: 190px;
  overflow: auto;
  margin: 10px 0 6px;
  padding: 9px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre;
  color: var(--ink-soft);
  background: var(--paper-deep);
  border-radius: 8px;
}

.report-fineprint {
  font-size: 11.5px;
  color: var(--ink-faint);
}

.report-status {
  font-size: 13px;
  color: var(--ink-soft);
  min-height: 18px;
}

.report-status.is-bad {
  color: var(--cinnabar);
}

.report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Невидимая капча своего места не занимает, но контейнер ей нужен. */
.report-captcha:empty {
  display: none;
}
