/* Основа, рамка страницы и общие детали. Цвета, размеры и отступы — только из tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 88px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 var(--t-sm)/1.5 var(--font); -webkit-font-smoothing: antialiased;
  min-height: 100dvh; overflow-wrap: break-word;
}
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img, svg, video, iframe { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--g3); outline-offset: 3px; border-radius: 10px; }
::selection { background: #BFEBDD; }

h1 { font-size: var(--t-xl); line-height: 1.12; font-weight: 800; letter-spacing: -0.03em; text-wrap: balance; }
h2 { font-size: var(--t-lg); line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; text-wrap: balance; }
h3 { font-size: var(--t-md); line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
.display { font-size: var(--t-display); line-height: 1.02; font-weight: 800; letter-spacing: -0.04em; }
.display span { display: block; }
.grad { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: var(--t-xs); margin-top: var(--s3); }

.icon { width: 20px; height: 20px; flex: none; }
.e3d { width: 1.4em; height: 1.4em; flex: none; object-fit: contain; user-select: none; }
.e3d-fallback { font-size: 1.1em; line-height: 1; flex: none; }

/* ——— Загрузка ——— */
.boot { display: grid; place-items: center; min-height: 100dvh; }
.boot-mark { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ——— Рамка: слева разделы (компьютер), снизу — они же (телефон) ——— */
.is-app #app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: var(--s7); padding: var(--s6) var(--s4); }
.brand { display: flex; align-items: center; gap: var(--s3); font-weight: 600; padding: 0 var(--s2); }
.brand-mark { width: 40px; height: 40px; border-radius: 50%; background: #DDDDE3; color: var(--muted); display: grid; place-items: center; font-size: var(--t-xs); font-weight: 600; letter-spacing: .02em; flex: none; }
.brand-name { font-size: var(--t-sm); letter-spacing: -0.01em; }
.rail-nav, .rail-foot { display: flex; flex-direction: column; gap: var(--s1); }
.rail-foot { margin-top: auto; }
.rail-link { display: flex; align-items: center; gap: var(--s3); padding: 11px var(--s4); border-radius: 16px; color: var(--muted); font-weight: 500; transition: background .15s, color .15s; }
.rail-link:hover { color: var(--ink); background: rgba(14, 14, 17, .04); }
.rail-link.active { color: var(--ink); background: var(--card); box-shadow: var(--shadow); font-weight: 600; }
.rail-link.active .icon { color: var(--accent); }

.stage { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: flex-end; gap: var(--s4); padding: var(--s4) var(--s7); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.topbar .brand { display: none; margin-right: auto; }
.status { display: flex; align-items: center; gap: var(--s2); }
.stat { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 var(--s3); border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .e3d { width: 20px; height: 20px; }
.stat-streak:not(.on) .e3d { filter: grayscale(1); opacity: .45; }
.stat-avatar { margin-left: var(--s1); border-radius: 50%; }
.main { padding: var(--s2) var(--s7) var(--s9); transition: opacity .15s; }
.main.loading { opacity: .5; }
.page { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--s6); }
.tabs { display: none; }

.preview-banner { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: var(--s3); padding: var(--s2) var(--s4); background: var(--dark); color: var(--on-dark); font-size: var(--t-xs); font-weight: 500; }

@media (max-width: 900px) {
  .is-app #app { display: block; }
  .rail { display: none; }
  .topbar { padding: var(--s3) var(--s4); padding-top: max(var(--s3), env(safe-area-inset-top)); }
  .topbar .brand { display: flex; }
  .topbar .brand-name { display: none; }
  .main { padding: var(--s1) var(--s4) calc(var(--tabbar) + var(--safe-bottom) + var(--s8)); }
  .tabs { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; height: calc(var(--tabbar) + var(--safe-bottom)); padding: 6px var(--s2) calc(6px + var(--safe-bottom)); background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); font-size: 0.6875rem; font-weight: 600; border-radius: 14px; }
  .tab .icon { width: 23px; height: 23px; }
  .tab.active { color: var(--ink); }
  .tab.active .icon { color: var(--accent); }
  .deck-open .tabs, .sheet-open .tabs { display: none; }
}

/* ——— Карточка ——— */
.card { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: var(--s6); min-width: 0; }
a.card { transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); flex-wrap: wrap; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: auto; padding-top: var(--s4); }
.more { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: var(--t-xs); font-weight: 600; }
.more .icon { width: 16px; height: 16px; }

/* ——— Кнопки ——— */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 50px; padding: 0 var(--s6); border-radius: 999px; font-weight: 600; font-size: var(--t-sm); letter-spacing: -0.01em; text-align: center; transition: transform .15s var(--ease), background .15s, box-shadow .15s, opacity .15s; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.97); }
.btn .icon.end { color: var(--g2-dark); }
.btn-small { min-height: 38px; padding: 0 var(--s4); font-size: var(--t-xs); }
.btn-small .icon { width: 16px; height: 16px; }
.btn-block { width: 100%; }
.btn-primary, .btn-dark { background: var(--dark); color: var(--on-dark); }
.btn-primary { box-shadow: 0 14px 28px -14px rgba(47, 174, 143, .95); }
.btn-primary .icon:first-child { color: var(--g1-dark); }
.btn-primary:hover, .btn-dark:hover { background: var(--dark-2); }
.btn-light { background: #fff; color: var(--ink); }
.btn-light .icon.end { color: var(--accent); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost:hover { background: rgba(14, 14, 17, .04); }
.btn-ghost .icon.end { color: var(--accent); }
.btn-ghost-dark { color: var(--on-dark); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .2); }
.btn-danger { background: var(--life); color: #fff; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.busy { opacity: .6; pointer-events: none; }
.btn-xp { font-style: normal; font-weight: 800; color: var(--g1-dark); margin-left: 2px; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }

/* ——— Метки ——— */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px var(--s3); border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font-size: var(--t-xs); font-weight: 500; color: var(--muted); }
.chip .icon { width: 15px; height: 15px; }
.chip-xp { background: var(--accent-wash); color: var(--accent-ink); box-shadow: none; font-weight: 600; }
.chip-done { background: var(--dark); color: var(--on-dark); box-shadow: none; }
.tier { display: inline-flex; align-items: center; gap: 5px; padding: 4px var(--s3); border-radius: 999px; background: var(--accent-wash); color: var(--accent-ink); font-size: var(--t-xs); font-weight: 600; white-space: nowrap; }
.tier .icon { width: 13px; height: 13px; }
.tier.locked { background: rgba(14, 14, 17, .06); color: var(--muted); }
.draft { display: inline-block; margin-left: var(--s2); padding: 2px var(--s2); border-radius: 8px; background: var(--todo); color: #5B4A00; font-size: 0.6875rem; font-weight: 600; font-style: normal; letter-spacing: 0; vertical-align: middle; }

/* ——— Аватарка с рамкой уровня ——— */
.avatar { position: relative; display: inline-block; width: var(--size); height: var(--size); flex: none; }
.avatar-ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.avatar-face { position: absolute; inset: 13%; border-radius: 50%; display: grid; place-items: center; overflow: hidden; font-weight: 600; font-size: calc(var(--size) * .27); letter-spacing: -0.02em; }
.avatar-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.frame-neon .avatar-ring { filter: drop-shadow(0 0 5px rgba(108, 123, 255, .65)); }
.frame-gold .avatar-ring { filter: drop-shadow(0 0 4px rgba(233, 163, 19, .55)); }
.frame-fire .avatar-ring { filter: drop-shadow(0 0 5px rgba(255, 122, 47, .6)); }

.pring { position: relative; display: inline-grid; place-items: center; width: var(--size); height: var(--size); flex: none; }
.pring svg { position: absolute; inset: 0; }
.pring-text { position: relative; display: flex; align-items: baseline; white-space: nowrap; font-weight: 800; letter-spacing: -0.04em; font-size: calc(var(--size) * .3); line-height: 1; }
.pring-text i { font-style: normal; font-size: .55em; font-weight: 600; color: var(--muted); margin-left: 2px; letter-spacing: 0; }
.bar { display: block; height: 10px; border-radius: 999px; background: rgba(14, 14, 17, .07); overflow: hidden; }
.bar.on-dark { background: rgba(255, 255, 255, .14); }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--gradient); transition: width 1.1s var(--ease); }
.bar.on-dark .bar-fill { background: var(--gradient-on-dark); }
.lives { display: inline-flex; gap: 3px; }
.heart .e3d { width: 26px; height: 26px; }
.lives.compact .heart .e3d { width: 19px; height: 19px; }
.heart.off .e3d { opacity: .22; filter: grayscale(1); }

/* ——— Сообщение внизу ——— */
.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(var(--s6) + var(--safe-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: var(--s3); max-width: min(92vw, 520px); padding: var(--s3) var(--s5); border-radius: 999px; background: var(--dark); color: var(--on-dark); font-weight: 500; box-shadow: var(--shadow-lift); animation: toast-in .28s var(--ease); }
.toast .icon { color: var(--g1-dark); }
.toast.tone-error { border-radius: var(--r-inner); }
.toast.tone-error .icon { color: #FFB86B; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }
@media (max-width: 900px) { .is-app .toast { bottom: calc(var(--tabbar) + var(--safe-bottom) + var(--s4)); } }

/* ——— Окно ——— */
.sheet-open { overflow: hidden; }
.sheet-backdrop { position: fixed; z-index: 70; inset: 0; display: grid; place-items: center; padding: var(--s4); background: rgba(14, 14, 17, .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); overflow-y: auto; animation: fade .2s; }
.sheet { position: relative; width: min(100%, 480px); background: var(--card); border-radius: var(--r-card); padding: var(--s7) var(--s6) var(--s6); box-shadow: var(--shadow-lift); animation: sheet-in .28s var(--ease); }
.sheet.wide { width: min(100%, 760px); }
.sheet-x { position: absolute; top: var(--s4); right: var(--s4); width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.sheet-x:hover { background: var(--wash); color: var(--ink); }
.sheet-title { padding-right: var(--s7); margin-bottom: var(--s3); }
.sheet-text { color: var(--muted); font-size: var(--t-sm); }
.sheet-note { display: flex; gap: var(--s2); padding: var(--s3) var(--s4); border-radius: var(--r-small); background: var(--wash); color: var(--muted); font-size: var(--t-xs); }
.sheet-note .icon { width: 17px; height: 17px; margin-top: 1px; }
.sheet-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); margin-top: var(--s6); }
.sheet-actions .btn { flex: 1 1 auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(18px) scale(.98); } }

.form { display: flex; flex-direction: column; gap: var(--s4); }
.form-error { color: var(--life); font-size: var(--t-xs); font-weight: 500; }
.code-input { width: 100%; height: 58px; padding: 0 var(--s5); border-radius: var(--r-inner); border: 1.5px solid var(--line); background: var(--wash); font: 500 var(--t-md)/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.code-input:focus { outline: none; border-color: var(--accent); background: #fff; }
.price-line { font-size: var(--t-sm); color: var(--muted); }
.price-line b { font-size: var(--t-lg); font-weight: 800; color: var(--ink); letter-spacing: -0.02em; }
.copy-helper { position: fixed; left: -9999px; top: 0; opacity: 0; }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.empty { display: flex; flex-direction: column; align-items: center; gap: var(--s3); padding: var(--s9) var(--s4); text-align: center; max-width: 480px; margin: 0 auto; }
.empty.small { padding: var(--s8) var(--s4); }
.empty p { color: var(--muted); }
.empty-art { width: 96px; height: 96px; }
.empty .btn { margin-top: var(--s3); }

/* ——— Первое знакомство ——— */
.welcome { display: flex; flex-direction: column; align-items: center; gap: var(--s3); text-align: center; }
.welcome-lead { color: var(--muted); max-width: 40ch; }
.welcome-list { display: flex; flex-direction: column; gap: var(--s3); width: 100%; margin-top: var(--s3); text-align: left; }
.welcome-list li { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-inner); background: var(--wash); }
.welcome-list .e3d { width: 34px; height: 34px; }
.welcome-list b { display: block; }
.welcome-list span { color: var(--muted); font-size: var(--t-xs); }
.welcome-fine { color: var(--muted); font-size: var(--t-xs); }
.welcome-fine a { text-decoration: underline; }

/* ——— Вход ——— */
.is-login #app { min-height: 100dvh; }
.login { min-height: 100dvh; display: flex; flex-direction: column; padding: var(--s6) var(--s7); max-width: 1240px; margin: 0 auto; }
.login-grid { flex: 1; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: var(--s9); align-items: center; padding: var(--s8) 0; }
.login-copy { display: flex; flex-direction: column; gap: var(--s5); }
.login-lead { font-size: var(--t-md); color: var(--muted); max-width: 46ch; }
.login-actions { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s3); margin-top: var(--s3); }
.login-fine { color: var(--muted); font-size: var(--t-xs); }
.login-note { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s4); border-radius: var(--r-inner); background: var(--card); box-shadow: var(--shadow); color: var(--muted); max-width: 46ch; }
.login-wait { display: flex; gap: var(--s4); align-items: center; padding: var(--s4) var(--s5); border-radius: var(--r-inner); background: var(--card); box-shadow: var(--shadow); }
.login-wait b { display: block; }
.login-wait span { color: var(--muted); font-size: var(--t-xs); }
.login-pin { display: flex; flex-direction: column; gap: var(--s1); padding: var(--s5) var(--s6); border-radius: var(--r-card); background: var(--dark); color: var(--on-dark); max-width: 420px; }
.login-pin span { color: var(--on-dark-muted); font-size: var(--t-xs); font-weight: 500; }
.login-pin b { font-size: 3.25rem; line-height: 1; font-weight: 800; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.login-pin i { font-style: normal; color: var(--on-dark-muted); font-size: var(--t-xs); margin-top: var(--s2); }
.login-dev { margin-top: var(--s4); padding: var(--s5); border-radius: var(--r-inner); border: 1.5px dashed #C9C9D2; width: 100%; max-width: 520px; }
.login-dev-title { display: flex; align-items: center; gap: var(--s2); color: var(--muted); font-size: var(--t-xs); margin-bottom: var(--s3); }
.login-dev-buttons { display: flex; flex-wrap: wrap; gap: var(--s2); }
.login-art { position: relative; min-height: 440px; }
.art-card { position: absolute; background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow-lift); padding: var(--s5); }
.art-card b { display: block; font-weight: 600; }
.art-card span { color: var(--muted); font-size: var(--t-xs); }
.art-level { top: 4%; left: 4%; display: flex; align-items: center; gap: var(--s4); transform: rotate(-3deg); }
.art-dark { top: 30%; right: 0; width: 62%; background: var(--dark); color: var(--on-dark); transform: rotate(2deg); padding-top: 92px; }
.art-dark span { color: var(--g1-dark); font-weight: 600; }
.art-emoji { position: absolute; top: -34px; left: var(--s5); width: 116px; height: 116px; }
.art-streak { bottom: 30%; left: 0; display: flex; align-items: center; gap: var(--s2); border-radius: 999px; padding: var(--s3) var(--s5); transform: rotate(-2deg); }
.art-streak .e3d { width: 30px; height: 30px; }
.art-prompt { bottom: 0; right: 8%; width: 66%; transform: rotate(-1.5deg); }
.art-prompt code { display: block; white-space: pre; font: 400 var(--t-xs)/1.6 var(--mono); color: var(--muted); }
.art-copy { display: inline-flex; align-items: center; gap: 6px; margin-top: var(--s3); padding: 7px var(--s4); border-radius: 999px; background: var(--dark); color: var(--on-dark) !important; font-weight: 600; }
.art-copy .icon { width: 15px; height: 15px; }
@media (max-width: 900px) {
  .login { padding: var(--s4); }
  .login-grid { grid-template-columns: 1fr; gap: var(--s7); padding: var(--s6) 0; }
  .login-art { min-height: 440px; order: -1; }
}
@media (max-width: 480px) {
  .art-streak { display: none; }   /* на узком экране карточка закрывает подпись соседней */
  .login-actions .btn { width: 100%; }
}

/* ——— Главная ——— */
.hello { display: flex; align-items: center; gap: var(--s4); padding: var(--s2) 0; }
.hello-text p { color: var(--muted); margin-top: 2px; max-width: 60ch; }
.hello-text b { color: var(--ink); font-weight: 600; }
.bento { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s4); }
.bento > .hero { grid-column: span 4; grid-row: span 2; }
.bento > .progress-card, .bento > .level-card, .bento > .streak-card, .bento > .plan-card, .bento > .awards-card { grid-column: span 2; }
.bento > .upsell-card { grid-column: span 4; }
.bento > .help-card { grid-column: span 2; }
.bento:not(:has(> .help-card)) > .upsell-card, .bento:not(:has(> .upsell-card)) > .help-card { grid-column: span 6; }

.hero { position: relative; overflow: hidden; display: flex; background: var(--dark); color: var(--on-dark); padding: var(--s7); min-height: 320px; }
.hero-text { position: relative; z-index: 1; display: flex; flex-direction: column; gap: var(--s3); max-width: 62%; }
.hero-kicker { font-weight: 600; font-size: var(--t-sm); color: var(--g1-dark); align-self: flex-start; }
.hero h2 { font-size: clamp(1.6rem, 1.1rem + 1.6vw, 2.5rem); line-height: 1.06; letter-spacing: -0.035em; }
.hero p { color: var(--on-dark-muted); max-width: 44ch; }
.hero-meta { display: flex; flex-wrap: wrap; gap: var(--s4); color: var(--on-dark-muted); font-size: var(--t-xs); font-weight: 500; }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta .icon { width: 16px; height: 16px; }
.hero-meta .xp { color: var(--g1-dark); font-weight: 600; }
.hero-cta { margin-top: auto; align-self: flex-start; }
.hero-art { position: absolute; right: -2%; bottom: -8%; width: min(44%, 300px); height: auto; aspect-ratio: 1; transform: rotate(8deg); filter: drop-shadow(0 30px 40px rgba(0, 0, 0, .5)); transition: transform .5s var(--ease); }
a.hero:hover .hero-art { transform: rotate(2deg) scale(1.05); }

.progress-card, .level-card, .streak-card { display: flex; flex-direction: column; gap: var(--s3); }
.progress-row { display: flex; align-items: center; gap: var(--s4); }
.progress-row b { display: block; font-size: var(--t-lg); font-weight: 800; letter-spacing: -0.02em; }
.progress-row span { color: var(--muted); font-size: var(--t-xs); }
.level-head { display: flex; justify-content: space-between; align-items: flex-start; }
.level-art { width: 64px; height: 64px; margin: -6px -4px 0 0; }
.level-title { font-size: var(--t-lg); font-weight: 800; letter-spacing: -0.02em; margin-top: auto; }
.level-next { color: var(--muted); font-size: var(--t-xs); }
.streak-main { display: flex; gap: var(--s3); align-items: flex-start; }
.streak-art { width: 48px; height: 48px; }
.streak-main b { display: block; font-size: var(--t-md); font-weight: 800; letter-spacing: -0.02em; }
.streak-main span { color: var(--muted); font-size: var(--t-xs); }
.streak-lives { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); color: var(--muted); font-size: var(--t-xs); }
.streak-card.at-risk { background: linear-gradient(180deg, var(--fire-wash), var(--card) 70%); }
.streak-card.at-risk .streak-main span { color: var(--warn); font-weight: 500; }

.plan { display: flex; flex-direction: column; margin: 0 calc(var(--s3) * -1); }
.plan a { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s3); padding: var(--s3); border-radius: var(--r-small); }
.plan a:hover { background: var(--wash); }
.plan-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--wash); color: var(--muted); font-size: var(--t-xs); font-weight: 600; }
.plan-dot.now { background: var(--dark); color: var(--g1-dark); }
.plan-dot .icon { width: 14px; height: 14px; }
.plan-title { font-weight: 500; line-height: 1.3; }
.plan-meta { color: var(--faint); font-size: var(--t-xs); white-space: nowrap; display: flex; gap: var(--s2); }
.plan-meta em { font-style: normal; font-weight: 600; color: var(--accent-ink); }
.plan-card h3, .rules h2 { margin-bottom: var(--s3); }

.awards { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); }
.award { aspect-ratio: 1; border-radius: var(--r-inner); background: var(--wash); display: grid; place-items: center; }
.award .e3d { width: 62%; height: 62%; }
.award.off .e3d, .award-item.off .e3d { filter: grayscale(1); opacity: .22; }

.help-card { display: flex; flex-direction: column; gap: var(--s3); }
.help-art { width: 68px; height: 68px; }
.help-card h3 { font-size: var(--t-lg); font-weight: 800; letter-spacing: -0.02em; }
.help-card p { color: var(--muted); margin-top: var(--s1); }
.help-card .more { margin-top: auto; padding-top: var(--s3); }
.bento:not(:has(> .upsell-card)) > .help-card { flex-direction: row; align-items: center; gap: var(--s5); }
.bento:not(:has(> .upsell-card)) > .help-card .more { margin: 0 0 0 auto; padding: 0; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: auto; }
.week li { display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--faint); font-size: 0.6875rem; font-weight: 600; }
.week i { width: 100%; max-width: 34px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: var(--wash); font-style: normal; color: transparent; }
.week i .icon { width: 15px; height: 15px; stroke-width: 2.5; }
.week i .e3d { width: 62%; height: 62%; }
.week .active i { background: var(--gradient); color: #fff; }
.week .frozen i { background: var(--life-wash); }
.week .missed i { background: none; box-shadow: inset 0 0 0 1.5px var(--line); }
.week .today i { background: none; box-shadow: inset 0 0 0 2px var(--ink); }
.week .today { color: var(--ink); }
.on-dark .week i, .game-head .week i { background: rgba(255, 255, 255, .08); }

.upsell-card { position: relative; overflow: hidden; display: flex; align-items: center; gap: var(--s4); background: linear-gradient(120deg, #E9F7EC, #E4F2F1 55%, #E3ECFA); }
.upsell-text { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); max-width: 62ch; position: relative; z-index: 1; }
.upsell-text .tier { background: rgba(255, 255, 255, .7); }
.upsell-text h3 { font-size: var(--t-lg); font-weight: 800; letter-spacing: -0.02em; }
.upsell-text p { color: #3F4A4A; }
.upsell-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.upsell-art { width: 132px; height: 132px; margin-left: auto; transform: rotate(-8deg); flex: none; }

@media (max-width: 1180px) {
  .bento { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .bento > .hero { grid-column: span 4; grid-row: auto; }
  .bento > .help-card, .bento > .upsell-card, .bento:not(:has(> .help-card)) > .upsell-card, .bento:not(:has(> .upsell-card)) > .help-card { grid-column: span 4; }
  .bento > .awards-card { grid-column: span 4; }
  .awards { grid-template-columns: repeat(8, 1fr); }
}
@media (max-width: 700px) {
  .bento { display: flex; flex-direction: column; }
  .bento > .help-card { flex-direction: row; align-items: center; }
  .bento > .help-card .more { display: none; }
  .hero { padding: var(--s6); min-height: 300px; }
  .hero-text { max-width: 100%; }
  .hero-art { width: 150px; right: -18px; bottom: -22px; opacity: .95; }
  .hero-cta { margin-top: var(--s5); }
  .hero p { max-width: 26ch; }
  .awards { grid-template-columns: repeat(4, 1fr); }
  .upsell-art { width: 84px; height: 84px; position: absolute; right: -6px; top: -6px; opacity: .9; }
  .hello .avatar { --size: 60px !important; }
  h1 { font-size: 1.625rem; }
}

/* ——— Заголовок страницы ——— */
.page-head { display: flex; gap: var(--s5); align-items: flex-start; padding: var(--s2) 0; }
.page-art { width: 84px; height: 84px; }
.page-lead { color: var(--muted); font-size: var(--t-md); line-height: 1.45; max-width: 62ch; margin-top: var(--s2); }
.author-note { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3); padding: var(--s4) var(--s5); border-radius: var(--r-inner); border: 1.5px dashed #C9C9D2; color: var(--muted); font-size: var(--t-xs); }
@media (max-width: 700px) { .page-head { gap: var(--s4); } .page-art { width: 56px; height: 56px; } .page-lead { font-size: var(--t-sm); } }

/* ——— Маршрут ——— */
.course-progress { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s4); color: var(--muted); font-size: var(--t-xs); font-weight: 500; }
.course-progress .bar { width: min(280px, 50vw); }
.module { display: flex; flex-direction: column; gap: var(--s4); }
.module-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); padding-top: var(--s4); }
.module-head p { color: var(--muted); margin-top: 2px; }
.module-offer { padding: var(--s5) var(--s6); border-radius: var(--r-card); background: linear-gradient(120deg, #E9F7EC, #E4F2F1 55%, #E3ECFA); }
.module-offer p { color: #3F4A4A; max-width: 62ch; }

.steps { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: var(--s2); }
.step { position: relative; }
.step + .step::before { content: ''; position: absolute; left: calc(var(--s4) + 21px); top: -14px; height: 28px; width: 2px; background: var(--line); }
.step.is-done + .step::before { background: var(--accent); }
.step-link { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s4); padding: var(--s4); border-radius: calc(var(--r-card) - var(--s2)); transition: background .15s; }
a.step-link:hover { background: var(--wash); }
.step-bubble { position: relative; z-index: 1; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--wash); color: var(--muted); font-weight: 600; box-shadow: 0 0 0 4px var(--card); }
.step-bubble .e3d { width: 28px; height: 28px; }
.step-bubble.done { background: var(--gradient); color: #fff; }
.step-bubble.now { background: var(--dark); }
.step-bubble.locked { color: var(--faint); }
.step-bubble.locked .icon { width: 17px; height: 17px; }
.step-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.step-title { font-weight: 600; font-size: var(--t-md); letter-spacing: -0.01em; line-height: 1.3; }
.step-sum { color: var(--muted); font-size: var(--t-xs); }
.step-meta { display: flex; align-items: center; gap: var(--s3); color: var(--faint); font-size: var(--t-xs); white-space: nowrap; }
.step-meta em { font-style: normal; font-weight: 600; color: var(--accent-ink); }
.step-go { display: inline-flex; align-items: center; gap: 6px; padding: 8px var(--s4); border-radius: 999px; background: var(--dark); color: var(--on-dark); font-weight: 600; }
.step-go .icon { width: 15px; height: 15px; color: var(--g2-dark); }
.step.is-now .step-link { background: var(--wash); }
.step.is-done .step-title { color: var(--muted); }
.step.is-locked .step-title, .step.is-gift .step-title { color: var(--muted); }
.module.is-locked .steps, .module.is-locked .shelf-card { box-shadow: none; background: rgba(255, 255, 255, .55); }
.module.is-locked .step-bubble { box-shadow: 0 0 0 4px transparent; }

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--s4); }
.shelf-card { position: relative; display: flex; flex-direction: column; gap: var(--s2); height: 100%; padding: var(--s5); border-radius: var(--r-card); background: var(--card); box-shadow: var(--shadow); transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.shelf-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.shelf-art { width: 52px; height: 52px; margin-bottom: var(--s2); }
.shelf-title { font-weight: 600; font-size: var(--t-md); line-height: 1.25; letter-spacing: -0.01em; }
.shelf-sum { color: var(--muted); font-size: var(--t-xs); }
.shelf-lock { position: absolute; top: var(--s4); right: var(--s4); color: var(--faint); }
.shelf-lock .icon { width: 17px; height: 17px; }
.shelf-card.is-locked .shelf-art { filter: grayscale(1); opacity: .5; }
.shelf-card.is-locked .shelf-title { color: var(--muted); }
@media (max-width: 700px) {
  .step-link { grid-template-columns: auto minmax(0, 1fr); gap: var(--s3); padding: var(--s3); }
  .step-meta { grid-column: 2; }
  .step + .step::before { left: calc(var(--s3) + 21px); }
  .shelf { grid-template-columns: 1fr 1fr; gap: var(--s3); }
  .shelf-card { padding: var(--s4); }
  .module-head { align-items: flex-start; flex-direction: column; }
}

/* ——— Запросы ——— */
.search { display: flex; align-items: center; gap: var(--s3); height: 56px; padding: 0 var(--s5); border-radius: 999px; background: var(--card); box-shadow: var(--shadow); color: var(--faint); }
.search:focus-within { box-shadow: var(--shadow), 0 0 0 2px var(--accent); color: var(--ink); }
.search-input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font-size: var(--t-md); }
.search-input::placeholder { color: var(--faint); }
.howto { background: var(--card); border-radius: var(--r-inner); box-shadow: var(--shadow); padding: 0 var(--s5); }
.howto summary { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) 0; font-weight: 600; cursor: pointer; list-style: none; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary .icon { margin-left: auto; color: var(--faint); transition: transform .2s; }
.howto[open] summary .icon { transform: rotate(180deg); }
.howto .prose { padding-bottom: var(--s5); }
.lib-groups { display: flex; flex-direction: column; gap: var(--s6); }
.lib-group { display: flex; flex-direction: column; gap: var(--s4); }
.lib-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: var(--s4); align-items: start; }
.lib-locked { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s2); }
.lib-locked li { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-small); background: rgba(255, 255, 255, .55); color: var(--muted); font-weight: 500; }
.lib-locked .icon { width: 16px; height: 16px; color: var(--faint); }

.prompt { display: flex; flex-direction: column; gap: var(--s3); background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: var(--s5); scroll-margin-top: 96px; }
.prompt[data-focus] { box-shadow: var(--shadow-lift), 0 0 0 2px var(--accent); }
.prompt-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.prompt-head h3 { font-size: var(--t-md); font-weight: 600; }
.prompt-lead { color: var(--muted); font-size: var(--t-xs); margin-top: 2px; }
.prompt-note { color: var(--muted); font-size: var(--t-xs); }
.prompt-note.prose p { font-size: var(--t-xs); }
.prompt-locked, .fixer-text { display: flex; align-items: center; gap: var(--s2); color: var(--muted); font-weight: 500; }
.prompt-locked .icon { width: 17px; height: 17px; }
.prompt-wrap { position: relative; border-radius: var(--r-inner); background: var(--dark); overflow: hidden; }
.prompt-body { margin: 0; padding: var(--s4) var(--s5); color: #E8E8EE; font: 400 var(--t-xs)/1.65 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2; }
.prompt-wrap.is-collapsed { max-height: 15.5em; }
.prompt-wrap.is-collapsed::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 5em; background: linear-gradient(transparent, var(--dark)); pointer-events: none; }
.prompt-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.prompt-copy { flex: 1 1 220px; }
.prompt-copy.copied { background: var(--accent); color: #fff; }
.prompt-copy.copied .icon { color: #fff; }
.prompt-toggle { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 var(--s3); color: var(--muted); font-size: var(--t-xs); font-weight: 600; border-radius: 999px; }
.prompt-toggle:hover { color: var(--ink); background: var(--wash); }
.prompt-toggle .icon { width: 16px; height: 16px; transition: transform .2s; }
.prompt-toggle.open .icon { transform: rotate(180deg); }
.prompt.compact { box-shadow: none; padding: 0; background: none; }

.fixer { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: var(--s5); display: flex; flex-direction: column; gap: var(--s4); }
.fixer-head { display: flex; align-items: center; gap: var(--s4); }
.fixer-art { width: 52px; height: 52px; }
.fixer-head p { color: var(--muted); font-size: var(--t-xs); }
.fixer-group { color: var(--muted); font-size: var(--t-xs); font-weight: 600; margin: var(--s2) 0; }
.fixer-chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.fixer-chip { display: inline-flex; align-items: center; gap: 6px; text-align: left; padding: 10px var(--s4); border-radius: 18px; background: var(--wash); font-weight: 500; font-size: var(--t-sm); line-height: 1.3; transition: background .15s, color .15s; }
.fixer-chip:hover { background: #EBEBF0; }
.fixer-chip.on { background: var(--dark); color: var(--on-dark); }
.fixer-chip.is-locked { color: var(--faint); }
.fixer-chip .icon { width: 14px; height: 14px; }
.fixer-answer { padding: var(--s5); border-radius: var(--r-inner); background: var(--wash); scroll-margin: 120px; }
.fixer-text { flex-wrap: wrap; color: var(--ink); }
.fixer-text .e3d { width: 28px; height: 28px; }

/* ——— Награды ——— */
.game-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s6); background: var(--dark); color: var(--on-dark); padding: var(--s7); }
.game-head-text { display: flex; flex-direction: column; gap: var(--s2); }
.game-head-text p { color: var(--on-dark-muted); }
.game-head-text .bar { margin-top: var(--s2); max-width: 420px; }
.game-next { color: var(--on-dark-muted); font-size: var(--t-xs); }
.game-stats { display: flex; gap: var(--s3); }
.game-stats > div { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 96px; padding: var(--s4) var(--s3); border-radius: var(--r-inner); background: rgba(255, 255, 255, .07); }
.game-stats .e3d { width: 30px; height: 30px; }
.game-stats b { font-size: var(--t-lg); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.game-stats span { color: var(--on-dark-muted); font-size: 0.6875rem; text-align: center; }
.game-stats .lives { margin: 5px 0; }
.game-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s4); align-items: start; }
.game-side { display: flex; flex-direction: column; gap: var(--s4); }
.ladder { display: flex; flex-direction: column; }
.rung { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s4); padding: var(--s3); border-radius: var(--r-inner); }
.rung-art { width: 50px; height: 50px; border-radius: 16px; background: var(--wash); display: grid; place-items: center; }
.rung-art .e3d { width: 32px; height: 32px; }
.rung b { display: block; font-weight: 600; }
.rung span { color: var(--muted); font-size: var(--t-xs); }
.rung em { display: inline-flex; align-items: center; gap: 4px; font-style: normal; color: var(--faint); font-size: var(--t-xs); font-weight: 500; white-space: nowrap; }
.rung em .icon { width: 15px; height: 15px; }
.rung.reached em .icon { color: var(--accent); width: 20px; height: 20px; }
.rung:not(.reached) .rung-art .e3d { filter: grayscale(1); opacity: .3; }
.rung:not(.reached) b { color: var(--muted); }
.rung.current { background: var(--dark); color: var(--on-dark); }
.rung.current span { color: var(--on-dark-muted); }
.rung.current .rung-art { background: rgba(255, 255, 255, .1); }
.rung.current em { color: var(--g1-dark); font-weight: 600; }
.rules ul { display: flex; flex-direction: column; gap: var(--s4); }
.rules li { display: flex; gap: var(--s3); align-items: flex-start; }
.rules .e3d { width: 30px; height: 30px; }
.rules li b { display: block; }
.rules li span { color: var(--muted); font-size: var(--t-xs); }
.rules li span b { display: inline; color: var(--ink); }
.award-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s3); }
.award-item { display: flex; flex-direction: column; gap: 4px; padding: var(--s3); border-radius: var(--r-inner); background: var(--wash); }
.award-item .award { width: 54px; aspect-ratio: 1; background: none; }
.award-item .award .e3d { width: 100%; height: 100%; }
.award-item b { font-weight: 600; line-height: 1.25; }
.award-item span { color: var(--muted); font-size: var(--t-xs); line-height: 1.35; }
.award-item.off b { color: var(--muted); }
.coins-now { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.coins-now b { color: var(--ink); font-weight: 800; font-size: var(--t-md); }
.coins-now .e3d { width: 22px; height: 22px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s4); }
.shop-item { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s5); border-radius: var(--r-inner); background: var(--wash); }
.shop-art { width: 60px; height: 60px; }
.shop-art .e3d { width: 100%; height: 100%; }
.shop-item b { font-weight: 600; font-size: var(--t-md); }
.shop-desc { color: var(--muted); font-size: var(--t-xs); flex: 1; }
.shop-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-top: var(--s2); }
.price { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; margin-right: auto; }
.price .e3d { width: 20px; height: 20px; }
.shop-item.is-locked .shop-art { filter: grayscale(1); opacity: .45; }
.shop-reset { margin-top: var(--s4); }
@media (max-width: 900px) {
  .game-head { grid-template-columns: auto minmax(0, 1fr); padding: var(--s5); gap: var(--s4); }
  .game-head .avatar { --size: 84px !important; }
  .game-stats { grid-column: 1 / -1; }
  .game-stats > div { flex: 1; min-width: 0; }
  .game-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ——— Профиль ——— */
.profile-head { display: flex; align-items: center; gap: var(--s5); }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); align-items: start; }
.profile .card h2 { margin-bottom: var(--s3); }
.profile .card-head h2 { margin-bottom: 0; }
.rows { display: flex; flex-direction: column; }
.rows li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows .e3d { width: 30px; height: 30px; }
.rows b { display: block; font-weight: 600; }
.rows span { color: var(--muted); font-size: var(--t-xs); }
.here { margin-left: var(--s2); padding: 2px var(--s2); border-radius: 8px; background: var(--accent-wash); color: var(--accent-ink); font-style: normal; font-size: 0.6875rem; font-weight: 600; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); cursor: pointer; }
.switch-row b { display: block; font-weight: 600; }
.switch-row span { color: var(--muted); font-size: var(--t-xs); }
.switch { position: relative; flex: none; width: 52px; height: 32px; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: #D5D5DC; transition: background .2s; pointer-events: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s var(--ease); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 3px solid var(--g3); outline-offset: 3px; }
@media (max-width: 900px) { .profile-grid { grid-template-columns: minmax(0, 1fr); } .profile-head { align-items: flex-start; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
