/* Месяц с Бадди. Сетка 4/8 px. Мир игры — главный герой, интерфейс вокруг тихий: стекло, один акцент. */
:root {
  --bg: #120c24;          /* ночная слива */
  --ink: #26183f;         /* тушь контуров */
  --text: #f5f3ff;        /* бумага */
  --text-2: #d9d3f0;
  --muted: #b3aad3;
  --accent: #8b5cf6;      /* сумеречный фиолетовый */
  --accent-strong: #7c3aed;
  --accent-ink: #c4b5fd;
  --accent-soft: rgba(139, 92, 246, .18);
  --lamp: #ffd479;        /* тёплая лампа */
  --good: #4ade80;
  --bad: #fb7185;
  --glass: rgba(255, 255, 255, .06);
  --glass-hi: rgba(255, 255, 255, .10);
  --glass-dark: rgba(24, 17, 48, .88);
  --stroke: rgba(255, 255, 255, .12);
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 28px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, p, ul, ol, dl, dd, fieldset { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
button, input { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
h1:focus, [tabindex="-1"]:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; }
kbd { font: 600 11px/1 inherit; }
@media (hover: none) { kbd { display: none !important; } }

.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sr-only, .hp {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- фон ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg i { position: absolute; border-radius: 50%; filter: blur(64px); opacity: .5; animation: drift 24s var(--ease) infinite alternate; }
.bg i:nth-child(1) { width: 420px; height: 420px; top: -160px; right: -120px; background: #6d28d9; }
.bg i:nth-child(2) { width: 360px; height: 360px; bottom: -140px; left: -160px; background: #312e81; animation-delay: -8s; }
.bg i:nth-child(3) { width: 240px; height: 240px; top: 40%; right: -120px; background: #a21caf; opacity: .22; animation-delay: -16s; }
@keyframes drift { to { transform: translate3d(-24px, 32px, 0) scale(1.08); } }

/* ---------- каркас ---------- */
.shell { max-width: 460px; margin: 0 auto; padding: 0 16px calc(40px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.brand img { width: 32px; height: 32px; border-radius: 50%; background: var(--glass-hi); }
.icon-btn {
  display: grid; place-items: center; width: 48px; height: 48px; padding: 0;
  border: 1px solid var(--stroke); border-radius: 50%; background: var(--glass); cursor: pointer; color: var(--text);
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.top .icon-btn { margin-right: -4px; }
.icon-btn:hover { background: var(--glass-hi); }
.icon-btn:active { transform: scale(.94); }
.icon-btn[aria-pressed="true"] { color: var(--muted); }
.glass { background: var(--glass); border: 1px solid var(--stroke); -webkit-backdrop-filter: blur(24px) saturate(140%); backdrop-filter: blur(24px) saturate(140%); }

/* ---------- экраны ---------- */
.screen { display: flex; flex-direction: column; gap: 16px; animation: enter .45s var(--ease) both; }
.screen.leaving { animation: leave .16s ease-in both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }
@keyframes leave { to { opacity: 0; transform: translateY(-6px); } }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.96); } }

h1 { font-size: 28px; line-height: 32px; font-weight: 700; letter-spacing: -.025em; }
.eyebrow { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--accent-ink); }
.lead { font-size: 17px; line-height: 24px; color: var(--text-2); }
.note, .hint { font-size: 14px; line-height: 20px; color: var(--muted); }
.actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.actions .note { text-align: center; }

/* ---------- кнопки ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 56px; padding: 12px 20px;
  border: 1px solid transparent; border-radius: var(--r-md); font-size: 17px; line-height: 24px; font-weight: 600;
  text-align: center; text-decoration: none; cursor: pointer; transition: transform .2s var(--ease), background .2s var(--ease);
}
a.btn.primary { color: #fff; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent-strong); color: #fff; box-shadow: 0 8px 24px -8px rgba(124, 58, 237, .8), inset 0 1px 0 rgba(255, 255, 255, .2); }
.btn.primary:hover { background: #6d28d9; }
.btn.secondary { background: var(--glass); border-color: var(--stroke); }
.btn.secondary:hover { background: var(--glass-hi); }
.btn.ghost { background: transparent; color: var(--accent-ink); min-height: 48px; }
.btn.ghost:hover { background: var(--glass); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn kbd { padding: 4px 8px; border-radius: 8px; background: rgba(255, 255, 255, .18); }

/* ---------- Бадди ---------- */
.buddy { object-fit: contain; flex: none; }
.buddy-fallback { display: grid; place-items: center; font-size: 48px; line-height: 1; }
.buddy-hero { width: 176px; height: 176px; }
.buddy-md { width: 120px; height: 120px; }
.buddy-xs { width: 64px; height: 64px; }
.buddy-hero.buddy-fallback { font-size: 96px; }
.bubble {
  position: relative; padding: 12px 16px; border-radius: var(--r-lg);
  background: rgba(139, 92, 246, .16); border: 1px solid rgba(196, 181, 253, .22); font-size: 16px; line-height: 24px;
}
.bubble-left { border-top-left-radius: 6px; }
.bubble-top { border-top-right-radius: 6px; margin-right: 48px; }

/* ---------- старт ---------- */
.lang { display: inline-flex; align-self: flex-start; padding: 4px; gap: 4px; border-radius: var(--r-md); background: var(--glass); border: 1px solid var(--stroke); }
.lang button, .lang a {
  display: grid; place-items: center; min-width: 64px; min-height: 48px; padding: 0 12px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--muted); font-weight: 600; text-decoration: none; cursor: pointer; transition: background .2s var(--ease), color .2s;
}
.lang button[aria-pressed="true"], .lang a[aria-current="page"] { background: var(--glass-hi); color: var(--text); }
.start-hero { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 0 8px; margin-top: 8px; }
.start-hero .eyebrow { grid-column: 1 / -1; }
.start-hero h1 { font-size: 44px; line-height: 48px; letter-spacing: -.035em; padding-bottom: 16px; }
.start-hero .buddy-hero { margin-right: -24px; margin-top: -8px; animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px) rotate(-2deg); } }
.start .bubble { margin-right: 32px; }

/* ---------- редактор ---------- */
.editor-top { display: grid; grid-template-columns: 128px 1fr; gap: 16px; align-items: start; }
.hero-preview { width: 128px; height: 128px; border-radius: var(--r-xl); overflow: hidden; display: grid; place-items: end center; background: radial-gradient(circle at 50% 30%, rgba(167, 139, 250, .35), rgba(255, 255, 255, .04)); }
.hero-preview svg { width: 116px; height: 116px; }
.buddy-note { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.buddy-note .bubble { font-size: 15px; line-height: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field legend { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.swatches { display: flex; gap: 8px; }
.swatch, .seg, .goal-card { position: relative; cursor: pointer; }
.swatch input, .seg input, .goal-card input, .check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; }
.sw { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--ink); transition: box-shadow .2s var(--ease), transform .2s var(--spring); }
.sw[data-set="hoodie"][data-c="0"] { background: #8b5cf6; }
.sw[data-set="hoodie"][data-c="1"] { background: #34d399; }
.sw[data-set="hoodie"][data-c="2"] { background: #fb7185; }
.sw[data-set="hoodie"][data-c="3"] { background: #38bdf8; }
.sw[data-set="skin"][data-c="0"] { background: #f6d3b3; }
.sw[data-set="skin"][data-c="1"] { background: #dfa77c; }
.sw[data-set="skin"][data-c="2"] { background: #a8714f; }
.swatch input:checked + .sw { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--text); transform: scale(1.06); }
.swatch input:focus-visible + .sw { outline: 2px solid var(--accent-ink); outline-offset: 6px; }
.segs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: var(--r-md); background: var(--glass); border: 1px solid var(--stroke); }
.segs-4 { grid-template-columns: repeat(4, 1fr); }
.seg span { display: grid; place-items: center; min-height: 48px; padding: 0 4px; border-radius: var(--r-sm); color: var(--muted); font-weight: 600; font-size: 14px; text-align: center; transition: background .2s var(--ease), color .2s; }
.seg input:checked + span { background: var(--glass-hi); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08); }
.seg input:focus-visible + span { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.goals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.goal-card { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 12px; min-height: 104px; padding: 12px; border-radius: var(--r-md); background: var(--glass); border: 1px solid var(--stroke); font-weight: 600; font-size: 15px; line-height: 20px; transition: border-color .2s, background .2s; }
.goal-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.goal-card:has(input:focus-visible) { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.goal-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 212, 121, .14); color: var(--lamp); }
.goal-ico .ico { width: 24px; height: 24px; }

/* ---------- игровой экран ---------- */
body.playing .top { display: none; }
body.playing .shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
body.playing .app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.playing { overscroll-behavior: none; }
body.playing .bg i { animation: none; }
.game { flex: 1; min-height: 0; gap: 8px; }

.hud { flex: none; padding: 8px; border-radius: var(--r-lg); background: rgba(24, 17, 48, .72); }
.hud-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.hud-ava { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--accent-soft); flex: none; }
.hud-ava svg { width: 40px; height: 40px; display: block; }
.hud-when { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; font-size: 14px; line-height: 20px; }
.hud-wd { padding: 2px 8px; border-radius: 8px; background: var(--accent-strong); color: #fff; font-weight: 700; font-size: 13px; }
.hud-day { font-weight: 600; white-space: nowrap; }
.hud-phase { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); white-space: nowrap; }
.hud-phase .ico { width: 16px; height: 16px; color: var(--lamp); }
.hud-btns { display: flex; gap: 4px; margin-left: auto; }
.hud-btns .icon-btn { width: 44px; height: 44px; position: relative; }
.hud-btns .icon-btn::after { content: ""; position: absolute; inset: -2px; }
.meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.meter { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: var(--r-sm); background: rgba(255, 255, 255, .05); min-width: 0; }
.m-label { display: flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.m-label .ico { width: 14px; height: 14px; }
.m-val { font-size: 15px; line-height: 20px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { display: block; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.fill { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); }
.meter[data-k="mood"] .fill { background: linear-gradient(90deg, #f472b6, #a78bfa); }
.goal-line { margin-top: 8px; }
.goal-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; line-height: 16px; color: var(--text-2); margin-bottom: 4px; }
.goal-row > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.goal-row .ico { width: 16px; height: 16px; color: var(--lamp); }
.goal-row span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }
.bar-goal { height: 6px; border-radius: 3px; }
.bar-goal .fill { background: linear-gradient(90deg, #7c3aed, var(--lamp)); }
.chips { position: absolute; top: 6px; left: 6px; pointer-events: none; }
.m-label { transition: opacity .2s var(--ease); }
.meter.changing .m-label { opacity: 0; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; line-height: 16px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; animation: chip .6s var(--spring) both; }
.chip.pos { background: #14532d; color: #bbf7d0; }
.chip.neg { background: #881337; color: #fecdd3; }
@keyframes chip { from { opacity: 0; transform: translateY(8px) scale(.8); } }

.stage { position: relative; flex: 1; min-height: 280px; overflow: hidden; border-radius: var(--r-lg); border: 1px solid var(--stroke); background: var(--bg); }
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: pointer; }
.stage canvas:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: -3px; }
.task {
  position: absolute; top: 8px; left: 8px; right: 8px; z-index: 2; display: flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 8px 12px; border-radius: var(--r-md); background: rgba(24, 17, 48, .72);
  font-size: 14px; line-height: 20px; font-weight: 600; pointer-events: none;
}
.task .ico { color: var(--lamp); width: 18px; height: 18px; }
.loc {
  position: absolute; top: 56px; left: 50%; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  border-radius: 999px; background: rgba(24, 17, 48, .8); font-weight: 600; white-space: nowrap; pointer-events: none;
  opacity: 0; transform: translate(-50%, -8px); transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.loc .ico { color: var(--accent-ink); }
.loc.show { opacity: 1; transform: translate(-50%, 0); }
.act {
  position: absolute; right: 12px; bottom: 12px; z-index: 2; display: flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 8px 0 14px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px; cursor: pointer;
  background: var(--accent-strong); color: #fff; font-weight: 600; font-size: 15px;
  box-shadow: 0 8px 24px -8px rgba(124, 58, 237, .9); animation: pop .35s var(--spring) both;
}
.act kbd { display: grid; place-items: center; min-width: 32px; height: 32px; border-radius: 999px; background: rgba(255, 255, 255, .2); }
.curtain { position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; gap: 8px; padding: 24px; text-align: center; background: var(--bg); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease); }
.curtain.on { opacity: 1; pointer-events: auto; }
.curtain p:first-child { font-size: 28px; line-height: 32px; font-weight: 700; letter-spacing: -.02em; }
.curtain-sub { color: var(--muted); }

/* диалог */
.sheet { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 3; max-height: calc(100% - 64px); overflow-y: auto; overscroll-behavior: contain; border-radius: var(--r-lg); }
.sheet-card { padding: 16px; border-radius: var(--r-lg); background: var(--glass-dark); animation: pop .4s var(--spring) both; }
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.ava { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 50%; overflow: hidden; background: var(--glass-hi); border: 1px solid var(--stroke); }
.ava svg { width: 48px; height: 48px; }
.ava-buddy { position: relative; display: block; background: rgba(139, 92, 246, .28); }
.ava-buddy .buddy-ava { position: absolute; left: 50%; top: -5px; width: 84px; height: 84px; max-width: none; transform: translateX(-50%); }
.sheet-card.peeking .ava-buddy { display: none; }
.sheet-card.peeking .sheet-head { min-height: 24px; margin-right: 96px; }
.peek {
  position: absolute; right: 12px; z-index: 2; width: 104px; height: 104px; object-fit: contain; pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(10, 4, 30, .45));
}
.peek.pop { animation: peek .45s var(--spring) both; }
@keyframes peek { from { opacity: 0; transform: translateY(24px) scale(.9); } }
.ava-buddy .buddy-fallback { font-size: 28px; }
.ava-glyph { color: var(--lamp); background: rgba(255, 212, 121, .12); }
.ava-glyph .ico { width: 24px; height: 24px; }
.sheet-meta { min-width: 0; }
.sheet-who { font-size: 15px; line-height: 20px; font-weight: 700; }
.sheet-eyebrow { font-size: 13px; line-height: 16px; color: var(--accent-ink); }
.sheet-text { position: relative; font-size: 16px; line-height: 24px; min-height: 24px; }
.sheet-text .ghost { visibility: hidden; }
.sheet-text .typed { position: absolute; inset: 0; }
.sheet .opts { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 14px 10px 10px;
  border: 1px solid var(--stroke); border-radius: var(--r-md); background: var(--glass);
  text-align: left; font-size: 16px; line-height: 22px; cursor: pointer; transition: background .2s var(--ease), border-color .2s;
}
.opt:hover:not(:disabled) { background: var(--glass-hi); border-color: rgba(196, 181, 253, .4); }
.opt:disabled { cursor: not-allowed; opacity: .45; }
.opt-n { display: grid !important; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 8px; background: rgba(255, 255, 255, .08); color: var(--accent-ink); font-size: 13px; }
.opt-t { display: flex; flex-direction: column; gap: 2px; }
.opt-sub { font-size: 13px; line-height: 16px; color: var(--muted); }
.sheet .btn { margin-top: 12px; min-height: 52px; }
.timer { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 12px; border-radius: var(--r-md); background: rgba(251, 113, 133, .14); color: #fecdd3; font-size: 14px; line-height: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.timer .ico { color: var(--bad); animation: pulse 1s ease-in-out infinite; }
.timer.over { background: var(--glass); color: var(--text-2); font-weight: 400; }
.timer.over .ico { color: var(--muted); animation: none; }
@keyframes pulse { 50% { opacity: .35; } }
.fact { display: flex; gap: 12px; margin-top: 12px; padding: 12px; border-radius: var(--r-md); background: rgba(255, 212, 121, .08); border: 1px solid rgba(255, 212, 121, .2); }
.fact > .ico { color: var(--lamp); margin-top: 2px; }
.fact-h { font-size: 14px; line-height: 20px; color: var(--lamp); margin-bottom: 4px; }
.fact-h b { color: var(--text); font-weight: 600; }
.fact p:last-child { color: var(--text-2); font-size: 15px; line-height: 22px; }
.sheet-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.sheet-list li { display: flex; align-items: center; gap: 8px; }
.sheet-list li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.sheet-list li.pos::before { background: var(--good); }
.sheet-list li.neg::before { background: var(--bad); }
.sheet-rows { margin-top: 12px; padding: 4px 12px; border-radius: var(--r-md); background: rgba(255, 255, 255, .05); }
.sheet-rows div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; }
.sheet-rows div + div { border-top: 1px solid var(--stroke); }
.sheet-rows dt { color: var(--muted); }
.sheet-rows dd { font-weight: 600; font-variant-numeric: tabular-nums; }
dd.pos { color: #86efac; }
dd.neg { color: #fda4af; }

/* телефон */
.phone-panel { position: absolute; inset: 0; z-index: 4; display: flex; align-items: flex-end; padding: 8px; background: rgba(18, 12, 36, .6); }
.phone-card { display: flex; flex-direction: column; width: 100%; max-height: 100%; border-radius: var(--r-xl); background: var(--glass-dark); animation: pop .4s var(--spring) both; }
.phone-head { display: flex; align-items: center; gap: 8px; padding: 8px; }
.tabs { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: var(--r-md); background: var(--glass); }
.tabs button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; }
.tabs button .ico { width: 16px; height: 16px; }
.tabs button[aria-selected="true"] { background: var(--glass-hi); color: var(--text); }
.phone-body { overflow-y: auto; padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.ph-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ph-stat { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: var(--r-md); background: var(--glass); }
.ph-stat .ico { color: var(--accent-ink); }
.ph-stat span { font-size: 13px; color: var(--muted); }
.ph-stat b { font-size: 20px; line-height: 24px; font-variant-numeric: tabular-nums; }
.ph-goal { padding: 12px; border-radius: var(--r-md); background: var(--glass); display: flex; flex-direction: column; gap: 8px; }
.ph-log, .ph-know { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ph-log li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--stroke); }
.ph-l { display: flex; flex-direction: column; min-width: 0; }
.ph-l b { font-size: 15px; font-weight: 600; }
.ph-l span { font-size: 13px; color: var(--muted); }
.ph-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ph-amt.income { color: #86efac; }
.ph-amt.save { color: var(--accent-ink); }
.ph-amt.loss, .ph-amt.lend { color: #fda4af; }
.ph-know li { display: flex; gap: 12px; padding: 12px; border-radius: var(--r-md); background: rgba(255, 212, 121, .07); }
.ph-know li .ico { color: var(--lamp); margin-top: 2px; }
.ph-know li div { display: flex; flex-direction: column; gap: 4px; }
.ph-know li span { font-size: 14px; line-height: 20px; color: var(--text-2); }
.ph-know li.locked { background: transparent; border: 1px dashed var(--stroke); color: var(--muted); }
.ph-know li.locked .ico { color: var(--muted); }

/* ---------- итоги ---------- */
.result-hero { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px; }
.result-hero .buddy-hero { margin-right: -24px; }
.type-name { font-size: 48px; line-height: 52px; letter-spacing: -.04em; background: linear-gradient(120deg, #fff 20%, var(--accent-ink) 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result .eyebrow { margin-bottom: 4px; }
.stats { border-radius: var(--r-lg); padding: 4px 16px; }
.stats div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; }
.stats div + div { border-top: 1px solid var(--stroke); }
.stats dt { color: var(--muted); font-size: 15px; }
.stats dd { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.done .result-hero h1 { font-size: 40px; line-height: 44px; padding-bottom: 16px; }
.where { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--r-lg); }
.where h2 { font-size: 17px; line-height: 24px; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bars li { display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 8px; font-size: 14px; }
.b-label { color: var(--text-2); }
.b-track { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.b-fill { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .9s var(--ease); }
.c-need { background: #60a5fa; }
.c-want { background: #f472b6; }
.c-save { background: #a78bfa; }
.c-loss { background: #fb7185; }
.c-lend { background: #fbbf24; }
.b-val { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- вишлист ---------- */
.wish-hero { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px; }
.wish-hero h1 { padding-bottom: 8px; }
.wish-hero .buddy-md { margin-right: -16px; }
.features { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.features li { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: var(--r-md); background: var(--glass); border: 1px solid var(--stroke); }
.f-ico { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: rgba(255, 212, 121, .14); color: var(--lamp); }
.f-ico .ico { width: 22px; height: 22px; }
.f-txt { display: flex; flex-direction: column; gap: 2px; }
.f-txt b { font-weight: 600; }
.f-txt span { font-size: 14px; line-height: 20px; color: var(--text-2); }
.form { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--r-xl); }
.f-label { font-size: 14px; line-height: 20px; font-weight: 600; }
.input { width: 100%; min-height: 52px; padding: 12px 16px; border-radius: var(--r-md); border: 1px solid var(--stroke); background: rgba(0, 0, 0, .25); font-size: 17px; transition: border-color .2s, box-shadow .2s; }
.input::placeholder { color: #8a82a8; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 4px rgba(251, 113, 133, .15); }
.check { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; min-height: 48px; padding: 4px 0; cursor: pointer; font-size: 15px; line-height: 20px; color: var(--text-2); }
.check .box { display: grid; place-items: center; width: 24px; height: 24px; margin-top: -2px; border-radius: 8px; border: 1.5px solid rgba(255, 255, 255, .35); transition: background .2s, border-color .2s; }
.check .box .ico { width: 16px; height: 16px; color: #fff; stroke-width: 2.6; opacity: 0; transform: scale(.4); transition: transform .2s var(--spring), opacity .2s; }
.check input:checked + .box { background: var(--accent-strong); border-color: var(--accent-strong); }
.check input:checked + .box .ico { opacity: 1; transform: scale(1); }
.check input:focus-visible + .box { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.check input[aria-invalid="true"] + .box { border-color: var(--bad); }
.link { align-self: flex-start; display: inline-flex; align-items: center; min-height: 48px; margin: -16px 0 -8px 36px; color: var(--accent-ink); font-size: 14px; text-underline-offset: 3px; }
.form-err { color: #fda4af; font-size: 15px; line-height: 20px; }
.form-err:empty { display: none; }

/* ---------- политика ---------- */
.doc a.brand { text-decoration: none; min-height: 48px; }
.policy { gap: 24px; padding-top: 8px; }
.policy article { display: flex; flex-direction: column; gap: 12px; }
.policy h2 { margin: 12px 0 0; font-size: 19px; line-height: 24px; letter-spacing: -.01em; }
.policy p { color: var(--text-2); }
.draft { padding: 12px 16px; border-radius: var(--r-md); background: rgba(251, 191, 36, .12); border: 1px solid rgba(251, 191, 36, .3); color: #fde68a; font-size: 15px; line-height: 20px; }

/* ---------- тост ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 20; display: flex; align-items: center; gap: 8px;
  width: max-content; max-width: min(428px, calc(100vw - 32px)); padding: 12px 16px; border-radius: var(--r-md);
  background: rgba(30, 22, 58, .94); font-size: 15px; line-height: 20px; overflow-wrap: anywhere;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.toast .ico { color: var(--lamp); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.playing .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
.curtain .ico { width: 40px; height: 40px; margin: 0 auto 8px; color: var(--lamp); }
.noscript { padding: 24px; text-align: center; }

/* ---------- узкие экраны ---------- */
@media (max-width: 374px) {
  .start-hero h1 { font-size: 38px; line-height: 44px; }
  .buddy-hero { width: 148px; height: 148px; }
  .type-name { font-size: 40px; line-height: 44px; }
  .m-val { font-size: 14px; }
  .goal-card { font-size: 14px; }
  .hud-phase span { display: none; }
}

/* ---------- меньше движения ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
