/* =========================================================================
   JB Fitness – "PULSE"
   Dark, high-tech, sporty-premium. Glass cards, neon-lime accent, glow.
   Mobile-first; desktop = sidebar, mobile = top bar + bottom nav.
   ========================================================================= */

:root {
  --bg: #0a0b0d;
  --bg-2: #101216;
  --surface: rgba(255, 255, 255, .045);
  --surface-solid: #15171b;
  --surface-2: rgba(255, 255, 255, .075);
  --surface-3: rgba(255, 255, 255, .14);
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .17);
  --chrome-bg: rgba(10, 11, 13, .82);

  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --text: #eef1f2;
  --text-dim: #9aa2a6;
  --text-faint: #6f777b;

  --accent: #c6ff3a;            /* neon lime */
  --accent-strong: #b4ee1f;
  --accent-soft: rgba(198, 255, 58, .12);
  --accent-grad: linear-gradient(135deg, #d7ff5c 0%, #a8e000 100%);
  --accent-ink: #0a0b0d;        /* text on accent */
  --glow: 0 0 18px rgba(198, 255, 58, .45);

  --good: #c6ff3a;
  --warn: #ffce4d;
  --warn-soft: rgba(255, 206, 77, .12);
  --bad: #ff6b5e;
  --bad-soft: rgba(255, 107, 94, .12);

  --radius: 20px;
  --radius-sm: 13px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 22px 50px rgba(0, 0, 0, .55);

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  --bottom-nav-h: 62px;
  --topbar-h: 56px;
}

/* ---------- Light theme ---------- */
html[data-theme="light"] {
  --bg: #f3f5ef;
  --bg-2: #eceee6;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-2: rgba(20, 30, 16, .045);
  --surface-3: rgba(20, 30, 16, .09);
  --line: rgba(20, 30, 16, .10);
  --line-strong: rgba(20, 30, 16, .18);
  --chrome-bg: rgba(255, 255, 255, .85);

  --text: #18201a;
  --text-dim: #5b6560;
  --text-faint: #8a948c;

  --accent: #5a8a0a;
  --accent-strong: #436806;
  --accent-soft: rgba(124, 180, 20, .16);
  --accent-grad: linear-gradient(135deg, #a7e23f 0%, #6fa400 100%);
  --accent-ink: #16230a;
  --glow: 0 4px 14px rgba(127, 170, 0, .26);

  --good: #5a8a0a;
  --warn: #9a6b16;
  --warn-soft: rgba(154, 107, 22, .12);
  --bad: #c2453c;
  --bad-soft: rgba(194, 69, 60, .10);

  --shadow-sm: 0 1px 2px rgba(20, 30, 16, .05), 0 2px 8px rgba(20, 30, 16, .05);
  --shadow: 0 16px 40px rgba(20, 30, 16, .12);
}
html[data-theme="light"] body {
  background:
    radial-gradient(620px 420px at 100% -80px, rgba(124, 180, 20, .10), transparent 60%),
    radial-gradient(700px 500px at -10% 0, rgba(124, 180, 20, .05), transparent 55%),
    var(--bg);
}
html[data-theme="light"] .seg button.on { background: #fff; box-shadow: var(--shadow-sm); }
html[data-theme="light"] .nav-bottom .nav-link.active { text-shadow: none; }
html[data-theme="light"] ::selection { background: rgba(124, 180, 20, .22); color: #16230a; }

* { box-sizing: border-box; }
html, body { height: 100%; }
html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }
body {
  margin: 0; color: var(--text);
  background:
    radial-gradient(620px 420px at 100% -80px, rgba(198,255,58,.10), transparent 60%),
    radial-gradient(700px 500px at -10% 0, rgba(120,180,255,.05), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  font-family: var(--font-body);
  font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
.hidden { display: none !important; }
.ic { display: inline-block; vertical-align: middle; flex: 0 0 auto; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-dim); }
.center { text-align: center; }
.mt { margin-top: 14px; } .mt-s { margin-top: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.big { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.row-ico { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 1fr; min-height: 100%; }
.content { min-width: 0; }
.sidebar { display: none; }
.main {
  padding: 14px calc(var(--sar) + 16px) calc(var(--sab) + var(--bottom-nav-h) + 26px) calc(var(--sal) + 16px);
  max-width: 720px; margin: 0 auto; width: 100%; outline: none;
}

/* ---------- Top bar (mobile) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--sat) + 9px) calc(var(--sar) + 16px) 9px calc(var(--sal) + 16px);
  height: calc(var(--topbar-h) + var(--sat));
  background: var(--chrome-bg); backdrop-filter: saturate(140%) blur(14px); -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--accent-grad); position: relative; flex: 0 0 auto; box-shadow: var(--glow); }
.brand-mark::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; border: 2px solid var(--bg); }
.brand-lines { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; letter-spacing: -.2px; }
.brand-sub { font-size: .61rem; letter-spacing: 1.6px; text-transform: uppercase; color: var(--text-faint); font-weight: 700; }

/* ---------- Navigation ---------- */
.nav-bottom {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; display: flex; justify-content: space-around; align-items: stretch;
  background: var(--chrome-bg); backdrop-filter: saturate(140%) blur(16px); -webkit-backdrop-filter: saturate(140%) blur(16px);
  border-top: 1px solid var(--line); padding-bottom: var(--sab); height: calc(var(--bottom-nav-h) + var(--sab));
}
.nav-bottom .nav-link {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: .66rem; color: var(--text-faint); padding: 8px 2px; min-width: 0; font-weight: 600; position: relative;
}
.nav-link.active { color: var(--accent); }
.nav-bottom .nav-link.active { text-shadow: 0 0 12px rgba(198,255,58,.5); }
.nav-bottom .nav-link.active::before { content: ""; position: absolute; top: 0; width: 22px; height: 2.5px; border-radius: 0 0 3px 3px; background: var(--accent); box-shadow: var(--glow); }
.nav-bottom .nav-link .ic { width: 23px; height: 23px; }

/* ---------- Headings / sections ---------- */
.page-head { margin: 6px 0 16px; }
.page-head h1 { font-family: var(--font-display); font-size: 1.7rem; margin: 0 0 3px; letter-spacing: -.8px; font-weight: 700; }
.page-head .sub { color: var(--text-dim); font-size: .95rem; }
.section-title { font-size: .73rem; text-transform: uppercase; letter-spacing: 1.4px; color: var(--text-faint); margin: 24px 2px 10px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ""; width: 13px; height: 2px; border-radius: 2px; background: var(--accent); box-shadow: var(--glow); flex: 0 0 auto; }

/* ---------- Cards (glass) ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 14px; }

/* ---------- Coach ---------- */
.coach { display: flex; gap: 13px; align-items: flex-start; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); }
.coach .coach-ico { width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: 0 0 auto; box-shadow: inset 0 0 12px rgba(198,255,58,.15); }
.coach .coach-body { min-width: 0; }
.coach .coach-label { font-size: .67rem; text-transform: uppercase; letter-spacing: 1.2px; font-weight: 700; color: var(--accent); }
.coach .coach-text { font-size: .95rem; margin-top: 3px; color: var(--text); }

/* ---------- Hero ---------- */
.hero { display: flex; gap: 18px; align-items: center; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; width: 240px; height: 240px; right: -70px; top: -90px; border-radius: 50%; background: radial-gradient(circle, rgba(198,255,58,.18), transparent 68%); pointer-events: none; }
.hero .ring-wrap { flex: 0 0 auto; position: relative; }
.hero .hero-info { min-width: 0; position: relative; }
.hero .eyebrow { font-size: .65rem; text-transform: uppercase; letter-spacing: 1.3px; color: var(--text-faint); font-weight: 700; }
.hero .big { font-family: var(--font-display); font-size: 2.7rem; line-height: 1; margin-top: 3px; letter-spacing: -1.5px; }
.hero .unit { font-size: 1rem; color: var(--text-dim); font-weight: 600; }
.hero .label { color: var(--text-dim); font-size: .9rem; margin-top: 6px; }
.hero .delta { font-weight: 700; font-size: .85rem; margin-top: 8px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.hero .delta.good { color: var(--accent); border-color: rgba(198,255,58,.3); background: var(--accent-soft); }
.hero .delta.bad { color: var(--bad); background: var(--bad-soft); border-color: rgba(255,107,94,.3); }
.js-ring { transition: stroke-dashoffset 1.1s cubic-bezier(.16, 1, .3, 1); filter: drop-shadow(0 0 5px rgba(198,255,58,.45)); }

/* ---------- Mini rings ---------- */
.goal-rings { display: flex; justify-content: space-around; gap: 10px; }
.mini-ring { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.mini-label { font-size: .72rem; color: var(--text-dim); text-align: center; font-weight: 600; }

/* ---------- Level ---------- */
.lvl-badge { display: inline-block; background: var(--accent-grad); color: var(--accent-ink); font-family: var(--font-display); font-size: .68rem; font-weight: 700; letter-spacing: .5px; padding: 3px 8px; border-radius: 6px; vertical-align: middle; box-shadow: var(--glow); }
.lvl-badge.lg { font-size: .9rem; padding: 7px 12px; border-radius: 9px; }
.level-card .big { font-size: 1.5rem; }

/* ---------- Tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 15px; backdrop-filter: blur(8px); }
.tile .t-ico { color: var(--accent); margin-bottom: 8px; }
.tile .t-val { font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; letter-spacing: -.6px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.tile .t-val.good { color: var(--accent); } .tile .t-val.warn { color: var(--warn); } .tile .t-val.bad { color: var(--bad); }
.tile .t-label { color: var(--text-dim); font-size: .74rem; margin-top: 4px; }

/* ---------- Streaks ---------- */
.streak-row { display: flex; gap: 12px; }
.streak { flex: 1; border-radius: var(--radius-sm); padding: 15px; border: 1px solid var(--line); background: var(--surface); }
.streak.lit { border-color: rgba(198,255,58,.35); background: var(--accent-soft); box-shadow: inset 0 0 20px rgba(198,255,58,.08); }
.streak .s-top { display: flex; align-items: center; gap: 9px; }
.streak .s-ico { color: var(--text-faint); }
.streak.lit .s-ico { color: var(--accent); }
.streak .s-num { font-family: var(--font-display); font-size: 1.85rem; font-weight: 700; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.streak.lit .s-num { color: var(--accent); }
.streak .s-label { color: var(--text-dim); font-size: .8rem; margin-top: 2px; }
.streak .s-best { color: var(--text-faint); font-size: .7rem; margin-top: 3px; }

/* ---------- Habit blocks ---------- */
.habit-head { display: flex; align-items: center; gap: 11px; }
.habit-head .ic { color: var(--accent); }
.habit-head .h-title { font-weight: 700; }
.habit-head .h-sub { color: var(--text-dim); font-size: .8rem; }

/* segmented control */
.seg { display: flex; gap: 5px; background: var(--surface-2); border: 1px solid var(--line); padding: 4px; border-radius: 12px; }
.seg.seg-wrap { flex-wrap: wrap; }
.seg.seg-wrap button { flex: 1 1 28%; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--text-dim); padding: 11px 8px; border-radius: 9px; font-weight: 700; cursor: pointer; font-size: .88rem; transition: all .15s; min-width: 0; font-variant-numeric: tabular-nums; }
.seg button.on { background: var(--surface-3); color: var(--text); }
.seg button.on.good { background: var(--accent); color: var(--accent-ink); box-shadow: var(--glow); }
.seg button.on.bad { background: var(--bad); color: #1a0a08; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .82rem; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.input, select, textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text);
  border-radius: var(--radius-sm); padding: 13px 14px; font-size: 1rem; outline: none;
  transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.input::placeholder, textarea::placeholder { color: #5b6166; }
.input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 70px; }
.input-row { display: flex; gap: 10px; }
.input-row > * { flex: 1; min-width: 0; }
.input-suffix { position: relative; }
.input-suffix .sfx { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: .85rem; pointer-events: none; }
.input-time { width: auto; }
.hint { color: var(--text-faint); font-size: .8rem; margin-top: 6px; }
select { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%239aa2a6' d='M6 8 0 0h12z'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
option { color: #111; }

/* reminder rows / switch */
.reminder-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: .92rem; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); padding: 13px 18px; border-radius: var(--radius-sm); font-size: .96rem; font-weight: 700; cursor: pointer; transition: transform .05s, filter .15s, background .15s; width: 100%; }
.btn:active { transform: scale(.985); }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--accent-grad); color: var(--accent-ink); border-color: transparent; box-shadow: var(--glow); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); padding-left: 4px; justify-content: flex-start; }
.btn-danger { background: var(--bad-soft); border-color: rgba(255,107,94,.3); color: var(--bad); }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { width: auto; flex: 1; }
.btn-sm { padding: 9px 14px; font-size: .85rem; width: auto; }
.stepper { display: inline-flex; gap: 6px; }

/* workout list (multiple sessions/day) */
.wo-list { display: flex; flex-direction: column; gap: 8px; }
.wo-list:empty { display: none; }
.wo-item { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.wo-item .wo-ic { color: var(--accent); }
.wo-item .wo-meta { flex: 1; min-width: 0; font-size: .92rem; }
.wo-item .wo-meta b { font-weight: 700; }
.wo-del { border: 0; background: transparent; color: var(--text-faint); cursor: pointer; padding: 4px; display: inline-flex; }
.wo-del:hover { color: var(--bad); }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-dim); }
.pill.good { color: var(--accent); background: var(--accent-soft); border-color: rgba(198,255,58,.3); }
.pill.warn { color: var(--warn); background: var(--warn-soft); border-color: rgba(255,206,77,.3); }
.pill.bad { color: var(--bad); background: var(--bad-soft); border-color: rgba(255,107,94,.3); }

/* ---------- Quote / callout ---------- */
.quote { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); font-size: 1rem; line-height: 1.5; }
.quote .q-author { display: block; margin-top: 8px; color: var(--text-faint); font-size: .8rem; font-weight: 600; }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 15px; border-radius: var(--radius-sm); background: var(--accent-soft); border: 1px solid rgba(198,255,58,.22); }
.callout .c-ico { color: var(--accent); flex: 0 0 auto; margin-top: 1px; }
.callout .c-body { font-size: .92rem; }
.callout.warn { background: var(--warn-soft); border-color: rgba(255,206,77,.25); }
.callout.warn .c-ico { color: var(--warn); }
.callout.plain { background: var(--surface-2); border-color: var(--line); }
.callout.plain .c-ico { color: var(--text-dim); }

/* ---------- Progress bars ---------- */
.bar { height: 9px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent-grad); border-radius: 999px; box-shadow: var(--glow); transition: width 1s cubic-bezier(.16,1,.3,1); }

/* ---------- Charts ---------- */
.chart-wrap { width: 100%; }
.chart-wrap canvas { width: 100%; display: block; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; color: var(--text-dim); font-size: .8rem; }
.chart-legend i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* heatmap */
.heat { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.heat .cell { aspect-ratio: 1; border-radius: 4px; background: var(--surface-2); }
.heat .cell.l3 { background: var(--accent); box-shadow: 0 0 8px rgba(198,255,58,.4); }
.heat .cell.miss { background: var(--bad-soft); border: 1px solid rgba(255,107,94,.3); }
.heat .cell.future { background: transparent; border: 1px dashed var(--line-strong); }

/* ---------- Achievements ---------- */
.ach-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.ach { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 15px; background: var(--surface); position: relative; backdrop-filter: blur(8px); }
.ach .a-ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-faint); margin-bottom: 10px; }
.ach.unlocked { border-color: rgba(198,255,58,.32); }
.ach.unlocked .a-ico { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 12px rgba(198,255,58,.18); }
.ach.locked { opacity: .72; }
.ach .a-title { font-weight: 700; font-size: .92rem; }
.ach .a-desc { color: var(--text-dim); font-size: .76rem; margin-top: 2px; }
.ach .a-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; }
.ach .xp { font-size: .72rem; font-weight: 800; color: var(--accent); }
.ach .a-prog { margin-top: 7px; }
.ach .a-badge { position: absolute; top: 13px; right: 13px; color: var(--accent); }

/* ---------- Rows ---------- */
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .r-main { font-weight: 600; }
.row .r-sub { color: var(--text-dim); font-size: .82rem; margin-top: 2px; }
.row .chev { color: var(--text-faint); }

/* ---------- Sync status ---------- */
.sync-status { display: inline-flex; align-items: center; gap: 7px; font-size: .76rem; color: var(--text-dim); font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.sync-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); flex: 0 0 auto; }
.sync-status.ok .dot { background: var(--accent); box-shadow: var(--glow); }
.sync-status.syncing .dot { background: var(--warn); animation: pulse 1s infinite; }
.sync-status.error .dot { background: var(--bad); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; transform: translateX(-50%) translateY(16px); bottom: calc(var(--bottom-nav-h) + var(--sab) + 16px); z-index: 100; background: var(--surface-solid); color: #fff; padding: 12px 18px; border-radius: 12px; border: 1px solid var(--line-strong); box-shadow: var(--shadow); font-weight: 600; font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: 90vw; text-align: center; display: flex; align-items: center; gap: 9px; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--accent-grad); color: var(--accent-ink); border-color: transparent; box-shadow: var(--glow); }
.toast .ic { width: 18px; height: 18px; }

/* ---------- Empty ---------- */
.empty { text-align: center; color: var(--text-dim); padding: 26px 16px; }
.empty .ic { color: var(--text-faint); margin-bottom: 8px; }

/* ---------- Simulation ---------- */
.sim-cta { display: flex; align-items: center; gap: 14px; text-decoration: none; border-color: rgba(198,255,58,.30); }
.sim-cta-ico { width: 44px; height: 44px; border-radius: 12px; flex: 0 0 auto; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 16px rgba(198,255,58,.18); }
.sim-cta-body { flex: 1; min-width: 0; }
.sim-cta .h-title { font-weight: 700; }
.sim-cta .h-sub { color: var(--text-dim); font-size: .82rem; margin-top: 1px; }

.sim-hero { display: flex; gap: 18px; align-items: center; }
.sim-body { flex: 0 0 auto; }
.sim-figure { display: block; }
.sim-figure path, .sim-figure circle { transition: d .5s cubic-bezier(.16,1,.3,1); filter: drop-shadow(0 0 12px rgba(198,255,58,.45)); }
.sim-stats { min-width: 0; }
.sim-stats .big { font-size: 2.6rem; }
.sim-line { font-size: .92rem; color: var(--text); margin-top: 4px; }
.sim-line.muted { color: var(--text-dim); }
.sim-stats .pill { margin-top: 10px; }

.sim-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; margin: 22px 0 6px; background: linear-gradient(90deg, var(--accent) 0%, var(--surface-3) 0%); outline: none; }
.sim-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-grad); box-shadow: var(--glow); cursor: pointer; border: 3px solid var(--bg); }
.sim-slider::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #c6ff3a; border: 3px solid var(--bg); cursor: pointer; }
.sim-scale { display: flex; justify-content: space-between; font-size: .72rem; color: var(--text-faint); font-weight: 600; }
.sim-lost { margin-top: 14px; font-size: 1.02rem; }
.sim-lost strong { color: var(--accent); font-size: 1.3rem; font-family: var(--font-display); }

/* ---------- Auth / Login ---------- */
.auth { min-height: calc(100vh - 56px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px 4px; text-align: center; }
.auth-card { width: 100%; max-width: 384px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 24px; backdrop-filter: blur(10px); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.auth-card::before { content: ""; position: absolute; width: 240px; height: 240px; left: 50%; top: -130px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(circle, rgba(198,255,58,.16), transparent 68%); pointer-events: none; }
.auth-brand { display: flex; justify-content: center; position: relative; }
.auth-mark { width: 60px; height: 60px; border-radius: 18px; }
.auth-mark::after { inset: 17px; border-width: 3px; }
.auth-name { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; letter-spacing: -.5px; margin-top: 16px; }
.auth-tag { font-size: .63rem; letter-spacing: 2px; text-transform: uppercase; color: var(--text-faint); font-weight: 700; margin-top: 3px; }
.auth-h { font-family: var(--font-display); font-size: 1.28rem; font-weight: 700; margin: 24px 0 6px; letter-spacing: -.4px; }
.auth-sub { color: var(--text-dim); font-size: .9rem; margin-bottom: 22px; line-height: 1.5; }
.auth-card .field { text-align: left; margin-bottom: 12px; }
.auth-err { color: var(--bad); font-size: .85rem; min-height: 18px; margin-top: 10px; }
.auth-skip { display: inline-block; margin-top: 6px; background: transparent; border: 0; color: var(--text-dim); font-weight: 600; font-size: .88rem; cursor: pointer; padding: 8px; }
.auth-skip:hover { color: var(--text); }
.auth-foot { display: inline-flex; align-items: center; gap: 7px; color: var(--text-faint); font-size: .78rem; }
.auth-foot .ic { color: var(--accent); }

body[data-screen="login"] .nav-bottom,
body[data-screen="login"] .topbar,
body[data-screen="login"] .sidebar { display: none !important; }
body[data-screen="login"] .app { grid-template-columns: 1fr; }
body[data-screen="login"] .main { padding: 0 16px; }

/* =========================================================================
   Desktop
   ========================================================================= */
@media (min-width: 880px) {
  .app { grid-template-columns: 256px 1fr; }
  .sidebar { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 0; align-self: start; height: 100vh; padding: 24px 16px; border-right: 1px solid var(--line); background: var(--surface); }
  .nav-side { display: flex; flex-direction: column; gap: 4px; margin-top: 22px; }
  .nav-side .nav-link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px; color: var(--text-dim); font-weight: 600; transition: background .15s, color .15s; }
  .nav-side .nav-link:hover { background: var(--surface-2); color: var(--text); }
  .nav-side .nav-link.active { background: var(--accent-soft); color: var(--accent); }
  .nav-side .nav-link .ic { width: 20px; height: 20px; }
  .sidebar-foot { margin-top: auto; }
  .topbar { display: none; }
  .nav-bottom { display: none; }
  .main { padding: 34px 36px 48px; max-width: 880px; }
  .toast { bottom: 24px; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .ach-grid { grid-template-columns: repeat(3, 1fr); }
  .page-head h1 { font-size: 1.95rem; }
}
@media (min-width: 560px) and (max-width: 879px) {
  .ach-grid { grid-template-columns: repeat(3, 1fr); }
  .tiles { grid-template-columns: repeat(4, 1fr); }
}

/* =========================================================================
   Motion
   ========================================================================= */
::selection { background: rgba(198,255,58,.25); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
@keyframes riseIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.main > * { animation: riseIn .55s cubic-bezier(.16, 1, .3, 1) both; }
.main > *:nth-child(1) { animation-delay: 0s; }
.main > *:nth-child(2) { animation-delay: .05s; }
.main > *:nth-child(3) { animation-delay: .10s; }
.main > *:nth-child(4) { animation-delay: .15s; }
.main > *:nth-child(5) { animation-delay: .20s; }
.main > *:nth-child(6) { animation-delay: .24s; }
.main > *:nth-child(7) { animation-delay: .28s; }
.main > *:nth-child(8) { animation-delay: .31s; }
.main > *:nth-child(n+9) { animation-delay: .34s; }
.chart-wrap canvas { animation: riseIn .6s ease both; }
.card, .tile, .streak, .ach { transition: box-shadow .22s, border-color .22s; }
@media (hover: hover) and (min-width: 880px) {
  .card:hover, .tile:hover, .streak:hover, .ach:hover { border-color: var(--line-strong); }
  .row:hover { padding-left: 4px; transition: padding-left .15s; }
}
@media (prefers-reduced-motion: reduce) {
  *, .main > * { animation-duration: .001ms !important; animation-delay: 0 !important; transition-duration: .001ms !important; }
}
