:root {
  --bg: #0b0f1a;
  --bg-grid: #0d1424;
  --panel: rgba(19, 26, 42, 0.72);
  --panel-solid: #131a2a;
  --border: rgba(45, 226, 230, 0.25);
  --accent: #2de2e6;
  --accent-rgb: 45, 226, 230;
  --second-rgb: 184, 79, 255;
  --accent-dim: rgba(45, 226, 230, 0.35);
  --grammar: #b84fff;
  --success: #39ff88;
  --review: #ffb86b;
  --error: #ff4d5e;
  --text: #e8f3ff;
  --text-dim: #8fa3c0;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", "HT Hanzi", monospace;
  --sans: -apple-system, "Segoe UI", "HT Hanzi", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100%;
}

body {
  background-image:
    linear-gradient(rgba(var(--accent-rgb), 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  background-color: var(--bg-grid);
}

.glow {
  text-shadow: 0 0 8px var(--accent-dim), 0 0 2px var(--accent);
}

button { font-family: inherit; }

.shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Falling hanzi behind everything (drawn by app.js). Panels blur it and
   word cards are opaque, so text always sits on a calm surface; during
   review it fades further so the exercise has the child's attention. */
#hanzi-rain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
  transition: opacity 0.6s ease;
}
body[data-route="review"] #hanzi-rain,
body[data-route="game"] #hanzi-rain { opacity: 0.16; }
body[data-route] #hanzi-rain.party { opacity: 0.6; }

/* Top bar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  font-family: var(--mono);
}

.topbar-title { display: flex; flex-direction: column; gap: 2px; }
.topbar-title .glow { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.02em; }
.topbar-sub { font-size: 0.72rem; color: var(--text-dim); }
.status-online { color: var(--success); position: relative; padding-left: 12px; }
.status-online::before {
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 6px; height: 6px; margin-top: -3px;
  border-radius: 50%; background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulseDot 1.8s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

@keyframes flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: 0.45; }
}
.glow { animation: flicker 2.2s linear 1; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .glow, .status-online::before, .view-root,
  .word-card, .grammar-card, .lesson-list-item, .mascot-img {
    animation: none !important;
  }
}

.topbar-stats { display: flex; gap: 16px; font-size: 0.8rem; color: var(--text-dim); }
.topbar-stats b { color: var(--accent); font-size: 0.95rem; }
.topbar-stats .stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.topbar-stats .stat small { font-size: 0.65rem; }

/* Navigation icons (inline SVG in index.html, drawn with currentColor) */
.nav-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-label { display: flex; flex-direction: column; gap: 1px; }

/* Russian label first, the Chinese name small beside it */
.zh-tag { font-size: 0.72em; color: var(--text-dim); margin-left: 6px; font-weight: normal; }
.tab-btn.active .zh-tag { color: inherit; opacity: 0.7; }
.section-tile .zh-tag { margin-left: 4px; }

/* Body layout */
.body-row {
  display: flex;
  flex: 1;
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
}

.sidenav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 160px;
  padding: 20px 10px;
  flex-shrink: 0;
}

.sidenav .nav-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-size: 1rem;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.sidenav .nav-item:active { transform: scale(0.97); }

/* Nav labels sit straight on the page; a dark plate keeps the falling hanzi from running through them. */
.sidenav .nav-item:not(.active):not(:hover) { background: rgba(11, 15, 26, 0.6); }

.sidenav .nav-item small { font-size: 0.68rem; color: var(--text-dim); }

.sidenav .nav-item.active,
.sidenav .nav-item:hover {
  color: var(--accent);
  border-color: var(--border);
  background: rgba(var(--accent-rgb), 0.06);
}

.bottomnav {
  display: none;
  position: sticky;
  bottom: 0;
  background: var(--panel);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(10px);
  justify-content: space-around;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}

/* Пять кнопок (с «Игры» и «Я») должны влезть в 320px: делим ширину поровну. */
.bottomnav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1 1 0;
  min-width: 0;
  max-width: 96px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.74rem;
  padding: 4px 2px;
  border-radius: 8px;
  white-space: nowrap;
  transition: color 0.15s ease, transform 0.1s ease;
}
@media (max-width: 360px) {
  .bottomnav .nav-item { font-size: 0.68rem; }
}
.bottomnav .nav-item small { font-size: 0.6rem; opacity: 0.7; }

.bottomnav .nav-item:active { transform: scale(0.92); }

.bottomnav .nav-item.active { color: var(--accent); }

.view-root {
  flex: 1;
  padding: 20px 20px 40px;
  min-width: 0;
  animation: fadeSlideIn 0.35s ease;
}

/* Panels / cards */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  backdrop-filter: blur(8px);
}

.hero-card { margin-bottom: 20px; }
.hero-card .eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.hero-card h1 {
  margin: 6px 0 2px;
  font-size: 1.5rem;
}
.hero-card .pinyin { color: var(--text-dim); font-family: var(--mono); font-size: 0.9rem; }
.hero-card .ru { color: var(--text-dim); margin: 4px 0 16px; }

.progress-bar {
  height: 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  margin: 8px 0;
}
.progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  transition: width 0.3s ease;
}

.btn-continue {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  background: var(--accent);
  color: #06131a;
  font-weight: 700;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--mono);
}
.btn-continue { transition: filter 0.15s ease, transform 0.1s ease; }
.btn-continue:hover { filter: brightness(1.1); }
.btn-continue:active { transform: scale(0.97); }

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.section-tile {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}
.section-tile b { color: var(--text); display: block; font-size: 1rem; }

/* Settings row (pinyin/translation toggles) */
.settings-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  font-family: var(--mono);
  font-size: 0.78rem;
}
.toggle {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.toggle.on { color: var(--accent); border-color: var(--accent-dim); }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.tab-btn.active { color: var(--bg); background: var(--accent); border-color: var(--accent); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.word-card, .grammar-card {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  animation: cardIn 0.32s ease backwards;
}
.card-grid > *:nth-child(1) { animation-delay: 0.01s; }
.card-grid > *:nth-child(2) { animation-delay: 0.04s; }
.card-grid > *:nth-child(3) { animation-delay: 0.07s; }
.card-grid > *:nth-child(4) { animation-delay: 0.1s; }
.card-grid > *:nth-child(5) { animation-delay: 0.13s; }
.card-grid > *:nth-child(6) { animation-delay: 0.16s; }
.card-grid > *:nth-child(n+7) { animation-delay: 0.18s; }
.word-card::before, .grammar-card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--accent);
}
.grammar-card::before { background: var(--grammar); }

.word-hanzi {
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.1;
  text-shadow: 0 0 10px rgba(45,226,230,0.25);
}
.word-pinyin {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.85rem;
  margin: 4px 0;
  cursor: pointer;
  min-height: 1.2em;
}
.word-pinyin.hidden-value { color: var(--text-dim); font-style: italic; }
.word-pos { color: var(--text-dim); font-size: 0.7rem; font-family: var(--mono); }
.word-ru { margin: 6px 0; }
.word-example {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 0.85rem;
  color: var(--text-dim);
}
.word-example .ex-hanzi, .example-row .ex-hanzi { color: var(--text); font-size: 1.1rem; }
.word-example .ex-pinyin { font-family: var(--mono); font-size: 0.78rem; }

.mastery-pill {
  margin-top: 12px;
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--border);
  user-select: none;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.mastery-pill:active { transform: scale(0.9); }
.mastery-badge { cursor: default; }
.mastery-badge:active { transform: none; }
.mastery-0 { color: var(--text-dim); }
.mastery-1 { color: var(--accent); border-color: var(--accent-dim); }
.mastery-2 { color: var(--review); border-color: rgba(255,184,107,0.4); }
.mastery-3 { color: var(--success); border-color: rgba(57,255,136,0.4); }

.grammar-card .pattern {
  font-family: var(--mono);
  background: rgba(184, 79, 255, 0.08);
  border: 1px solid rgba(184, 79, 255, 0.3);
  color: #dcb8ff;
  padding: 8px 10px;
  border-radius: 8px;
  margin: 6px 0 10px;
  font-size: 0.9rem;
}
.grammar-card h3 { margin: 0 0 2px; font-size: 1rem; }
.grammar-card .title-hanzi { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 6px; }
.grammar-card .example-row {
  font-size: 0.85rem;
  margin: 6px 0;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}
.grammar-card .example-row:last-child { border-bottom: none; }
.grammar-card .ex-pinyin { font-family: var(--mono); font-size: 0.75rem; color: var(--grammar); }

.lesson-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  background: rgba(255,255,255,0.02);
  animation: cardIn 0.3s ease backwards;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.lesson-list-item:hover { border-color: var(--accent-dim); }
.lesson-list-item:active { transform: scale(0.99); }
.lesson-list-item .num { font-family: var(--mono); color: var(--accent); margin-right: 10px; }
.lli-main { min-width: 0; }
.lli-main .num { display: block; font-size: 0.75rem; margin-bottom: 2px; }
.lli-title { font-size: 1.05rem; }
.lli-ru { font-size: 0.8rem; color: var(--text-dim); margin-top: 4px; }
.lli-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 12px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  white-space: nowrap;
}
.mini-bar { width: 64px; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.08); overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--success)); }

.progress-caption { margin: 8px 0 12px; color: var(--text-dim); font-size: 0.9rem; overflow-wrap: anywhere; }

/* Pronunciation button */
.say-row { display: flex; align-items: center; gap: 10px; }
.say-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--accent-dim);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
}
.say-btn:hover { filter: brightness(1.25); }
.say-btn:active { transform: scale(0.9); }
.say-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.say-btn svg .fill { fill: currentColor; }
.word-example .say-btn, .example-row .say-btn { width: 28px; height: 28px; }
.word-example .say-btn svg, .example-row .say-btn svg { width: 15px; height: 15px; }
.lesson-list-item:nth-child(1) { animation-delay: 0.01s; }
.lesson-list-item:nth-child(2) { animation-delay: 0.03s; }
.lesson-list-item:nth-child(3) { animation-delay: 0.05s; }
.lesson-list-item:nth-child(4) { animation-delay: 0.07s; }
.lesson-list-item:nth-child(5) { animation-delay: 0.09s; }
.lesson-list-item:nth-child(n+6) { animation-delay: 0.1s; }

/* Mascot / assistant */
.mascot-panel {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
}
.mascot-img {
  height: 200px;
  width: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 0 14px rgba(var(--accent-rgb), 0.25));
  animation: float 4.5s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.mascot-speech {
  position: relative;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  flex: 1;
}
.mascot-speech::before {
  content: "";
  position: absolute;
  left: -8px;
  bottom: 18px;
  width: 14px; height: 14px;
  background: var(--panel-solid);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: rotate(45deg);
}
.mascot-name {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.mascot-line { color: var(--text); font-size: 0.92rem; }

@media (max-width: 560px) {
  .mascot-panel { align-items: center; }
  .mascot-img { height: 120px; }
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 20px;
  font-family: var(--mono);
}

.group-heading {
  font-family: var(--mono);
  color: var(--accent);
  margin: 24px 0 10px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.group-heading:first-child { margin-top: 0; }

body.ru-hidden .word-ru { display: none; }

/* Intro visual novel */
.intro-stage {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: calc(100vh - 90px);
  position: relative;
  padding-top: 20px;
}
.intro-skip {
  position: absolute;
  top: 0; right: 0;
  color: var(--text-dim);
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 6px 10px;
  z-index: 2;
}
.intro-skip:hover { color: var(--accent); }

.intro-character-row {
  display: flex;
  align-items: flex-end;
  min-height: 46vh;
}
.intro-stage.side-left .intro-character-row { justify-content: flex-start; }
.intro-stage.side-right .intro-character-row { justify-content: flex-end; }

.intro-img {
  height: 46vh;
  max-height: 460px;
  min-height: 260px;
  width: auto;
  filter: drop-shadow(0 0 24px rgba(var(--accent-rgb), 0.3));
  animation: float 4.5s ease-in-out infinite;
}

.intro-box {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  width: 100%;
  cursor: pointer;
  animation: fadeSlideIn 0.25s ease;
  margin-top: 16px;
}
.intro-text {
  min-height: 3.6em;
  font-size: 1.05rem;
  line-height: 1.5;
  margin: 6px 0 14px;
}
.intro-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.intro-dots { display: flex; gap: 6px; }
.intro-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
}
.intro-dot.active { background: var(--accent); box-shadow: 0 0 6px var(--accent); }

@media (max-width: 700px) {
  .intro-character-row { min-height: 34vh; justify-content: center !important; }
  .intro-img { height: 34vh; min-height: 170px; }
  .intro-text { font-size: 0.95rem; }
}

/* Group picker */
body.no-group .sidenav,
body.no-group .bottomnav,
body.no-group .topbar-stats { display: none; }

.group-picker { text-align: center; padding: 32px 20px; }
.group-picker h1 { margin: 8px 0 4px; }
.group-btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 24px;
}
.group-btn {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 16px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: inherit;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.group-btn:hover { border-color: var(--accent); }
.group-btn:active { transform: scale(0.98); }
.group-btn-label { font-size: 1.2rem; font-weight: 700; }
.group-btn-sub { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); }
.group-btn-course {
  align-self: center;
  padding: 1px 8px;
  border: 1px solid var(--accent-dim);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
}

.lesson-list-note {
  margin-top: 4px;
  padding: 10px 0 0;
  color: var(--text-dim);
  font-size: 0.82rem;
  text-align: center;
}
.change-group-link {
  text-align: center;
  margin-top: 14px;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
}
.change-group-link:hover { color: var(--accent); }

/* Student login (server mode) */
.login-panel { max-width: 420px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.login-field { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--text-dim); }
.login-field input {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-family: var(--mono);
  font-size: 1.3rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.login-field input:focus { outline: none; border-color: var(--accent); }
.login-error { color: var(--error); font-size: 0.9rem; }

/* Homework */
.hw-panel { margin-bottom: 20px; border-left: 3px solid var(--review); }
.hw-panel-returned { border-left-color: var(--error); }
.hw-panel-submitted { border-left-color: var(--accent); }
.hw-panel-accepted { border-left-color: var(--success); }
.hw-panel h3, .hw-card h3 { margin: 4px 0 6px; font-size: 1.15rem; }
.hw-card { margin-bottom: 16px; }
.hw-details { white-space: pre-wrap; margin-bottom: 8px; }
.hw-due { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 8px; }
.hw-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid currentColor;
  margin-bottom: 10px;
}
.hw-todo { color: var(--review); }
.hw-submitted { color: var(--accent); }
.hw-returned { color: var(--error); }
.hw-accepted { color: var(--success); }
.hw-comment {
  background: rgba(255, 77, 94, 0.07);
  border-left: 3px solid var(--error);
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 10px;
}
.hw-panel-accepted .hw-comment, .hw-card .hw-accepted ~ .hw-comment {
  background: rgba(57, 255, 136, 0.06);
  border-left-color: var(--success);
}
.hw-more { color: var(--text-dim); font-size: 0.8rem; margin-top: 8px; }
.hw-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 12px; }
.hw-photo { position: relative; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.hw-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hw-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(11, 15, 26, 0.8);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.hw-add { display: inline-block; cursor: pointer; }
.hw-hint { color: var(--text-dim); font-size: 0.8rem; margin-top: 8px; }
.hw-progress { color: var(--accent); margin: 8px 0; }

/* Review quiz */
.quiz-stage {
  position: relative;
  display: flex;
  justify-content: center;
}

/* "对！" floating up over the card on a right answer */
.cheer {
  position: absolute;
  left: 50%;
  top: 6px;
  z-index: 5;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--success);
  text-shadow: 0 0 14px rgba(57, 255, 136, 0.6);
  pointer-events: none;
  animation: cheerUp 0.9s ease-out forwards;
}
@keyframes cheerUp {
  0% { opacity: 0; transform: translate(-50%, 12px) scale(0.6); }
  25% { opacity: 1; transform: translate(-50%, 0) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -46px) scale(1); }
}
.quiz-stage.settled .quiz-card { animation: none; }
.quiz-card {
  max-width: 440px;
  width: 100%;
  text-align: center;
  padding: 32px 24px;
}
.quiz-card .word-hanzi,
.quiz-card .quiz-hanzi {
  font-size: 3.2rem;
  text-shadow: 0 0 14px rgba(var(--accent-rgb), 0.3);
}
.quiz-card .title-hanzi { font-size: 1.4rem; margin-bottom: 6px; }
.quiz-card .pattern { display: inline-block; margin: 6px auto 0; }
.quiz-front { margin-bottom: 18px; }
.quiz-back { animation: fadeSlideIn 0.25s ease; text-align: left; }
.quiz-back .word-example { text-align: left; }
.quiz-reveal { width: 100%; }
.quiz-rate {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.rate-btn {
  flex: 1;
  padding: 12px 10px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  transition: transform 0.1s ease, filter 0.15s ease;
}
.rate-btn:active { transform: scale(0.97); }
.rate-no { border-color: rgba(255,77,94,0.4); color: var(--error); }
.rate-no:hover { filter: brightness(1.2); }
.rate-yes { border-color: rgba(57,255,136,0.4); color: var(--success); }
.rate-yes:hover { filter: brightness(1.2); }

/* Exercise variants (综合练习) */
.quiz-instruction {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}
.quiz-prompt-ru {
  font-size: 1.4rem;
  padding: 4px 0;
}
.quiz-example-hanzi {
  font-size: 1.6rem;
  margin-top: 8px;
  text-shadow: 0 0 10px rgba(var(--accent-rgb), 0.25);
}
.quiz-statement {
  font-size: 1.05rem;
  color: var(--text);
  margin: 16px 0;
  font-style: italic;
}
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.option-btn {
  padding: 12px 14px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  transition: transform 0.1s ease, filter 0.15s ease, border-color 0.15s ease;
}
.option-btn:not(:disabled):hover { border-color: var(--accent-dim); }
.option-btn:not(:disabled):active { transform: scale(0.98); }
.option-btn:disabled { cursor: default; }
/* «Выбери пиньинь»: варианты отличаются только знаком тона — он должен быть
   крупным и чётким, моноширинный шрифт рисует диакритику мелко. */
.quiz-options-pinyin .option-btn {
  font-family: var(--sans);
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  text-align: center;
}
.option-correct {
  border-color: rgba(57,255,136,0.6);
  color: var(--success);
  background: rgba(57,255,136,0.08);
}
.option-wrong {
  border-color: rgba(255,77,94,0.6);
  color: var(--error);
  background: rgba(255,77,94,0.08);
}
.quiz-tf-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.tf-btn {
  flex: 1;
  padding: 14px 10px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  transition: transform 0.1s ease, filter 0.15s ease, border-color 0.15s ease;
}
.tf-btn:not(:disabled):hover { border-color: var(--accent-dim); }
.tf-btn:not(:disabled):active { transform: scale(0.97); }
.tf-btn:disabled { cursor: default; }
.quiz-continue {
  width: 100%;
  margin-top: 18px;
  animation: fadeSlideIn 0.2s ease;
}

/* Fill-in-the-blank */
.quiz-sentence {
  font-size: 1.3rem;
  line-height: 1.8;
  margin-bottom: 10px;
}
.blank-slot {
  display: inline-block;
  min-width: 2.2em;
  padding: 0 8px;
  margin: 0 2px;
  border-bottom: 2px solid var(--accent-dim);
  color: var(--accent);
  font-family: var(--mono);
}
.blank-correct { border-color: var(--success); color: var(--success); }
.blank-wrong { border-color: var(--error); color: var(--error); }

/* Sentence building */
.sentence-build-hint { margin-bottom: 14px; }
.sentence-assembly {
  min-height: 56px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  padding: 10px;
  margin-bottom: 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
}
.assembly-placeholder {
  color: var(--text-dim);
  font-size: 0.8rem;
  align-self: center;
  margin: auto;
}
.token-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 8px;
}
.token-chip {
  padding: 8px 14px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 1rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  transition: transform 0.1s ease, filter 0.15s ease, border-color 0.15s ease;
}
.token-chip:not(:disabled):hover { border-color: var(--accent-dim); }
.token-chip:not(:disabled):active { transform: scale(0.95); }
.token-chip:disabled { cursor: default; }
.token-placed { border-color: var(--accent-dim); color: var(--accent); }
.token-correct { border-color: rgba(57,255,136,0.6); color: var(--success); background: rgba(57,255,136,0.08); }
.token-wrong { border-color: rgba(255,77,94,0.6); color: var(--error); background: rgba(255,77,94,0.08); }
.sentence-build-result {
  text-align: center;
  font-size: 0.95rem;
  margin-top: 4px;
}
.sentence-build-result.is-correct { color: var(--success); }
.sentence-build-result.is-wrong { color: var(--error); }
.sentence-build-reveal { text-align: center; margin-top: 8px; }
.sentence-build-card .sentence-build-reveal + .word-ru { text-align: center; margin-bottom: 4px; }
.sentence-check {
  width: 100%;
  margin-top: 10px;
}
.sentence-check:disabled { opacity: 0.4; cursor: default; }

/* Listening */
.listen-btn {
  display: inline-block;
  margin: 6px auto 12px;
  padding: 14px 26px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 1rem;
  cursor: pointer;
  border: 1px solid var(--accent-dim);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
  transition: transform 0.1s ease, filter 0.15s ease;
}
.listen-btn:hover { filter: brightness(1.2); }
.listen-btn:active { transform: scale(0.96); }

/* Matching pairs */
.match-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.match-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.match-tile {
  min-height: 52px;
  padding: 10px 8px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.3;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  transition: transform 0.1s ease, border-color 0.15s ease, opacity 0.2s ease;
}
.match-col:first-child .match-tile { font-size: 1.25rem; }
.match-tile:not(:disabled):hover { border-color: var(--accent-dim); }
.match-tile:not(:disabled):active { transform: scale(0.97); }
.match-selected { border-color: var(--accent); color: var(--accent); background: rgba(var(--accent-rgb), 0.1); }
.match-solved {
  border-color: rgba(57,255,136,0.5);
  color: var(--success);
  background: rgba(57,255,136,0.06);
  opacity: 0.6;
  cursor: default;
}
.match-wrong {
  border-color: rgba(255,77,94,0.6);
  color: var(--error);
  animation: shake 0.3s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@media (prefers-reduced-motion: reduce) {
  .match-wrong { animation: none; }
}

@media (max-width: 860px) {
  .sidenav { display: none; }
  .bottomnav { display: flex; }
  .view-root { padding: 16px 14px 90px; }
  .topbar { padding: 12px 14px; }
  .topbar-stats { gap: 10px; font-size: 0.7rem; }
}

/* ---- Game: chips, «Я» page, workshop (server mode only) ---- */

.game-only { display: none !important; }
body.game-on .nav-item.game-only { display: flex !important; }
body.game-on .stat.game-only { display: flex !important; }
.sidenav .nav-item.game-only, .bottomnav .nav-item.game-only { display: none; }
.stat-chips { cursor: pointer; }
.stat-chips b::before { content: "◆ "; font-size: 0.8em; }

/* Themes bought in the workshop: the whole site follows these variables. */
body[data-theme="theme-matrix"] { --accent: #39ff88; --accent-rgb: 57, 255, 136; --accent-dim: rgba(57, 255, 136, 0.35); --border: rgba(57, 255, 136, 0.25); --second-rgb: 45, 226, 230; --bg: #07120b; --bg-grid: #0a170e; --panel: rgba(12, 28, 18, 0.72); --panel-solid: #0f1f15; }
body[data-theme="theme-pink"] { --accent: #ff5fd2; --accent-rgb: 255, 95, 210; --accent-dim: rgba(255, 95, 210, 0.35); --border: rgba(255, 95, 210, 0.25); --second-rgb: 138, 107, 255; --bg: #140a16; --bg-grid: #180c1b; --panel: rgba(34, 16, 38, 0.72); --panel-solid: #22112a; }
body[data-theme="theme-gold"] { --accent: #ffc94d; --accent-rgb: 255, 201, 77; --accent-dim: rgba(255, 201, 77, 0.35); --border: rgba(255, 201, 77, 0.25); --second-rgb: 255, 138, 61; --bg: #120e07; --bg-grid: #16110a; --panel: rgba(36, 28, 14, 0.72); --panel-solid: #241c0e; }
body[data-theme="theme-lantern"] { --accent: #ff5a5a; --accent-rgb: 255, 90, 90; --accent-dim: rgba(255, 90, 90, 0.35); --border: rgba(255, 90, 90, 0.28); --second-rgb: 255, 201, 77; --bg: #14080a; --bg-grid: #1a0a0d; --panel: rgba(40, 14, 18, 0.72); --panel-solid: #2a0f14; }
body[data-theme="theme-aurora"] { --accent: #6dffb5; --accent-rgb: 109, 255, 181; --accent-dim: rgba(109, 255, 181, 0.35); --border: rgba(109, 255, 181, 0.25); --second-rgb: 184, 79, 255; --bg: #081214; --bg-grid: #0a171a; --panel: rgba(14, 32, 34, 0.72); --panel-solid: #0f2224; }
body[data-theme="theme-sakura"] { --accent: #ffb3cf; --accent-rgb: 255, 179, 207; --accent-dim: rgba(255, 179, 207, 0.35); --border: rgba(255, 179, 207, 0.28); --second-rgb: 255, 122, 168; --bg: #160c12; --bg-grid: #1c1017; --panel: rgba(40, 20, 31, 0.72); --panel-solid: #2a141f; }
/* Темы четвертей: награда за битву с Архитектором (цвета протоколов I–IV). */
body[data-theme="theme-protocol-1"] { --accent: #b84fff; --accent-rgb: 184, 79, 255; --accent-dim: rgba(184, 79, 255, 0.35); --border: rgba(184, 79, 255, 0.3); --second-rgb: 45, 226, 230; --bg: #0b0714; --bg-grid: #110a1e; --panel: rgba(24, 14, 40, 0.72); --panel-solid: #1a1030; }
body[data-theme="theme-protocol-2"] { --accent: #3da5ff; --accent-rgb: 61, 165, 255; --accent-dim: rgba(61, 165, 255, 0.35); --border: rgba(61, 165, 255, 0.3); --second-rgb: 45, 226, 230; --bg: #060d1a; --bg-grid: #0a1428; --panel: rgba(12, 28, 52, 0.72); --panel-solid: #0e2140; }
body[data-theme="theme-protocol-3"] { --accent: #ff4d5e; --accent-rgb: 255, 77, 94; --accent-dim: rgba(255, 77, 94, 0.35); --border: rgba(255, 77, 94, 0.3); --second-rgb: 255, 201, 77; --bg: #130608; --bg-grid: #1b090d; --panel: rgba(38, 12, 16, 0.72); --panel-solid: #2a0d12; }
body[data-theme="theme-protocol-4"] { --accent: #ffc94d; --accent-rgb: 255, 201, 77; --accent-dim: rgba(255, 201, 77, 0.35); --border: rgba(255, 201, 77, 0.3); --second-rgb: 255, 138, 61; --bg: #110d05; --bg-grid: #17110a; --panel: rgba(36, 28, 12, 0.72); --panel-solid: #281e0e; }
/* Четыре «холодных» темы держим разными не только цветом, но и яркостью и подложкой:
   Лунный свет — нейтральная ночь и кремовая луна; Лёд — насыщенный синий и почти белый;
   Сиреневый вечер — пастельная сирень с тёплым закатом; Туманность — почти чёрный космос,
   насыщенная фиолетовая и розовая дымка. */
body[data-theme="theme-moon"] { --accent: #efe6c4; --accent-rgb: 239, 230, 196; --accent-dim: rgba(239, 230, 196, 0.35); --border: rgba(239, 230, 196, 0.22); --second-rgb: 160, 178, 210; --bg: #0b0d13; --bg-grid: #10131b; --panel: rgba(26, 29, 40, 0.8); --panel-solid: #1a1d28; }
body[data-theme="theme-ice"] { --accent: #cfeeff; --accent-rgb: 207, 238, 255; --accent-dim: rgba(207, 238, 255, 0.35); --border: rgba(207, 238, 255, 0.3); --second-rgb: 90, 170, 255; --bg: #071a33; --bg-grid: #0a2143; --panel: rgba(16, 46, 86, 0.78); --panel-solid: #102e56; }
body[data-theme="theme-lilac"] { --accent: #cdb8f5; --accent-rgb: 205, 184, 245; --accent-dim: rgba(205, 184, 245, 0.35); --border: rgba(205, 184, 245, 0.25); --second-rgb: 255, 183, 160; --bg: #1b1521; --bg-grid: #221b2a; --panel: rgba(46, 36, 58, 0.8); --panel-solid: #2e243a; }
body[data-theme="theme-nebula"] { --accent: #a65bff; --accent-rgb: 166, 91, 255; --accent-dim: rgba(166, 91, 255, 0.35); --border: rgba(166, 91, 255, 0.35); --second-rgb: 255, 70, 180; --bg: #06030e; --bg-grid: #0a0514; --panel: rgba(28, 10, 50, 0.8); --panel-solid: #1c0a33; }
body[data-theme="theme-moon"] { background-image: radial-gradient(ellipse 70% 45% at 88% -6%, rgba(239, 230, 196, 0.16), transparent 70%), linear-gradient(rgba(var(--accent-rgb), 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--accent-rgb), 0.04) 1px, transparent 1px); background-size: 100% 100%, 32px 32px, 32px 32px; background-attachment: fixed, scroll, scroll; }
body[data-theme="theme-ice"] { background-image: linear-gradient(165deg, rgba(207, 238, 255, 0.11), transparent 42%), linear-gradient(rgba(var(--accent-rgb), 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--accent-rgb), 0.06) 1px, transparent 1px); background-size: 100% 100%, 32px 32px, 32px 32px; background-attachment: fixed, scroll, scroll; }
body[data-theme="theme-lilac"] { background-image: linear-gradient(0deg, rgba(255, 183, 160, 0.13), transparent 48%), linear-gradient(rgba(var(--accent-rgb), 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--accent-rgb), 0.04) 1px, transparent 1px); background-size: 100% 100%, 32px 32px, 32px 32px; background-attachment: fixed, scroll, scroll; }
body[data-theme="theme-nebula"] { background-image: radial-gradient(ellipse 55% 40% at 15% 8%, rgba(255, 70, 180, 0.2), transparent 70%), radial-gradient(ellipse 60% 50% at 90% 75%, rgba(110, 60, 255, 0.24), transparent 70%), linear-gradient(rgba(var(--accent-rgb), 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--accent-rgb), 0.05) 1px, transparent 1px); background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px; background-attachment: fixed, fixed, scroll, scroll; }

/* Avatar: a learned hanzi (or the first letter of the name) in a frame. */
.avatar {
  width: 72px; height: 72px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 18px;
  background: var(--panel-solid);
  border: 2px solid var(--border);
  font-size: 38px; color: var(--accent);
  text-shadow: 0 0 10px var(--accent-dim);
}
.avatar.small { width: 44px; height: 44px; border-radius: 12px; font-size: 22px; }
.frame-double { border: 5px double var(--accent); }
.frame-data { border: 2px dashed var(--accent); }
.frame-neon { border: 2px solid var(--accent); box-shadow: 0 0 12px var(--accent-dim), inset 0 0 10px rgba(var(--accent-rgb), 0.25); }
.frame-pulse { border: 2px solid var(--accent); animation: frame-pulse 1.8s ease-in-out infinite; }
.frame-gold { border: 3px solid #ffc94d; box-shadow: 0 0 14px rgba(255, 201, 77, 0.55); }
.frame-galaxy {
  border: 3px solid transparent;
  background: linear-gradient(var(--panel-solid), var(--panel-solid)) padding-box,
              conic-gradient(#b84fff, #2de2e6, #ff5fd2, #6dffb5, #b84fff) border-box;
  box-shadow: 0 0 16px rgba(184, 79, 255, 0.45);
}
.frame-dragon {
  border: 3px solid transparent;
  background: linear-gradient(var(--panel-solid), var(--panel-solid)) padding-box,
              conic-gradient(#ff3d3d, #ffc94d, #ff8a3d, #ff3d3d, #ffc94d, #ff3d3d) border-box;
  box-shadow: 0 0 16px rgba(255, 90, 60, 0.5);
}
.frame-guardian {
  border: 3px solid transparent;
  background: linear-gradient(var(--panel-solid), var(--panel-solid)) padding-box,
              conic-gradient(#b84fff, #3da5ff, #ff4d5e, #ffc94d, #b84fff) border-box;
  box-shadow: 0 0 16px rgba(255, 201, 77, 0.45);
}
@keyframes frame-pulse {
  0%, 100% { box-shadow: 0 0 4px var(--accent-dim); }
  50% { box-shadow: 0 0 20px var(--accent), 0 0 4px var(--accent); }
}

.me-head { display: flex; gap: 16px; align-items: center; }
/* font-size задаёт design.css (одна полоска .me-name, без дублей) — здесь только начертание. */
.me-name { font-weight: 700; overflow-wrap: anywhere; }
.me-title { color: var(--accent); font-size: 0.95rem; margin-top: 2px; }
.me-level { color: var(--text-dim); font-size: 0.85rem; margin-top: 4px; font-family: var(--mono); overflow-wrap: anywhere; }
.me-today { color: var(--text-dim); font-size: 0.85rem; margin-top: 6px; }
@media (max-width: 380px) {
  .avatar { width: 56px; height: 56px; font-size: 30px; }
}
.me-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn-ghost {
  padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text); font-size: 0.85rem; cursor: pointer;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost[disabled] { opacity: 0.5; cursor: default; }

.avatar-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.avatar-pick {
  width: 44px; height: 44px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--panel-solid);
  color: var(--text); font-size: 22px; cursor: pointer;
}
.avatar-pick.active { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 8px var(--accent-dim); }

.goal-reward { font-weight: 700; margin: 4px 0 10px; }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.badge {
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px;
  background: var(--panel-solid); opacity: 0.55;
}
.badge.earned { opacity: 1; border-color: var(--success); box-shadow: 0 0 10px rgba(57, 255, 136, 0.18); }
.badge-name { font-weight: 700; font-size: 0.95rem; }
.badge-name::before { content: "◇ "; color: var(--text-dim); }
.badge.earned .badge-name::before { content: "◆ "; color: var(--success); }
.badge-desc { color: var(--text-dim); font-size: 0.78rem; margin-top: 4px; }
.badge-chips { font-family: var(--mono); font-size: 0.75rem; color: var(--accent); margin-top: 6px; }

.shop-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.shop-tab {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: transparent; color: var(--text-dim); font-size: 0.85rem; cursor: pointer;
}
.shop-tab.active { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.shop-item {
  display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--border); border-radius: 12px; padding: 12px;
  background: var(--panel-solid);
}
.shop-item.equipped { border-color: var(--accent); box-shadow: 0 0 10px var(--accent-dim); }
.shop-preview { min-height: 48px; display: flex; align-items: center; gap: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.2); }
.preview-text { font-size: 1.4rem; color: var(--accent); }
.preview-title { font-size: 0.9rem; color: var(--accent); }
.shop-name { font-weight: 700; font-size: 0.95rem; }
.shop-sub { color: var(--text-dim); font-size: 0.75rem; flex: 1; }
.shop-item .btn-ghost { width: 100%; }
.shop-buy { color: var(--bg) !important; background: var(--accent); border-color: var(--accent) !important; font-weight: 700; }
.shop-note { color: var(--text-dim); font-size: 0.8rem; margin-top: 10px; }

/* Подарок однокласснику, серия недель */
.shop-present { font-size: 0.8rem; }
.shop-try { font-size: 0.8rem; }
.shop-try.on { border-color: var(--accent); color: var(--accent); }
.me-sticker { font-size: 0.9em; margin-left: 2px; }
.preview-sticker { font-size: 2.2rem; line-height: 1; }
.preview-burst { font-size: 1.5rem; font-weight: 700; letter-spacing: 0.15em; text-shadow: 0 0 10px currentColor; }
.preview-burst.rainbow {
  background: linear-gradient(90deg, #ff5f5f, #ffc94d, #6dffb5, #3fa7ff, #b84fff);
  -webkit-background-clip: text; background-clip: text; color: transparent !important; text-shadow: none;
}

/* Примерка: плашка над нижней панелью, пока что-то ещё не куплено. */
.tryon-bar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 40; width: min(440px, calc(100% - 24px));
  padding: 12px 14px; border-radius: 14px;
  background: var(--panel-solid); border: 1px solid var(--accent);
  box-shadow: 0 0 24px var(--accent-dim);
  display: grid; gap: 8px;
}
.tryon-bar[hidden] { display: none; }
.tryon-head { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.tryon-look { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.tryon-title { font-size: 0.8rem; font-weight: 400; color: var(--accent); }
.tryon-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tryon-row .btn-ghost { width: auto; padding: 6px 12px; }
.tryon-clear { justify-self: end; font-size: 0.8rem; }
@media (max-width: 860px) {
  .tryon-bar { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
.present-pick, .present-notice {
  border: 1px solid var(--accent); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px;
  background: rgba(var(--accent-rgb), 0.06); box-shadow: 0 0 12px var(--accent-dim);
}
.present-head { font-weight: 700; margin-bottom: 8px; }
.present-list { display: flex; flex-wrap: wrap; gap: 8px; }
.present-to { font-size: 0.95rem; }
.present-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.present-foot .shop-note { margin: 0; }
.present-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; }
.present-notice .btn-continue { margin-top: 8px; }
.me-streak { color: var(--text-dim); font-size: 0.85rem; margin-top: 6px; }
.pair-panel { cursor: default; }
.pair-panel[data-route-link] { cursor: pointer; }
.pair-who { font-weight: 700; margin: 6px 0 4px; }
.pair-done { color: var(--success); font-family: var(--mono); font-weight: 700; margin-top: 6px; }
.pair-members { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 0.88rem; color: var(--text-dim); }
.pair-member b { color: var(--text); font-family: var(--mono); }
.pair-member.me b { color: var(--accent); }
.me-streak b { color: var(--accent); font-family: var(--mono); }

.history-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-size: 0.9rem; }
.history-row .plus { color: var(--success); font-family: var(--mono); white-space: nowrap; }
.history-row .minus { color: var(--review); font-family: var(--mono); white-space: nowrap; }
.history-day { color: var(--text-dim); font-size: 0.75rem; }
.earn-list { margin: 8px 0 0; padding-left: 18px; color: var(--text-dim); font-size: 0.88rem; line-height: 1.6; }
.earn-list b { color: var(--accent); font-family: var(--mono); }

.review-reward { margin-top: 14px; font-size: 1.05rem; }
.review-reward b { color: var(--accent); font-family: var(--mono); }

.toast {
  position: fixed; left: 50%; top: 14px; transform: translate(-50%, -20px);
  z-index: 50; max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 14px;
  background: var(--panel-solid); border: 1px solid var(--accent);
  box-shadow: 0 0 24px var(--accent-dim);
  color: var(--text); font-weight: 700; text-align: center;
  opacity: 0; transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast small { display: block; font-weight: normal; color: var(--text-dim); margin-top: 2px; }

.hw-excused { color: var(--success); }
.hw-pass { margin-top: 10px; }

@media (prefers-reduced-motion: reduce) {
  .frame-pulse { animation: none; box-shadow: 0 0 12px var(--accent-dim); }
  .toast { transition: none; }
}

/* ---- Иероглиф: как пишется и из чего состоит ---- */

/* Иероглиф в карточке — кнопка, но выглядит как текст: пунктир снизу
   намекает, что на него можно нажать, и не мешает читать сам знак. */
.hz-btn {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0 1px;
  cursor: pointer;
  border-bottom: 2px dotted var(--accent-dim);
  line-height: 1;
}
.hz-btn:hover, .hz-btn:focus-visible { color: var(--accent); border-bottom-color: var(--accent); }

body.hz-shown { overflow: hidden; }

.hz-modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.hz-backdrop { position: absolute; inset: 0; background: rgba(4, 8, 16, 0.78); backdrop-filter: blur(3px); }
.hz-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.hz-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hz-count { font-family: var(--mono); font-size: 0.85rem; color: var(--text-dim); }
.hz-x {
  width: 36px; height: 36px; flex: 0 0 auto;
  border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--text-dim);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.hz-x:hover { color: var(--accent); border-color: var(--accent); }

.hz-svg { display: block; width: 100%; max-width: 260px; margin: 8px auto; aspect-ratio: 1 / 1; }
.hz-grid line { stroke: var(--border); stroke-width: 2; stroke-dasharray: 16 16; }
.hz-outline { fill: rgba(255, 255, 255, 0.07); }
.hz-stroke { fill: none; stroke: var(--accent); stroke-width: 220; stroke-linecap: round; stroke-linejoin: round; }
.hz-stroke-solid { fill: var(--accent); }

/* «Напиши сам»: обводка пальцем. Шаблон бледный, обведённые черты — ярким,
   след пальца — тем же цветом, но полупрозрачным, чтобы было видно шаблон. */
.write-card .quiz-front { gap: 2px; }
.write-word { font-size: 1.6rem; line-height: 1.2; }
.write-target { color: var(--accent); font-weight: 600; }
.write-svg {
  display: block; width: 100%; max-width: 300px; margin: 10px auto; aspect-ratio: 1 / 1;
  border: 1px solid var(--border); border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  /* Без этого палец на телефоне не рисует, а листает страницу. */
  touch-action: none;
  cursor: crosshair;
}
.write-grid line { stroke: var(--border); stroke-width: 2; stroke-dasharray: 16 16; }
.write-outline { fill: rgba(255, 255, 255, 0.08); transition: fill 200ms linear; }
.write-outline.write-done { fill: var(--accent); }
/* «Упор на иероглифы»: по памяти контур не виден, пока черта не написана */
.write-memory .write-outline:not(.write-done) { fill: transparent; }
.write-blank { color: var(--muted, #8aa3ab); }
.write-hint {
  fill: none; stroke: var(--review); stroke-width: 220;
  stroke-linecap: round; stroke-linejoin: round; opacity: 0;
}
.write-hint-solid { fill: var(--review); opacity: 0; transition: opacity 200ms linear; }
.write-ink {
  fill: none; stroke: rgba(var(--accent-rgb), 0.55); stroke-width: 70;
  stroke-linecap: round; stroke-linejoin: round;
}
.write-status {
  text-align: center; font-family: var(--mono); font-size: 0.8rem;
  color: var(--text-dim); margin-bottom: 8px;
}
.write-hint-btn { display: block; margin: 0 auto; width: auto; }
@keyframes write-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}
.write-shake { animation: write-shake 220ms ease-in-out; }
@media (prefers-reduced-motion: reduce) { .write-shake { animation: none; } }

.hz-tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.hz-tab {
  min-width: 48px; height: 48px; padding: 0 12px;
  border-radius: 12px; border: 1px solid var(--border);
  background: transparent; color: var(--text-dim);
  font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.hz-tab:hover, .hz-tab:focus-visible { color: var(--accent); border-color: var(--accent); }
.hz-tab.active { color: var(--accent); border-color: var(--accent); background: rgba(var(--accent-rgb), 0.12); box-shadow: 0 0 10px var(--accent-dim); }
.hz-progress { min-height: 20px; text-align: center; font-family: var(--mono); font-size: 0.8rem; color: var(--text-dim); margin-top: 6px; }

.hz-parts { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: center; gap: 6px; margin-top: 10px; }
.hz-part {
  flex: 0 1 96px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 8px;
  border: 1px solid var(--border); border-radius: 12px;
  background: rgba(var(--accent-rgb), 0.05);
  text-align: center;
}
.hz-part-whole { flex: 0 0 auto; background: transparent; border-style: dashed; }
.hz-part-glyph { font-size: 2rem; line-height: 1.1; color: var(--text); }
.hz-part-py { font-family: var(--mono); font-size: 0.78rem; color: var(--accent); }
.hz-part-ru { font-size: 0.82rem; color: var(--text-dim); }
.hz-part-unknown { opacity: 0.6; }
.hz-part-key {
  font-size: 0.68rem; font-family: var(--mono); color: var(--bg);
  background: var(--accent); border-radius: 999px; padding: 1px 8px; margin-top: 2px;
}
.hz-part-own { font-size: 0.68rem; color: var(--success); }
.hz-plus { align-self: center; color: var(--text-dim); font-size: 1.1rem; }
.hz-note { font-size: 0.82rem; color: var(--text-dim); text-align: center; margin-top: 10px; }
.hz-credit { font-size: 0.7rem; color: var(--text-dim); opacity: 0.7; text-align: center; margin-top: 12px; }

@media (max-width: 380px) {
  .hz-part { flex-basis: 84px; }
  .hz-part-glyph { font-size: 1.7rem; }
}

/* ---- Игры Архитектора ---- */

.back-link {
  display: inline-block;
  margin: 0 0 12px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.85rem;
  text-decoration: none;
}
.back-link:hover { color: var(--accent); }

.arcade-tokens { margin-bottom: 16px; padding: 14px 18px; }
.arcade-tokens-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-family: var(--mono); }
.arcade-tokens-row b { color: var(--accent); margin-right: 4px; }
.token-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid var(--accent-dim);
  background: transparent;
}
.token-dot.on { background: var(--accent); box-shadow: 0 0 8px var(--accent-dim); }
.arcade-hint { color: var(--text-dim); font-size: 0.85rem; margin-top: 8px; }

.game-card {
  display: block;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.1s ease;
  animation: cardIn 0.32s ease backwards;
}
.game-card:hover { border-color: var(--accent); }
.game-card:active { transform: scale(0.98); }
.game-card-zh { font-size: 2rem; color: var(--accent); text-shadow: 0 0 10px var(--accent-dim); }
.game-card-name { font-size: 1.1rem; font-weight: 700; margin-top: 4px; }
.game-card-desc { color: var(--text-dim); font-size: 0.88rem; margin-top: 6px; }
.game-card-rec { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); margin-top: 10px; }

.arcade-intro { text-align: center; }
.arcade-rec { font-family: var(--mono); color: var(--text-dim); }
.arcade-msg {
  margin-top: 12px; padding: 8px 12px; border-radius: 8px;
  border: 1px solid rgba(255, 77, 94, 0.4); color: var(--error); font-size: 0.9rem;
}
.arcade-btns {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 10px; margin-top: 14px;
}
.arcade-btns .btn-continue { margin-top: 0; }
.arcade-btns .btn-continue, .arcade-btns .btn-ghost { padding: 12px 18px; font-size: 0.95rem; text-decoration: none; }
.arcade-btns button:disabled { opacity: 0.5; cursor: default; }
.arcade-score {
  font-family: var(--mono); font-size: 3.2rem; font-weight: 700; line-height: 1;
  color: var(--accent); text-shadow: 0 0 14px var(--accent-dim);
}
.arcade-score-label { color: var(--text-dim); margin: 4px 0 10px; }
.arcade-score-label + .arcade-hint { margin: -6px 0 10px; }
.arcade-new { font-family: var(--mono); color: var(--success); font-weight: 700; }
.arcade-chips {
  display: inline-block; margin-top: 10px; padding: 4px 14px; border-radius: 999px;
  font-family: var(--mono); font-size: 1.3rem; font-weight: 700;
  color: var(--accent); border: 1px solid var(--accent-dim); background: rgba(var(--accent-rgb), 0.08);
}

/* Пауза и полноэкранный переключатель — общая панель над полем игры (arcade.js arcadeChromeHtml()). */
.arcade-chrome { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 8px; }
.arcade-chrome-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-solid); color: var(--text); font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.arcade-chrome-btn.on { border-color: var(--accent); color: var(--accent); background: rgba(var(--accent-rgb), 0.12); }
.arcade-pause { max-width: 360px; margin: 10vh auto 0; }

/* «Во весь экран» — не настоящий Fullscreen API (ненадёжен в Safari на iPhone), а свой «режим
   фокуса»: прячем шапку/меню сайта, игра занимает всю высоту экрана. */
body.game-focus .topbar, body.game-focus .sidenav, body.game-focus .bottomnav { display: none; }
body.game-focus .view-root { padding: 12px; }
body.game-focus .body-row { padding-bottom: 12px; }

/* «Взлом терминала» */
.hack { max-width: 560px; margin: 0 auto; padding: 16px; }
.hack-hud {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 0.9rem; color: var(--text-dim);
}
.hack-hud b { color: var(--accent); font-size: 1.15rem; }
.hack-paid {
  font-size: 0.72rem; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--accent-dim); color: var(--accent);
}
.hack-time { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin: 8px 0 10px; }
.hack-time > span { display: block; height: 100%; background: linear-gradient(90deg, var(--error), var(--accent)); }
.hack-log {
  min-height: 7.2em; padding: 8px 10px; border-radius: 8px;
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 0.74rem; line-height: 1.4;
  display: flex; flex-direction: column; justify-content: flex-end;
  overflow: hidden;
}
.hack-log > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hack-ok { color: var(--success); }
.hack-bad { color: var(--error); }
.hack-idle { color: var(--text-dim); }
.hack-bonus { text-align: center; font-family: var(--mono); color: var(--success); font-weight: 700; margin-top: 8px; }
.hack-q { text-align: center; margin: 14px 0 10px; min-height: 96px; }
.hack-ask { color: var(--text-dim); font-size: 0.9rem; }
.hack-hanzi { font-size: 3rem; line-height: 1.25; color: var(--text); }
.hack-ru { font-size: 1.5rem; font-weight: 700; margin-top: 10px; }
.hack-q .listen-btn { margin-top: 12px; }
.hack-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hack-opt { text-align: center; min-height: 54px; font-size: 1rem; overflow-wrap: anywhere; }
.hack-opt-zh { font-family: var(--sans); font-size: 1.5rem; }
.hack-wrong { animation: shake 0.3s ease; border-color: rgba(255, 77, 94, 0.6); }
@media (prefers-reduced-motion: reduce) { .hack-wrong { animation: none; } }
@media (max-width: 380px) {
  .hack-hanzi { font-size: 2.5rem; }
  .hack-opt { font-size: 0.9rem; }
}

/* «Иероглифный дождь» */
.rain { max-width: 560px; margin: 0 auto; padding: 14px; }
.rain-lives { letter-spacing: 3px; font-size: 1.05rem; }
.rain-life { color: rgba(255, 255, 255, 0.15); transition: color 0.2s ease; }
.rain-life.on { color: var(--error); text-shadow: 0 0 8px rgba(255, 77, 94, 0.5); }
.rain-ask {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 8px;
  min-height: 58px; margin: 6px 0 8px; text-align: center;
  color: var(--text-dim); font-size: 0.95rem;
}
.rain-ask b { color: var(--text); font-size: 1.3rem; }
.rain-ask .rain-py { font-family: var(--sans); color: var(--accent); font-size: 1.45rem; }
.rain-ask .rain-say { margin: 0; padding: 8px 18px; }
.rain-reveal { color: var(--text); }
.rain-reveal b { color: var(--accent); font-size: 1.5rem; }
.rain-field {
  position: relative;
  height: clamp(260px, 50vh, 460px);
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--border);
  background:
    linear-gradient(90deg, transparent calc(25% - 1px), rgba(var(--accent-rgb), 0.07) 25%, transparent calc(25% + 1px),
      transparent calc(50% - 1px), rgba(var(--accent-rgb), 0.07) 50%, transparent calc(50% + 1px),
      transparent calc(75% - 1px), rgba(var(--accent-rgb), 0.07) 75%, transparent calc(75% + 1px)),
    rgba(0, 0, 0, 0.4);
  touch-action: manipulation;
}
.rain-drop {
  position: absolute; top: 0;
  width: calc(25% - 8px); margin-left: 4px; height: 58px; padding: 0 2px;
  border-radius: 10px;
  border: 1px solid var(--accent-dim);
  background: var(--panel-solid);
  color: var(--text);
  font-family: var(--sans); line-height: 1; white-space: nowrap;
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.18);
  cursor: pointer;
  will-change: transform;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.rain-len-1 { font-size: 1.9rem; }
.rain-len-2 { font-size: 1.5rem; }
.rain-len-3 { font-size: 1.12rem; }
.rain-len-4 { font-size: 0.92rem; }
.rain-drop:disabled { cursor: default; }
.rain-caught {
  border-color: var(--success); color: var(--success);
  background: rgba(57, 255, 136, 0.14); box-shadow: 0 0 18px rgba(57, 255, 136, 0.55);
}
.rain-wrong {
  border-color: rgba(255, 77, 94, 0.7); color: var(--error);
  background: rgba(255, 77, 94, 0.12);
  animation: rain-fade 0.6s ease forwards;
}
@keyframes rain-fade { to { opacity: 0.25; } }
.rain-missed {
  border-color: var(--accent); color: var(--accent);
  box-shadow: 0 0 18px var(--accent-dim);
  animation: rain-blink 0.5s ease-in-out 3;
}
@keyframes rain-blink { 50% { box-shadow: 0 0 2px var(--accent-dim); } }
.rain-ground {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, transparent, rgba(255, 77, 94, 0.8), transparent);
  box-shadow: 0 0 10px rgba(255, 77, 94, 0.6);
}
@media (prefers-reduced-motion: reduce) {
  .rain-wrong { animation: none; opacity: 0.4; }
  .rain-missed { animation: none; }
}
@media (max-width: 380px) {
  .rain { padding: 10px; }
  .rain-len-1 { font-size: 1.7rem; }
  .rain-len-2 { font-size: 1.3rem; }
  .rain-len-3 { font-size: 1rem; }
  .rain-len-4 { font-size: 0.8rem; }
}

/* «Память» */
.mem { max-width: 620px; margin: 0 auto; padding: 14px; }
.mem-count { font-size: 0.8rem; }
.mem-task { text-align: center; color: var(--text-dim); font-size: 0.9rem; margin: 8px 0 12px; min-height: 2.6em; }
.mem-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mem-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  height: 92px; padding: 6px 2px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-solid);
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.mem-closed {
  background:
    repeating-linear-gradient(45deg, rgba(var(--accent-rgb), 0.06) 0 6px, transparent 6px 12px),
    var(--panel-solid);
  border-color: var(--accent-dim);
}
.mem-closed:hover { border-color: var(--accent); }
.mem-back { font-size: 1.6rem; color: rgba(var(--accent-rgb), 0.35); font-family: var(--sans); }
.mem-open { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-dim); }
.mem-matched {
  border-color: rgba(57, 255, 136, 0.55);
  background: rgba(57, 255, 136, 0.07);
  cursor: default;
}
.mem-matched.mem-face-sound { cursor: pointer; }
.mem-miss { border-color: rgba(255, 77, 94, 0.7); box-shadow: 0 0 10px rgba(255, 77, 94, 0.35); }
.mem-hanzi { font-family: var(--sans); line-height: 1.1; }
.mem-len-1 { font-size: 2rem; }
.mem-len-2 { font-size: 1.6rem; }
.mem-len-3 { font-size: 1.2rem; }
.mem-len-4 { font-size: 1rem; }
.mem-ru { font-size: 0.85rem; line-height: 1.2; text-align: center; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
.mem-ru-long { font-size: 0.76rem; }
.mem-ru-tight { font-size: 0.68rem; letter-spacing: -0.01em; }
.mem-py { font-family: var(--mono); font-size: 0.72rem; color: var(--accent); }
.mem-matched .mem-py { color: var(--success); }
.mem-sound { font-size: 1.5rem; color: var(--accent); }
.mem-anim { animation: mem-flip 0.28s ease; }
@keyframes mem-flip { from { transform: rotateY(90deg); } to { transform: none; } }
.mem-hit { animation: mem-hit 0.4s ease; }
@keyframes mem-hit { 50% { transform: scale(1.06); box-shadow: 0 0 18px rgba(57, 255, 136, 0.6); } }
@media (prefers-reduced-motion: reduce) { .mem-anim, .mem-hit { animation: none; } }
@media (max-width: 520px) {
  .mem-board { grid-template-columns: repeat(3, 1fr); }
  .mem-card { height: 84px; }
}
@media (max-width: 340px) {
  .mem { padding: 10px; }
  .mem-board { gap: 6px; }
  .mem-ru { font-size: 0.78rem; }
  .mem-ru-long { font-size: 0.7rem; }
  .mem-ru-tight { font-size: 0.62rem; }
  .mem-len-1 { font-size: 1.8rem; }
  .mem-len-2 { font-size: 1.4rem; }
  .mem-len-3 { font-size: 1.05rem; }
  .mem-len-4 { font-size: 0.85rem; }
}

/* «Собери иероглиф» */
.build { width: 100%; max-width: 560px; margin: 0 auto; padding: 16px; }
.build-ask { text-align: center; color: var(--text-dim); margin: 10px 0 12px; }
.build-parts { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 16px; }
.build-part-show {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 84px; padding: 10px 8px;
  border: 1px dashed var(--accent-dim); border-radius: 12px;
  background: rgba(var(--accent-rgb), 0.05);
}
.build-glyph { font-family: var(--sans); font-size: 2.4rem; line-height: 1.1; color: var(--text); }
.build-gloss { font-size: 0.78rem; color: var(--text-dim); }
.build-plus { font-family: var(--mono); font-size: 1.4rem; color: var(--accent); }
.build-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.build-opt { text-align: center; font-family: var(--sans); font-size: 2rem; padding: 10px; }
.build-target {
  text-align: center; font-family: var(--sans); font-size: 4.2rem; line-height: 1.15;
  color: var(--text); text-shadow: 0 0 16px var(--accent-dim); margin-bottom: 12px;
}
.build-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.build-tile {
  height: 72px; border-radius: 12px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03);
  color: var(--text); font-family: var(--sans); font-size: 2rem;
  cursor: pointer; transition: transform 0.1s ease, border-color 0.15s ease;
  touch-action: manipulation;
}
.build-tile:not(:disabled):active { transform: scale(0.96); }
.build-tile:disabled { cursor: default; }
.build-on { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.14); box-shadow: 0 0 12px var(--accent-dim); }
.build-tile.option-correct { border-color: rgba(57, 255, 136, 0.6); color: var(--success); background: rgba(57, 255, 136, 0.08); }
.build-tile.option-wrong { border-color: rgba(255, 77, 94, 0.6); color: var(--error); background: rgba(255, 77, 94, 0.08); }
.build-verdict { text-align: center; font-weight: 700; margin-top: 14px; font-family: var(--mono); }
.build-ok { color: var(--success); }
.build-bad { color: var(--error); }
.build-explain {
  margin-top: 8px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(0, 0, 0, 0.25); text-align: center;
}
.build-formula { font-size: 1.05rem; }
.build-formula b { font-family: var(--sans); font-size: 1.4rem; color: var(--accent); }
.build-formula .build-whole { color: var(--text); font-size: 1.6rem; }
.build-word { color: var(--text-dim); font-size: 0.85rem; margin-top: 6px; }
.build-next { display: flex; margin: 12px auto 0; }
@media (max-width: 380px) {
  .build { padding: 12px; }
  .build-part-show { min-width: 70px; }
  .build-glyph { font-size: 2rem; }
  .build-target { font-size: 3.6rem; }
  .build-tile { height: 64px; font-size: 1.8rem; }
}

/* Тексты уроков (课文) */
.tx-intro { margin: 0 0 12px; }
.tx-text { margin-bottom: 16px; }
.tx-scene { color: var(--text-dim); font-size: 0.95rem; margin: 6px 0 12px; line-height: 2.2; }
.tx-scene .tx-w { font-size: 1.05rem; }
.tx-lines { display: flex; flex-direction: column; gap: 10px; }
.tx-line { display: flex; gap: 10px; align-items: flex-start; }
.tx-who { flex: 0 0 64px; display: flex; flex-direction: column; gap: 4px; padding-top: 0.9em; }
.tx-who-name {
  font-family: var(--sans); font-size: 0.8rem; color: var(--accent); text-align: center;
  border: 1px solid var(--accent-dim); border-radius: 8px; padding: 2px 4px; background: rgba(var(--accent-rgb), 0.06);
}
.tx-say {
  flex: 1; min-width: 0;
  border: 1px solid var(--border); border-radius: 12px; padding: 6px 12px;
  background: rgba(255, 255, 255, 0.02);
}
.tx-story .tx-say { border-style: dashed; }
.tx-hz { font-family: var(--sans); font-size: 1.5rem; line-height: 2.6; color: var(--text); overflow-wrap: anywhere; }
.tx-w { cursor: pointer; border-radius: 6px; padding: 0 1px; ruby-position: under; white-space: nowrap; -webkit-tap-highlight-color: transparent; }
.tx-w:hover { background: rgba(var(--accent-rgb), 0.08); }
.tx-w rt { font-family: var(--sans); font-size: 0.55em; color: var(--accent); letter-spacing: 0.02em; margin-top: 0.2em; }
/* Слог — только у своего слова: пробел между соседними ruby-токенами (разными словами), а не внутри
   одного (там иероглифы одного слова и так идут подряд, как в китайском тексте без пробелов). Соседство
   с .tx-punct (запятая, знак вопроса) не считается — там и так естественный зазор не нужен. */
.tx-unit { white-space: nowrap; margin-right: 0.25em; }

/* Транскрипция строго под иероглифом/словом (оформление, 2026-10-13): карточки слов, грамматики и примеры
   в миссии — тот же приём, что уже работал у текстов уроков (.tx-w выше). white-space: nowrap — один токен
   (слово + его слог) никогда не рвётся переносом; между отдельными ruby-токенами перенос обычный. */
.word-ruby { ruby-position: under; white-space: nowrap; }
.word-ruby rt { font-size: 0.5em; letter-spacing: 0.02em; color: var(--accent); margin-top: 0.2em; }
.word-ruby + .word-ruby { margin-left: 0.25em; }
.word-ruby-row, .ex-ruby-row { line-height: 1.8; }
.mission-prompt-ruby .word-ruby rt { color: inherit; opacity: .75; }
/* У примеров (.ex-hanzi) сам иероглиф мелкий ("font-size:14px" у .word-example) — 0.5em от него был бы
   нечитаемым слогом; даём слогу тот же твёрдый размер, что раньше был у отдельной строки .ex-pinyin. */
.ex-ruby-row .word-ruby rt { font-size: 0.78rem; }
.grammar-card .ex-ruby-row .word-ruby rt { color: var(--grammar); }
.tx-py-hidden { display: none; }
.tx-noted { text-decoration: underline dotted rgba(var(--accent-rgb), 0.8); text-underline-offset: 6px; text-decoration-thickness: 2px; }
.tx-open { background: rgba(var(--accent-rgb), 0.18); }
.tx-mark {
  display: inline-block; min-width: 1.2em; margin: 0 2px 0 1px; padding: 0 3px; border-radius: 999px;
  font-family: var(--mono); font-size: 0.5em; line-height: 1.5; text-align: center; vertical-align: super;
  color: var(--bg); background: var(--accent);
}
.tx-punct { color: var(--text-dim); }
.tx-pop {
  margin: 4px 0 6px; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--accent-dim); background: rgba(var(--accent-rgb), 0.06);
}
.tx-pop-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.tx-pop-hz { font-family: var(--sans); font-size: 1.6rem; }
.tx-pop-py { font-family: var(--sans); color: var(--accent); font-size: 1.1rem; }
.tx-pop-ru { font-size: 0.9rem; margin-top: 4px; }
.tx-dim { color: var(--text-dim); font-size: 0.82rem; }
.tx-notes { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 10px; }
.tx-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; font-size: 0.92rem; line-height: 1.45; }
.tx-note-n {
  flex: 0 0 auto; width: 1.6em; height: 1.6em; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--mono); font-size: 0.8rem; color: var(--bg); background: var(--accent);
}
.tx-note-hz { font-family: var(--sans); font-size: 1.1rem; color: var(--accent); }
/* Телефон (≤600px): реплика — компактный «пузырь» с именем-меткой над ним, а не колонка 64px. Явные
   auto-размеры у метки — чтобы она не раздувалась ни в одном браузере (на части телефонов видели
   высокие пустые плашки). Переносы по словам дают <wbr> между tx-unit. */
@media (max-width: 600px) {
  .tx-lines { gap: 8px; }
  .tx-line { display: block; }
  .tx-who { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0 0 3px 6px; height: auto; }
  .tx-who-name { flex: 0 0 auto; height: auto; text-align: left; font-size: 0.78rem; line-height: 1.3; padding: 1px 9px; }
  .tx-say { padding: 2px 10px 4px; border-radius: 14px; }
  .tx-hz { font-size: 1.3rem; line-height: 2.5; }
  .tx-scene { line-height: 2.3; }
  .tx-scene .tx-w { font-size: 1rem; }
}
@media (max-width: 380px) {
  .tx-hz { font-size: 1.2rem; }
}

/* ---- Что сделать (главная) и значки на меню ---- */
.todo-panel { margin-bottom: 20px; }
.todo-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.todo-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: 10px; text-align: left;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.02);
  color: var(--text); font: inherit; font-size: 0.95rem;
}
button.todo-item { cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
button.todo-item:hover { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.06); }
.todo-ic { flex: 0 0 auto; width: 1.6em; text-align: center; font-size: 1.15rem; }
.todo-text { flex: 1; min-width: 0; line-height: 1.35; }
.todo-when { display: block; color: var(--text-dim); font-size: 0.82rem; margin-top: 2px; }
.todo-go { flex: 0 0 auto; color: var(--accent); }
.todo-now { border-left: 3px solid var(--accent); }
.todo-urgent { border-left-color: var(--error); }
.todo-urgent .todo-when { color: var(--error); }
.todo-wait { opacity: 0.8; }
.todo-done { border-style: dashed; }
.todo-done .todo-ic { color: var(--success); }
.todo-all-done { margin-top: 10px; color: var(--success); font-size: 0.88rem; }

.nav-item { position: relative; }
.nav-badge {
  position: absolute; top: 2px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
  border-radius: 9px; background: var(--error); color: #fff;
  font-size: 0.68rem; font-weight: 600; line-height: 18px; text-align: center;
  pointer-events: none;
}
.sidenav .nav-badge { position: static; margin-left: auto; }

/* ---- Картинки наград (app/assets/rewards/v1) ---- */
.me-head { flex-wrap: wrap; }
.me-head > div:nth-child(2) { flex: 1; min-width: 0; }
.title-banner { position: relative; margin-top: 14px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: #0b0f1a; }
.title-banner-img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; object-fit: cover; }
.title-banner-text {
  position: absolute; left: 4%; top: 50%; transform: translateY(-50%); max-width: 40%;
  font-weight: 700; font-size: clamp(0.95rem, 3.4vw, 1.35rem); line-height: 1.2;
  color: var(--accent); text-shadow: 0 0 10px rgba(0, 0, 0, 0.9), 0 0 14px var(--accent-dim);
  overflow-wrap: anywhere;
}
.preview-banner { width: 150px; height: 50px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.badge { display: flex; flex-direction: column; }
/* Размер .badge-art задаёт только design.css — здесь не дублируем. */
.badge-art { object-fit: contain; margin: 0 auto 6px; filter: grayscale(0.85) brightness(0.7); }
.badge.earned .badge-art { filter: none; }
.badge-art-none {
  display: grid; place-items: center; font-size: 1.8rem; color: var(--text-dim);
  border: 1px dashed var(--border); border-radius: 16px; box-sizing: border-box; width: 64px; height: 64px; margin: 4px auto 10px;
}
.badge.earned .badge-art-none { color: var(--success); border-color: var(--success); }
@media (max-width: 480px) {
  .title-banner-text { max-width: 46%; }
}

/* «Тоны-гонки»: трасса на canvas, под ней — четыре дорожки-кнопки с линиями тонов */
.tone-ask {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 10px;
  min-height: 52px; margin: 6px 0 8px; text-align: center; color: var(--text); font-size: 1.02rem;
}
.tone-ask .listen-btn { margin: 0; padding: 6px 16px; }
.tone-zh { color: var(--accent); font-size: 1.6rem; font-family: var(--sans); }
.tone-canvas {
  display: block; width: 100%; height: clamp(250px, 44vh, 430px);
  border-radius: 12px; border: 1px solid var(--border); background: #070a14;
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer;
}
.tone-lanes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.tone-lane {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--accent-dim); color: var(--accent); background: var(--panel-solid); font-family: var(--sans);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.tone-lane-2 { color: #b84fff; } .tone-lane-3 { color: #ffc94d; } .tone-lane-4 { color: #ff4d5e; }
.tone-lane:disabled { cursor: default; }
.tone-lane .tone-line { width: 40px; height: 30px; }
.tone-num { font-family: var(--mono); font-size: 1.2rem; color: var(--text); line-height: 1; }
.tone-name { font-size: 0.7rem; color: var(--text-dim); text-align: center; line-height: 1.15; }
.tone-steer { border-color: currentColor; background: rgba(255, 255, 255, 0.06); transform: translateY(-2px); box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.25); }
.tone-correct { border-color: var(--success); color: var(--success); background: rgba(57, 255, 136, 0.12); box-shadow: 0 0 18px rgba(57, 255, 136, 0.45); }
.tone-bad { border-color: rgba(255, 77, 94, 0.8); color: var(--error); background: rgba(255, 77, 94, 0.12); }
.tone-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.tone-gas { padding: 8px 18px; }
.tone-combo { font-family: var(--mono); color: var(--accent); }
.tone-nitro { color: #ffc94d; text-shadow: 0 0 10px rgba(255, 201, 77, 0.7); animation: tone-pulse 0.8s ease-in-out infinite; }
@keyframes tone-pulse { 50% { opacity: 0.65; } }
@media (max-width: 480px) { .tone-name { font-size: 0.62rem; } .tone-controls .arcade-hint { display: none; } }
@media (prefers-reduced-motion: reduce) { .tone-lane { transition: none; } .tone-nitro { animation: none; } }

/* «Башни Архитектора»: поле на canvas, под ним цель и варианты, между волнами — карточки улучшений */
.tower-canvas {
  display: block; width: 100%; height: clamp(240px, 42vh, 420px);
  border-radius: 12px; border: 1px solid var(--border); background: #070a14;
}
.tower-ask { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 10px; min-height: 48px; margin: 8px 0 6px; text-align: center; color: var(--text); }
.tower-ask .listen-btn { margin: 0; padding: 6px 16px; }
.tower-zh { color: #ffc94d; font-size: 1.8rem; font-family: var(--sans); }
.tower-wait { color: var(--text-dim); }
.tower-heat { text-align: center; color: var(--error); font-size: 0.9rem; margin-bottom: 6px; }
.tower-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tower-opt { min-height: 50px; text-align: left; overflow-wrap: anywhere; }
.tower-opt kbd { font-family: var(--mono); font-size: 0.7em; opacity: 0.55; margin-right: 4px; }
.tower-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tower-card {
  display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 12px; text-align: left; cursor: pointer;
  border: 1px solid rgba(255, 201, 77, 0.5); background: var(--panel-solid); color: var(--text); font-family: var(--sans);
}
.tower-card b { color: #ffc94d; }
.tower-card span { font-size: 0.8rem; color: var(--text-dim); }
.tower-card:disabled { opacity: 0.4; cursor: default; }
@media (max-width: 480px) { .tower-cards { grid-template-columns: 1fr; } .tower-opts { grid-template-columns: 1fr; } }

/* «Дэш-тон»: раннер на canvas, под ним кнопки тонов; ♪ — музыка */
.dash-canvas {
  display: block; width: 100%; height: clamp(260px, 46vh, 440px);
  border-radius: 12px; border: 1px solid var(--border); background: #07041a;
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer;
}
.dash-tones .tone-lane:disabled { opacity: 0.35; }
.dash-hint { text-align: center; margin-top: 8px; }
.dash .tone-ask { min-height: 64px; }
.dash-right { display: inline-flex; align-items: center; gap: 10px; }
.dash-music {
  font: inherit; font-size: 1rem; line-height: 1; padding: 4px 9px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--text-dim);
}
.dash-music.on { color: var(--accent); border-color: var(--accent-dim); box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.25); }
/* На телефоне сцена ниже на 48px: иначе кнопки тонов уходят под нижнее меню (390×667–844, 2026-10-31) */
@media (max-width: 480px) { .dash-hint { display: none; } .dash-canvas { height: clamp(220px, calc(46vh - 48px), 440px); } }
.me-pause { margin: 6px 0; padding: 8px 10px; border-radius: 10px; font-size: 0.85rem; color: var(--review); border: 1px solid currentColor; background: rgba(255, 201, 77, 0.07); }

/* «Морской бой»: два поля на canvas, ниже слово клетки и варианты */
.sea-canvas {
  display: block; width: 100%; height: 360px; border-radius: 12px; border: 1px solid var(--border); background: #050816;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; cursor: crosshair;
}
.sea-left { font-family: var(--mono); color: var(--text-dim); }
.sea-setup { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 6px 0 4px; }
.sea-setup kbd { font-family: var(--mono); font-size: 0.7em; opacity: 0.6; margin-left: 6px; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; }
.sea-hint { text-align: center; margin-top: 4px; }

/* Вопрос и варианты ответа в играх с полем на canvas: «прилипают» к низу экрана над меню, чтобы не листать */
.answer-sheet {
  position: sticky; bottom: 12px; z-index: 20; margin-top: 8px; padding: 6px 10px 10px;
  border: 1px solid var(--accent-dim); border-radius: 14px; background: rgba(8, 12, 24, 0.95);
  box-shadow: 0 -10px 26px rgba(0, 0, 0, 0.5);
}
.answer-sheet .tower-ask { min-height: 0; margin: 4px 0 6px; }
.answer-sheet .tower-heat { margin-bottom: 4px; }
@media (max-width: 860px) {
  .answer-sheet { bottom: calc(74px + env(safe-area-inset-bottom)); }
  .answer-sheet .tower-opts { grid-template-columns: 1fr 1fr; gap: 6px; }
  .answer-sheet .tower-opt { min-height: 46px; padding: 6px 8px; font-size: 0.92rem; }
  .answer-sheet .tower-cards { grid-template-columns: 1fr; gap: 6px; }
  .answer-sheet .tower-card { padding: 8px 10px; }
}

/* Редкие вещи (600–1500 ◆): анимированные рамки и темы */
.frame-aurora {
  border: 3px solid transparent;
  background: linear-gradient(var(--panel-solid), var(--panel-solid)) padding-box,
              conic-gradient(#6dffb5, #3da5ff, #b84fff, #6dffb5) border-box;
  box-shadow: 0 0 18px rgba(109, 255, 181, 0.5); animation: frame-hue 5s linear infinite;
}
.frame-plasma {
  border: 3px solid transparent;
  background: linear-gradient(var(--panel-solid), var(--panel-solid)) padding-box,
              conic-gradient(#ff5fd2, #8a6bff, #2de2e6, #ff5fd2) border-box;
  animation: frame-plasma 1.4s ease-in-out infinite, frame-hue 7s linear infinite;
}
.frame-hologram {
  border: 3px solid transparent;
  background: linear-gradient(var(--panel-solid), var(--panel-solid)) padding-box,
              linear-gradient(115deg, #2de2e6 0%, #b84fff 25%, #ffffff 40%, #2de2e6 55%, #ff5fd2 80%, #2de2e6 100%) border-box;
  background-size: 100% 100%, 300% 300%; box-shadow: 0 0 14px rgba(45, 226, 230, 0.5);
  animation: frame-sweep 2.4s linear infinite;
}
@keyframes frame-hue { to { filter: hue-rotate(360deg); } }
@keyframes frame-plasma { 50% { box-shadow: 0 0 6px rgba(255, 95, 210, 0.5), 0 0 26px rgba(138, 107, 255, 0.9); } 0%, 100% { box-shadow: 0 0 18px rgba(255, 95, 210, 0.7), 0 0 8px rgba(45, 226, 230, 0.5); } }
@keyframes frame-sweep { to { background-position: 0 0, 300% 0; } }
@media (prefers-reduced-motion: reduce) { .frame-aurora, .frame-plasma, .frame-hologram { animation: none; } }
body[data-theme="theme-obsidian"] { --accent: #a9b4ff; --accent-rgb: 169, 180, 255; --accent-dim: rgba(169, 180, 255, 0.35); --border: rgba(169, 180, 255, 0.24); --second-rgb: 255, 95, 210; --bg: #06070c; --bg-grid: #0a0c14; --panel: rgba(16, 18, 30, 0.8); --panel-solid: #12141f; }
body[data-theme="theme-solar"] { --accent: #ffe08a; --accent-rgb: 255, 224, 138; --accent-dim: rgba(255, 224, 138, 0.35); --border: rgba(255, 224, 138, 0.28); --second-rgb: 255, 106, 61; --bg: #150a05; --bg-grid: #1b0d06; --panel: rgba(44, 22, 12, 0.78); --panel-solid: #2c160c; }
body[data-theme="theme-solar"] { background-image: radial-gradient(ellipse 60% 45% at 50% -8%, rgba(255, 150, 60, 0.28), transparent 70%), linear-gradient(rgba(var(--accent-rgb), 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--accent-rgb), 0.04) 1px, transparent 1px); background-size: 100% 100%, 32px 32px, 32px 32px; background-attachment: fixed, scroll, scroll; }

/* Сезонный пропуск: лесенка из десяти ступеней */
.season-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; }
.season-head h2 { margin: 0.2em 0; }
.season-when { font-family: var(--mono); color: var(--accent); font-size: 0.85rem; }
.season-rules { color: var(--text-dim); font-size: 0.85rem; margin: 10px 0 14px; }
.season-ladder { display: grid; gap: 8px; }
.season-step {
  display: grid; grid-template-columns: 34px 78px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 8px 12px 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: rgba(var(--accent-rgb), 0.04);
}
.season-n { font: 800 1.2rem var(--mono); color: var(--text-dim); text-align: center; }
.season-prev { display: flex; align-items: center; justify-content: center; min-height: 48px; overflow: hidden; }
.season-prev .swatch { width: 18px; height: 18px; }
.season-prev .preview-banner { width: 74px; max-width: 100%; height: 48px; aspect-ratio: auto; object-fit: cover; object-position: 80% center; }
.season-prev .preview-title { font-size: 0.7rem; text-align: center; line-height: 1.15; }
.season-name { font-weight: 700; }
.season-kind { font: 600 0.68rem var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }
.season-state { font-family: var(--mono); font-size: 0.8rem; color: var(--text-dim); }
.season-done { color: var(--success); }
.season-missed { color: var(--error); }
.season-done { border-color: rgba(57, 255, 136, 0.35); }
.season-done .season-n { color: var(--success); }
.season-next { border-color: var(--accent); box-shadow: 0 0 18px var(--accent-dim); background: rgba(var(--accent-rgb), 0.1); }
.season-next .season-n { color: var(--accent); }
.season-locked, .season-missed { opacity: 0.6; }
@media (max-width: 520px) { .season-step { grid-template-columns: 26px 60px minmax(0, 1fr); } .season-act { grid-column: 1 / -1; justify-self: end; } }
.frame-maple {
  border: 3px solid transparent;
  background: linear-gradient(var(--panel-solid), var(--panel-solid)) padding-box,
              conic-gradient(#ff3d1f, #ff9a3d, #ffd36b, #ff3d1f) border-box;
  box-shadow: 0 0 16px rgba(255, 120, 40, 0.6); animation: frame-hue 9s linear infinite;
}
.frame-harvest {
  border: 3px solid transparent;
  background: linear-gradient(var(--panel-solid), var(--panel-solid)) padding-box,
              conic-gradient(#ffd36b, #ff8a3d, #ffe9a8, #ff5a3d, #ffd36b) border-box;
  animation: frame-plasma 1.8s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .frame-maple, .frame-harvest { animation: none; } }
body[data-theme="theme-autumn"] { --accent: #ffb04d; --accent-rgb: 255, 176, 77; --accent-dim: rgba(255, 176, 77, 0.35); --border: rgba(255, 176, 77, 0.28); --second-rgb: 255, 90, 61; --bg: #150a06; --bg-grid: #1b0e08; --panel: rgba(44, 24, 14, 0.78); --panel-solid: #2c180e; }
@media (max-width: 520px) { .profile-tab { font-size: 0.78rem; padding-left: 6px; padding-right: 6px; overflow-wrap: normal; word-break: keep-all; } .profile-tab .ui-icon { display: none; } }

/* Зимний сезон */
.frame-frost {
  border: 3px solid transparent;
  background: linear-gradient(var(--panel-solid), var(--panel-solid)) padding-box,
              linear-gradient(135deg, #e8f7ff, #7ec8ff 30%, #ffffff 50%, #8fb4ff 70%, #e8f7ff) border-box;
  background-size: 100% 100%, 300% 300%; box-shadow: 0 0 14px rgba(150, 210, 255, 0.55); animation: frame-sweep 3.2s linear infinite;
}
.frame-polaris {
  border: 3px solid transparent;
  background: linear-gradient(var(--panel-solid), var(--panel-solid)) padding-box,
              conic-gradient(#7ee8ff, #6b7bff, #e8f7ff, #7ee8ff, #b9a6ff, #7ee8ff) border-box;
  animation: frame-plasma 2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .frame-frost, .frame-polaris { animation: none; } }
body[data-theme="theme-polar"] { --accent: #7ee8ff; --accent-rgb: 126, 232, 255; --accent-dim: rgba(126, 232, 255, 0.35); --border: rgba(126, 232, 255, 0.26); --second-rgb: 107, 123, 255; --bg: #050a18; --bg-grid: #08112a; --panel: rgba(14, 24, 52, 0.78); --panel-solid: #0e1834; }
body[data-theme="theme-polar"] { background-image: radial-gradient(ellipse 70% 40% at 20% -5%, rgba(126, 232, 255, 0.2), transparent 70%), radial-gradient(ellipse 60% 40% at 85% 10%, rgba(107, 123, 255, 0.22), transparent 70%), linear-gradient(rgba(var(--accent-rgb), 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--accent-rgb), 0.04) 1px, transparent 1px); background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px; background-attachment: fixed, fixed, scroll, scroll; }

/* Перевод примера в карточке грамматики урока — по нажатию (app/js/hanzi.js renderGrammarCard) */
.ex-ru-btn { border: 1px dashed var(--border); background: transparent; color: var(--text-dim); border-radius: 6px;
  padding: 2px 12px; font: inherit; font-size: 0.8rem; cursor: pointer; margin-top: 4px; }
.ex-ru-btn:hover { color: var(--accent); border-color: var(--accent-dim); }
