/* Карта желаний — design tokens + base */

:root {
  /* ── DARK (default per TZ) ── */
  --bg-app: #0F0F1A;
  --bg-app-2: #14142A;
  --bg-card: #1A1A2E;
  --bg-card-hover: #242440;
  --bg-elev: #20203A;
  --border: #2E2E52;
  --border-strong: #3D3D6A;
  --border-subtle: rgba(255,255,255,0.06);
  --text-primary: #F2F2FA;
  --text-secondary: rgba(242, 242, 250, 0.72);
  --text-tertiary: rgba(242, 242, 250, 0.45);
  --text-quat: rgba(242, 242, 250, 0.28);

  --accent: #6C3FE8;
  --accent-2: #A78BFA;
  --accent-soft: rgba(108, 63, 232, 0.18);
  --accent-ring: rgba(108, 63, 232, 0.45);
  --gold: #F5A623;
  --gold-2: #FBBF24;

  /* 8 life zones */
  --z-health: #22D3A3;
  --z-family: #F472B6;
  --z-career: #60A5FA;
  --z-finance: #A78BFA;
  --z-growth: #FB923C;
  --z-leisure: #34D399;
  --z-env: #E879F9;
  --z-spirit: #FBBF24;

  --success: #34D399;
  --error: #F87171;
  --warning: #FBBF24;

  /* radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 24px;
  --r-pill: 9999px;

  /* typography */
  --font-display: 'Manrope', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --shadow-card: 0 1px 0 rgba(255,255,255,0.03) inset, 0 8px 24px rgba(0,0,0,0.32);
  --shadow-pop: 0 24px 48px rgba(0,0,0,0.45), 0 0 0 1px var(--border);

  --glow-mult: 1;
  --pad: 16px;
  --gap: 16px;

  /* viewport scale (set by JS) */
  --vp-scale: 1;
}

/* ── Light theme ── */
[data-theme="light"] {
  --bg-app: #F7F7FB;
  --bg-app-2: #ECECF5;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F2F2FA;
  --bg-elev: #FFFFFF;
  --border: #E5E5F0;
  --border-strong: #D0D0E0;
  --border-subtle: rgba(15,15,40,0.06);
  --text-primary: #14142A;
  --text-secondary: rgba(20, 20, 42, 0.72);
  --text-tertiary: rgba(20, 20, 42, 0.5);
  --text-quat: rgba(20, 20, 42, 0.3);
  --accent-soft: rgba(108, 63, 232, 0.10);
  --shadow-card: 0 1px 2px rgba(15, 15, 40, 0.04), 0 6px 18px rgba(15, 15, 40, 0.06);
  --shadow-pop: 0 18px 36px rgba(15, 15, 40, 0.12), 0 0 0 1px var(--border);
}

/* ── Style: Minimal ── */
[data-style="minimal"] {
  --bg-card: var(--bg-app-2);
  --bg-card-hover: var(--bg-app);
  --glow-mult: 0;
  --shadow-card: 0 0 0 1px var(--border-subtle);
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 14px;
  --r-2xl: 16px;
}
[data-theme="dark"][data-style="minimal"] {
  --accent: #E2DCFF;
  --accent-2: #F2EFFF;
  --bg-app: #0B0B14;
  --bg-app-2: #131322;
  --bg-card: #131322;
}

/* ── Style: Neo-brutal ── */
[data-style="brutal"] {
  --r-sm: 2px;
  --r-md: 4px;
  --r-lg: 4px;
  --r-xl: 6px;
  --r-2xl: 6px;
  --r-pill: 6px;
  --border: var(--text-primary);
  --shadow-card: 5px 5px 0 var(--text-primary);
  --shadow-pop: 8px 8px 0 var(--text-primary);
  --glow-mult: 0;
}
[data-theme="dark"][data-style="brutal"] {
  --bg-app: #FFF8E7;
  --bg-app-2: #FEEFD3;
  --bg-card: #FFF;
  --bg-card-hover: #FEEFD3;
  --border: #14142A;
  --text-primary: #14142A;
  --text-secondary: rgba(20, 20, 42, 0.78);
  --text-tertiary: rgba(20, 20, 42, 0.5);
  --text-quat: rgba(20, 20, 42, 0.32);
  --accent: #FF5C2B;
  --accent-2: #FF7A4D;
  --accent-soft: rgba(255, 92, 43, 0.18);
}

/* ── Style: Glass ── */
[data-style="glass"] {
  --bg-card: rgba(255, 255, 255, 0.06);
  --bg-card-hover: rgba(255, 255, 255, 0.10);
  --bg-elev: rgba(255, 255, 255, 0.10);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.20);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.10) inset, 0 12px 36px rgba(0,0,0,0.4);
}
[data-style="glass"][data-theme="dark"] {
  --bg-app: #1A0B2E;
  --bg-app-2: #2D1645;
}
[data-style="glass"][data-theme="light"] {
  --bg-card: rgba(255, 255, 255, 0.55);
  --bg-card-hover: rgba(255, 255, 255, 0.75);
  --bg-elev: rgba(255, 255, 255, 0.85);
  --border: rgba(255, 255, 255, 0.6);
  --border-strong: rgba(20, 20, 42, 0.12);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.8) inset, 0 12px 36px rgba(15, 15, 40, 0.12);
}

/* ── Reset + base ── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: #07070F;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.display { font-family: var(--font-display); letter-spacing: -0.02em; }

/* ── Stage (page wrapper) ── */
.stage {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(108, 63, 232, 0.10), transparent 70%),
    radial-gradient(ellipse 70% 50% at 90% 100%, rgba(244, 114, 182, 0.08), transparent 70%),
    #07070F;
  padding: 32px 24px 80px;
}
.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1700px;
  margin: 0 auto 28px;
  color: rgba(255,255,255,0.86);
  font-family: var(--font-display);
}
.stage-head .title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.stage-head .sub {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}
.stage-head .crumbs {
  display: flex; gap: 8px; align-items: center;
  font-family: var(--font-mono); font-size: 11px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.stage-head .crumbs .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 12px #34D399;
}

.viewports {
  max-width: 1700px;
  margin: 0 auto;
  display: flex;
  gap: 32px;
  align-items: flex-start;
  justify-content: center;
  transform-origin: top center;
}
.vp-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.vp-label .pill {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 9999px;
  padding: 2px 8px;
  color: rgba(255,255,255,0.65);
}

/* ── App shell ── */
.app {
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-body);
  width: 100%;
  height: 100%;
  display: flex;
  overflow: hidden;
}
[data-style="glass"] .app {
  background:
    radial-gradient(ellipse 50% 50% at 10% 10%, rgba(108, 63, 232, 0.25), transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 90%, rgba(244, 114, 182, 0.20), transparent 60%),
    var(--bg-app);
}
[data-style="brutal"] .app {
  background:
    repeating-linear-gradient(45deg, transparent 0 22px, rgba(20,20,42,0.025) 22px 23px),
    var(--bg-app);
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-app-2);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  gap: 4px;
}
[data-style="glass"] .sidebar { background: rgba(0,0,0,0.18); }
[data-style="brutal"] .sidebar { background: var(--bg-app); border-right: 2px solid var(--border); }

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 18px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.sidebar-brand .logo {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 0 calc(20px * var(--glow-mult)) var(--accent-ring);
}
.sidebar-brand .grp {
  font-size: 10px; color: var(--text-tertiary);
  font-family: var(--font-mono); letter-spacing: 0.08em;
  text-transform: uppercase; font-weight: 500;
  display: block; margin-top: 1px;
}

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  position: relative;
  transition: background 120ms ease, color 120ms ease;
}
.nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--border);
}
.nav-item.active::before {
  content: ''; position: absolute; left: -16px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 calc(10px * var(--glow-mult)) var(--accent);
}
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.nav-item .badge {
  margin-left: auto; font-family: var(--font-mono); font-size: 10px;
  background: var(--accent); color: #fff;
  padding: 1px 6px; border-radius: 9999px;
}
.nav-section {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-quat);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 14px 12px 6px;
}

.sidebar .members {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
}
.sidebar .member {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border-radius: var(--r-md);
  font-size: 13px;
}
.sidebar .member .name { flex: 1; }
.sidebar .member .lvl {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
  background: rgba(255,255,255,0.04);
  padding: 1px 5px; border-radius: 4px;
}
[data-theme="light"] .sidebar .member .lvl { background: rgba(0,0,0,0.04); }

/* ── Content ── */
.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
.content::-webkit-scrollbar { width: 10px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
}
[data-theme="light"] .content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0; z-index: 4;
  background: color-mix(in oklab, var(--bg-app) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
[data-style="brutal"] .topbar { background: var(--bg-app); }

.topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.topbar .breadcrumb {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 2px;
}
.topbar-spacer { flex: 1; }
.topbar .search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 7px 12px;
  font-size: 13px; color: var(--text-tertiary);
  min-width: 220px;
}
.topbar .icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  position: relative;
}
.topbar .icon-btn:hover { background: var(--bg-card-hover); }
.topbar .icon-btn .pip {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--error);
  box-shadow: 0 0 8px var(--error);
}

.main {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  padding: 24px 28px;
  flex: 1;
  min-height: 0;
}
.main.no-rail { grid-template-columns: 1fr; }
.main-col { min-width: 0; }
.right-rail { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ── Card ── */
.card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  padding: var(--pad);
  position: relative;
}
[data-style="glass"] .card { backdrop-filter: blur(20px) saturate(140%); -webkit-backdrop-filter: blur(20px) saturate(140%); }
.card.flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.card-head .ttl {
  font-family: var(--font-display);
  font-weight: 700; font-size: 15px;
  letter-spacing: -0.01em;
}
.card-head .more {
  color: var(--text-tertiary); font-size: 12px;
  font-family: var(--font-mono);
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-radius: var(--r-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 500;
  font-size: 13.5px;
  transition: background 120ms, transform 80ms;
}
.btn:hover { background: var(--bg-card-hover); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 calc(20px * var(--glow-mult)) var(--accent-ring);
}
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-card-hover); }
[data-style="brutal"] .btn { font-weight: 600; border-width: 2px; box-shadow: 3px 3px 0 var(--border); }
[data-style="brutal"] .btn:active { box-shadow: 0 0 0 var(--border); transform: translate(3px, 3px); }
[data-style="brutal"] .btn.primary { box-shadow: 3px 3px 0 var(--border); }

/* ── Zone color helpers ── */
.zone-h { --zc: var(--z-health); }
.zone-fam { --zc: var(--z-family); }
.zone-car { --zc: var(--z-career); }
.zone-fin { --zc: var(--z-finance); }
.zone-gr { --zc: var(--z-growth); }
.zone-lei { --zc: var(--z-leisure); }
.zone-env { --zc: var(--z-env); }
.zone-spi { --zc: var(--z-spirit); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: color-mix(in oklab, var(--zc, var(--accent)) 16%, transparent);
  color: var(--zc, var(--accent));
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid color-mix(in oklab, var(--zc, var(--accent)) 35%, transparent);
  font-family: var(--font-body);
}
[data-style="brutal"] .chip {
  background: var(--zc, var(--accent));
  color: #fff;
  border-color: var(--border);
  font-weight: 700;
}
.chip .glyph { font-size: 11px; }

/* ── Wish card ── */
.wish {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--zc, var(--accent));
  border-radius: var(--r-lg);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
  position: relative;
  transition: transform 150ms, box-shadow 150ms, border-color 150ms;
  cursor: grab;
}
.wish:hover {
  border-color: color-mix(in oklab, var(--zc, var(--accent)) 60%, var(--border));
  box-shadow:
    0 0 calc(20px * var(--glow-mult)) color-mix(in oklab, var(--zc, var(--accent)) 35%, transparent),
    var(--shadow-card);
  transform: translateY(-2px);
}
.wish.dragging {
  transform: rotate(2deg) scale(1.03);
  box-shadow:
    0 0 28px color-mix(in oklab, var(--zc, var(--accent)) 50%, transparent),
    0 24px 48px rgba(0,0,0,0.5);
  cursor: grabbing;
  z-index: 10;
}
.wish .cover {
  height: 86px;
  border-radius: var(--r-md);
  position: relative;
  overflow: hidden;
  margin: -2px -2px 0;
  background:
    radial-gradient(ellipse 80% 100% at 50% 100%, color-mix(in oklab, var(--zc) 22%, transparent), transparent 80%),
    color-mix(in oklab, var(--zc) 8%, var(--bg-elev));
  display: grid; place-items: center;
  font-size: 36px;
  color: color-mix(in oklab, var(--zc) 80%, transparent);
  border: 1px solid var(--border-subtle);
}
[data-style="brutal"] .wish .cover { background: var(--zc); color: #fff; }
.wish .title {
  font-family: var(--font-display);
  font-weight: 700; font-size: 14.5px;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.wish .meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 11.5px; color: var(--text-tertiary);
  font-family: var(--font-mono);
}
.wish .meta .due { display: inline-flex; align-items: center; gap: 4px; }
.wish .meta .due.overdue { color: var(--error); }
.wish .progress { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.wish .progress > i { display: block; height: 100%; background: var(--zc); border-radius: 2px; transition: width 240ms; }
.wish-foot {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; color: var(--text-tertiary);
}
.wish-foot .step-count {
  font-family: var(--font-mono);
}
.wish-foot .step-count b { color: var(--text-primary); font-weight: 600; }

/* avatar stack */
.av-stack { display: flex; }
.av-stack .av { margin-left: -8px; border: 2px solid var(--bg-card); }
.av-stack .av:first-child { margin-left: 0; }

.av {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-display);
  flex-shrink: 0;
}
.av.sm { width: 20px; height: 20px; font-size: 10px; }
.av.md { width: 32px; height: 32px; font-size: 12px; }
.av.lg { width: 48px; height: 48px; font-size: 16px; }
.av.xl { width: 72px; height: 72px; font-size: 22px; }

/* ── Zone tile ── */
.zone-tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
  position: relative;
  overflow: hidden;
  transition: transform 150ms, box-shadow 150ms, border-color 150ms;
  cursor: pointer;
}
.zone-tile::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 100% 70% at 0% 0%, color-mix(in oklab, var(--zc) 14%, transparent), transparent 60%);
  pointer-events: none;
}
.zone-tile:hover {
  transform: translateY(-2px);
  border-color: color-mix(in oklab, var(--zc) 60%, var(--border));
  box-shadow: 0 0 calc(24px * var(--glow-mult)) color-mix(in oklab, var(--zc) 30%, transparent);
}
.zone-tile .head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.zone-tile .glyph {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  font-size: 16px;
  background: color-mix(in oklab, var(--zc) 20%, transparent);
  color: var(--zc);
  border: 1px solid color-mix(in oklab, var(--zc) 30%, transparent);
}
.zone-tile .nm {
  font-family: var(--font-display); font-weight: 700;
  font-size: 14px; letter-spacing: -0.01em;
}
.zone-tile .ct { font-size: 11px; color: var(--text-tertiary); font-family: var(--font-mono); }
.zone-tile .ring { margin: 6px 0; }
.zone-tile .foot {
  display: flex; align-items: center; gap: 10px;
  font-size: 11.5px; color: var(--text-secondary);
}
.zone-tile .foot .delta {
  font-family: var(--font-mono); font-size: 11px;
  padding: 1px 6px; border-radius: 4px;
  background: color-mix(in oklab, var(--zc) 20%, transparent);
  color: var(--zc);
}

/* ── XP bar ── */
.xp-bar {
  position: relative; height: 8px;
  background: var(--border);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.xp-bar > i {
  position: absolute; inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: var(--r-pill);
  box-shadow: 0 0 calc(12px * var(--glow-mult)) var(--accent-ring);
}

/* ── Badge ── */
.badge-cell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 10px;
  text-align: center;
  position: relative;
  transition: transform 150ms, border-color 150ms, box-shadow 150ms;
}
.badge-cell.locked { opacity: 0.45; filter: grayscale(1); }
.badge-cell:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.badge-cell .glyph {
  width: 52px; height: 52px; margin: 0 auto 6px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 22px;
  background: radial-gradient(circle at 30% 30%, var(--rar-2, #FBBF24), var(--rar-1, #F5A623));
  box-shadow: 0 0 calc(16px * var(--glow-mult)) color-mix(in oklab, var(--rar-1, #F5A623) 50%, transparent);
}
.badge-cell.locked .glyph { background: var(--border); box-shadow: none; }
.badge-cell .nm { font-size: 12px; font-weight: 600; line-height: 1.2; }
.badge-cell .desc { font-size: 10.5px; color: var(--text-tertiary); margin-top: 2px; }

.rarity-common { --rar-1: #94A3B8; --rar-2: #CBD5E1; }
.rarity-uncommon { --rar-1: #34D399; --rar-2: #6EE7B7; }
.rarity-rare { --rar-1: #60A5FA; --rar-2: #93C5FD; }
.rarity-epic { --rar-1: #A78BFA; --rar-2: #C4B5FD; }
.rarity-legendary { --rar-1: #F59E0B; --rar-2: #FCD34D; }

/* ── Heatmap ── */
.heatmap {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 13px);
  grid-auto-columns: 13px;
  gap: 3px;
}
.heatmap .cell {
  border-radius: 3px;
  background: color-mix(in oklab, var(--zc, var(--accent)) calc(var(--l, 0) * 100%), var(--border));
  transition: transform 100ms;
}
.heatmap .cell:hover { transform: scale(1.4); }
.heatmap.compact { grid-template-rows: repeat(7, 9px); grid-auto-columns: 9px; gap: 2px; }
.heatmap.compact .cell { border-radius: 2px; }

/* ── Stream / feed ── */
.feed-item {
  display: flex; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.feed-item:last-child { border-bottom: 0; }
.feed-item .when { color: var(--text-tertiary); font-size: 11px; font-family: var(--font-mono); }
.feed-item .body { flex: 1; }
.feed-item .body strong { font-weight: 600; }
.feed-item .body .accent { color: var(--accent); font-weight: 600; }

/* ── Step (goal step) ── */
.step {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-md);
}
.step:hover { background: var(--bg-card-hover); }
.step .box {
  width: 20px; height: 20px; border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: background 120ms, border-color 120ms;
}
.step.done .box {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.step .text { flex: 1; font-size: 13.5px; }
.step.done .text { text-decoration: line-through; color: var(--text-tertiary); }
.step .due { font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); }
.step .due.overdue { color: var(--error); }

/* ── Toast ── */
.toast-stack {
  position: absolute; right: 16px; bottom: 16px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 10px 14px;
  font-size: 13px;
  display: flex; gap: 10px; align-items: center;
  box-shadow: var(--shadow-pop);
  animation: toast-in 280ms cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative; overflow: hidden;
  min-width: 220px;
}
.toast .xp {
  font-family: var(--font-mono); font-weight: 700;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.toast::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px; background: var(--accent);
  animation: toast-progress 3.6s linear forwards;
  transform-origin: left;
}
@keyframes toast-in {
  from { transform: translateY(20px) scale(0.96); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes toast-progress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* +XP floating */
.xp-float {
  position: absolute; pointer-events: none;
  font-family: var(--font-mono); font-weight: 700;
  font-size: 14px;
  color: var(--gold);
  text-shadow: 0 0 12px var(--gold);
  animation: xp-up 1.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  z-index: 99;
}
@keyframes xp-up {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-40px); opacity: 0; }
}

/* ── Bottom nav (mobile) ── */
.btm-nav {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10px 14px 28px;
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  background: color-mix(in oklab, var(--bg-app) 80%, transparent);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid var(--border-subtle);
  z-index: 30;
}
.btm-nav .nav {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 4px;
  color: var(--text-tertiary);
  border-radius: var(--r-md);
  font-size: 10.5px;
  font-weight: 500;
  font-family: var(--font-body);
}
.btm-nav .nav.active { color: var(--accent); }
.btm-nav .nav .icon { width: 22px; height: 22px; }

/* ── Onboarding ── */
.onb {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 24px;
  background:
    radial-gradient(ellipse 100% 60% at 50% 0%, rgba(108, 63, 232, 0.25), transparent 70%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(244, 114, 182, 0.15), transparent 70%),
    var(--bg-app);
  position: relative;
}

/* ── Radar SVG ── */
.radar text { font-family: var(--font-body); fill: var(--text-tertiary); font-size: 10px; }
.radar .axis { stroke: var(--border-subtle); }
.radar .ring { stroke: var(--border-subtle); fill: none; }
.radar .ring.faint { stroke: var(--border); opacity: 0.35; }
.radar .target { stroke: var(--gold-2); fill: rgba(251, 191, 36, 0.05); stroke-dasharray: 5 4; stroke-width: 1.5; }
.radar .current { stroke: var(--accent); fill: var(--accent-soft); stroke-width: 2; }
.radar .pt { fill: var(--accent); stroke: var(--bg-app); stroke-width: 2; cursor: ns-resize; }
.radar .pt:hover { r: 7; }

/* ── Matrix quadrants ── */
.matrix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  height: 580px;
}
.quad {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px;
  display: flex; flex-direction: column;
  gap: 8px;
  min-height: 0;
  position: relative;
}
.quad .qh { display: flex; align-items: center; justify-content: space-between; }
.quad .ql { font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: -0.01em; }
.quad .qm { font-size: 11px; color: var(--text-tertiary); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.quad .qcount {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--bg-elev);
  padding: 2px 7px; border-radius: 4px;
  color: var(--text-secondary);
}
.quad .qbody { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.quad.q1 { background: linear-gradient(135deg, color-mix(in oklab, var(--error) 12%, var(--bg-card)), var(--bg-card)); border-color: color-mix(in oklab, var(--error) 30%, var(--border)); }
.quad.q2 { background: linear-gradient(135deg, color-mix(in oklab, var(--z-leisure) 12%, var(--bg-card)), var(--bg-card)); border-color: color-mix(in oklab, var(--z-leisure) 30%, var(--border)); }
.quad.q3 { background: linear-gradient(135deg, color-mix(in oklab, var(--z-career) 12%, var(--bg-card)), var(--bg-card)); border-color: color-mix(in oklab, var(--z-career) 30%, var(--border)); }
.quad.q4 { background: linear-gradient(135deg, color-mix(in oklab, var(--text-tertiary) 8%, var(--bg-card)), var(--bg-card)); }
.quad .mini-wish {
  background: var(--bg-elev);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  border-left: 3px solid var(--zc, var(--accent));
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  cursor: grab;
  transition: transform 150ms, box-shadow 150ms;
}
.quad .mini-wish:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(0,0,0,0.2); }
.quad .mini-wish.dragging { transform: rotate(2deg) scale(1.04); box-shadow: 0 12px 24px rgba(0,0,0,0.4); cursor: grabbing; }

/* Kanban columns */
.kanban {
  display: grid;
  grid-template-columns: repeat(8, minmax(220px, 1fr));
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 12px;
  min-width: 100%;
}
.kanban.cols-3 { grid-template-columns: repeat(3, minmax(280px, 1fr)); }
.k-col {
  background: var(--bg-app-2);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-subtle);
  padding: 10px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 200px;
  transition: background 150ms, border-color 150ms;
}
.k-col.drop {
  background: color-mix(in oklab, var(--zc, var(--accent)) 10%, var(--bg-app-2));
  border-color: var(--zc, var(--accent));
}
.k-col .kh {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px;
  font-family: var(--font-display); font-weight: 700;
}
.k-col .kh .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--zc); box-shadow: 0 0 calc(8px * var(--glow-mult)) var(--zc); }
.k-col .kh .ct { font-family: var(--font-mono); color: var(--text-tertiary); font-weight: 500; margin-left: auto; font-size: 11px; }
.k-col .add {
  border: 1px dashed var(--border);
  color: var(--text-tertiary);
  border-radius: var(--r-md);
  padding: 7px 10px;
  font-size: 12px;
  text-align: center;
}

/* habit list */
.habit-row {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.habit-row:last-child { border-bottom: 0; }
.habit-row .nm-block { display: flex; align-items: center; gap: 10px; }
.habit-row .check-btn {
  width: 30px; height: 30px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--zc, var(--border-strong));
  background: color-mix(in oklab, var(--zc, var(--accent)) 8%, transparent);
  display: grid; place-items: center;
  transition: background 120ms, transform 120ms;
}
.habit-row .check-btn.done {
  background: var(--zc, var(--accent));
  border-color: var(--zc, var(--accent));
  color: #fff;
  box-shadow: 0 0 calc(14px * var(--glow-mult)) var(--zc, var(--accent));
}
.habit-row .check-btn:hover { transform: scale(1.06); }
.habit-row .streak {
  font-family: var(--font-mono); font-size: 13px;
  display: flex; align-items: center; gap: 4px;
  color: var(--gold);
}
.habit-row .month-pct {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
}

/* Empty / skeleton */
.empty {
  text-align: center; padding: 40px 20px;
  color: var(--text-secondary);
}
.empty .icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: grid; place-items: center; margin: 0 auto 16px;
  font-size: 28px;
  border: 1px solid var(--border);
}
.empty h3 { font-family: var(--font-display); font-size: 17px; font-weight: 700; margin: 0 0 6px; }
.empty p { color: var(--text-tertiary); font-size: 13px; margin: 0 0 18px; }

.skel {
  background:
    linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.05) 50%, transparent 100%),
    var(--border);
  background-size: 200% 100%, 100% 100%;
  border-radius: var(--r-md);
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer {
  from { background-position: -100% 0, 0 0; }
  to { background-position: 100% 0, 0 0; }
}

/* Badge modal */
.modal-back {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 90;
  animation: fade-in 240ms;
}
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  padding: 28px 28px 24px;
  width: 320px;
  text-align: center;
  box-shadow: var(--shadow-pop);
  animation: badge-pop 460ms cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes badge-pop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}
.modal-card .big-badge {
  width: 110px; height: 110px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 50px;
  background: radial-gradient(circle at 30% 30%, var(--rar-2), var(--rar-1));
  box-shadow: 0 0 60px var(--rar-1);
  animation: pulse-gold 1.6s ease-in-out infinite;
}
@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 60px var(--rar-1); }
  50% { box-shadow: 0 0 100px var(--rar-2); }
}

/* Profile XP card */
.profile-hero {
  display: flex; gap: 16px; align-items: center;
  padding: 18px;
  border-radius: var(--r-2xl);
  background:
    radial-gradient(ellipse 80% 100% at 100% 0%, rgba(108, 63, 232, 0.25), transparent 70%),
    var(--bg-card);
  border: 1px solid var(--border);
}
.profile-hero .lvl-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent-2);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

/* utility */
.row { display: flex; gap: 10px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; }
.dim { color: var(--text-tertiary); }
.dim2 { color: var(--text-secondary); }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.ttl-xl { font-family: var(--font-display); font-weight: 800; font-size: 26px; letter-spacing: -0.02em; line-height: 1.1; }
.ttl-lg { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -0.02em; line-height: 1.2; }
.ttl-md { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.eyebrow { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 500; }

.divider { height: 1px; background: var(--border-subtle); margin: 14px 0; }

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