/* Fitness RPG — tokens and base.
   Direction: an evening camp on a long hike. Warm dark surfaces, ember accent.
   Colour lives in the moments: rings of the day, the hero, charts. Every stat has its own colour
   and wears it everywhere (signature). Light theme keeps the same logic on warm paper. */
:root {
  /* dark (default) */
  --bg: #121110; --bg-deep: #0C0B0A; --card: #1B1A18; --raised: #252320; --raised-2: #2E2B27;
  --text: #F2EEE6; --text-2: #ADA79C; --text-3: #857F75;
  --line: rgba(242, 238, 230, .08); --line-strong: rgba(242, 238, 230, .15);
  --accent: #F26B3A; --accent-ink: #FF8A5C; --accent-soft: rgba(242, 107, 58, .16); --on-accent: #1A0D07;
  --primary-bg: #F2EEE6; --primary-fg: #141210;
  --paper: #F2EDE4;
  --pos: #6CCB8B; --neg: #F0635A; --warn: #E9B949;
  --shadow-s: none; --shadow-f: 0 16px 40px rgba(0, 0, 0, .45);
  --scrim: rgba(0, 0, 0, .55);

  /* stat colours (signature) */
  --c-str: #F26B3A;  /* Сила */
  --c-end: #33B8A5;  /* Выносливость */
  --c-dis: #5AA7E8;  /* Дисциплина */
  --c-cook: #8FBF5A; /* Кулинария */
  --c-eco: #E9B949;  /* Экономика */
  --c-pos: #E57E9D;  /* Осанка */
  --ring-move: var(--c-end); --ring-train: var(--c-str); --ring-food: var(--c-cook);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
  --round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI Variable Display", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* 4px scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px;
  --r-s: 8px; --r-c: 12px; --r-m: 16px; --r-card: 22px; --r-panel: 28px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 160ms; --t-menu: 220ms; --t-enter: 420ms; --t-ring: 1100ms;

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tabbar-h: 64px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F5F2EC; --bg-deep: #ECE7DE; --card: #FFFFFF; --raised: #F1EDE6; --raised-2: #E8E3DA;
  --text: #1C1A17; --text-2: #5C574E; --text-3: #7A7468;
  --line: rgba(28, 26, 23, .08); --line-strong: rgba(28, 26, 23, .16);
  --accent: #E25C2A; --accent-ink: #B8461A; --accent-soft: rgba(226, 92, 42, .12); --on-accent: #FFFFFF;
  --primary-bg: #1C1A17; --primary-fg: #FFFFFF;
  --pos: #1F9D55; --neg: #D64545; --warn: #B7791F;
  --shadow-s: 0 1px 2px rgba(40, 30, 20, .05); --shadow-f: 0 12px 32px rgba(40, 30, 20, .14);
  --scrim: rgba(20, 16, 12, .35);
  --c-str: #E25C2A; --c-end: #1E9E8C; --c-dis: #2F86D0; --c-cook: #5F9A32; --c-eco: #C9971F; --c-pos: #D2577D;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    --bg: #F5F2EC; --bg-deep: #ECE7DE; --card: #FFFFFF; --raised: #F1EDE6; --raised-2: #E8E3DA;
    --text: #1C1A17; --text-2: #5C574E; --text-3: #7A7468;
    --line: rgba(28, 26, 23, .08); --line-strong: rgba(28, 26, 23, .16);
    --accent: #E25C2A; --accent-ink: #B8461A; --accent-soft: rgba(226, 92, 42, .12); --on-accent: #FFFFFF;
    --primary-bg: #1C1A17; --primary-fg: #FFFFFF;
    --pos: #1F9D55; --neg: #D64545; --warn: #B7791F;
    --shadow-s: 0 1px 2px rgba(40, 30, 20, .05); --shadow-f: 0 12px 32px rgba(40, 30, 20, .14);
    --scrim: rgba(20, 16, 12, .35);
    --c-str: #E25C2A; --c-end: #1E9E8C; --c-dis: #2F86D0; --c-cook: #5F9A32; --c-eco: #C9971F; --c-pos: #D2577D;
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/22px var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
img { max-width: 100%; display: block; }
a { color: var(--accent-ink); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; font-family: var(--round); }
p { margin: 0 0 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: tabular-nums; }
.rnd { font-family: var(--round); }
.mono { font-family: var(--mono); font-size: 12px; line-height: 16px; color: var(--text-3); }
.muted { color: var(--text-3); }
.sec { color: var(--text-2); }
.accent { color: var(--accent-ink); }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.app {
  max-width: 560px; margin: 0 auto;
  padding: calc(var(--safe-t) + 16px) 16px calc(var(--tabbar-h) + var(--safe-b) + 32px);
  min-height: 100dvh;
}
.boot { padding: 48px 0; text-align: center; color: var(--text-3); }

/* entrance: one short fade-and-rise per screen, staggered by --i */
.enter .rise { opacity: 0; transform: translateY(10px); animation: rise var(--t-enter) var(--ease) forwards; animation-delay: calc(var(--i, 0) * 50ms); }
@keyframes rise { to { opacity: 1; transform: none; } }
.pop { animation: pop 360ms var(--ease); }
@keyframes pop { 0% { transform: scale(.92); } 100% { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}
