/* Стиль у дусі Apple Human Interface: системний шрифт, скло, м'які тіні, системні кольори */
:root {
  --bg: #f2f2f7;
  --bg2: #ffffff;
  --fill: rgba(120, 120, 128, .12);
  --fill2: rgba(120, 120, 128, .2);
  --label: #1d1d1f;
  --label2: rgba(60, 60, 67, .6);
  --label3: rgba(60, 60, 67, .3);
  --sep: rgba(60, 60, 67, .12);
  --glass: rgba(255, 255, 255, .72);
  --accent: #007aff;
  --accent-tint: rgba(0, 122, 255, .1);
  --orange: #ff9500;
  --green: #34c759;
  --green-tint: rgba(52, 199, 89, .14);
  --red: #ff3b30;
  --red-tint: rgba(255, 59, 48, .12);
  --teal: #30b0c7;
  --yellow: #ffcc00;
  --purple: #af52de;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
  --r: 22px;
  --ease: cubic-bezier(.32, .72, 0, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 17px; letter-spacing: -.01em;
  color: var(--label); background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { letter-spacing: -.022em; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; letter-spacing: inherit; }
input, textarea { font: inherit; letter-spacing: inherit; }
svg.sf { width: 1em; height: 1em; display: block; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; padding: 0 24px; border-radius: 14px;
  font-size: 17px; font-weight: 600;
  background: var(--accent); color: #fff;
  transition: transform .2s var(--ease), opacity .2s, background .2s;
}
.btn:active { transform: scale(.97); opacity: .85; }
.btn[disabled] { background: var(--fill); color: var(--label3); cursor: default; transform: none; opacity: 1; }
.btn.ok { background: var(--green); }
.btn.bad { background: var(--red); }
.btn.ghost { background: var(--fill); color: var(--accent); }
.btn.wide { width: 100%; }

/* ---------- Каркас ---------- */
.layout { display: grid; grid-template-columns: 260px 1fr 340px; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 28px 14px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: .5px solid var(--sep);
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 700; padding: 0 12px 24px; letter-spacing: -.03em; }
.logo svg { width: 38px; height: 38px; }
/* Логотип «Бобро»: повний — у широкій панелі, лише медальйон — у вузькій */
.logo .logo-full { width: 122px; height: 38px; display: block; }
.logo .logo-full + .logo-mark { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 10px;
  font-size: 15px; font-weight: 500; color: var(--label); text-align: left;
  transition: background .15s;
}
.nav-item .ic { font-size: 20px; color: var(--accent); }
.nav-item:hover { background: var(--fill); }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item.active .ic { color: #fff; }

.main { padding: 36px 32px 140px; display: flex; justify-content: center; }
.main-inner { width: 100%; max-width: 620px; }
.aside { position: sticky; top: 0; height: 100vh; padding: 28px 24px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }

.stats { display: flex; gap: 8px; }
.stat {
  display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600;
  padding: 7px 12px; border-radius: 99px; background: var(--bg2); box-shadow: var(--shadow);
  font-variant-numeric: tabular-nums;
}
.stat .e { font-size: 16px; }
.stat.streak .e { color: var(--orange); }
.stat.gems .e { color: var(--teal); }
.stat.hearts .e { color: var(--red); }
.stat.dim .e { color: var(--label3); }

.panel { border-radius: var(--r); padding: 20px; background: var(--bg2); box-shadow: var(--shadow); }
.panel h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.panel p { margin: 0; color: var(--label2); font-size: 15px; line-height: 1.4; }

.goal-bar, .mini-bar { height: 6px; border-radius: 99px; background: var(--fill); overflow: hidden; margin-top: 12px; }
.goal-bar > div, .mini-bar > div { height: 100%; background: var(--orange); border-radius: 99px; transition: width .6s var(--ease); }
.goal-row { display: flex; align-items: center; gap: 16px; }
.ring { width: 64px; height: 64px; flex: none; }
.ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }

.mobile-top, .mobile-nav, .large-title { display: none; }
.mobile-top > .logo-full { display: none; }

/* ---------- Шлях ---------- */
.unit-banner {
  border-radius: var(--r); color: #fff; padding: 22px 24px; margin: 8px 0 72px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 70%, #000));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--c) 35%, transparent);
}
.unit-banner .eyebrow { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; opacity: .75; }
.unit-banner h2 { margin: 2px 0 4px; font-size: 24px; font-weight: 700; }
.unit-banner p { margin: 0; opacity: .85; font-size: 15px; }
.unit-banner .guide { width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: 22px; backdrop-filter: blur(10px); }

.path { position: relative; display: flex; flex-direction: column; align-items: center; gap: 26px; margin-bottom: 56px; }
.node-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
.node-wrap.has-bubble { margin-top: 34px; }
.path > .node-wrap.has-bubble:first-child { margin-top: 0; }
.node {
  --c: var(--accent);
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 82%, #fff), var(--c));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--c) 40%, transparent), inset 0 1px 0 rgba(255,255,255,.4);
  display: grid; place-items: center; font-size: 30px; position: relative;
  transition: transform .25s var(--ease);
}
.node:hover { transform: scale(1.05); }
.node:active { transform: scale(.94); }
.node.locked { background: var(--bg2); box-shadow: var(--shadow); color: var(--label3); font-size: 24px; }
.node.done::after {
  content: ""; position: absolute; right: -2px; bottom: -2px;
  width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--bg);
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' stroke='white' stroke-width='3' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat;
}
.node-ring { position: absolute; inset: -10px; border-radius: 50%; border: 4px solid color-mix(in srgb, var(--c) 28%, transparent); pointer-events: none; animation: pulse 2s var(--ease) infinite; }
.node-label { margin-top: 12px; font-size: 13px; font-weight: 500; color: var(--label2); }
.start-bubble {
  position: absolute; top: -50px; white-space: nowrap;
  background: var(--bg2); color: var(--accent); box-shadow: var(--shadow-lg);
  padding: 8px 16px; border-radius: 99px; font-weight: 600; font-size: 14px;
  animation: bob 2s ease-in-out infinite;
}
.stars { display: flex; gap: 1px; font-size: 11px; margin-top: 3px; color: var(--yellow); }
.stars .off { color: var(--label3); }
.path-mascot { position: absolute; width: 104px; top: 90px; filter: drop-shadow(0 8px 16px rgba(0,0,0,.12)); }
.path-mascot.right { right: 2%; }
.path-mascot.left { left: 2%; }

@keyframes bob { 50% { transform: translateY(-5px); } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.06); opacity: .6; } }

/* ---------- Урок ---------- */
.lesson { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg2); }
.lesson-top {
  position: sticky; top: 0; z-index: 5;
  width: 100%; padding: 16px max(20px, calc(50% - 480px)); display: flex; align-items: center; gap: 16px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.close-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--fill); color: var(--label2); display: grid; place-items: center; font-size: 14px; }
.progress { flex: 1; height: 8px; border-radius: 99px; background: var(--fill); overflow: hidden; }
.progress > div { height: 100%; border-radius: 99px; background: var(--green); transition: width .5s var(--ease); }
.lesson-body { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 12px 20px 200px; animation: fadeIn .35s var(--ease); }
.ex-title { font-size: 28px; font-weight: 700; margin: 16px 0 28px; line-height: 1.15; }
.new-word { color: var(--purple); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.card {
  border-radius: 20px; padding: 22px 10px 16px; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 17px; font-weight: 500;
  box-shadow: inset 0 0 0 2px transparent;
  transition: transform .2s var(--ease), box-shadow .2s, background .2s;
}
.card .em { font-size: 60px; line-height: 1; }
.card:active { transform: scale(.96); }
.card.sel { background: var(--accent-tint); box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); }
.card.ok { background: var(--green-tint); box-shadow: inset 0 0 0 2px var(--green); color: var(--green); }
.card.bad { background: var(--red-tint); box-shadow: inset 0 0 0 2px var(--red); color: var(--red); animation: shake .4s; }

.speech { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; }
.speech .mascot { width: 100px; flex: none; }
.bubble {
  position: relative; border-radius: 20px 20px 20px 6px; padding: 14px 18px;
  font-size: 19px; background: var(--bg); margin-bottom: 26px; display: flex; align-items: center; gap: 10px;
}
.speak-btn { font-size: 20px; color: var(--accent); }

.answer-line { min-height: 60px; border-bottom: 1px solid var(--sep); display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; align-content: flex-start; }
.answer-line + .answer-line { min-height: 56px; }
.bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 34px; }
.chip {
  padding: 10px 16px; border-radius: 12px; background: var(--bg2);
  box-shadow: 0 0 0 1px var(--sep), 0 1px 2px rgba(0,0,0,.06);
  font-size: 17px; font-weight: 500;
  transition: transform .2s var(--ease), background .2s, opacity .2s;
  animation: fadeIn .25s var(--ease);
}
.chip:active { transform: scale(.94); }
.chip.used { color: transparent; background: var(--fill); box-shadow: none; pointer-events: none; animation: none; }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-col { display: flex; flex-direction: column; gap: 12px; }
.match .chip { width: 100%; padding: 18px 12px; }
.chip.sel { background: var(--accent-tint); color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.chip.matched { opacity: .3; pointer-events: none; background: var(--green-tint); color: var(--green); box-shadow: none; }
.chip.wrong { background: var(--red-tint); color: var(--red); box-shadow: 0 0 0 2px var(--red); animation: shake .4s; }

.listen-btns { display: flex; justify-content: center; align-items: flex-end; gap: 16px; margin: 10px 0 28px; }
.big-speaker {
  width: 120px; height: 120px; border-radius: 30px; color: #fff; font-size: 48px;
  background: linear-gradient(180deg, #5ac8fa, var(--accent));
  box-shadow: 0 10px 24px rgba(0, 122, 255, .35);
  display: grid; place-items: center;
  transition: transform .2s var(--ease);
}
.big-speaker.slow { width: 72px; height: 72px; border-radius: 20px; font-size: 28px; background: var(--fill); color: var(--accent); box-shadow: none; }
.big-speaker:active { transform: scale(.94); }
.text-input {
  width: 100%; min-height: 120px; resize: none; border: 0; border-radius: 16px;
  padding: 16px; font-size: 19px; background: var(--bg); color: var(--label); outline: none;
  box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .2s;
}
.text-input:focus { box-shadow: inset 0 0 0 2px var(--accent); }

/* ---------- Нижня панель (sheet) ---------- */
.footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep);
}
.footer.ok, .footer.bad { border-radius: 26px 26px 0 0; border: 0; box-shadow: var(--shadow-lg); background: var(--bg2); }
.footer-inner { max-width: 1000px; margin: 0 auto; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.footer .btn { min-width: 180px; }
.feedback { display: flex; align-items: center; gap: 14px; }
.feedback .badge { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; flex: none; color: #fff; }
.footer.ok .badge { background: var(--green); }
.footer.bad .badge { background: var(--red); }
.feedback h4 { margin: 0 0 2px; font-size: 20px; font-weight: 700; }
.footer.ok h4 { color: var(--green); }
.footer.bad h4 { color: var(--red); }
.feedback .sol { font-size: 16px; color: var(--label2); }
.slide-up { animation: slideUp .45s var(--ease); }

@keyframes slideUp { from { transform: translateY(100%); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes pop { 0% { transform: scale(.7); opacity: 0; } 60% { transform: scale(1.04); } }

/* ---------- Результат ---------- */
.result { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 20px 160px; background: var(--bg2); }
.result .mascot { width: 170px; animation: pop .6s var(--ease); filter: drop-shadow(0 12px 24px rgba(0,0,0,.12)); }
.result h1 { font-size: 34px; font-weight: 700; margin: 18px 0 8px; }
.result.fail h1 { color: var(--red); }
.result-boxes { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 20px; }
.rbox { width: 150px; border-radius: 20px; background: var(--bg); padding: 16px 12px; text-align: left; animation: pop .6s var(--ease) backwards; }
.rbox:nth-child(2) { animation-delay: .1s; }
.rbox:nth-child(3) { animation-delay: .2s; }
.rbox .t { font-size: 13px; font-weight: 600; color: var(--c); }
.rbox .v { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ---------- Рейтинг і профіль ---------- */
.page-title { font-size: 34px; font-weight: 700; margin: 4px 0 6px; letter-spacing: -.03em; }
.page-sub { color: var(--label2); margin: 0 0 22px; font-size: 15px; line-height: 1.4; }
.section-h { font-size: 13px; font-weight: 400; text-transform: uppercase; color: var(--label2); margin: 28px 16px 8px; letter-spacing: 0; }
.league-badges { display: flex; justify-content: center; gap: 14px; font-size: 40px; margin: 6px 0 14px; }
.league-badges span:not(.cur) { filter: grayscale(1); opacity: .3; }
.league-badges .cur { transform: scale(1.25); }
.list { background: var(--bg2); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.lb-row { display: flex; align-items: center; gap: 14px; padding: 10px 16px; position: relative; }
.lb-row + .lb-row::before, .zone + .lb-row::before { content: ""; position: absolute; top: 0; left: 98px; right: 0; border-top: .5px solid var(--sep); }
.lb-row.me { background: var(--accent-tint); }
.lb-rank { width: 24px; text-align: center; font-weight: 600; color: var(--label2); font-variant-numeric: tabular-nums; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; color: #fff; font-weight: 600; flex: none; }
.lb-name { flex: 1; font-weight: 500; }
.lb-xp { color: var(--label2); font-variant-numeric: tabular-nums; }
.zone { text-align: center; color: var(--green); font-size: 12px; font-weight: 600; padding: 8px; background: var(--green-tint); text-transform: uppercase; letter-spacing: .04em; }

.profile-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; margin-bottom: 8px; }
.profile-head .avatar { width: 100px; height: 100px; font-size: 52px; background: linear-gradient(180deg, #ffd8a8, #ff9500); box-shadow: var(--shadow-lg); }
.name-input { font-size: 28px; font-weight: 700; border: 0; background: none; color: var(--label); width: 100%; outline: none; text-align: center; letter-spacing: -.02em; border-radius: 10px; padding: 4px; }
.name-input:focus { background: var(--fill); }
.grid-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gstat { background: var(--bg2); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); }
.gstat .e { font-size: 22px; }
.gstat b { font-size: 26px; display: block; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.gstat small { color: var(--label2); font-size: 13px; }
.achv { display: flex; align-items: center; gap: 14px; padding: 12px 16px; position: relative; }
.achv + .achv::before { content: ""; position: absolute; top: 0; left: 74px; right: 0; border-top: .5px solid var(--sep); }
.achv .e { font-size: 24px; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(180deg, #ffe08a, #ffb300); flex: none; }
.achv.locked .e { filter: grayscale(1); opacity: .45; }
.achv .info { flex: 1; font-weight: 500; }
.achv small { color: var(--label2); display: block; font-size: 13px; font-weight: 400; margin-top: 2px; }
.achv .mini-bar { margin-top: 8px; }
.cell-btn { width: 100%; text-align: left; padding: 14px 16px; font-size: 17px; color: var(--accent); position: relative; display: flex; justify-content: space-between; align-items: center; }
.cell-btn + .cell-btn::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.cell-btn.danger { color: var(--red); }
.switch { width: 51px; height: 31px; border-radius: 99px; background: var(--fill2); position: relative; transition: background .25s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15); transition: transform .3s var(--ease); }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(20px); }
.cell-btn .lbl { color: var(--label); }

.toast {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 50;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  color: var(--label); padding: 12px 20px; border-radius: 99px; box-shadow: var(--shadow-lg); font-size: 15px; font-weight: 500;
  animation: toastIn .45s var(--ease);
}
@keyframes toastIn { from { transform: translate(-50%, -80px); } }

/* ---------- Адаптивність ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 80px 1fr; }
  .aside { display: none; }
  .sidebar { align-items: center; }
  .sidebar .logo span, .sidebar .nav-item .lbl, .sidebar .logo .logo-full { display: none; }
  .sidebar .logo .logo-full + .logo-mark { display: block; }
  .logo { padding: 0 0 24px; }
  .nav-item { padding: 10px; }
  .mobile-top { display: flex; position: sticky; top: 0; z-index: 5; padding: 10px 0; justify-content: flex-end; margin-bottom: 8px;
    background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
  .main { padding-top: 0; }
}
@media (max-width: 700px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-top { margin: 0 -16px 8px; padding: 10px 16px; border-bottom: .5px solid var(--sep); justify-content: space-between; }
  .mobile-top > .logo-full { display: block; width: 103px; height: 32px; margin: -4px 0; flex: none; align-self: center; }
  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
    background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: .5px solid var(--sep); justify-content: space-around; padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  }
  .mobile-nav .nav-item { flex-direction: column; gap: 3px; padding: 4px 18px; font-size: 10px; color: var(--label2); background: none; }
  .mobile-nav .nav-item .ic { font-size: 24px; color: var(--label3); }
  .mobile-nav .nav-item.active, .mobile-nav .nav-item.active .ic { color: var(--accent); background: none; }
  .main { padding: 0 16px 110px; }
  .ex-title { font-size: 24px; }
  .footer-inner { flex-direction: column; align-items: stretch; }
  .footer .btn { width: 100%; }
  .path-mascot { display: none; }
  .speech .mascot { width: 76px; }
  .card .em { font-size: 46px; }
  .stat { padding: 5px 10px; box-shadow: none; background: var(--fill); }
}

/* ---------- Власні іконки ---------- */
.lesson-ico { width: 34px; height: 34px; color: #fff; display: grid; place-items: center; filter: drop-shadow(0 1px 1px rgba(0,0,0,.15)); }
.lesson-ico svg { width: 100%; height: 100%; }
.node.locked .lesson-ico { width: 26px; height: 26px; color: var(--label3); filter: none; }
.league-badges span { width: 44px; height: 44px; display: block; }
.league-badges span svg { width: 100%; height: 100%; }
.achv .e { background: var(--c); color: #fff; }
.achv .e svg { width: 24px; height: 24px; }
.gstat .e svg { width: 24px; height: 24px; }
.avatar svg { width: 82%; height: 82%; }
.avatar.me-av { overflow: hidden; }
.profile-head .avatar svg { width: 80%; height: 80%; margin-top: 10px; }
.new-word { display: flex; align-items: center; gap: 6px; }
.big-speaker svg { width: 52px; height: 52px; }
.big-speaker.slow svg { width: 44px; height: 44px; }
.speak-btn svg { width: 22px; height: 22px; }
.close-btn svg { width: 14px; height: 14px; }
.feedback .badge svg { width: 28px; height: 28px; }
.btn svg { width: 18px; height: 18px; }
.cell-btn .val { display: flex; align-items: center; gap: 6px; color: var(--label2); }
.cell-btn .val svg { width: 14px; height: 14px; color: var(--label3); }

/* ---------- Підказки у вправах ---------- */
.tip { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-tint); color: var(--accent); border-radius: 14px; padding: 12px 14px; margin: -12px 0 22px; font-size: 15px; line-height: 1.35; animation: fadeIn .4s var(--ease); }
.new-word + .tip { margin: 10px 0 0; }
.tip svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.tip span { color: var(--label); }

/* ---------- Онбординг ---------- */
.onboarding { min-height: 100vh; background: var(--bg2); display: flex; flex-direction: column; }
.ob-top { max-width: 640px; width: 100%; margin: 0 auto; padding: 18px 20px; display: grid; grid-template-columns: 80px 1fr 80px; align-items: center; }
.ob-back { width: 36px; height: 36px; border-radius: 50%; background: var(--fill); color: var(--label2); display: grid; place-items: center; }
.ob-back svg { width: 16px; height: 16px; }
.ob-skip { color: var(--accent); font-size: 15px; justify-self: end; }
.ob-dots { display: flex; justify-content: center; gap: 8px; }
.ob-dots span { width: 8px; height: 8px; border-radius: 99px; background: var(--fill2); transition: all .35s var(--ease); }
.ob-dots span.on { width: 24px; background: var(--accent); }
.ob-body { flex: 1; max-width: 560px; width: 100%; margin: 0 auto; padding: 20px 20px 160px; display: flex; flex-direction: column; justify-content: center; animation: fadeIn .45s var(--ease); }
.ob-hero { width: 190px; margin: 0 auto; animation: pop .7s var(--ease); filter: drop-shadow(0 16px 30px rgba(255,149,0,.3)); }
.ob-title { font-size: 34px; font-weight: 700; text-align: center; margin: 22px 0 10px; letter-spacing: -.03em; }
.ob-text { text-align: center; color: var(--label2); font-size: 19px; line-height: 1.4; margin: 0; }
.ob-speech .bubble { margin-bottom: 30px; }
.goal-opt { color: var(--label); }
.goal-opt .lbl { display: flex; flex-direction: column; }
.goal-opt small { color: var(--label2); font-size: 14px; margin-top: 2px; }
.goal-opt.sel { background: var(--accent-tint); }
.radio { width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--fill2); display: grid; place-items: center; color: #fff; }
.goal-opt.sel .radio { background: var(--accent); box-shadow: none; }
.goal-opt .radio svg { width: 14px; height: 14px; color: #fff; }
.how-row { display: flex; gap: 14px; padding: 14px 16px; align-items: center; position: relative; }
.how-row + .how-row::before { content: ""; position: absolute; top: 0; left: 74px; right: 0; border-top: .5px solid var(--sep); }
.how-row small { display: block; color: var(--label2); font-size: 14px; margin-top: 2px; line-height: 1.35; }
.how-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--c); color: #fff; display: grid; place-items: center; flex: none; }
.how-ic svg { width: 24px; height: 24px; }
.onboarding .list { background: var(--bg); box-shadow: none; }

/* ---------- Екскурсія ---------- */
.tour { position: fixed; inset: 0; z-index: 100; }
.tour-hole { position: fixed; border-radius: 18px; box-shadow: 0 0 0 9999px rgba(0,0,0,.55); transition: all .45s var(--ease); pointer-events: none; }
.tour-card { position: fixed; width: min(330px, calc(100vw - 24px)); background: var(--bg2); border-radius: 20px; padding: 16px; box-shadow: var(--shadow-lg); animation: fadeIn .35s var(--ease); transition: top .45s var(--ease), left .45s var(--ease); }
.tour-head { display: flex; gap: 12px; align-items: flex-start; }
.tour-head svg { width: 52px; flex: none; }
.tour-head b { font-size: 17px; }
.tour-head p { margin: 4px 0 0; color: var(--label2); font-size: 15px; line-height: 1.35; }
.tour-actions { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 14px; }
.tour-skip { color: var(--label2); font-size: 15px; }
.tour .btn { height: 40px; padding: 0 18px; font-size: 15px; border-radius: 99px; }

/* ---------- Мініігри ---------- */
.games-list { display: flex; flex-direction: column; gap: 14px; }
.game-card { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: var(--r); background: var(--bg2); box-shadow: var(--shadow); text-align: left; transition: transform .25s var(--ease); }
.game-card:hover { transform: translateY(-2px); }
.game-card:active { transform: scale(.98); }
.game-ic { width: 64px; height: 64px; border-radius: 18px; flex: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 75%, #fff), var(--c)); box-shadow: 0 8px 18px color-mix(in srgb, var(--c) 35%, transparent); }
.game-ic svg { width: 34px; height: 34px; }
.game-ic.sm { width: 28px; height: 28px; border-radius: 8px; box-shadow: none; }
.game-ic.sm svg { width: 16px; height: 16px; }
.game-info { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.game-info b { font-size: 18px; }
.game-info small { color: var(--label2); font-size: 14px; line-height: 1.35; }
.game-best { font-size: 13px; color: var(--accent); font-weight: 600; margin-top: 4px; }
.game-play { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-tint); color: var(--accent); display: grid; place-items: center; flex: none; }
.game-play svg { width: 18px; height: 18px; margin-left: 2px; }
.g-title { flex: 1; display: flex; align-items: center; gap: 10px; font-weight: 600; }
.game-body { padding-bottom: 60px; }
.g-timer { height: 8px; border-radius: 99px; background: var(--fill); overflow: hidden; margin-top: 10px; }
.g-timer > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .1s linear, background .3s; }
.g-timer > div.low { background: var(--red); }
.g-meta { display: flex; justify-content: space-between; margin: 10px 0 0; color: var(--label2); font-size: 15px; font-variant-numeric: tabular-nums; }
.g-combo { display: flex; align-items: center; gap: 4px; color: var(--orange); font-weight: 600; animation: pop .3s var(--ease); }
.g-combo svg { width: 16px; height: 16px; }
.g-word { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 30px 0 30px; animation: fadeIn .25s var(--ease); }
.g-word .em { font-size: 76px; line-height: 1; }
.g-word b { font-size: 30px; letter-spacing: -.02em; }
.g-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.g-options .chip { padding: 18px 12px; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.chip .key { width: 22px; height: 22px; border-radius: 6px; background: var(--fill); color: var(--label2); font-size: 12px; display: grid; place-items: center; flex: none; }
.chip.ok { background: var(--green-tint); color: var(--green); box-shadow: 0 0 0 2px var(--green); }
.chip.bad { background: var(--red-tint); color: var(--red); box-shadow: 0 0 0 2px var(--red); animation: shake .4s; }

.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; perspective: 900px; }
.mem-card { aspect-ratio: 3 / 4; }
.mem-inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .5s var(--ease); }
.mem-card.up .mem-inner { transform: rotateY(180deg); }
.mem-back, .mem-front { position: absolute; inset: 0; border-radius: 16px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: grid; place-items: center; padding: 6px; }
.mem-back { background: linear-gradient(160deg, #a5a3ff, #5856d6); color: rgba(255,255,255,.55); box-shadow: 0 4px 12px rgba(88,86,214,.3); }
.mem-back svg { width: 40%; height: 40%; }
.mem-front { transform: rotateY(180deg); background: var(--bg2); box-shadow: 0 0 0 1px var(--sep), var(--shadow); font-size: 15px; font-weight: 600; text-align: center; word-break: break-word; }
.mem-front.en { color: var(--accent); }
.mem-card.done .mem-front { background: var(--green-tint); color: var(--green); box-shadow: 0 0 0 2px var(--green); }
.mem-card.done { animation: pop .4s var(--ease); }

.ana-slots { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 30px; }
.slot { width: 44px; height: 54px; border-radius: 12px; background: var(--fill); display: grid; place-items: center; font-size: 26px; font-weight: 700; text-transform: uppercase; }
.slot.fill { background: var(--green-tint); color: var(--green); animation: pop .25s var(--ease); }
.ana-tiles { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.tile { width: 54px; height: 54px; border-radius: 14px; background: var(--bg2); box-shadow: 0 0 0 1px var(--sep), 0 2px 4px rgba(0,0,0,.08); font-size: 24px; font-weight: 600; text-transform: uppercase; transition: transform .2s var(--ease), opacity .2s; }
.tile:active { transform: scale(.9); }
.tile.used { opacity: 0; pointer-events: none; transform: scale(.6); }
.tile.wrong { background: var(--red-tint); color: var(--red); box-shadow: 0 0 0 2px var(--red); animation: shake .35s; }

@media (max-width: 700px) {
  .mobile-nav .nav-item { padding: 4px 10px; }
  .g-word .em { font-size: 60px; }
  .mem-front { font-size: 13px; }
  .slot { width: 36px; height: 46px; font-size: 22px; }
  .tile { width: 48px; height: 48px; }
  .game-ic { width: 54px; height: 54px; }
}

/* ================= Анімації ================= */

/* --- Бобро: хвіст, вуха, кліпання, дихання --- */
.fox .m-tail, .fox .m-ear-l, .fox .m-ear-r, .fox .m-head, .fox .m-eyes { transform-box: fill-box; }
.fox .m-tail { transform-origin: 0% 100%; animation: tailWag 2.6s ease-in-out infinite; }
.fox .m-ear-l { transform-origin: 70% 90%; animation: earL 5s ease-in-out infinite; }
.fox .m-ear-r { transform-origin: 30% 90%; animation: earR 5s ease-in-out 1.3s infinite; }
.fox .m-head { transform-origin: 50% 100%; animation: headTilt 6s ease-in-out infinite; }
.fox-normal .m-eyes { transform-origin: 50% 50%; animation: blink 4.2s infinite; }
.fox-happy .m-tail { animation-duration: 1s; }
/* sad — це «думає» (hero-think): спокійна поза без опущених вух, герой не сумує */
.fox-sad .m-tail { animation: none; }
.fox-sad .m-head { animation: none; }

@keyframes tailWag { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(10deg); } }
@keyframes earL { 0%, 86%, 100% { transform: rotate(0); } 90% { transform: rotate(-14deg); } 94% { transform: rotate(4deg); } }
@keyframes earR { 0%, 86%, 100% { transform: rotate(0); } 90% { transform: rotate(14deg); } 94% { transform: rotate(-4deg); } }
@keyframes headTilt { 0%, 40%, 100% { transform: rotate(0); } 50%, 70% { transform: rotate(-3deg); } }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.08); } }

/* Реакція на відповідь у вправі */
.mascot.react.fox-happy { animation: hop .6s var(--ease); }
.mascot.react.fox-sad { animation: droop .5s var(--ease); }
@keyframes hop { 30% { transform: translateY(-16px) scale(1.04, .96); } 55% { transform: translateY(0) scale(1.06, .92); } 75% { transform: translateY(-4px); } }
@keyframes droop { 40% { transform: translateY(4px) scale(1.03, .95); } }

/* Бобро на головній: підстрибує */
.path-mascot { animation: float 4s ease-in-out infinite; }
.path-mascot.left { animation-delay: -2s; }
@keyframes float { 50% { transform: translateY(-10px); } }
.ob-hero { animation: pop .7s var(--ease), float 4s ease-in-out .7s infinite; }

/* --- Переходи між екранами --- */
.view-enter .main-inner, .view-enter.lesson .lesson-body, .view-enter .ob-body, .view-enter.result { animation: viewIn .5s var(--ease) backwards; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px) scale(.99); } }
.view-enter .node { animation: nodeIn .55s var(--ease) backwards; animation-delay: calc(var(--i) * 45ms + .1s); }
@keyframes nodeIn { from { opacity: 0; transform: scale(.4) translateY(20px); } }
.view-enter .unit-banner { animation: viewIn .55s var(--ease) backwards; }
.view-enter .game-card, .view-enter .lb-row, .view-enter .achv, .view-enter .gstat { animation: viewIn .5s var(--ease) backwards; }
.view-enter .game-card:nth-child(2), .view-enter .gstat:nth-child(2) { animation-delay: .07s; }
.view-enter .game-card:nth-child(3), .view-enter .gstat:nth-child(3) { animation-delay: .14s; }
.view-enter .gstat:nth-child(4) { animation-delay: .21s; }
.view-enter .lb-row:nth-child(-n+14) { animation-delay: calc(.03s * var(--n, 1)); }
.view-enter .aside .panel { animation: viewIn .5s var(--ease) backwards; }
.view-enter .aside .panel:nth-child(3) { animation-delay: .08s; }
.view-enter .aside .panel:nth-child(4) { animation-delay: .16s; }

/* --- Мікровзаємодії --- */
.card.sel { animation: springSel .4s var(--ease); }
@keyframes springSel { 40% { transform: scale(.94); } 75% { transform: scale(1.03); } }
.answer-line .chip { animation: chipIn .32s var(--ease); }
@keyframes chipIn { from { opacity: 0; transform: translateY(24px) scale(.85); } }
.chip.matched { animation: matchPulse .45s var(--ease); }
@keyframes matchPulse { 40% { transform: scale(1.08); opacity: 1; } }
.feedback .badge { animation: badgePop .5s var(--ease) .1s backwards; }
@keyframes badgePop { from { transform: scale(0) rotate(-90deg); } 70% { transform: scale(1.15); } }
.feedback h4 { animation: viewIn .4s var(--ease) .15s backwards; }
.progress.glow > div { box-shadow: 0 0 14px var(--green); animation: barGlow .8s var(--ease); }
@keyframes barGlow { 40% { filter: brightness(1.3); } }
.node-wrap.has-bubble .node:hover { transform: scale(1.08) rotate(-3deg); }
.btn:not([disabled]):hover { filter: brightness(1.06); }

/* Втрата серця */
.stat.hearts { position: relative; }
.stat.hearts.hit .e { animation: heartHit .6s var(--ease); }
@keyframes heartHit { 20% { transform: scale(1.5); } 40% { transform: scale(.8) rotate(-12deg); } 60% { transform: scale(1.15) rotate(8deg); } }
.minus { position: absolute; right: 6px; top: 100%; color: var(--red); font-weight: 700; font-size: 14px; animation: minusFly 1s var(--ease) forwards; pointer-events: none; }
@keyframes minusFly { from { opacity: 0; transform: translateY(-10px); } 30% { opacity: 1; } to { opacity: 0; transform: translateY(14px); } }

/* --- Конфеті --- */
.confetti { position: fixed; left: 50%; top: 45%; z-index: 200; pointer-events: none; }
.confetti i { position: absolute; left: 0; top: 0; opacity: 0;
  animation: confetti var(--d) cubic-bezier(.2, .7, .4, 1) var(--delay) forwards; }
@keyframes confetti {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  60% { opacity: 1; transform: translate(calc(var(--x) * .8), var(--y)) rotate(calc(var(--r) * .7)); }
  100% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 70vh)) rotate(var(--r)); }
}

/* Ігри */
.g-options .chip.ok { animation: springSel .4s var(--ease); }
.mem-card:not(.up):hover .mem-inner { transform: rotateY(-12deg); }
.ana-slots .slot.fill { animation: slotIn .3s var(--ease); }
@keyframes slotIn { from { transform: translateY(-14px) scale(.7); opacity: 0; } }

/* Повага до налаштування «Зменшити рух» */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ================= Шпалери + Glass UI + плаваючі вікна ================= */
:root {
  --glass-bg: rgba(255, 255, 255, .58);
  --glass-strong: rgba(255, 255, 255, .78);
  --glass-tint: rgba(255, 255, 255, .55);
  --glass-border: rgba(255, 255, 255, .75);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, .9), inset 0 0 0 1px rgba(255, 255, 255, .35);
  --glass-shadow: 0 1px 1px rgba(0, 0, 0, .04), 0 10px 40px rgba(31, 38, 80, .14);
  --blur: saturate(190%) blur(28px);
  --gap: 16px;
  --win-r: 30px;
  --win-w: 1080px;
}

body { background: #eef0fb; }

/* --- Шпалери: м'які кольорові плями, що повільно пливуть --- */
.wallpaper { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: linear-gradient(140deg, #ffe9d6 0%, #f5e6ff 45%, #dceeff 100%); }
.wallpaper span { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .85; will-change: transform; }
.wallpaper span:nth-child(1) { width: 52vmax; height: 52vmax; left: -14vmax; top: -18vmax; background: #ffb057; animation: drift1 26s ease-in-out infinite; }
.wallpaper span:nth-child(2) { width: 46vmax; height: 46vmax; right: -16vmax; top: -10vmax; background: #ff7eb3; animation: drift2 32s ease-in-out infinite; }
.wallpaper span:nth-child(3) { width: 50vmax; height: 50vmax; left: 20vw; bottom: -26vmax; background: #6fb6ff; animation: drift3 30s ease-in-out infinite; }
.wallpaper span:nth-child(4) { width: 34vmax; height: 34vmax; right: 6vw; bottom: -8vmax; background: #9b8cff; animation: drift1 36s ease-in-out -8s infinite reverse; }
.wallpaper span:nth-child(5) { width: 26vmax; height: 26vmax; left: 8vw; top: 42vh; background: #5fe3c0; opacity: .55; animation: drift2 28s ease-in-out -4s infinite; }

@keyframes drift1 { 50% { transform: translate(12vw, 10vh) scale(1.12); } }
@keyframes drift2 { 50% { transform: translate(-10vw, 14vh) scale(.9); } }
@keyframes drift3 { 50% { transform: translate(-8vw, -12vh) scale(1.1); } }

/* --- Скло: загальний рецепт --- */
.sidebar, .panel, .list, .game-card, .gstat, .stat, .unit-banner .guide, .tour-card, .toast,
.mobile-top, .mobile-nav, .footer, .lesson, .result, .onboarding, .start-bubble, .node.locked {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--glass-edge), var(--glass-shadow);
  border: 0;
}

/* --- Бічна панель: плаває окремим вікном --- */
.layout { grid-template-columns: 252px 1fr 340px; gap: var(--gap); padding: var(--gap); min-height: 100vh; }
.sidebar { top: var(--gap); height: calc(100vh - var(--gap) * 2); border-radius: var(--win-r); padding: 22px 12px; }
.nav-item { border-radius: 14px; }
.nav-item:hover { background: var(--glass-tint); }
.nav-item.active { background: var(--accent); box-shadow: 0 6px 16px rgba(0, 122, 255, .35); }
.main { padding: 20px 8px 140px; }
.aside { top: var(--gap); height: calc(100vh - var(--gap) * 2); padding: 0; }
.panel, .list, .game-card, .gstat { border-radius: 26px; }
.stat { background: var(--glass-bg); }
.unit-banner { border-radius: 28px; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 14px 36px color-mix(in srgb, var(--c) 40%, transparent); }
.node.locked { color: var(--label3); }
.lb-row.me { background: var(--accent-tint); }

/* --- Урок, результат, онбординг: окреме вікно з відступами --- */
.lesson, .result, .onboarding {
  width: min(var(--win-w), calc(100% - var(--gap) * 2));
  min-height: calc(100vh - var(--gap) * 2);
  margin: var(--gap) auto;
  border-radius: var(--win-r);
  position: relative;
}
.lesson-top { position: sticky; top: var(--gap); border-radius: var(--win-r) var(--win-r) 0 0; padding: 18px 24px; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.lesson-body { padding-bottom: 210px; }
.result { padding-bottom: 190px; }

/* Нижня панель — плаваюча скляна «пігулка» всередині вікна */
.footer {
  left: 50%; right: auto; transform: translateX(-50%);
  bottom: calc(var(--gap) * 2 + env(safe-area-inset-bottom));
  width: min(calc(var(--win-w) - 40px), calc(100% - var(--gap) * 4));
  border-radius: 24px;
  background: var(--glass-strong);
}
.footer-inner { padding: 16px 18px; }
.footer.ok, .footer.bad { border-radius: 24px; background: var(--glass-strong); }
.footer.ok { box-shadow: var(--glass-edge), inset 0 0 0 2px color-mix(in srgb, var(--green) 45%, transparent), var(--glass-shadow); }
.footer.bad { box-shadow: var(--glass-edge), inset 0 0 0 2px color-mix(in srgb, var(--red) 45%, transparent), var(--glass-shadow); }
.slide-up { animation: footerUp .5s var(--ease); }
@keyframes footerUp { from { transform: translate(-50%, 130%); } }
.btn { border-radius: 16px; }
.btn.ghost { background: var(--glass-tint); box-shadow: inset 0 0 0 1px var(--glass-border); }

/* --- Внутрішні елементи: напівпрозорі «скельця» --- */
.card, .bubble, .text-input, .chip, .tile, .mem-front, .rbox, .onboarding .list, .ob-back, .close-btn {
  background: var(--glass-tint);
  box-shadow: inset 0 0 0 1px var(--glass-border), 0 2px 8px rgba(0, 0, 0, .04);
}
.card { border-radius: 24px; }
.card.sel { background: var(--accent-tint); box-shadow: inset 0 0 0 2px var(--accent); }
.card.ok { background: var(--green-tint); box-shadow: inset 0 0 0 2px var(--green); }
.card.bad { background: var(--red-tint); box-shadow: inset 0 0 0 2px var(--red); }
.chip.sel { background: var(--accent-tint); box-shadow: 0 0 0 2px var(--accent); }
.chip.ok { background: var(--green-tint); box-shadow: 0 0 0 2px var(--green); }
.chip.bad, .chip.wrong, .tile.wrong { background: var(--red-tint); box-shadow: 0 0 0 2px var(--red); }
.chip.matched { background: var(--green-tint); box-shadow: none; }
.chip.used { background: rgba(120, 120, 128, .14); box-shadow: none; }
.text-input:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.progress, .g-timer, .goal-bar, .mini-bar { background: rgba(120, 120, 128, .18); }
.answer-line { border-color: rgba(120, 120, 128, .22); }
.tip { background: var(--accent-tint); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.tour-card { border-radius: 26px; background: var(--glass-strong); }
.tour-hole { border-radius: 22px; box-shadow: 0 0 0 9999px rgba(10, 10, 20, .45), 0 0 0 2px rgba(255,255,255,.6); }

/* --- Мобільні та планшети --- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 84px 1fr; }
  .mobile-top { top: var(--gap); margin: 0 0 14px; padding: 10px 14px; border-radius: 22px; }
}
@media (max-width: 700px) {
  :root { --gap: 10px; --win-r: 26px; }
  .layout { grid-template-columns: 1fr; padding: var(--gap) var(--gap) 0; }
  .main { padding: 0 2px 120px; }
  .mobile-top { margin: 0 0 14px; padding: 10px 14px; border-bottom: 0; }
  .mobile-nav {
    left: var(--gap); right: var(--gap); bottom: calc(var(--gap) + env(safe-area-inset-bottom));
    border-radius: 28px; padding: 8px 6px; border-top: 0;
  }
  .footer { width: calc(100% - var(--gap) * 4); bottom: calc(var(--gap) * 2 + env(safe-area-inset-bottom)); }
  .footer-inner { padding: 14px; }
  .lesson-top { padding: 14px 16px; }
}
.lesson-top { background: var(--glass-bg); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: inset 0 -1px 0 rgba(120,120,128,.12); }

/* ================= Рейтинг ================= */
.league-card { text-align: center; padding: 22px 20px 18px; border-radius: 30px; margin-bottom: 18px;
  background: var(--glass-bg); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--glass-edge), var(--glass-shadow); }
.league-row { display: flex; justify-content: center; align-items: center; gap: 18px; margin-bottom: 6px; }
.lg { width: 34px; height: 34px; opacity: .3; filter: grayscale(.6); transition: transform .3s var(--ease); }
.lg svg { width: 100%; height: 100%; }
.lg.cur { width: 70px; height: 70px; opacity: 1; filter: drop-shadow(0 8px 18px rgba(199, 128, 78, .55)); animation: float 4s ease-in-out infinite; }
.league-card .page-title { margin: 4px 0 10px; }
.league-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.league-meta span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px; font-size: 14px; font-weight: 500;
  background: var(--glass-tint); box-shadow: inset 0 0 0 1px var(--glass-border); color: var(--label2); }
.league-meta svg { width: 15px; height: 15px; }
.league-meta .good { color: var(--green); background: var(--green-tint); }
.league-meta .bad { color: var(--red); background: var(--red-tint); }

/* П'єдестал */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 10px; margin: 10px 0 6px; }
.pod { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.pod-av { position: relative; margin-bottom: 8px; }
.pod .avatar { width: 62px; height: 62px; font-size: 24px; box-shadow: 0 0 0 3px var(--m), 0 8px 20px rgba(0, 0, 0, .15); }
.pod-1 .avatar { width: 80px; height: 80px; font-size: 30px; }
.medal { position: absolute; right: -4px; bottom: -4px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--m); color: #fff; font-size: 13px; font-weight: 700; box-shadow: 0 0 0 3px rgba(255,255,255,.85), 0 3px 8px rgba(0,0,0,.2); }
.pod b { font-size: 15px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod small { color: var(--label2); font-size: 13px; font-variant-numeric: tabular-nums; margin-bottom: 8px; }
.pod-base { width: 100%; border-radius: 20px 20px 14px 14px; position: relative; overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--m) 55%, rgba(255,255,255,.6)), color-mix(in srgb, var(--m) 20%, rgba(255,255,255,.3)));
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), inset 0 0 0 1px rgba(255,255,255,.4), 0 10px 26px color-mix(in srgb, var(--m) 30%, transparent); }
.pod-1 .pod-base { height: 120px; }
.pod-2 .pod-base { height: 88px; }
.pod-3 .pod-base { height: 66px; }
.pod.me b { color: var(--accent); }
.view-enter .pod { animation: podIn .7s var(--ease) backwards; }
.view-enter .pod-1 { animation-delay: .25s; }
.view-enter .pod-2 { animation-delay: .1s; }
.view-enter .pod-3 { animation-delay: .4s; }
@keyframes podIn { from { opacity: 0; transform: translateY(40px); } }

/* Роздільники зон */
.zone-sep { display: flex; align-items: center; gap: 10px; margin: 14px 4px; color: var(--green); font-size: 13px; font-weight: 600; }
.zone-sep::before, .zone-sep::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .3; }
.zone-sep span { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border-radius: 99px; background: var(--green-tint); }
.zone-sep svg { width: 12px; height: 12px; transform: rotate(90deg); }
.zone-sep.down { color: var(--red); margin: 6px 16px; }
.zone-sep.down span { background: var(--red-tint); }
.zone-sep.down svg { transform: rotate(-90deg); }
.lb-list .zone-sep::before { content: ""; position: static; border: 0; }

/* Рядки списку */
.lb-list { padding: 6px 0; }
.lb-row { gap: 12px; padding: 10px 16px; margin: 0 6px; border-radius: 18px; }
.lb-row + .lb-row::before, .zone-sep + .lb-row::before { left: 92px; right: 10px; }
.lb-row .avatar { width: 40px; height: 40px; font-size: 16px; }
.lb-rank { width: 22px; color: var(--label3); }
.lb-main { flex: 1; min-width: 0; }
.lb-name { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.lb-bar { height: 5px; border-radius: 99px; background: rgba(120, 120, 128, .16); margin-top: 6px; overflow: hidden; }
.lb-bar > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #5ac8fa, var(--accent)); transition: width .8s var(--ease); }
.lb-row.danger .lb-bar > div { background: linear-gradient(90deg, #ff9f9a, var(--red)); }
.lb-xp { text-align: right; font-weight: 600; color: var(--label); font-variant-numeric: tabular-nums; }
.lb-xp small { display: block; font-size: 11px; color: var(--label2); font-weight: 500; }
.lb-row.me { background: var(--accent-tint); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 45%, transparent); }
.lb-row.me::before, .lb-row.me + .lb-row::before { display: none; }
.you { font-size: 11px; font-weight: 700; color: #fff; background: var(--accent); padding: 2px 7px; border-radius: 99px; }
.view-enter .lb-row { animation-delay: calc(var(--n) * 35ms + .3s); }

@media (max-width: 700px) {
  .pod .avatar { width: 52px; height: 52px; }
  .pod-1 .avatar { width: 66px; height: 66px; }
  .pod-1 .pod-base { height: 96px; } .pod-2 .pod-base { height: 70px; } .pod-3 .pod-base { height: 52px; }
  .lb-row { padding: 9px 12px; margin: 0 4px; }
}
.pod-base { display: flex; justify-content: center; padding-top: 10px; }
.pod-base span { font-size: 34px; font-weight: 800; color: #fff; text-shadow: 0 2px 8px color-mix(in srgb, var(--m) 70%, #000); opacity: .95; }
.pod-1 .pod-base span { font-size: 44px; }

/* ================= Заставка та завантаження ================= */
#splash { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(120% 90% at 20% 10%, #ffb057 0%, transparent 55%), radial-gradient(110% 90% at 90% 20%, #ff7eb3 0%, transparent 55%),
    radial-gradient(120% 100% at 50% 100%, #6fb6ff 0%, transparent 60%), #f5e6ff;
  transition: opacity .6s var(--ease), transform .6s var(--ease); }
#splash.out { opacity: 0; transform: scale(1.06); pointer-events: none; }
.sp-logo { width: 112px; height: 112px; border-radius: 28px; overflow: hidden; box-shadow: 0 20px 50px rgba(255, 120, 0, .35), inset 0 1px 0 rgba(255,255,255,.6);
  animation: spLogo 1.6s var(--ease) infinite; }
.sp-logo img { width: 100%; height: 100%; display: block; }
@keyframes spLogo { 0%, 100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-14px) rotate(-6deg); } 55% { transform: translateY(0) rotate(4deg) scale(1.04, .96); } }
.sp-name { font-size: 34px; font-weight: 800; letter-spacing: -.04em; color: #3b2a1a; }
.sp-bar { width: 180px; height: 6px; border-radius: 99px; background: rgba(255,255,255,.55); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.7); }
.sp-bar i { display: block; height: 100%; width: 100%; border-radius: 99px; background: linear-gradient(90deg, #ff9500, #ff2d55); transform-origin: left; animation: spBar 1.5s var(--ease) forwards; }
@keyframes spBar { from { transform: scaleX(0); } }
.sp-tip { font-size: 15px; color: rgba(59, 42, 26, .7); min-height: 20px; }

.loader { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; background: rgba(10, 10, 20, .25);
  -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%); animation: fadeIn .3s var(--ease); transition: opacity .4s; }
.loader.out { opacity: 0; }
.loader-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 26px 30px; border-radius: 30px; min-width: 260px; text-align: center;
  background: var(--glass-strong); box-shadow: var(--glass-edge), var(--glass-shadow); animation: pop .5s var(--ease); }
.loader-fox { width: 90px; animation: spLogo 1s var(--ease) infinite; }
.loader-card .sp-bar { background: rgba(120,120,128,.18); }

/* ================= Перемикач курсу та аркуш ================= */
.course-switch { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; margin: 0 0 22px; border-radius: 22px; text-align: left;
  background: var(--glass-bg); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--glass-edge), var(--glass-shadow);
  transition: transform .25s var(--ease); }
.course-switch:hover { transform: translateY(-1px); }
.course-switch:active { transform: scale(.98); }
.cs-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; flex: none;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 72%, #fff), var(--c)); box-shadow: 0 6px 14px color-mix(in srgb, var(--c) 35%, transparent); }
.cs-ic svg { width: 26px; height: 26px; }
.cs-ic.big { width: 52px; height: 52px; border-radius: 16px; }
.cs-txt { display: flex; flex-direction: column; }
.cs-txt small { font-size: 12px; color: var(--label2); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.cs-txt b { font-size: 22px; letter-spacing: -.02em; }
.cs-chev { width: 16px; height: 16px; color: var(--label3); transform: rotate(90deg); margin-left: 6px; }
.cs-chev svg { width: 100%; height: 100%; }

.course-item { width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 16px; text-align: left; position: relative; transition: background .2s; }
.course-item + .course-item::before { content: ""; position: absolute; top: 0; left: 82px; right: 0; border-top: .5px solid var(--sep); }
.course-item:hover { background: var(--glass-tint); }
.course-item.cur { background: var(--accent-tint); }
.ci-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ci-main b { font-size: 17px; }
.ci-main small { color: var(--label2); font-size: 13px; margin-top: 1px; }
.ci-main .mini-bar { margin-top: 8px; height: 5px; }
.ci-count { color: var(--label2); font-size: 14px; font-variant-numeric: tabular-nums; }
.radio.on { background: var(--accent); box-shadow: none; }
.radio svg { width: 14px; height: 14px; color: #fff; }

.sheet-wrap { position: fixed; inset: 0; z-index: 300; display: flex; align-items: flex-end; justify-content: center; }
.sheet-back { position: absolute; inset: 0; background: rgba(10, 10, 20, .35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fadeIn .3s var(--ease); cursor: default; }
.sheet { position: relative; width: min(560px, calc(100% - 20px)); margin-bottom: 10px; padding: 8px 14px 18px; border-radius: 32px;
  background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--glass-edge), var(--shadow-lg);
  animation: sheetUp .5s var(--ease); max-height: 86vh; overflow-y: auto; }
@keyframes sheetUp { from { transform: translateY(110%); } }
.grabber { width: 38px; height: 5px; border-radius: 99px; background: var(--fill2); margin: 4px auto 6px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 12px; }
.sheet-head h2 { margin: 0; font-size: 22px; }
.sheet .list { background: var(--glass-tint); }
@media (min-width: 701px) { .sheet-wrap { align-items: center; } .sheet { margin: 0; } @keyframes sheetUp { from { transform: translateY(40px) scale(.96); opacity: 0; } } }

/* ================= Налаштування ================= */

.list.pad { padding: 14px 16px; }
.row-lbl { font-size: 13px; color: var(--label2); margin-bottom: 8px; font-weight: 500; }
.hint { margin: 10px 0 0; font-size: 13px; color: var(--label2); }
.seg { display: flex; padding: 3px; border-radius: 12px; background: rgba(120,120,128,.14); gap: 2px; }
.seg button { flex: 1; padding: 8px 6px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--label); transition: background .25s var(--ease), box-shadow .25s; }
.seg button.on { background: var(--bg2); box-shadow: 0 2px 8px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); font-weight: 600; }
.seg.off { opacity: .45; }
.field { width: 100%; border: 0; border-radius: 12px; padding: 12px 14px; font-size: 17px; background: rgba(120,120,128,.12); color: var(--label); outline: none; }
.field:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.cell-btn .lbl { display: flex; flex-direction: column; }
.cell-btn .lbl small { color: var(--label2); font-size: 13px; margin-top: 2px; }
.section-h { margin-top: 26px; }

/* ================= Нові вправи ================= */
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 18px; text-align: left; font-size: 17px; font-weight: 500;
  background: var(--glass-tint); box-shadow: inset 0 0 0 1px var(--glass-border), 0 2px 8px rgba(0,0,0,.04); transition: transform .2s var(--ease), background .2s; }
.opt:active { transform: scale(.97); }
.opt .key { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; flex: none; font-size: 12px; background: rgba(120,120,128,.14); color: var(--label2); }
.opt.sel { background: var(--accent-tint); box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); animation: springSel .4s var(--ease); }
.opt.ok { background: var(--green-tint); box-shadow: inset 0 0 0 2px var(--green); color: var(--green); }
.opt.bad { background: var(--red-tint); box-shadow: inset 0 0 0 2px var(--red); color: var(--red); animation: shake .4s; }
.opt.sel .key, .opt.ok .key, .opt.bad .key { background: currentColor; color: #fff; }
.opt.sel .key { background: var(--accent); } .opt.ok .key { background: var(--green); } .opt.bad .key { background: var(--red); }
@media (max-width: 700px) { .opts { grid-template-columns: 1fr; } }

.big-expr { text-align: center; font-size: 46px; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 30px; font-variant-numeric: tabular-nums;
  padding: 26px 16px; border-radius: 26px; background: var(--glass-tint); box-shadow: inset 0 0 0 1px var(--glass-border); animation: pop .5s var(--ease); }
.big-glyph { display: grid; place-items: center; margin: 0 auto 26px; width: 140px; height: 140px; border-radius: 34px; font-size: 96px;
  background: linear-gradient(160deg, #f0d9b5, #b58863); box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 12px 30px rgba(120, 80, 40, .3); animation: pop .5s var(--ease); }
@media (max-width: 700px) { .big-expr { font-size: 34px; padding: 20px 12px; } }

/* Шахова дошка */
.board { display: grid; grid-template-columns: repeat(8, 1fr); width: min(100%, 420px); aspect-ratio: 1; margin: 0 auto 26px; border-radius: 16px; overflow: hidden;
  box-shadow: 0 0 0 5px rgba(255,255,255,.55), 0 14px 36px rgba(60, 40, 20, .25); }
.sq { position: relative; display: grid; place-items: center; padding: 0; border: 0; font-size: clamp(22px, 7.5vw, 40px); line-height: 1; }
.sq.lt { background: #f0d9b5; }
.sq.dk { background: #b58863; }
.sq.hi { box-shadow: inset 0 0 0 100px rgba(255, 214, 10, .45); }
.board.tap .sq { cursor: pointer; transition: filter .15s; }
.board.tap .sq:hover:not([disabled]) { filter: brightness(1.08); }
.sq.sel { box-shadow: inset 0 0 0 4px var(--accent), inset 0 0 0 100px rgba(0, 122, 255, .25); }
.sq.ok { box-shadow: inset 0 0 0 4px var(--green), inset 0 0 0 100px rgba(52, 199, 89, .35); animation: pop .35s var(--ease); }
.sq.bad { box-shadow: inset 0 0 0 4px var(--red), inset 0 0 0 100px rgba(255, 59, 48, .35); animation: shake .35s; }
.sq .rk, .sq .fl { position: absolute; font-style: normal; font-size: 10px; font-weight: 700; opacity: .7; }
.sq .rk { left: 3px; top: 2px; } .sq .fl { right: 3px; bottom: 1px; }
.sq.lt .rk, .sq.lt .fl { color: #b58863; } .sq.dk .rk, .sq.dk .fl { color: #f0d9b5; }
.pc { display: block; font-family: "Apple Symbols", "Segoe UI Symbol", "DejaVu Sans", serif; pointer-events: none; }
.pc.pw { color: #fff; -webkit-text-stroke: 1.2px #2b2118; paint-order: stroke fill; text-shadow: 0 2px 2px rgba(0,0,0,.25); }
.pc.pb { color: #1d1712; text-shadow: 0 2px 2px rgba(0,0,0,.25); }
.card .em .pc { font-size: 54px; }
.big-glyph .pc { font-size: 96px; }

/* Вимкнені анімації з налаштувань */
html.no-motion *, html.no-motion *::before, html.no-motion *::after { animation: none !important; transition: none !important; }
html.no-motion #splash .sp-bar i { transform: none; }

/* ================= Робота над помилками ================= */
/* «Ремонт» — теплий нейтральний, як картка справи міста (town-life.md §8): без червоного */
.review-card { width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 10px; margin: -8px 0 28px; border-radius: 18px; text-align: left;
  background: #fff; color: var(--label);
  box-shadow: inset 0 0 0 1.5px var(--glass-border), 0 2px 0 rgba(90, 60, 30, .08); transition: transform .25s var(--ease); }
.review-card:hover { transform: translateY(-2px); }
.review-card:active { transform: scale(.98); }
.review-card:focus-visible { outline: 3px solid var(--label); outline-offset: 2px; }
.rv-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #3b2a1e; flex: none; background: var(--accent-tint); }
.rv-ic svg { width: 24px; height: 24px; }
.rv-txt { flex: 1; display: flex; flex-direction: column; }
.rv-txt b { font-size: 17px; }
.rv-txt small { color: var(--label2); font-size: 14px; margin-top: 2px; }
.rv-go { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-tint); color: var(--accent); flex: none; }
.rv-go svg { width: 16px; height: 16px; margin-left: 2px; }

/* ================= Встановлення ================= */
.inst-row { display: flex; align-items: center; gap: 14px; }
.inst-row b { display: block; font-size: 17px; }
.inst-row small { display: block; color: var(--label2); font-size: 14px; margin-top: 2px; line-height: 1.35; }
.inst-logo { width: 56px; height: 56px; border-radius: 14px; flex: none; box-shadow: 0 6px 16px rgba(255, 149, 0, .35); }
.inst-ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; }
.inst-ic.ok { background: var(--green); }
.inst-ic svg { width: 22px; height: 22px; }

/* ================= Доступність і мобільні дрібниці ================= */
/* Видимий фокус для клавіатури (мишею/пальцем не з'являється) */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.text-input:focus-visible, .field:focus-visible, .name-input:focus-visible { outline: none; }
.sq:focus-visible { outline-offset: -3px; position: relative; z-index: 1; }
.mem-card:focus-visible { border-radius: 16px; }
.sheet-back:focus-visible { outline: none; }

/* Довгі українські слова й речення переносяться, а не вилазять за край */
.ex-title, .bubble, .chip, .opt, .card, .feedback h4, .feedback .sol, .unit-banner h2, .unit-banner p, .node-label,
.cs-txt b, .ci-main b, .game-info b, .page-title, .ob-title, .tip span, .result h1, .lb-name, .tour-head b, .tour-head p { overflow-wrap: anywhere; }
.feedback > div, .cs-txt, .bubble { min-width: 0; }
.node-label { max-width: 150px; text-align: center; }

/* Зони дотику ≥ 44px без зміни вигляду */
.close-btn, .ob-back, .speak-btn { position: relative; }
.close-btn::after, .ob-back::after, .speak-btn::after { content: ""; position: absolute; inset: -6px; }
.ob-back::after { inset: -4px; }
.speak-btn::after { inset: -11px; }
.ob-skip, .tour-skip { min-height: 44px; padding: 0 4px; }
.chip { min-height: 44px; }
.seg button { min-height: 40px; }
.mobile-nav .nav-item { min-height: 44px; min-width: 0; }

/* Безпечні зони iPhone (чубчик, домашній індикатор, альбомна орієнтація) */
body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.layout { padding-top: calc(var(--gap) + env(safe-area-inset-top)); }
.sidebar, .aside { top: calc(var(--gap) + env(safe-area-inset-top)); height: calc(100vh - var(--gap) * 2 - env(safe-area-inset-top)); }
.lesson, .result, .onboarding { margin-top: calc(var(--gap) + env(safe-area-inset-top)); min-height: calc(100vh - var(--gap) * 2 - env(safe-area-inset-top)); }
.lesson-top { top: calc(var(--gap) + env(safe-area-inset-top)); }
.lesson-body { padding-bottom: calc(210px + env(safe-area-inset-bottom)); }
.result { padding-bottom: calc(190px + env(safe-area-inset-bottom)); }
.ob-body { padding-bottom: calc(160px + env(safe-area-inset-bottom)); }
.game-body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
.toast { top: calc(16px + env(safe-area-inset-top)); max-width: calc(100vw - 32px); text-align: center; }
.sheet { margin-bottom: calc(10px + env(safe-area-inset-bottom)); max-height: calc(86vh - env(safe-area-inset-top)); }
@media (max-width: 1100px) { .mobile-top { top: calc(var(--gap) + env(safe-area-inset-top)); } }
@media (max-width: 700px) {
  .main { padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
  .lesson-body { padding-left: 16px; padding-right: 16px; }
}
@media (min-width: 701px) { .sheet { margin-bottom: 0; } }

/* Шахова дошка завжди вміщується в ширину екрана */
.board { grid-template-columns: repeat(8, minmax(0, 1fr)); max-width: 100%; }
.sq { min-width: 0; min-height: 0; }

/* Заставка в темній системній темі (режим «Авто») */

/* «Зменшити рух»: зупиняємо й нескінченні фонові анімації */
@media (prefers-reduced-motion: reduce) {
  .wallpaper span, .fox *, .path-mascot, .node-ring, .start-bubble, .lg.cur, .ob-hero { animation: none !important; }
  .view-enter * { animation: none !important; }
}
.tour .btn { height: 44px; }

/* ================= Покращення UI: меню, верх головної, стежка ================= */
/* Групи в бічному меню */
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { margin-top: 14px; padding-top: 12px; border-top: .5px solid var(--sep); }
.nav-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--label3); padding: 0 12px 6px; }
.sidebar { overflow-y: auto; }
@media (max-width: 1100px) { .nav-title { display: none; } .nav-group + .nav-group { margin-top: 8px; padding-top: 8px; } }

/* Верх головної: курс і магазин в одному рядку, картки на всю ширину */
.learn-top { display: flex; flex-wrap: wrap; align-items: stretch; gap: 12px; margin-bottom: 30px; }
.learn-top > * { flex: 1 1 100%; margin: 0 !important; }
.learn-top > .course-switch { flex: 1 1 260px; }
.learn-top > .shop-top { flex: 0 0 auto; display: flex; align-items: stretch; gap: 8px; }
.learn-top > .shop-top .shop-pill { height: 100%; min-height: 66px; border-radius: 22px; padding: 0 18px; }
@media (max-width: 700px) { .learn-top > .shop-top .shop-pill { min-height: 58px; padding: 0 14px; } .learn-top { gap: 10px; margin-bottom: 26px; } }

/* Лічильники справа — більші картки */
.aside > .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.aside > .stats .stat { flex-direction: column; justify-content: center; gap: 4px; padding: 12px 6px; border-radius: 20px; font-size: 20px; font-weight: 700; }
.aside > .stats .stat .e { width: 26px; height: 26px; font-size: 26px; }
.aside > .stats .stat .e svg { width: 100%; height: 100%; }

/* Банер розділу з прогресом */
.ub-txt { flex: 1; min-width: 0; }
.ub-prog { display: flex; align-items: center; gap: 10px; margin-top: 12px; max-width: 280px; }
.ub-bar { flex: 1; height: 6px; border-radius: 99px; background: rgba(255,255,255,.28); overflow: hidden; }
.ub-bar i { display: block; height: 100%; border-radius: 99px; background: #fff; box-shadow: 0 0 8px rgba(255,255,255,.6); transition: width .8s var(--ease); }
.ub-prog span { font-size: 13px; font-weight: 700; opacity: .9; font-variant-numeric: tabular-nums; }
.unit-banner .guide svg { width: 22px; height: 22px; }

/* Стежка між вузлами */
.path { isolation: isolate; }
.path-line { position: absolute; left: 0; top: 0; z-index: -1; pointer-events: none; overflow: visible; }
.path-line path { fill: none; stroke-linecap: round; }
.pl-base { stroke: rgba(120, 120, 128, .28); stroke-width: 6; stroke-dasharray: 1 14; }
.pl-done { stroke: var(--green); stroke-width: 6; opacity: .75; }
.view-enter .path-line { animation: fadeIn .8s var(--ease) .3s backwards; }

/* Вузли: трохи більші, мітки читабельніші */
.node { width: 78px; height: 78px; }
.node-label { font-weight: 600; color: var(--label); opacity: .75; }
.node.locked + .node-label { opacity: .45; }
.node.current + .node-label { opacity: 1; color: var(--accent); }
@media (max-width: 700px) {
  .learn-top > .course-switch { flex: 1 1 0; min-width: 0; }
  .learn-top > .course-switch .cs-txt b { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .learn-top > .shop-top .shop-pill > span { display: none; } /* лише значок і кристали */
  .learn-top > .shop-top .shop-pill { flex-direction: column; gap: 2px; justify-content: center; }
}

/* ================= Екран уроку: центрування, лічильник, комбо ================= */
.lesson-body { display: flex; flex-direction: column; justify-content: safe center; min-height: calc(100vh - 260px); }
.prog-count { font-size: 14px; font-weight: 600; color: var(--label2); font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }
.combo { display: inline-flex; align-items: center; gap: 3px; padding: 5px 10px; border-radius: 99px; font-weight: 700; font-size: 15px;
  color: #fff; background: linear-gradient(135deg, #ffb340, #ff3b30); box-shadow: 0 4px 14px rgba(255, 90, 40, .4); font-variant-numeric: tabular-nums; }
.combo svg { width: 16px; height: 16px; }
.combo.pop { animation: comboPop .5s var(--ease); }
@keyframes comboPop { 30% { transform: scale(1.35) rotate(-6deg); } 60% { transform: scale(.95); } }

/* Більші картки й заголовок на великих екранах */
@media (min-width: 701px) {
  .ex-title { font-size: 32px; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
  .card { padding: 28px 12px 20px; font-size: 18px; }
  .card .em { font-size: 72px; }
  .opt { padding: 18px 18px; font-size: 18px; }
}
.result .footer .btn svg { width: 16px; height: 16px; }
@media (max-width: 700px) { .lesson-body { min-height: calc(100vh - 300px); } .prog-count { display: none; } }

/* ================= Вправа «Скажіть уголос» ================= */
.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; margin-top: 10px; }
.mic-btn { position: relative; width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: linear-gradient(160deg, #5ac8fa, var(--accent)); box-shadow: 0 12px 30px rgba(0, 122, 255, .35); transition: transform .2s var(--ease); }
.mic-btn svg { width: 44px; height: 44px; }
.mic-btn:active { transform: scale(.94); }
.mic-btn[disabled] { opacity: .5; }
.mic-btn.on { background: linear-gradient(160deg, #ff8a80, var(--red)); box-shadow: 0 12px 30px rgba(255, 59, 48, .4); }
.mic-btn.on::before, .mic-btn.on::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--red); animation: micPulse 1.4s ease-out infinite; }
.mic-btn.on::after { animation-delay: .7s; }
@keyframes micPulse { from { transform: scale(1); opacity: .7; } to { transform: scale(1.7); opacity: 0; } }
.heard { min-height: 52px; width: 100%; max-width: 460px; padding: 14px 18px; border-radius: 18px; text-align: center; font-size: 18px;
  color: var(--label2); background: var(--glass-tint); box-shadow: inset 0 0 0 1px var(--glass-border); overflow-wrap: anywhere; }
.heard.has { color: var(--label); font-weight: 500; }

/* =====================================================================
   СТИЛЬ «МІСТЕЧКО» — нова власна айдентика Бобра
   ===================================================================== */
html[data-theme="town"] {
  color-scheme: light;
  --bg: #f6efe2; --bg2: #fffaf1;
  --label: #3b2a1e; --label2: #7a6553; --label3: #b8a690;
  --sep: rgba(90, 60, 30, .14); --fill: rgba(90, 60, 30, .08); --fill2: rgba(90, 60, 30, .16);
  --accent: #b4532e; --accent-deep: #94411f; --accent-tint: #fbe3d6;
  --green: #3f8f5f; --green-tint: #dcefe0; --red: #d64545; --red-tint: #fbe0dc;
  --orange: #e8913a; --yellow: #f2b632; --purple: #8a64b8; --teal: #3d8a8f;
  --glass-bg: #fffaf1; --glass-strong: #fffaf1; --glass-tint: #fff;
  --glass-border: rgba(90, 60, 30, .16);
  --glass-edge: inset 0 0 0 1.5px rgba(90, 60, 30, .14);
  --glass-shadow: 0 3px 0 rgba(90, 60, 30, .10), 0 14px 30px rgba(90, 60, 30, .10);
  --shadow: 0 2px 0 rgba(90, 60, 30, .08); --shadow-lg: 0 18px 40px rgba(90, 60, 30, .18);
  --blur: none; --r: 22px; --win-r: 28px;
  --font-round: ui-rounded, "SF Pro Rounded", "Nunito", -apple-system, system-ui, sans-serif;
}
html[data-theme="town"] body { background: #cfe8f2; font-family: var(--font-round); }
html[data-theme="town"] h1, html[data-theme="town"] h2, html[data-theme="town"] h3, html[data-theme="town"] .page-title,
html[data-theme="town"] .ex-title, html[data-theme="town"] .logo span { font-family: var(--font-round); font-weight: 800; letter-spacing: -.01em; }

/* Небо, пагорби та хмарки замість кольорових плям */
html[data-theme="town"] .wallpaper {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320' preserveAspectRatio='none'%3E%3Cpath d='M0 190 C240 120 420 230 720 170 S1200 110 1440 180 V320 H0Z' fill='%23a9d18e'/%3E%3Cpath d='M0 250 C300 200 520 290 860 235 S1260 210 1440 250 V320 H0Z' fill='%238cc07a'/%3E%3C/svg%3E") bottom / 100% 38vh no-repeat,
    linear-gradient(180deg, #8fd0ef 0%, #c4e7f4 48%, #f3ecd8 100%);
}
html[data-theme="town"] .wallpaper span { filter: none; border-radius: 999px; background: #fff; opacity: .9; height: 42px; width: 140px; }
html[data-theme="town"] .wallpaper span::before, html[data-theme="town"] .wallpaper span::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
html[data-theme="town"] .wallpaper span::before { width: 62px; height: 62px; left: 22px; top: -30px; }
html[data-theme="town"] .wallpaper span::after { width: 46px; height: 46px; left: 70px; top: -20px; }
html[data-theme="town"] .wallpaper span:nth-child(1) { left: 6%; top: 9%; animation: cloud 70s linear infinite; }
html[data-theme="town"] .wallpaper span:nth-child(2) { left: 58%; top: 5%; transform: scale(.7); animation: cloud 95s linear -30s infinite; }
html[data-theme="town"] .wallpaper span:nth-child(3) { left: 30%; top: 22%; transform: scale(.55); opacity: .7; animation: cloud 120s linear -60s infinite; }
html[data-theme="town"] .wallpaper span:nth-child(4), html[data-theme="town"] .wallpaper span:nth-child(5) { display: none; }
@keyframes cloud { from { translate: -20vw 0; } to { translate: 110vw 0; } }

/* Кнопки — теракота з «натиском» униз */
html[data-theme="town"] .btn { background: var(--accent); border-radius: 16px; font-weight: 700; box-shadow: 0 4px 0 var(--accent-deep); transition: transform .12s, box-shadow .12s; }
html[data-theme="town"] .btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-deep); opacity: 1; }
html[data-theme="town"] .btn.ghost { background: #fff; color: var(--accent); box-shadow: 0 3px 0 rgba(90,60,30,.15), inset 0 0 0 1.5px rgba(90,60,30,.14); }
html[data-theme="town"] .btn.ok { background: var(--green); box-shadow: 0 4px 0 #2d6b46; }
html[data-theme="town"] .btn.bad { background: var(--red); box-shadow: 0 4px 0 #a93232; }
html[data-theme="town"] .btn[disabled] { background: #eadfcd; color: #b8a690; box-shadow: none; }

/* ---------- Урок: одна головна дія, «Майже» замість «неправильно» (UX-аудит §5.1–5.2) ---------- */
.btn-quiet { flex: none; min-height: 48px; min-width: 96px; padding: 0 12px; border-radius: 14px; font-size: 16px; font-weight: 800; color: var(--label2); }
.btn-quiet:hover { color: var(--label); }
.footer.ask .footer-inner { flex-direction: row; align-items: center; }
.footer.ask .btn { flex: 1; min-width: 0; max-width: 260px; }
@media (max-width: 700px) { .footer.ask .btn { width: auto; max-width: none; } }
/* Вимкнена «Перевірити» «спить»: пунктир і читабельний текст (5.3 : 1), а не бліда плашка */
html[data-theme="town"] .footer.ask #check-btn[disabled] { background: var(--bg2); color: var(--label2); box-shadow: none; outline: 2px dashed var(--label3); outline-offset: -2px; }

/* «Правильно»: зелена панель, темніший зелений для контрасту (5.3 : 1 і 6.4 : 1) */
html[data-theme="town"] .footer.ok { background: #dcefe0; box-shadow: var(--glass-edge), inset 0 0 0 2px rgba(45, 107, 70, .35), var(--glass-shadow); }
html[data-theme="town"] .footer.ok .badge { background: #2d6b46; }
html[data-theme="town"] .footer.ok h4 { color: #2d6b46; font-size: 22px; font-weight: 800; }
html[data-theme="town"] .footer.ok .sol { color: var(--label); }
html[data-theme="town"] .footer.ok .btn.ok { background: #2d6b46; box-shadow: 0 4px 0 #1f4d32; }
html[data-theme="town"] .footer.ok .btn.ok:active { box-shadow: 0 1px 0 #1f4d32; }

/* «Майже»: теплий пісок, лампочка, правильна відповідь — найбільший текст; кнопка — звичайна головна */
.footer.try { background: #fdf1d2; box-shadow: var(--glass-edge), inset 0 0 0 2px rgba(122, 79, 10, .3), var(--glass-shadow); }
.footer.try .badge { background: #f2b632; color: #3b2a1e; }
.footer.try h4 { color: #7a4f0a; font-size: 18px; font-weight: 800; }
.footer.try .sol { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 2px; font-size: 24px; font-weight: 800; line-height: 1.2; color: var(--label); }
.footer.try .speak-btn { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--label); box-shadow: inset 0 0 0 1.5px var(--sep); }
.footer.try .later { margin-top: 4px; font-size: 14px; font-weight: 700; color: #6b5646; }

/* Варіанти після перевірки: свій хибний вибір — пунктир без червоного, правильний — зелена рамка й ✓ */
.lesson-body .card { position: relative; }
.lesson-body .card.try, .lesson-body .opt.try { background: var(--glass-tint); color: var(--label); box-shadow: none; outline: 2px dashed var(--label2); outline-offset: -2px; animation: none; }
.lesson-body .opt.try .key { background: var(--label2); color: #fff; }
.lesson-body .card.ok, .lesson-body .opt.ok { background: #dcefe0; color: #2d6b46; box-shadow: inset 0 0 0 3px #2d6b46; }
.lesson-body .opt.ok .key { background: #2d6b46; }
.lesson-body .card.ok::after, .lesson-body .opt.ok::after { content: "✓"; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: #2d6b46; color: #fff; font-size: 15px; font-weight: 800; line-height: 1; }
.lesson-body .card.ok::after { position: absolute; top: 8px; right: 8px; }
.lesson-body .opt.ok::after { margin-left: auto; }
.lesson-body .sq.try { box-shadow: inset 0 0 0 100px rgba(253, 241, 210, .55); outline: 3px dashed #3b2a1e; outline-offset: -3px; animation: none; }
.lesson-body .chip.wrong { background: #fdf1d2; color: var(--label); box-shadow: 0 0 0 2px #7a4f0a; animation: none; }
html[data-theme="town"] .nav-item.active { background: var(--accent); color: #fff; box-shadow: 0 3px 0 #b4532e; }
html[data-theme="town"] .nav-item.active .ic { color: #fff; }
html[data-theme="town"] .nav-item .ic { color: var(--accent); }
html[data-theme="town"] .stat.streak .e { color: #f2a51a; }
html[data-theme="town"] .stat.gems .e { color: #b0703a; }
html[data-theme="town"] .stat.hearts .e { color: #e8913a; }
html[data-theme="town"] .sidebar, html[data-theme="town"] .mobile-nav, html[data-theme="town"] .mobile-top { background: rgba(255, 250, 241, .94); }
html[data-theme="town"] .lesson, html[data-theme="town"] .result, html[data-theme="town"] .onboarding { background: rgba(255, 250, 241, .97); }
html[data-theme="town"] .lesson-top { background: rgba(255, 250, 241, .96); }
html[data-theme="town"] #splash { background: linear-gradient(180deg, #8fd0ef, #f3ecd8); }
html[data-theme="town"] .sp-name { font-family: var(--font-round); font-weight: 800; }
html[data-theme="town"] .sp-bar i { background: linear-gradient(90deg, #e8913a, #d9693f); }

/* Мініатюра стилю в налаштуваннях */

/* ================= Головна: герой і райони містечка ================= */
.town-hero { position: relative; border-radius: 28px; overflow: hidden; margin-bottom: 16px;
  background: linear-gradient(180deg, #9ad6f1 0%, #d7eef6 70%, #f6efe2 100%); box-shadow: var(--glass-edge), var(--glass-shadow); }
.th-sky { position: absolute; inset: 0; pointer-events: none; }
.th-sun { position: absolute; right: 22px; top: 16px; width: 54px; height: 54px; color: #ffcf4a; filter: drop-shadow(0 0 14px rgba(255, 200, 60, .7)); animation: spin 40s linear infinite; }
.th-sun svg { width: 100%; height: 100%; }
@keyframes spin { to { transform: rotate(360deg); } }
.th-body { position: relative; display: flex; align-items: flex-end; gap: 16px; padding: 22px 22px 20px; }
.th-fox { width: 112px; flex: none; margin-bottom: -6px; }
.th-text { flex: 1; min-width: 0; }
.th-text small { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #4f6b78; }
.th-text h1 { margin: 4px 0 4px; font-size: 26px; line-height: 1.15; color: #2c2118; }
.th-text p { margin: 0; color: #5c4a3c; font-size: 15px; }
.th-bar { height: 10px; border-radius: 99px; background: rgba(255,255,255,.7); margin: 12px 0 14px; overflow: hidden; box-shadow: inset 0 0 0 1.5px rgba(90,60,30,.12); }
.th-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #e8913a, #d9693f); transition: width 1s var(--ease); }
.th-go { min-width: 180px; }
.th-go svg { width: 16px; height: 16px; }

.town { display: flex; flex-direction: column; gap: 18px; padding-bottom: 20px; }
.district { border-radius: 26px; background: var(--glass-bg); box-shadow: var(--glass-edge), var(--glass-shadow); overflow: hidden;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.d-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 6px; }
.d-sign { flex: 1; min-width: 0; }
.d-sign small { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--c); }
.d-sign h2 { margin: 2px 0; font-size: 21px; }
.d-sign p { margin: 0; font-size: 14px; color: var(--label2); }
.d-count { display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-radius: 99px; font-size: 14px; color: var(--label2);
  background: color-mix(in srgb, var(--c) 12%, transparent); }
.d-count svg { width: 18px; height: 18px; color: var(--c); }
.d-count b { color: var(--label); font-size: 16px; }
.d-scene { position: relative; padding: 4px 12px 0; background: linear-gradient(180deg, transparent 0 62%, color-mix(in srgb, #8cc07a 55%, transparent) 62%); }
.d-plots { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.d-road { height: 14px; margin: 0 -12px; background: repeating-linear-gradient(90deg, #d9c7a4 0 24px, #e6d6b6 24px 48px); box-shadow: inset 0 2px 0 rgba(90,60,30,.12); }
.d-tree { position: absolute; bottom: 10px; width: 64px; opacity: .9; z-index: 0; }
.d-tree.t1 { left: -6px; } .d-tree.t2 { right: -6px; }
.d-tree svg { width: 100%; height: auto; display: block; }

.plot { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 4px 2px 10px; border-radius: 18px;
  transition: transform .25s var(--ease), background .2s; min-width: 0; }
.plot:hover { transform: translateY(-3px); background: rgba(255,255,255,.35); }
.plot:active { transform: scale(.97); }
.plot-art { width: 100%; max-width: 132px; aspect-ratio: 1; display: block; }
.plot-art svg { width: 100%; height: 100%; display: block; overflow: visible; }
.plot.locked .plot-art { opacity: .75; filter: saturate(.6); }
.plot-name { font-weight: 800; font-size: 14px; margin-top: -2px; line-height: 1.15; }
.plot-sub { font-size: 12px; color: var(--label2); margin-top: 2px; line-height: 1.25; overflow-wrap: anywhere; }
.plot-sub svg { width: 10px; height: 10px; display: inline-block; vertical-align: -1px; }
.plot.locked .plot-name, .plot.locked .plot-sub { opacity: .6; }
.pl-stars { color: #f2b632; letter-spacing: 1px; } .pl-stars .off { color: var(--label3); }
.plot.current .plot-art { animation: plotBob 2.4s ease-in-out infinite; }
@keyframes plotBob { 50% { transform: translateY(-4px); } }
.plot-cta { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 6px 12px; border-radius: 99px; background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 700; box-shadow: 0 3px 0 #b4532e; }
.plot-cta svg { width: 12px; height: 12px; }
.view-enter .plot { animation: plotIn .6s var(--ease) backwards; animation-delay: calc(var(--i) * 40ms + .15s); }
@keyframes plotIn { from { opacity: 0; transform: translateY(18px) scale(.9); } }
.view-enter .district { animation: viewIn .5s var(--ease) backwards; animation-delay: calc(var(--d) * 90ms); }

/* Анімації деталей будівель */
.ta-smoke { animation: smoke 3s ease-in-out infinite; }
@keyframes smoke { 0% { opacity: 0; transform: translateY(4px); } 30% { opacity: .9; } 100% { opacity: 0; transform: translateY(-10px); } }
.ta-blades { animation: spin 6s linear infinite; }
.ta-light { animation: beacon 2s ease-in-out infinite; }
@keyframes beacon { 50% { opacity: .35; } }
.ta-water { animation: water 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: bottom; }
@keyframes water { 50% { transform: scaleY(.85); } }
.ta-hook { animation: hook 2.8s ease-in-out infinite; transform-box: fill-box; transform-origin: top; }
@keyframes hook { 50% { transform: translateY(5px); } }
/* Рівень 4–5: світло у вікнах (museum.md §3.3; у Фонтана SKY — вода) */
.town-svg.ta-lit:not(.town-fountain) [fill="#9fd3f0"] { fill: #ffd56b; }
.town-svg.ta-lit:not(.town-fountain) [fill="#e3f4fc"] { fill: #fff4cc; }
.ta-decor-svg { display: block; overflow: visible; }

@media (max-width: 700px) {
  .th-body { padding: 16px 16px 16px; gap: 10px; }
  .th-fox { width: 82px; }
  .th-text h1 { font-size: 20px; }
  .th-sun { width: 40px; height: 40px; right: 14px; top: 12px; }
  .th-go { width: 100%; min-width: 0; }
  .d-plots { grid-template-columns: repeat(2, 1fr); }
  .d-scene { background: linear-gradient(180deg, transparent 0 80%, color-mix(in srgb, #8cc07a 55%, transparent) 80%); }
  .d-tree { display: none; }
}

/* ================= Урок: цеглинки замість смужки ================= */
.bricks { flex: 1; display: flex; gap: 4px; height: 18px; }
.bricks i { flex: 1; border-radius: 4px; background: var(--fill); box-shadow: inset 0 0 0 1px rgba(90,60,30,.08); transition: background .3s; }
.bricks i.on { background: linear-gradient(180deg, #ef9a6a, #d9693f); box-shadow: inset 0 -3px 0 rgba(120, 50, 20, .25), inset 0 1px 0 rgba(255,255,255,.4); }
.bricks i.new { animation: brickDrop .45s var(--ease); }
@keyframes brickDrop { from { transform: translateY(-16px); opacity: 0; } 70% { transform: translateY(2px); } }
@media (max-width: 700px) { .bricks { gap: 3px; height: 14px; } }

/* ================= Результат: «Збудовано!» ================= */
.built-stage { position: relative; width: 240px; height: 210px; display: flex; align-items: flex-end; justify-content: center; }
.built-art { width: 210px; animation: rise .9s var(--ease) .1s backwards; transform-origin: bottom; }
.built-art svg { width: 100%; height: auto; display: block; overflow: visible; }
.built-fox { position: absolute; right: -40px; bottom: -4px; width: 92px; animation: pop .6s var(--ease) .7s backwards; }
@keyframes rise { 0% { transform: scaleY(0); opacity: 0; } 60% { transform: scaleY(1.06); opacity: 1; } 100% { transform: scaleY(1); } }
.result.built h1 { margin-top: 10px; }

/* ================= Сусіди ================= */
.nb-card { border-radius: 28px; padding: 22px; margin-bottom: 8px; background: var(--glass-bg); box-shadow: var(--glass-edge), var(--glass-shadow);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.nb-head { display: flex; align-items: center; gap: 14px; }
.nb-head > svg { width: 52px; height: 52px; padding: 10px; border-radius: 16px; color: #fff; background: linear-gradient(160deg, #6fb38a, var(--green)); flex: none; }
.nb-head small { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--label2); }
.nb-head .page-title { margin: 2px 0 0; }
.nb-goal-bar { height: 16px; border-radius: 99px; background: var(--fill); overflow: hidden; box-shadow: inset 0 0 0 1.5px rgba(90,60,30,.1); }
.nb-goal-bar i { display: block; height: 100%; border-radius: 99px; background: repeating-linear-gradient(45deg, #f2b632 0 10px, #e8a21f 10px 20px); transition: width 1s var(--ease); }
.nb-goal-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 14px; color: var(--label2); }
.nb-goal-meta span { display: inline-flex; gap: 4px; align-items: center; } .nb-goal-meta svg { width: 14px; height: 14px; }
.nb-me { margin: 14px 0 12px; font-size: 15px; }
.nb-hint, .nb-done { font-size: 14px; color: var(--label2); padding: 12px 14px; border-radius: 14px; background: var(--fill); display: flex; gap: 6px; align-items: center; }
.nb-done { color: var(--green); background: var(--green-tint); } .nb-done svg { width: 16px; height: 16px; }
.nb-card .btn svg { width: 18px; height: 18px; }
.nb-list { padding: 6px 0; }
.nb-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; position: relative; }
.nb-row + .nb-row::before { content: ""; position: absolute; top: 0; left: 74px; right: 12px; border-top: .5px solid var(--sep); }
.nb-row.me { background: var(--accent-tint); }
.nb-row .avatar { width: 44px; height: 44px; font-size: 17px; }
.nb-main { flex: 1; min-width: 0; }
.nb-name { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.nb-main small { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--label2); }
.nb-main small svg { width: 12px; height: 12px; }
.nb-bar { height: 5px; border-radius: 99px; background: var(--fill); margin-top: 6px; overflow: hidden; }
.nb-bar i { display: block; height: 100%; border-radius: 99px; background: var(--green); }
.nb-xp { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.nb-xp small { display: block; font-size: 11px; font-weight: 500; color: var(--label2); }
.view-enter .nb-row { animation: viewIn .5s var(--ease) backwards; animation-delay: calc(var(--n) * 35ms + .2s); }
@media (min-width: 701px) { .cards { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); } }

/* ================= Деталі по сайту ================= */
/* Порада Бобра */
.tip-btn { flex: 1; text-align: left; font-size: 15px; line-height: 1.4; color: var(--label2); padding: 0; }
.tip-btn b { color: var(--label); }
.tip-btn small { display: block; margin-top: 6px; color: var(--accent); font-weight: 600; font-size: 13px; }

/* Погода в бічному меню */
.weather { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 18px; background: var(--fill); }
.weather .w-ic { width: 34px; height: 34px; flex: none; }
.weather .w-ic svg { width: 100%; height: 100%; }
.weather.sunny .w-ic { color: #f2b632; animation: spin 30s linear infinite; }
.weather.cloudy .w-ic { color: #8aa5b5; }
.weather b { display: block; font-size: 15px; }
.weather small { display: block; font-size: 12px; color: var(--label2); }
@media (min-width: 701px) { .sidebar { display: flex; flex-direction: column; } }
@media (max-width: 1100px) { .weather .w-txt { display: none; } .weather { justify-content: center; padding: 10px 6px; } }

/* Паспорт мешканця */
.passport { border-radius: 24px; padding: 16px; margin: 4px 0 6px; background: var(--glass-bg); box-shadow: var(--glass-edge), var(--glass-shadow); }
.pp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.pp-head svg { width: 22px; height: 22px; color: var(--accent); }
.pp-head b { flex: 1; font-size: 17px; }
.pp-head span { font-size: 14px; color: var(--label2); font-weight: 600; }
.pp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pp-item { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 16px; background: color-mix(in srgb, var(--c) 9%, transparent); }
.pp-item .cs-ic { width: 38px; height: 38px; border-radius: 12px; }
.pp-item .cs-ic svg { width: 20px; height: 20px; }
.pp-item > div { flex: 1; min-width: 0; }
.pp-item b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-item small { font-size: 12px; color: var(--label2); }
.pp-bar { height: 5px; border-radius: 99px; background: var(--fill); margin-top: 5px; overflow: hidden; }
.pp-bar i { display: block; height: 100%; background: var(--c); border-radius: 99px; }
@media (max-width: 420px) { .pp-grid { grid-template-columns: 1fr; } }

/* Гірлянда з прапорців над заголовками сторінок (стиль «Містечко») */
html[data-theme="town"] .main-inner > .page-title:first-child::before,
html[data-theme="town"] .nb-card::before, html[data-theme="town"] .passport::before {
  content: ""; display: block; height: 16px; margin: -4px 0 10px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='16'%3E%3Cpath d='M0 2 Q36 10 72 2' stroke='%23a0673c' stroke-width='1.5' fill='none'/%3E%3Cpath d='M6 4 l6 0 -3 9z' fill='%23e07a4f'/%3E%3Cpath d='M24 6.6 l6 0 -3 9z' fill='%23f2b632'/%3E%3Cpath d='M42 6.6 l6 0 -3 9z' fill='%234f8f5f'/%3E%3Cpath d='M60 4 l6 0 -3 9z' fill='%233d7ea6'/%3E%3C/svg%3E") left top / 72px 16px repeat-x;
}

/* Осінь: листя кружляє по небу (стиль «Містечко») */
html[data-theme="town"][data-season="autumn"] .wallpaper span:nth-child(4),
html[data-theme="town"][data-season="autumn"] .wallpaper span:nth-child(5) {
  display: block; width: 16px; height: 16px; border-radius: 2px 14px 2px 14px; background: #e8913a; opacity: .85; top: -5vh;
  animation: leaf 14s linear infinite;
}
html[data-theme="town"][data-season="autumn"] .wallpaper span:nth-child(4)::before,
html[data-theme="town"][data-season="autumn"] .wallpaper span:nth-child(5)::before {
  content: ""; position: absolute; width: 13px; height: 13px; left: 30vw; top: 20vh; border-radius: 2px 12px 2px 12px; background: #c4553a; }
html[data-theme="town"][data-season="autumn"] .wallpaper span:nth-child(4)::after,
html[data-theme="town"][data-season="autumn"] .wallpaper span:nth-child(5)::after {
  content: ""; position: absolute; width: 12px; height: 12px; left: -18vw; top: 38vh; border-radius: 2px 11px 2px 11px; background: #f2b632; }
html[data-theme="town"][data-season="autumn"] .wallpaper span:nth-child(4) { left: 15%; }
html[data-theme="town"][data-season="autumn"] .wallpaper span:nth-child(5) { left: 65%; animation-delay: -7s; animation-duration: 18s; }
@keyframes leaf { 0% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(40px, 30vh) rotate(160deg); } 50% { transform: translate(-30px, 60vh) rotate(320deg); } 100% { transform: translate(20px, 110vh) rotate(640deg); } }
/* Зима: замість листя — сніжинки */
html[data-theme="town"][data-season="winter"] .wallpaper span:nth-child(4),
html[data-theme="town"][data-season="winter"] .wallpaper span:nth-child(5) { display: block; width: 8px; height: 8px; border-radius: 50%; background: #fff; top: -5vh; left: 30%; animation: leaf 12s linear infinite; }
html[data-theme="town"][data-season="winter"] .wallpaper span:nth-child(5) { left: 70%; animation-delay: -6s; }

/* ================= Ще деталі ================= */
/* Привітання під логотипом */
.greet { font-size: 13px; color: var(--label2); padding: 0 12px 14px; margin-top: -14px; }
@media (max-width: 1100px) { .greet { display: none; } }

/* Рівень мешканця */
.lvl-ring { position: relative; width: 64px; height: 64px; flex: none; }
.lvl-ring .ring { position: absolute; inset: 0; }
.lvl-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; font-weight: 800; color: var(--accent); }

/* Сповіщення про досягнення */
.ach-pop { position: fixed; left: 50%; top: 18px; z-index: 950; display: flex; align-items: center; gap: 14px; padding: 12px 20px 12px 12px; border-radius: 22px;
  background: var(--glass-strong); box-shadow: var(--glass-edge), var(--shadow-lg); transform: translateX(-50%); animation: achIn .6s var(--ease); transition: opacity .5s, transform .5s; }
.ach-pop.out { opacity: 0; transform: translate(-50%, -30px); }
.ap-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; color: #fff; background: var(--c); animation: pop .6s var(--ease) .2s backwards; }
.ap-ic svg { width: 28px; height: 28px; }
.ach-pop small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); font-weight: 700; }
.ach-pop b { display: block; font-size: 17px; }
.ach-pop em { display: block; font-style: normal; font-size: 13px; color: var(--label2); }
@keyframes achIn { from { transform: translate(-50%, -80px) scale(.9); opacity: 0; } }

/* Іскорки під пальцем */
.spark { position: fixed; z-index: 990; width: 7px; height: 7px; margin: -3px 0 0 -3px; border-radius: 50%; pointer-events: none; animation: spark .6s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }

/* Бобро реагує на дотик */
.fox { cursor: pointer; }
.fox.poke { animation: foxPoke .6s var(--ease); }
@keyframes foxPoke { 25% { transform: translateY(-12px) rotate(-6deg); } 50% { transform: translateY(0) rotate(4deg) scale(1.05, .95); } 75% { transform: translateY(-4px); } }
.fox-say { position: fixed; z-index: 960; width: 180px; padding: 9px 12px; border-radius: 16px 16px 16px 4px; font-size: 14px; font-weight: 600; text-align: center;
  background: var(--glass-strong); color: var(--label); box-shadow: var(--glass-edge), var(--shadow-lg); animation: pop .35s var(--ease); pointer-events: none; }

/* Лічильники «підстрибують» при зміні */
.stat.bump .e, .stat.bump { animation: statBump .7s var(--ease); }
.stat.drop { animation: shake .4s; }
@keyframes statBump { 30% { transform: scale(1.25) translateY(-3px); } 60% { transform: scale(.95); } }

/* Пташки над містечком */
html[data-theme="town"] body::after {
  content: ""; position: fixed; z-index: -1; top: 14vh; left: -80px; width: 60px; height: 22px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 22'%3E%3Cpath d='M2 10 Q8 3 14 10 Q20 3 26 10' stroke='%233b2f2a' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3Cpath d='M34 16 Q39 10 44 16 Q49 10 54 16' stroke='%233b2f2a' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: birds 38s linear infinite; opacity: .55;
}
@keyframes birds { 0% { transform: translate(0, 0); } 50% { transform: translate(60vw, -4vh); } 100% { transform: translate(125vw, 2vh); } }

/* День і ніч на небі (стиль «Містечко») */
html[data-theme="town"][data-time="morning"] .wallpaper { background-color: #f7d9b8; }
html[data-theme="town"][data-time="morning"] .wallpaper { background-image:
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320' preserveAspectRatio='none'%3E%3Cpath d='M0 190 C240 120 420 230 720 170 S1200 110 1440 180 V320 H0Z' fill='%23a9d18e'/%3E%3Cpath d='M0 250 C300 200 520 290 860 235 S1260 210 1440 250 V320 H0Z' fill='%238cc07a'/%3E%3C/svg%3E"),
  linear-gradient(180deg, #ffd6a8 0%, #ffe9cc 45%, #f3ecd8 100%); }
html[data-theme="town"][data-time="evening"] .wallpaper { background-image:
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320' preserveAspectRatio='none'%3E%3Cpath d='M0 190 C240 120 420 230 720 170 S1200 110 1440 180 V320 H0Z' fill='%2388a874'/%3E%3Cpath d='M0 250 C300 200 520 290 860 235 S1260 210 1440 250 V320 H0Z' fill='%23709a62'/%3E%3C/svg%3E"),
  linear-gradient(180deg, #f59a72 0%, #f7c08e 45%, #f1dcc0 100%); }
html[data-theme="town"][data-time="night"] .wallpaper { background-image:
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320' preserveAspectRatio='none'%3E%3Cpath d='M0 190 C240 120 420 230 720 170 S1200 110 1440 180 V320 H0Z' fill='%23435e4f'/%3E%3Cpath d='M0 250 C300 200 520 290 860 235 S1260 210 1440 250 V320 H0Z' fill='%23344b3f'/%3E%3C/svg%3E"),
  radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent), radial-gradient(1.5px 1.5px at 32% 8%, #fff 50%, transparent),
  radial-gradient(2px 2px at 52% 22%, #fff 50%, transparent), radial-gradient(1.5px 1.5px at 72% 12%, #fff 50%, transparent),
  radial-gradient(1.5px 1.5px at 88% 28%, #fff 50%, transparent), radial-gradient(2px 2px at 22% 34%, #fff8 50%, transparent),
  linear-gradient(180deg, #1d2b4f 0%, #3a4b78 50%, #6b6f8f 100%); }
html[data-theme="town"][data-time="morning"] .wallpaper, html[data-theme="town"][data-time="evening"] .wallpaper,
html[data-theme="town"][data-time="night"] .wallpaper { background-size: 100% 38vh, auto; background-position: bottom, 0 0; background-repeat: no-repeat; }
html[data-theme="town"][data-time="night"] .wallpaper { background-size: 100% 38vh, auto, auto, auto, auto, auto, auto, auto; }
html[data-theme="town"][data-time="night"] .wallpaper span:nth-child(-n+3) { opacity: .25; }
html[data-theme="town"][data-time="night"] body::after { display: none; }
/* Хмари й пташки вилітають за край — не даємо сторінці розширюватися вбік (clip не ламає sticky) */
html, body { overflow-x: clip; }

/* Головна-мапа: на десктопі даємо місту всю ширину центральної колонки */
@media (min-width: 701px) { .main-inner:has(.tm-view) { max-width: none; } }
/* Кнопка Арени на головній */
.arena-pill { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 22px; text-align: left; flex: 1 1 220px !important;
  background: linear-gradient(135deg, #3b2a4f, #6a3d6e); color: #fff; box-shadow: 0 4px 0 #2a1d38, 0 12px 26px rgba(60, 30, 80, .3); transition: transform .2s var(--ease); }
.arena-pill:hover { transform: translateY(-2px); }
.arena-pill:active { transform: translateY(3px); box-shadow: 0 1px 0 #2a1d38; }
.ap-swords { font-size: 26px; }
.arena-pill b { display: block; font-size: 17px; }
.arena-pill small { display: block; font-size: 12px; opacity: .8; }
.arena-pill > svg { width: 14px; height: 14px; margin-left: auto; opacity: .7; }

/* ================= Розділи з вкладками ================= */
.hub-tabs { display: flex; gap: 4px; padding: 4px; margin: 0 0 18px; border-radius: 18px; background: var(--glass-bg);
  box-shadow: var(--glass-edge), var(--glass-shadow); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); overflow-x: auto; scrollbar-width: none; }
.hub-tabs::-webkit-scrollbar { display: none; }
/* Вкладок «Містечка» більше, ніж уміщує телефон: гортаються всередині, сторінка не ширшає */
.main, .main-inner { min-width: 0; }
.hub-tabs button { flex: 1; min-height: 44px; padding: 0 14px; border-radius: 14px; font-weight: 700; font-size: 15px; color: var(--label2); white-space: nowrap;
  transition: background .25s var(--ease), color .2s, transform .2s var(--ease); }
.hub-tabs button:hover { color: var(--label); background: var(--fill); }
.hub-tabs button.on { background: var(--accent); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 65%, #000); }
.hub-tabs button:active { transform: scale(.97); }
/* Меню з 4 пунктів: трохи більші кнопки */
.sidebar .nav-item { padding: 12px 14px; font-size: 16px; }
.sidebar .nav-item .ic { font-size: 22px; }
.mobile-nav .nav-item { flex: 1; }
@media (max-width: 700px) { .hub-tabs { margin: 0 0 14px; } .hub-tabs button { font-size: 14px; padding: 0 10px; } }

/* =====================================================================
   ЗИМОВЕ СВЯТО (новорічний івент) — html[data-event="ny"]
   ===================================================================== */
/* Сніг: два шари сніжинок, що падають */
html[data-event="ny"] .wallpaper::before, html[data-event="ny"] .wallpaper::after {
  content: ""; position: absolute; inset: -100% 0 0 0; pointer-events: none;
  background-image:
    radial-gradient(3px 3px at 10% 20%, #fff 50%, transparent 52%), radial-gradient(2px 2px at 30% 60%, #fff 50%, transparent 52%),
    radial-gradient(3px 3px at 55% 35%, #fff 50%, transparent 52%), radial-gradient(2px 2px at 75% 80%, #fff 50%, transparent 52%),
    radial-gradient(4px 4px at 90% 15%, #fff 50%, transparent 52%), radial-gradient(2px 2px at 45% 90%, #fff 50%, transparent 52%),
    radial-gradient(3px 3px at 20% 75%, #fff 50%, transparent 52%), radial-gradient(2px 2px at 65% 5%, #fff 50%, transparent 52%);
  background-size: 320px 320px; animation: snowFall 14s linear infinite; opacity: .9;
}
html[data-event="ny"] .wallpaper::after { background-size: 210px 210px; animation-duration: 9s; opacity: .7; filter: blur(.4px); }
@keyframes snowFall { to { transform: translateY(50%); } }
/* Засніжені пагорби у стилі «Містечко» */
html[data-event="ny"][data-theme="town"] .wallpaper {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320' preserveAspectRatio='none'%3E%3Cpath d='M0 190 C240 120 420 230 720 170 S1200 110 1440 180 V320 H0Z' fill='%23eef6fb'/%3E%3Cpath d='M0 250 C300 200 520 290 860 235 S1260 210 1440 250 V320 H0Z' fill='%23ffffff'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #a9cfe6 0%, #d6e9f3 50%, #f4f8fb 100%) !important;
  background-size: 100% 38vh, auto !important; background-position: bottom, 0 0 !important; background-repeat: no-repeat !important;
}
html[data-event="ny"][data-theme="town"][data-time="night"] .wallpaper {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320' preserveAspectRatio='none'%3E%3Cpath d='M0 190 C240 120 420 230 720 170 S1200 110 1440 180 V320 H0Z' fill='%23c9d6e6'/%3E%3Cpath d='M0 250 C300 200 520 290 860 235 S1260 210 1440 250 V320 H0Z' fill='%23dde6f0'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #16233f 0%, #2e3f66 55%, #5d6a8c 100%) !important;
}
html[data-event="ny"] .wallpaper span:nth-child(4), html[data-event="ny"] .wallpaper span:nth-child(5) { display: none !important; }

/* Гірлянда з вогників над бічним меню та верхньою панеллю */
html[data-event="ny"] .sidebar, html[data-event="ny"] .mobile-top { position: relative; }
html[data-event="ny"] .sidebar::before, html[data-event="ny"] .mobile-top::before {
  content: ""; position: absolute; left: 14px; right: 14px; top: -2px; height: 18px; pointer-events: none; z-index: 2;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='18'%3E%3Cpath d='M0 3 Q20 12 40 3 T80 3' stroke='%233b5a3f' stroke-width='1.6' fill='none'/%3E%3Ccircle cx='10' cy='9' r='3.2' fill='%23ff5a5a'/%3E%3Ccircle cx='30' cy='9' r='3.2' fill='%23ffd23f'/%3E%3Ccircle cx='50' cy='9' r='3.2' fill='%234fc3f7'/%3E%3Ccircle cx='70' cy='9' r='3.2' fill='%2366d17a'/%3E%3C/svg%3E") left top / 80px 18px repeat-x;
  animation: twinkle 1.6s steps(2) infinite;
}
@keyframes twinkle { 50% { filter: brightness(1.5) saturate(1.3); } }

/* Картка свята на головній */
.ny-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 22px; text-align: left; color: #fff;
  background: linear-gradient(135deg, #2a4f7a, #4a8fc2); box-shadow: 0 4px 0 #1d3a5c, 0 12px 26px rgba(30, 70, 120, .3); transition: transform .2s var(--ease); }
.ny-card:hover { transform: translateY(-2px); }
.ny-card:active { transform: translateY(3px); box-shadow: 0 1px 0 #1d3a5c; }
.ny-flake { font-size: 30px; animation: spin 8s linear infinite; }
.ny-txt { flex: 1; min-width: 0; }
.ny-txt b { display: block; font-size: 17px; }
.ny-txt small { display: block; font-size: 13px; opacity: .85; }
.ny-card > svg { width: 14px; height: 14px; opacity: .7; }
.ny-gift { font-size: 24px; animation: bob 1.2s ease-in-out infinite; }

/* Сторінка свята */
.ny-hero { position: relative; overflow: hidden; display: flex; align-items: flex-end; gap: 16px; padding: 22px; border-radius: 28px; color: #fff;
  background: linear-gradient(180deg, #1f3a63 0%, #3d6b9e 70%, #e9f2f9 70.5%, #fff 100%); box-shadow: var(--glass-edge), var(--glass-shadow); min-height: 210px; }
.ny-snow { position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(2px 2px at 15% 20%, #fff 50%, transparent 52%), radial-gradient(3px 3px at 40% 50%, #fff 50%, transparent 52%),
    radial-gradient(2px 2px at 70% 30%, #fff 50%, transparent 52%), radial-gradient(3px 3px at 85% 65%, #fff 50%, transparent 52%);
  background-size: 160px 160px; animation: snowFall 8s linear infinite; }
.ny-fox { position: relative; width: 120px; flex: none; }
.ny-hero-txt { position: relative; flex: 1; padding-bottom: 60px; }
.ny-hero-txt small { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; opacity: .8; font-weight: 700; }
.ny-hero-txt h1 { margin: 4px 0; font-size: 28px; color: #fff; }
.ny-hero-txt p { margin: 0; opacity: .9; }
.ny-count { position: absolute; right: 0; bottom: 0; display: flex; align-items: baseline; gap: 6px; padding: 8px 14px; border-radius: 99px; background: #fff; color: #2a4f7a; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.ny-count span { font-size: 20px; } .ny-count b { font-size: 26px; } .ny-count small { font-size: 13px; opacity: .7; text-transform: none; letter-spacing: 0; }
.ny-bar { height: 14px; border-radius: 99px; background: var(--fill); margin: 16px 2px 0; overflow: hidden; box-shadow: inset 0 0 0 1.5px rgba(40,80,130,.12); }
.ny-bar i { display: block; height: 100%; border-radius: 99px; background: repeating-linear-gradient(45deg, #4a8fc2 0 10px, #6fb0dd 10px 20px); transition: width 1s var(--ease); }
.ny-track { padding: 6px 0; }
.ny-tier { display: flex; align-items: center; gap: 12px; padding: 12px 16px; position: relative; }
.ny-tier + .ny-tier::before { content: ""; position: absolute; top: 0; left: 70px; right: 12px; border-top: .5px solid var(--sep); }
.ny-node { width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #4a8fc2; background: #e3f0f9; }
.ny-node svg { width: 22px; height: 22px; }
.ny-tier.ready .ny-node { background: #4a8fc2; color: #fff; animation: pulse 1.6s ease-in-out infinite; }
.ny-tier.got .ny-node { background: var(--green); color: #fff; }
.ny-info { flex: 1; min-width: 0; } .ny-info b { display: block; font-size: 15px; } .ny-info small { color: var(--label2); }
.ny-tier .btn { height: 38px; padding: 0 14px; font-size: 14px; }
.ny-ok { color: var(--green); font-weight: 700; font-size: 14px; } .ny-left { color: var(--label2); font-size: 13px; font-variant-numeric: tabular-nums; }
.ny-how { padding: 4px 0; }
.ny-how-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.ny-how-row span { font-size: 22px; } .ny-how-row b { flex: 1; } .ny-how-row small { color: var(--label2); }
@media (max-width: 700px) { .ny-fox { width: 84px; } .ny-hero-txt h1 { font-size: 21px; } .ny-hero { padding: 16px; } }

/* Пункт меню «Я»: голова Бобра в колі 32 (town-street.md §5.2) */
.nav-item .ic.nav-me { width: 32px; height: 32px; flex: none; border-radius: 50%; background: #fffaf1; box-shadow: inset 0 0 0 1.5px rgba(90, 60, 30, .14); display: grid; place-items: center; overflow: hidden; font-size: 0; }
.nav-item .ic.nav-me .nav-fox { width: 28px; height: 28px; display: block; }
.nav-item.active .ic.nav-me { box-shadow: 0 0 0 2px #fff; }
