/* ================= جزيرتي — نظام التصميم ================= */
*, *::before, *::after { box-sizing: border-box; }

:root{
  --bg-0:#070B18;
  --bg-1:#0D1430;
  --bg-solid:#0C1226;
  --text:#F1F5F9;
  --muted:#94A3B8;
  --cyan:#38BDF8;
  --violet:#A855F7;
  --green:#34D399;
  --gold:#FBBF24;
  --rose:#FB7185;
  --surface: rgba(255,255,255,.055);
  --surface-2: rgba(255,255,255,.09);
  --surface-3: rgba(255,255,255,.14);
  --border: rgba(255,255,255,.12);
  --border-strong: rgba(255,255,255,.22);
  --shadow: 0 18px 40px rgba(3,8,20,.45);
  --radius:24px;
  --radius-sm:16px;
  --ok:#34D399;
  --warn:#FBBF24;
  --bad:#FB7185;
}

[data-theme="light"]{
  --bg-0:#EEF4FF;
  --bg-1:#E4EDFB;
  --bg-solid:#F7FAFF;
  --text:#0B1729;
  --muted:#54637F;
  --surface: rgba(255,255,255,.72);
  --surface-2: rgba(255,255,255,.92);
  --surface-3: rgba(255,255,255,1);
  --border: rgba(11,23,41,.10);
  --border-strong: rgba(11,23,41,.18);
  --shadow: 0 16px 36px rgba(30,60,110,.14);
}

html, body{ margin:0; padding:0; }
html{ -webkit-text-size-adjust:100%; }
body{
  font-family:'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color:var(--text);
  background:var(--bg-0);
  min-height:100vh;
  overflow-x:hidden;
  -webkit-font-smoothing:antialiased;
  line-height:1.55;
}
body::before{
  content:'';
  position:fixed; inset:0; z-index:-1; pointer-events:none;
  background:
    radial-gradient(70% 50% at 78% -12%, rgba(124,58,237,.42), transparent 66%),
    radial-gradient(60% 45% at 2% 104%, rgba(16,185,129,.28), transparent 66%),
    radial-gradient(55% 40% at 45% 45%, rgba(56,189,248,.10), transparent 72%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 58%, #060A16);
}
[data-theme="light"] body::before{
  background:
    radial-gradient(70% 50% at 78% -12%, rgba(168,85,247,.22), transparent 66%),
    radial-gradient(60% 45% at 2% 104%, rgba(16,185,129,.22), transparent 66%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 60%, #DDE8F8);
}
button, input, select, textarea{ font-family:inherit; }
button{ cursor:pointer; }
button, .chip, .nav-item, .plot, .swatch{ -webkit-user-select:none; user-select:none; -webkit-tap-highlight-color:transparent; }
h1,h2,h3,h4{ margin:0; line-height:1.25; font-weight:800; letter-spacing:0; }
p{ margin:0; }
ul, ol{ margin:0; padding:0; list-style:none; }
a{ color:var(--cyan); }
svg{ display:block; }
.hidden{ display:none !important; }
.num{ font-variant-numeric: tabular-nums; }

/* ================= layout ================= */
.app{
  display:grid;
  grid-template-columns:1fr;
  max-width:1440px;
  margin:0 auto;
  min-height:100vh;
}
@media (min-width:1000px){
  .app{ grid-template-columns:268px minmax(0,1fr); }
}
.main-col{ min-width:0; padding:14px 14px 108px; }
@media (min-width:700px){ .main-col{ padding:18px 22px 40px; } }
@media (min-width:1000px){ .main-col{ padding:22px 30px 56px; } }

.view{ display:block; animation:viewIn .32s ease both; }
@keyframes viewIn{ from{ opacity:0; transform:translateY(8px);} to{ opacity:1; transform:none;} }

/* ================= sidebar ================= */
.sidebar{ display:none; }
@media (min-width:1000px){
  .sidebar{
    display:flex; flex-direction:column; gap:10px;
    padding:22px 16px;
    border-inline-end:1px solid var(--border);
    position:sticky; top:0; height:100vh; overflow-y:auto;
  }
}
.brand{ display:flex; align-items:center; gap:10px; padding:6px 10px 14px; }
.brand-mark{
  width:44px; height:44px; border-radius:14px; display:grid; place-items:center; font-size:22px;
  background:linear-gradient(140deg, rgba(56,189,248,.35), rgba(168,85,247,.35));
  border:1px solid var(--border-strong);
  box-shadow:0 8px 20px rgba(56,189,248,.18);
}
.brand-name{ font-size:19px; font-weight:800; }
.brand-sub{ font-size:11px; color:var(--muted); }
.nav-label{ font-size:11px; color:var(--muted); padding:12px 12px 4px; letter-spacing:0; }
.nav-item{
  display:flex; align-items:center; gap:10px;
  width:100%; border:1px solid transparent; background:transparent; color:var(--muted);
  font-size:14.5px; font-weight:700; padding:10px 12px; border-radius:14px; text-align:start;
  transition:background .18s ease, color .18s ease, transform .12s ease;
  min-height:44px;
}
.nav-item svg{ width:19px; height:19px; flex:0 0 auto; }
.nav-item:hover{ background:var(--surface); color:var(--text); }
.nav-item:active{ transform:scale(.985); }
.nav-item.active{
  color:var(--text);
  background:linear-gradient(100deg, rgba(56,189,248,.18), rgba(168,85,247,.16));
  border-color:var(--border);
}
.nav-item .nav-badge{
  margin-inline-start:auto; font-size:11px; font-weight:800; padding:1px 7px; border-radius:99px;
  background:rgba(251,191,36,.18); color:var(--gold);
}
.side-foot{ margin-top:auto; padding-top:14px; }
.mini-rank{
  border:1px solid var(--border); background:var(--surface); border-radius:18px; padding:12px;
}
.mini-rank .mr-top{ display:flex; align-items:center; justify-content:space-between; font-size:12px; color:var(--muted); }
.mini-rank .mr-rank{ font-weight:800; font-size:13.5px; color:var(--text); margin-top:2px; }

/* ================= topbar ================= */
.topbar{ position:sticky; top:0; z-index:30; padding:8px 0 10px; }
.topbar-inner{
  display:flex; flex-wrap:wrap; align-items:center; gap:10px 14px;
  background:linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.04));
  border:1px solid var(--border); border-radius:20px;
  padding:10px 14px; backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px);
  box-shadow:0 12px 30px rgba(3,8,20,.32);
}
[data-theme="light"] .topbar-inner{ background:linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.7)); }

.tb-id{ display:flex; align-items:center; gap:10px; min-width:0; }
.lvl-orb{
  width:46px; height:46px; border-radius:50%; flex:0 0 auto;
  display:grid; place-items:center; font-weight:800; font-size:19px; color:#fff;
  background:radial-gradient(circle at 30% 25%, #7DD3FC, #6366F1 55%, #7C3AED);
  border:1px solid rgba(255,255,255,.35);
  box-shadow:0 0 0 4px rgba(99,102,241,.16), 0 8px 22px rgba(99,102,241,.42);
  font-variant-numeric:tabular-nums;
}
.tb-meta{ min-width:0; }
.rank-line{ font-weight:800; font-size:14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:210px; }
.xp-remaining{ font-size:11.5px; color:var(--muted); white-space:nowrap; }
.xp-box{ flex:1 1 150px; order:2; min-width:110px; }
.xp-bar{
  position:relative; height:12px; border-radius:99px; overflow:hidden;
  background:rgba(255,255,255,.10); border:1px solid var(--border);
}
[data-theme="light"] .xp-bar{ background:rgba(11,23,41,.08); }
.xp-bar > i{
  display:block; height:100%; border-radius:99px; width:0;
  background:linear-gradient(90deg, var(--green), var(--cyan) 55%, var(--violet));
  box-shadow:0 0 14px rgba(56,189,248,.5);
  transition:width .7s cubic-bezier(.2,.8,.2,1);
}
.tb-chips{ display:flex; align-items:center; gap:7px; margin-inline-start:auto; order:3; }
.chip{
  display:inline-flex; align-items:center; gap:5px;
  font-size:12.5px; font-weight:800; padding:6px 11px; border-radius:99px;
  background:var(--surface-2); border:1px solid var(--border); white-space:nowrap;
  font-variant-numeric:tabular-nums;
}
.chip.gold{ color:var(--gold); background:rgba(251,191,36,.12); border-color:rgba(251,191,36,.28); }
.chip.fire{ color:#FDBA74; background:rgba(251,113,133,.12); border-color:rgba(251,113,133,.28); }
.chip.date{ color:var(--muted); font-weight:700; }
@media (max-width:720px){
  .xp-box{ flex-basis:100%; order:3; }
  .tb-chips{ flex-basis:100%; order:4; margin-inline-start:0; justify-content:space-between; }
  .chip.date{ display:none; }
  .rank-line{ max-width:160px; font-size:13px; }
  .lvl-orb{ width:42px; height:42px; font-size:17px; }
}
.icon-btn{
  position:relative; display:inline-grid; place-items:center;
  width:40px; height:40px; border-radius:12px; border:1px solid var(--border);
  background:var(--surface-2); color:var(--text); transition:transform .12s ease, background .18s ease;
}
.icon-btn:hover{ background:var(--surface-3); }
.icon-btn:active{ transform:scale(.94); }
.icon-btn svg{ width:19px; height:19px; }
.bell-dot{
  position:absolute; top:-5px; inset-inline-end:-5px; min-width:18px; height:18px; padding:0 4px;
  border-radius:99px; background:linear-gradient(135deg,#F87171,#FB7185); color:#fff;
  font-size:10.5px; font-weight:800; display:grid; place-items:center; border:2px solid var(--bg-solid);
}

/* ================= cards & common ================= */
.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px);
  box-shadow:var(--shadow), inset 0 1px 0 rgba(255,255,255,.06);
  padding:18px;
}
[data-theme="light"] .card{ box-shadow:var(--shadow), inset 0 1px 0 rgba(255,255,255,.9); }
.card-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:14px; flex-wrap:wrap; }
.card-head h2{ font-size:17px; }
.card-head h3{ font-size:15px; }
.muted{ color:var(--muted); }
.small{ font-size:12.5px; }
.tiny{ font-size:11.5px; }

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:44px; padding:10px 16px; border-radius:14px;
  border:1px solid var(--border); background:var(--surface-2); color:var(--text);
  font-size:14px; font-weight:800; text-decoration:none;
  transition:transform .12s ease, background .18s ease, box-shadow .18s ease, opacity .18s;
}
.btn svg{ width:17px; height:17px; }
.btn:hover{ background:var(--surface-3); }
.btn:active{ transform:scale(.97); }
.btn:disabled, .btn[disabled]{ opacity:.45; cursor:not-allowed; transform:none; }
.btn.primary{
  border:none; color:#fff;
  background:linear-gradient(135deg,#0EA5E9,#6366F1 52%,#8B5CF6);
  box-shadow:0 10px 26px rgba(56,189,248,.32), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn.primary:hover{ box-shadow:0 12px 30px rgba(56,189,248,.45); }
.btn.gold{
  border:none; color:#241703;
  background:linear-gradient(135deg,#FDE68A,#FBBF24 60%,#F59E0B);
  box-shadow:0 10px 24px rgba(251,191,36,.28);
}
.btn.ghost{ background:transparent; }
.btn.danger{ color:#FECDD3; background:rgba(251,113,133,.14); border-color:rgba(251,113,133,.35); }
.btn.sm{ min-height:38px; padding:7px 13px; font-size:13px; border-radius:12px; }
.btn.block{ width:100%; }
.btn.icon-only{ padding:0; width:38px; min-height:38px; }

.pill{
  display:inline-flex; align-items:center; gap:6px; font-size:11.5px; font-weight:800;
  padding:4px 10px; border-radius:99px; background:var(--surface-2); border:1px solid var(--border);
  color:var(--muted);
}
.pill.green{ color:#6EE7B7; background:rgba(52,211,153,.12); border-color:rgba(52,211,153,.28); }
.pill.cyan{ color:#7DD3FC; background:rgba(56,189,248,.12); border-color:rgba(56,189,248,.28); }
.pill.violet{ color:#D8B4FE; background:rgba(168,85,247,.14); border-color:rgba(168,85,247,.3); }
.pill.gold{ color:#FCD34D; background:rgba(251,191,36,.12); border-color:rgba(251,191,36,.3); }

.view-head{ margin:6px 2px 16px; }
.view-head h1{ font-size:26px; letter-spacing:-.2px; }
.view-head p{ color:var(--muted); font-size:13.5px; margin-top:4px; }
@media (min-width:700px){ .view-head h1{ font-size:30px; } }

.grid{ display:grid; gap:14px; }
.cols-2{ grid-template-columns:1fr; }
@media (min-width:700px){ .cols-2{ grid-template-columns:repeat(2,minmax(0,1fr)); } }
.cols-3{ grid-template-columns:1fr; }
@media (min-width:620px){ .cols-3{ grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (min-width:1020px){ .cols-3{ grid-template-columns:repeat(3,minmax(0,1fr)); } }
.cols-4{ grid-template-columns:repeat(2,minmax(0,1fr)); }
@media (min-width:820px){ .cols-4{ grid-template-columns:repeat(4,minmax(0,1fr)); } }

/* ================= dashboard ================= */
.hero{
  position:relative; overflow:hidden;
  border-radius:28px; border:1px solid var(--border);
  background:
    radial-gradient(120% 120% at 90% -20%, rgba(168,85,247,.30), transparent 60%),
    radial-gradient(100% 100% at 0% 120%, rgba(16,185,129,.22), transparent 60%),
    linear-gradient(135deg, rgba(56,189,248,.10), rgba(13,20,48,.5));
  padding:18px;
  margin-bottom:16px;
  box-shadow:var(--shadow);
}
@media (min-width:700px){ .hero{ padding:24px 26px; } }
.hero-row{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.hero-avatar{ width:82px; height:82px; flex:0 0 auto; }
@media (min-width:700px){ .hero-avatar{ width:104px; height:104px; } }
.hero-avatar svg{ width:100%; height:100%; }
.hero-hi{ font-size:13px; color:var(--muted); font-weight:700; }
.hero-rank{ font-size:22px; font-weight:800; margin-top:2px; }
@media (min-width:700px){ .hero-rank{ font-size:27px; } }
.hero-tagline{ font-size:13px; color:#A5B4FC; margin-top:4px; }
[data-theme="light"] .hero-tagline{ color:#6D5BD0; }
.hero-quote{
  margin-top:16px; padding:12px 14px; border-radius:16px;
  background:rgba(255,255,255,.06); border:1px dashed var(--border-strong);
  font-size:13.5px; font-weight:600; color:#E2E8F0;
  display:flex; gap:8px; align-items:flex-start;
}
[data-theme="light"] .hero-quote{ color:#22304a; background:rgba(255,255,255,.6); }
.hero-stats{ display:flex; gap:8px; flex-wrap:wrap; margin-top:14px; }

.dash-grid{ display:grid; gap:14px; grid-template-columns:1fr; }
@media (min-width:1020px){ .dash-grid{ grid-template-columns:minmax(0,1.15fr) minmax(0,1fr); align-items:start; } }

.island-card{ padding:14px; overflow:hidden; }
.island-stage{
  position:relative; border-radius:20px; overflow:hidden;
  background:radial-gradient(120% 90% at 50% 0%, rgba(56,189,248,.16), transparent 60%);
}
.island-svg{ width:100%; height:auto; display:block; }
.island-svg.preview{ pointer-events:none; }
.island-legend{ display:flex; gap:6px; flex-wrap:wrap; margin-top:10px; }

/* plots */
.plot{ cursor:pointer; }
.plot.empty ellipse{
  animation:plotPulse 3.4s ease-in-out infinite;
  transform-box:fill-box; transform-origin:center;
}
.plot.locked{ opacity:.62; }
.plot:hover{ filter:brightness(1.08); }
.plot-built, .plot-empty{ transition:filter .2s ease; }
@keyframes plotPulse{ 0%,100%{ opacity:.6; } 50%{ opacity:1; } }

/* bird helper */
.bird{
  display:flex; align-items:flex-end; gap:8px; margin-top:12px;
}
.bird-art{ width:54px; height:54px; flex:0 0 auto; animation:birdBob 4s ease-in-out infinite; transform-origin:bottom center; }
@keyframes birdBob{ 0%,100%{ transform:translateY(0) rotate(-2deg);} 50%{ transform:translateY(-5px) rotate(2deg);} }
.bird-bubble{
  position:relative; flex:1; min-width:0;
  background:rgba(255,255,255,.07); border:1px solid var(--border);
  border-radius:16px 16px 16px 4px; padding:10px 12px; font-size:12.5px; color:var(--text);
}
[data-theme="light"] .bird-bubble{ background:rgba(255,255,255,.75); }
.bird-name{ font-size:11px; font-weight:800; color:#7DD3FC; display:block; margin-bottom:2px; }

/* tasks */
.task-list{ display:flex; flex-direction:column; gap:9px; }
.task-item{
  display:flex; align-items:center; gap:10px;
  padding:11px 12px; border-radius:16px;
  background:rgba(255,255,255,.045); border:1px solid var(--border);
  transition:transform .16s ease, background .18s ease, opacity .2s;
}
[data-theme="light"] .task-item{ background:rgba(255,255,255,.6); }
.task-item:hover{ transform:translateY(-1px); background:rgba(255,255,255,.075); }
[data-theme="light"] .task-item:hover{ background:#fff; }
.task-item.done{ opacity:.52; }
.task-item.done .t-title{ text-decoration:line-through; }
.prio{ width:9px; height:34px; border-radius:99px; flex:0 0 auto; }
.prio.high{ background:linear-gradient(180deg,#FB7185,#E11D48); box-shadow:0 0 12px rgba(251,113,133,.45); }
.prio.med{ background:linear-gradient(180deg,#FDE68A,#F59E0B); box-shadow:0 0 12px rgba(251,191,36,.4); }
.prio.low{ background:linear-gradient(180deg,#6EE7B7,#10B981); box-shadow:0 0 12px rgba(52,211,153,.4); }
.t-info{ min-width:0; flex:1; }
.t-title{ font-size:14px; font-weight:700; overflow-wrap:anywhere; }
.t-meta{ display:flex; gap:8px; flex-wrap:wrap; margin-top:3px; font-size:11.5px; color:var(--muted); font-weight:700; }
.t-meta .xp{ color:#7DD3FC; }
.t-meta .gem{ color:#FCD34D; }
.t-actions{ display:flex; align-items:center; gap:6px; flex:0 0 auto; }
@media (max-width:420px){
  .t-actions .btn.sm{ padding:7px 10px; font-size:12px; }
  .task-item{ padding:10px; }
}

.empty-state{
  text-align:center; padding:26px 14px; color:var(--muted); font-size:13px;
  border:1px dashed var(--border-strong); border-radius:18px;
}
.empty-state .em{ font-size:30px; display:block; margin-bottom:6px; }

/* ================= habits ================= */
.habit-card{ display:flex; align-items:center; gap:12px; }
.ring{
  --p:0%;
  width:58px; height:58px; border-radius:50%; flex:0 0 auto; position:relative;
  background:conic-gradient(from -90deg, var(--green) var(--p), rgba(255,255,255,.10) 0);
  display:grid; place-items:center;
}
[data-theme="light"] .ring{ background:conic-gradient(from -90deg, #10B981 var(--p), rgba(11,23,41,.08) 0); }
.ring::before{
  content:''; position:absolute; inset:6px; border-radius:50%; background:var(--bg-solid);
}
[data-theme="light"] .ring::before{ background:#F3F8FF; }
.ring span{ position:relative; font-size:12.5px; font-weight:800; font-variant-numeric:tabular-nums; }
.habit-emoji{ font-size:22px; }
.habit-body{ flex:1; min-width:0; }
.habit-name{ font-size:14.5px; font-weight:800; }
.habit-sub{ font-size:11.5px; color:var(--muted); margin-top:2px; display:flex; gap:8px; flex-wrap:wrap; }
.habit-actions{ display:flex; gap:6px; align-items:center; flex:0 0 auto; }
@media (max-width:430px){
  .habit-card{ flex-wrap:wrap; }
  .habit-actions{ width:100%; }
  .habit-actions .btn{ flex:1; }
}
.streak-warn{
  display:flex; gap:10px; align-items:center; padding:12px 14px; border-radius:16px;
  background:rgba(251,113,133,.12); border:1px solid rgba(251,113,133,.32);
  color:#FECDD3; font-size:13px; font-weight:700; margin-bottom:14px;
}
[data-theme="light"] .streak-warn{ color:#9F1239; }

/* ================= achievements ================= */
.ach-card{ display:flex; gap:12px; align-items:center; position:relative; overflow:hidden; }
.ach-icon{
  width:52px; height:52px; border-radius:16px; display:grid; place-items:center; font-size:24px;
  background:linear-gradient(140deg, rgba(56,189,248,.2), rgba(168,85,247,.2));
  border:1px solid var(--border); flex:0 0 auto;
}
.ach-locked .ach-icon{ filter:grayscale(1); opacity:.5; background:rgba(255,255,255,.05); }
.ach-locked{ opacity:.68; }
.ach-title{ font-size:14px; font-weight:800; }
.ach-desc{ font-size:12px; color:var(--muted); margin-top:2px; }
.ach-state{ margin-inline-start:auto; font-size:11px; font-weight:800; }
.ach-state.open{ color:var(--green); }
.ach-state.lock{ color:var(--muted); }

/* ================= stats ================= */
.stat-tile{
  padding:14px 16px; border-radius:20px; border:1px solid var(--border);
  background:linear-gradient(150deg, rgba(255,255,255,.09), rgba(255,255,255,.03));
}
[data-theme="light"] .stat-tile{ background:linear-gradient(150deg,#fff,rgba(255,255,255,.7)); }
.stat-tile .st-label{ font-size:12px; color:var(--muted); font-weight:700; }
.stat-tile .st-value{ font-size:24px; font-weight:800; margin-top:2px; font-variant-numeric:tabular-nums; }
.stat-tile .st-emoji{ font-size:18px; }

.chart{
  display:flex; align-items:flex-end; gap:7px; height:150px; padding-top:8px;
}
.bar-col{ flex:1; display:flex; flex-direction:column; justify-content:flex-end; align-items:center; gap:6px; height:100%; min-width:0; }
.bar-track{ width:100%; max-width:34px; height:100%; display:flex; align-items:flex-end; border-radius:10px; background:rgba(255,255,255,.05); }
[data-theme="light"] .bar-track{ background:rgba(11,23,41,.06); }
.bar-fill{
  width:100%; border-radius:10px; min-height:4px;
  background:linear-gradient(180deg, var(--cyan), var(--violet));
  box-shadow:0 0 12px rgba(56,189,248,.35);
  transition:height .6s cubic-bezier(.2,.8,.2,1);
}
.bar-fill.zero{ background:rgba(255,255,255,.12); box-shadow:none; }
.bar-label{ font-size:10.5px; color:var(--muted); font-weight:700; white-space:nowrap; }
.bar-value{ font-size:10.5px; font-weight:800; color:var(--text); }

.month-chart{ display:flex; align-items:flex-end; gap:3px; height:88px; }
.month-chart i{
  flex:1; border-radius:4px 4px 2px 2px; min-height:3px;
  background:linear-gradient(180deg, #34D399, #22D3EE);
  opacity:.85;
}
.habit-bar-row{ display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.habit-bar-track{ flex:1; height:10px; border-radius:99px; background:rgba(255,255,255,.08); overflow:hidden; }
[data-theme="light"] .habit-bar-track{ background:rgba(11,23,41,.08); }
.habit-bar-fill{ height:100%; border-radius:99px; background:linear-gradient(90deg,var(--green),var(--cyan)); }

/* ================= shop / buildings ================= */
.tile-card{
  display:flex; flex-direction:column; gap:10px;
  padding:14px; border-radius:20px; border:1px solid var(--border);
  background:linear-gradient(160deg, rgba(255,255,255,.08), rgba(255,255,255,.025));
  transition:transform .18s ease, border-color .2s ease, box-shadow .2s;
}
[data-theme="light"] .tile-card{ background:linear-gradient(160deg,#fff,rgba(255,255,255,.72)); }
.tile-card:hover{ transform:translateY(-3px); border-color:var(--border-strong); box-shadow:0 16px 30px rgba(3,8,20,.3); }
.tile-top{ display:flex; align-items:center; gap:10px; }
.tile-emoji{
  width:48px; height:48px; border-radius:15px; display:grid; place-items:center; font-size:24px;
  background:rgba(255,255,255,.07); border:1px solid var(--border); flex:0 0 auto;
}
.tile-name{ font-size:14.5px; font-weight:800; }
.tile-sub{ font-size:11.5px; color:var(--muted); }
.tile-desc{ font-size:12.5px; color:var(--muted); min-height:34px; }
.tile-foot{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:auto; }
.cost{ font-size:13px; font-weight:800; color:var(--gold); display:inline-flex; gap:4px; align-items:center; }
.lvl-pips{ display:flex; gap:3px; }
.lvl-pips i{ width:14px; height:6px; border-radius:99px; background:rgba(255,255,255,.16); display:block; }
.lvl-pips i.on{ background:linear-gradient(90deg,var(--cyan),var(--violet)); box-shadow:0 0 8px rgba(56,189,248,.5); }

/* ================= avatar ================= */
.avatar-frame{
  display:grid; place-items:center; padding:14px; border-radius:24px;
  background:radial-gradient(90% 80% at 50% 0%, rgba(56,189,248,.18), transparent 70%), rgba(255,255,255,.04);
  border:1px solid var(--border);
}
.avatar-svg{ width:170px; height:170px; }
.av-body{ animation:avBreathe 4.5s ease-in-out infinite; transform-box:fill-box; transform-origin:50% 100%; }
@keyframes avBreathe{ 0%,100%{ transform:translateY(0) scale(1);} 50%{ transform:translateY(-2px) scale(1.012);} }
.av-jump{ animation:avJump .9s cubic-bezier(.3,1.4,.4,1); }
@keyframes avJump{ 0%,100%{ transform:translateY(0);} 40%{ transform:translateY(-16px) scale(1.04);} }

.swatch-row{ display:flex; flex-wrap:wrap; gap:8px; }
.swatch{
  width:40px; height:40px; border-radius:13px; border:2px solid transparent;
  display:grid; place-items:center; font-size:18px; background:var(--surface-2);
  transition:transform .14s ease, border-color .16s ease; padding:0;
}
.swatch:hover{ transform:translateY(-2px); }
.swatch.on{ border-color:var(--cyan); box-shadow:0 0 0 3px rgba(56,189,248,.22); }
.swatch.locked{ opacity:.45; position:relative; }
.swatch.locked::after{ content:'🔒'; position:absolute; font-size:11px; bottom:0; inset-inline-end:1px; }
.opt-group{ margin-top:14px; }
.opt-group .og-label{ font-size:12px; font-weight:800; color:var(--muted); margin-bottom:7px; }

/* ================= modals ================= */
.modal-backdrop{
  position:fixed; inset:0; z-index:80; display:flex; align-items:flex-end; justify-content:center;
  background:rgba(3,7,18,.68); backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px);
  padding:0; animation:fadeIn .2s ease;
}
@media (min-width:700px){ .modal-backdrop{ align-items:center; padding:24px; } }
@keyframes fadeIn{ from{ opacity:0 } to{ opacity:1 } }
.modal-card{
  width:100%; max-width:520px; max-height:88vh; overflow-y:auto;
  background:linear-gradient(180deg, #141C33, #0E1428);
  border:1px solid var(--border-strong);
  border-radius:26px 26px 0 0; padding:20px;
  animation:sheetUp .3s cubic-bezier(.2,.8,.2,1);
  box-shadow:0 -20px 60px rgba(0,0,0,.5);
}
[data-theme="light"] .modal-card{ background:linear-gradient(180deg,#FFFFFF,#F1F6FF); }
@media (min-width:700px){ .modal-card{ border-radius:26px; } }
@keyframes sheetUp{ from{ opacity:0; transform:translateY(28px);} to{ opacity:1; transform:none;} }
.modal-title{ display:flex; align-items:center; gap:10px; font-size:18px; font-weight:800; margin-bottom:4px; }
.modal-sub{ font-size:12.5px; color:var(--muted); margin-bottom:16px; }
.modal-actions{ display:flex; gap:8px; margin-top:18px; flex-wrap:wrap; }
.modal-actions .btn{ flex:1; }

.field{ margin-bottom:12px; }
.field label{ display:block; font-size:12.5px; font-weight:800; color:var(--muted); margin-bottom:6px; }
.input, .select, textarea.input{
  width:100%; min-height:46px; padding:10px 14px; border-radius:14px;
  background:rgba(255,255,255,.06); border:1px solid var(--border); color:var(--text);
  font-size:15px; font-weight:600; outline:none;
  transition:border-color .16s ease, box-shadow .16s ease, background .16s;
}
[data-theme="light"] .input, [data-theme="light"] .select{ background:#fff; }
.input:focus, .select:focus{ border-color:var(--cyan); box-shadow:0 0 0 3px rgba(56,189,248,.22); }
.input::placeholder{ color:var(--muted); font-weight:500; }
.select{ appearance:none; background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%); background-position:calc(0% + 16px) calc(50% - 2px),calc(0% + 21px) calc(50% - 2px); background-size:5px 5px,5px 5px; background-repeat:no-repeat; }
.row-2{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.row-3{ display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.seg{ display:flex; gap:6px; background:rgba(255,255,255,.05); padding:5px; border-radius:14px; border:1px solid var(--border); }
.seg button{
  flex:1; border:0; background:transparent; color:var(--muted); font-weight:800; font-size:13px;
  padding:8px 6px; border-radius:10px; min-height:38px; transition:background .18s, color .18s;
}
.seg button.on{ background:linear-gradient(135deg, rgba(56,189,248,.28), rgba(168,85,247,.28)); color:var(--text); }
.chip-select{ display:flex; flex-wrap:wrap; gap:8px; }
.chip-select button{
  border:1px solid var(--border); background:var(--surface-2); color:var(--text);
  font-size:13px; font-weight:700; padding:9px 13px; border-radius:99px; min-height:40px;
}
.chip-select button.on{ border-color:var(--cyan); background:rgba(56,189,248,.18); }

/* building sheet */
.sheet-hero{ display:flex; gap:12px; align-items:center; margin-bottom:14px; }
.sheet-emoji{
  width:64px; height:64px; border-radius:20px; display:grid; place-items:center; font-size:32px;
  background:linear-gradient(140deg, rgba(56,189,248,.24), rgba(168,85,247,.24));
  border:1px solid var(--border-strong); flex:0 0 auto;
}
.tier-track{ display:flex; gap:6px; margin:14px 0; }
.tier-track i{
  flex:1; height:8px; border-radius:99px; background:rgba(255,255,255,.12); position:relative;
  transition:background .3s ease;
}
.tier-track i.on{ background:linear-gradient(90deg,var(--cyan),var(--violet)); box-shadow:0 0 10px rgba(56,189,248,.5); }
.tier-list{ display:flex; flex-direction:column; gap:6px; margin-top:8px; }
.tier-line{ display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--muted); }
.tier-line b{ color:var(--text); }
.tier-line .dot{ width:8px; height:8px; border-radius:50%; background:rgba(255,255,255,.2); flex:0 0 auto; }
.tier-line .dot.on{ background:var(--green); box-shadow:0 0 8px var(--green); }

/* notifications list */
.notif-item{ display:flex; gap:10px; align-items:flex-start; padding:11px 12px; border-radius:14px; background:rgba(255,255,255,.05); border:1px solid var(--border); margin-bottom:8px; font-size:13px; }
.notif-item .em{ font-size:18px; }
[data-theme="light"] .notif-item{ background:#fff; }

/* ================= toasts & float rewards ================= */
.toasts{
  position:fixed; inset-inline:0; bottom:100px; z-index:95; display:flex; flex-direction:column;
  align-items:center; gap:8px; pointer-events:none; padding:0 14px;
}
@media (min-width:1000px){ .toasts{ bottom:28px; } }
.toast{
  display:flex; align-items:center; gap:8px;
  background:rgba(17,24,45,.94); color:#fff; border:1px solid rgba(255,255,255,.16);
  padding:10px 16px; border-radius:99px; font-size:13px; font-weight:700;
  box-shadow:0 16px 36px rgba(0,0,0,.45);
  opacity:0; transform:translateY(12px) scale(.96); transition:all .26s cubic-bezier(.2,.8,.2,1);
  max-width:min(94vw, 460px); text-align:center;
}
.toast.show{ opacity:1; transform:none; }
.toast.good{ border-color:rgba(52,211,153,.5); }
.toast.bad{ border-color:rgba(251,113,133,.5); }

.float-reward{
  position:fixed; z-index:96; pointer-events:none; font-weight:800; font-size:15px;
  transform:translate(-50%,-50%); animation:floatUp 1.1s cubic-bezier(.2,.8,.2,1) forwards;
  text-shadow:0 2px 12px rgba(0,0,0,.6); white-space:nowrap;
}
@keyframes floatUp{
  0%{ opacity:0; transform:translate(-50%,-50%) scale(.7); }
  25%{ opacity:1; transform:translate(-50%,-70%) scale(1.08); }
  100%{ opacity:0; transform:translate(-50%,-160%) scale(1); }
}

/* ================= celebration ================= */
.celebrate{
  position:fixed; inset:0; z-index:90; display:grid; place-items:center; padding:20px;
  background:radial-gradient(80% 60% at 50% 30%, rgba(124,58,237,.35), rgba(3,7,18,.86) 70%);
  backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px);
}
.celeb-card{
  width:100%; max-width:400px; text-align:center; padding:28px 22px 22px;
  border-radius:28px; border:1px solid var(--border-strong);
  background:linear-gradient(180deg, rgba(30,41,80,.95), rgba(12,18,38,.97));
  box-shadow:0 30px 80px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.14);
  animation:celebPop .45s cubic-bezier(.2,1.4,.4,1) both;
}
[data-theme="light"] .celeb-card{ background:linear-gradient(180deg,#FFFFFF,#EEF4FF); }
@keyframes celebPop{ from{ opacity:0; transform:scale(.85) translateY(20px);} to{ opacity:1; transform:none;} }
.celeb-emoji{ font-size:62px; line-height:1; animation:celebFloat 2.4s ease-in-out infinite; }
@keyframes celebFloat{ 0%,100%{ transform:translateY(0) rotate(-3deg);} 50%{ transform:translateY(-8px) rotate(3deg);} }
.celeb-card h2{ font-size:23px; margin-top:10px; }
.celeb-card p{ font-size:13.5px; color:var(--muted); margin-top:6px; }
.celeb-reward{ margin-top:12px; font-size:14px; font-weight:800; color:var(--gold); }
.celeb-card .btn{ margin-top:18px; width:100%; }

/* ================= onboarding ================= */
.onb{
  position:fixed; inset:0; z-index:100; padding:18px;
  display:flex; align-items:center; justify-content:center;
  background:
    radial-gradient(80% 60% at 70% -10%, rgba(124,58,237,.45), transparent 62%),
    radial-gradient(70% 50% at 10% 110%, rgba(16,185,129,.32), transparent 62%),
    linear-gradient(180deg,#070B18,#0D1430);
  overflow-y:auto;
}
.onb-card{
  width:100%; max-width:520px; margin:auto; padding:24px;
  border-radius:28px; border:1px solid var(--border-strong);
  background:rgba(255,255,255,.055); backdrop-filter:blur(20px);
  box-shadow:0 30px 80px rgba(0,0,0,.55); animation:celebPop .5s cubic-bezier(.2,1.2,.4,1) both;
}
.onb-dots{ display:flex; gap:6px; justify-content:center; margin-bottom:16px; }
.onb-dots i{ width:22px; height:5px; border-radius:99px; background:rgba(255,255,255,.18); display:block; }
.onb-dots i.on{ background:linear-gradient(90deg,var(--cyan),var(--violet)); width:34px; }
.onb h2{ font-size:23px; text-align:center; }
.onb p.sub{ text-align:center; color:var(--muted); font-size:13.5px; margin-top:8px; }
.onb-art{ display:grid; place-items:center; margin:6px 0 12px; }
.onb-art svg{ width:min(100%, 320px); height:auto; }
.onb-actions{ display:flex; gap:8px; margin-top:18px; }
.onb-actions .btn{ flex:1; }

/* ================= bottom nav ================= */
.bottomnav{
  position:fixed; inset-inline:0; bottom:0; z-index:60;
  display:flex; gap:2px; padding:7px 8px calc(7px + 2px);
  background:rgba(9,14,30,.88);
  backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px);
  border-top:1px solid var(--border);
}
[data-theme="light"] .bottomnav{ background:rgba(255,255,255,.92); }
.bottomnav button{
  flex:1; min-width:0; border:0; background:transparent; color:var(--muted);
  display:flex; flex-direction:column; align-items:center; gap:3px;
  font-size:10.5px; font-weight:800; padding:6px 2px; border-radius:14px; min-height:52px;
  transition:color .18s ease, background .18s ease;
}
.bottomnav button svg{ width:20px; height:20px; }
.bottomnav button.active{
  color:var(--text);
  background:linear-gradient(180deg, rgba(56,189,248,.18), rgba(168,85,247,.16));
}
@media (min-width:1000px){ .bottomnav{ display:none; } }

/* ================= misc ================= */
.list-row{
  display:flex; align-items:center; gap:10px; padding:11px 12px; border-radius:14px;
  border:1px solid var(--border); background:rgba(255,255,255,.04); margin-bottom:8px;
}
[data-theme="light"] .list-row{ background:#fff; }
.grow{ flex:1; min-width:0; }
.divider{ height:1px; background:var(--border); margin:16px 0; }
.kv{ display:flex; align-items:center; justify-content:space-between; gap:10px; font-size:13.5px; padding:9px 0; border-bottom:1px solid var(--border); }
.kv:last-child{ border-bottom:0; }
.kv b{ font-variant-numeric:tabular-nums; }
.switch{ width:50px; height:29px; border-radius:99px; background:rgba(255,255,255,.14); border:1px solid var(--border); position:relative; transition:background .2s; flex:0 0 auto; }
.switch::after{ content:''; position:absolute; top:3px; inset-inline-start:3px; width:21px; height:21px; border-radius:50%; background:#fff; transition:transform .2s ease; }
.switch.on{ background:linear-gradient(135deg,var(--cyan),var(--violet)); }
.switch.on::after{ transform:translateX(-21px); }
[dir="rtl"] .switch.on::after{ transform:translateX(-21px); }
[dir="ltr"] .switch.on::after{ transform:translateX(21px); }

.progress-line{ height:8px; border-radius:99px; background:rgba(255,255,255,.1); overflow:hidden; }
.progress-line i{ display:block; height:100%; border-radius:99px; background:linear-gradient(90deg,var(--green),var(--cyan)); transition:width .5s ease; }

.link-row{
  display:flex; align-items:center; gap:12px; width:100%; text-align:start;
  padding:13px 14px; border-radius:16px; border:1px solid var(--border);
  background:rgba(255,255,255,.04); color:var(--text); font-size:14px; font-weight:700;
  min-height:52px; transition:background .18s, transform .12s;
}
[data-theme="light"] .link-row{ background:#fff; }
.link-row:hover{ background:rgba(255,255,255,.09); }
.link-row:active{ transform:scale(.99); }
.link-row .lr-emoji{ font-size:20px; }
.link-row .lr-arrow{ margin-inline-start:auto; color:var(--muted); }

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; }
}
::-webkit-scrollbar{ width:9px; height:9px; }
::-webkit-scrollbar-thumb{ background:rgba(255,255,255,.16); border-radius:99px; }
[data-theme="light"] ::-webkit-scrollbar-thumb{ background:rgba(11,23,41,.18); }

/* ================= install / PWA ================= */
.install-banner{
  display:flex; align-items:center; gap:12px; margin-bottom:16px;
  padding:12px 14px; border-radius:20px;
  border:1px solid rgba(56,189,248,.34);
  background:linear-gradient(120deg, rgba(56,189,248,.16), rgba(168,85,247,.14));
  box-shadow:var(--shadow);
  animation:viewIn .35s ease both;
}
.ib-icon{
  width:44px; height:44px; flex:0 0 auto; border-radius:14px; display:grid; place-items:center;
  background:rgba(255,255,255,.12); border:1px solid var(--border); color:#7DD3FC;
}
[data-theme="light"] .ib-icon{ background:#fff; color:#0284C7; }
.ib-icon svg{ width:22px; height:22px; }
.ib-body{ flex:1; min-width:0; display:flex; flex-direction:column; }
.ib-body b{ font-size:13.5px; }
.ib-body span{ font-size:12px; color:var(--muted); }
.ib-actions{ display:flex; gap:6px; align-items:center; flex:0 0 auto; }
@media (max-width:430px){
  .install-banner{ flex-wrap:wrap; }
  .ib-actions{ width:100%; }
  .ib-actions .btn.primary{ flex:1; }
}

.install-icon{
  width:84px; height:84px; border-radius:22px; display:block; margin:2px auto 16px;
  border:1px solid var(--border-strong);
  box-shadow:0 14px 34px rgba(3,8,20,.45);
}
.install-steps{ display:flex; flex-direction:column; gap:9px; }
.install-step{
  display:flex; gap:10px; align-items:flex-start;
  padding:11px 13px; border-radius:14px; font-size:13px; line-height:1.6;
  background:rgba(255,255,255,.05); border:1px solid var(--border);
}
[data-theme="light"] .install-step{ background:#fff; }
.install-step .n{
  width:24px; height:24px; flex:0 0 auto; border-radius:50%; display:grid; place-items:center;
  font-size:12px; font-weight:800; color:#fff;
  background:linear-gradient(135deg,var(--cyan),var(--violet));
}
.install-step b{ color:var(--text); }