:root {
  --ground: #F4F2EE;
  --card: #FFFFFF;
  --ink: #15171C;
  --muted: #5E5B54;
  --line: #E4E0D8;
  --soft: #EFEBE4;
  --accent: #C2410C;
  --accent-soft: #FBE7DC;
  --accent-ink: #7C2D12;
  --green: #1F6F54;
  --green-soft: #DDEFE6;
  --green-ink: #1F4D3C;
  --dark: #15171C;
  --dark-ink: #F4F2EE;
  --dark-muted: #C9C5BC;
  --dark-line: #3A3E47;
  --peach: #F6A97A;
  --display: 'Unbounded', system-ui, sans-serif;
  --body: 'Manrope', system-ui, sans-serif;
  --tabbar-h: 72px;
}
:root[data-theme="dark"] {
  --ground: #101215;
  --card: #1B1E24;
  --ink: #F4F2EE;
  --muted: #A9A59C;
  --line: #2C3038;
  --soft: #262A31;
  --accent-soft: #3A2114;
  --accent-ink: #F6C3A4;
  --green-soft: #17322A;
  --green-ink: #9FD9BF;
  --dark: #21242B;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--body); -webkit-font-smoothing: antialiased; }
button { font-family: var(--body); color: inherit; cursor: pointer; }
a { color: var(--accent); }

.screen { padding: 20px 20px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; max-width: 560px; margin: 0 auto; }

.title { font-family: var(--display); font-weight: 700; font-size: 22px; margin: 0; }
.sub { font-size: 13px; color: var(--muted); margin: 0; }
.label { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.card { background: var(--card); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card.dark { background: var(--dark); color: var(--dark-ink); }
.card.dark .sub { color: var(--dark-muted); }
.card.dark .label { color: var(--peach); }

.avatar { width: 44px; height: 44px; border-radius: 22px; background: var(--dark); color: var(--dark-ink); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 68px; height: 68px; border-radius: 34px; font-family: var(--display); font-size: 20px; }

.big-num { font-family: var(--display); font-weight: 700; font-size: 28px; }
.bar { height: 10px; border-radius: 5px; background: var(--dark-line); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 5px; background: var(--peach); }
.levels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); font-size: 12px; text-align: center; color: var(--dark-muted); }
.levels .on { color: var(--peach); font-weight: 700; }

.soon { border: 1px dashed #B8B2A6; border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.soon b { font-size: 15px; }
.soon span { font-size: 13px; color: var(--muted); }
.step-chip { align-self: flex-start; font-size: 11px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); padding: 3px 8px; border-radius: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }

.list { background: var(--card); border-radius: 20px; padding: 2px 16px; }
.row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; border-bottom: 1px solid var(--soft); }
.row:last-child { border-bottom: none; }
.row .grow { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row .name { font-weight: 700; font-size: 15px; }
.row .hint { font-size: 12px; color: var(--muted); }
.pts { font-size: 13px; font-weight: 700; color: var(--green); white-space: nowrap; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 8px; background: var(--soft); color: var(--muted); white-space: nowrap; }

.error { background: var(--accent-soft); color: var(--accent-ink); border-radius: 16px; padding: 14px; font-size: 14px; }
.skeleton { height: 80px; border-radius: 20px; background: var(--card); opacity: .6; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: space-around; align-items: center; }
.tab { flex: 1; max-width: 90px; min-height: 52px; border: none; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--accent); font-weight: 700; }

/* ---------- шаг 5: вход, онбординг, профиль ---------- */
body.no-tabs .tabbar { display: none; }
body.no-tabs .screen { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
.center { text-align: center; }

.hero { display: flex; flex-direction: column; gap: 10px; padding-top: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: 1px; }
.brand svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.lead { font-size: 17px; line-height: 1.45; color: var(--muted); margin: 0; }
.motto { font-size: 12px; font-weight: 700; letter-spacing: 2px; color: var(--accent); margin: 0; }

.input { height: 52px; border-radius: 14px; border: 1px solid var(--dark-line); background: var(--ground); color: var(--ink); font-family: var(--body); font-size: 18px; padding: 0 16px; letter-spacing: 2px; text-transform: uppercase; width: 100%; }
.card.dark .input { background: #101215; color: var(--dark-ink); }
.input[aria-invalid="true"] { border-color: #E5484D; }
.field-error { color: #E5484D; font-size: 14px; margin: 0; }
.card.dark .field-error { color: #FF8B8E; }

.btn { min-height: 48px; border-radius: 14px; border: 1px solid var(--ink); background: transparent; font-weight: 700; font-size: 15px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { border-color: var(--line); color: var(--muted); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; border-color: var(--line); }
.btn:disabled { opacity: .45; }
.card.dark .btn.ghost { border-color: var(--dark-line); color: var(--dark-muted); }
.link-btn { background: none; border: none; color: var(--accent); font-weight: 700; font-size: 14px; padding: 8px 0; min-height: 44px; }
.actions { display: flex; gap: 10px; margin-top: 6px; }
.actions .btn { flex: 1; }

.dots { display: flex; gap: 6px; padding-top: 8px; }
.dots i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.dots i.on { background: var(--accent); }

.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day { height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 13px; }
.day[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }

.opt { width: 100%; border: none; background: none; text-align: left; font-family: var(--body); color: var(--ink); }
.radio { width: 22px; height: 22px; border-radius: 11px; border: 2px solid var(--line); flex-shrink: 0; }
.opt[aria-checked="true"] .radio { border: 7px solid var(--accent); }

.pill { font-size: 13px; font-weight: 600; background: var(--accent-soft); color: var(--accent-ink); padding: 6px 12px; border-radius: 14px; }
.tag.ok { background: var(--green-soft); color: var(--green-ink); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 1px; }

/* ---------- шаг 7: сегодня, привычки, задачи ---------- */
.power { flex-direction: row; align-items: center; gap: 16px; }
.ring { --p: 0; width: 84px; height: 84px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: conic-gradient(var(--peach) calc(var(--p) * 1%), var(--dark-line) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--dark); }
.ring b { position: relative; font-family: var(--display); font-size: 17px; }
.power-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.big-num.small { font-size: 24px; }
.big-num .of { font-size: 14px; color: var(--dark-muted); font-family: var(--body); }

.quick { gap: 8px; }
.quick-row { display: flex; gap: 8px; }
.input.plain { text-transform: none; letter-spacing: 0; font-size: 15px; height: 46px; border-color: var(--line); background: var(--ground); flex: 1; min-width: 0; }
.btn.square { width: 46px; min-height: 46px; padding: 0; flex-shrink: 0; }
.btn.square svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; }
.hint.warn { color: #C2410C; font-weight: 600; }

.row.habit { gap: 10px; }
.check { width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--line); background: transparent; flex-shrink: 0; display: grid; place-items: center; padding: 0; position: relative; }
.check::after { content: ""; position: absolute; inset: -8px; } /* зона нажатия 46px */
.check svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.check[aria-checked="true"] { background: var(--green); border-color: var(--green); }
.check[aria-checked="true"] svg { opacity: 1; }
.name.done { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.pts.dim { color: var(--muted); font-weight: 600; }
.icon-btn { width: 36px; height: 36px; border: none; background: none; color: var(--muted); display: grid; place-items: center; flex-shrink: 0; border-radius: 10px; }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.soon .btn { margin-top: 8px; align-self: flex-start; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--dark); color: var(--dark-ink); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 40px); text-align: center; z-index: 10; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.quick .hint { font-size: 13px; color: var(--muted); margin: 0; }

/* ---------- шаг 8: мой путь ---------- */
.advice { border-left: 4px solid var(--accent); }
.advice b { font-size: 16px; }
.advice .actions { margin-top: 2px; }
.advice .actions .btn { flex: 0 0 auto; }
.btn.small.primary { border-color: var(--accent); }
.chip:disabled { opacity: .4; }
.opt.row .hint { line-height: 1.35; }

/* ---------- шаг 10: напоминания ---------- */
.icon-btn.on { color: var(--accent); }
.remind { border-left: 4px solid var(--peach); }
.remind .quick-row { align-items: center; }
.switch { width: 52px; height: 32px; border-radius: 16px; border: none; background: var(--line); position: relative; flex-shrink: 0; padding: 0; }
.switch i { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 13px; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch[aria-checked="true"] { background: var(--green); }
.switch[aria-checked="true"] i { left: 23px; }

/* ---------- шаг 11: рейтинг ---------- */
.row.rank .avatar { width: 36px; height: 36px; border-radius: 18px; font-size: 13px; }
.place { width: 24px; text-align: center; font-family: var(--display); font-weight: 700; font-size: 14px; color: var(--muted); flex-shrink: 0; }
.place.top { color: var(--accent); }
.row.rank.me { background: var(--accent-soft); margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.row.rank.me .name { color: var(--accent-ink); }
.head .chips { flex-wrap: nowrap; }

/* ---------- шаг 12: сборы ---------- */
.gather .g-when { font-family: var(--display); font-size: 18px; }
.g-people { display: flex; align-items: center; gap: 10px; }
.faces { display: flex; }
.faces .avatar { width: 30px; height: 30px; border-radius: 15px; font-size: 11px; border: 2px solid var(--card); margin-left: -8px; }
.faces .avatar:first-child { margin-left: 0; }
.g-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.head .btn.small.primary { color: #fff; }
.screen > .input.plain { flex: none; }
