/* ───────── tokens & themes ───────── */
:root {
  --font: 'Vazirmatn', Tahoma, system-ui, sans-serif;
  --display: 'Lalezar', 'Vazirmatn', sans-serif;
  --r: 18px;
  --r-lg: 24px;
  --sun: #ffc94d;
  --ease: cubic-bezier(.22, .9, .3, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --nav-gap: max(12px, calc(env(safe-area-inset-bottom, 0px) + 4px));
  --card: #ffffff;
}
html[data-theme="blue"] {
  --accent: #3b82f6; --accent-2: #22c3ee; --accent-3: #8b7cf6;
  --accent-ink: #1d4ed8; --accent-soft: #dbe8ff; --accent-softer: #eef4ff;
  --bg: #f3f7ff; --bg-2: #dfeaff; --bg-3: #e3f6ff;
  --ink: #0f1d3a; --ink-2: #43547a; --ink-3: #6f80a5;
  --line: #dde6f5; --line-2: #e9eef8; --card-2: #f1f5fd;
  --sb: #0d1a36; --sb-2: #16264a; --sb-ink: #c3d0ee; --sb-dim: #7a8bb3; --sb-accent: #7cc4ff;
  --grad: linear-gradient(135deg, #5aa2ff 0%, #3b82f6 48%, #22c3ee 100%);
  --hero: linear-gradient(135deg, #3b6ff6 0%, #3b9bf6 45%, #22c3ee 100%);
  --glow: rgba(59, 130, 246, .5); --shadow-c: rgba(37, 79, 170, .28);
  --glyph: "✦";
  --o1: #3b82f6; --o2: #22c3ee; --o-soft: #dbe8ff; --o-ink: #1d4ed8; --o-grad: var(--grad);
}
html[data-theme="pink"] {
  --accent: #f0468e; --accent-2: #ff8fbb; --accent-3: #b18cff;
  --accent-ink: #c0175d; --accent-soft: #ffe0ed; --accent-softer: #fff0f6;
  --bg: #fff5f9; --bg-2: #ffe3ef; --bg-3: #f3e8ff;
  --ink: #3a1430; --ink-2: #7a4865; --ink-3: #9d6c87;
  --line: #f5dbe7; --line-2: #f9e8f0; --card-2: #fff2f7;
  --sb: #2a0f27; --sb-2: #3c1838; --sb-ink: #f0cfe0; --sb-dim: #b07f9b; --sb-accent: #ff9ec6;
  --grad: linear-gradient(135deg, #ff8fbf 0%, #f0468e 50%, #b18cff 100%);
  --hero: linear-gradient(135deg, #f0468e 0%, #ff7aa8 45%, #b18cff 100%);
  --glow: rgba(240, 70, 142, .5); --shadow-c: rgba(180, 40, 110, .26);
  --glyph: "♥";
  --o1: #f0468e; --o2: #ff8fbb; --o-soft: #ffe0ed; --o-ink: #c0175d; --o-grad: var(--grad);
}
html[data-theme="duo"] {
  --accent: #8b5cf6; --accent-2: #f0468e; --accent-3: #3b82f6;
  --accent-ink: #6d28d9; --accent-soft: #ede5ff; --accent-softer: #f6f1ff;
  --bg: #f8f5ff; --bg-2: #ffe3ef; --bg-3: #dfeaff;
  --ink: #23163f; --ink-2: #5b4c80; --ink-3: #85799f;
  --line: #e7e0f6; --line-2: #f0ebfa; --card-2: #f5f1fd;
  --sb: #1e1438; --sb-2: #2b1f4d; --sb-ink: #d9cff3; --sb-dim: #9384b8; --sb-accent: #c4a8ff;
  --grad: linear-gradient(135deg, #5aa2ff 0%, #8b5cf6 50%, #f0468e 100%);
  --hero: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #f0468e 100%);
  --glow: rgba(139, 92, 246, .45); --shadow-c: rgba(90, 60, 170, .25);
  --glyph: "✦";
  --o1: #8b5cf6; --o2: #f0468e; --o-soft: #ede5ff; --o-ink: #6d28d9; --o-grad: var(--grad);
}
/* colour of whoever owns a card — so her goals stay pink on his blue board, and vice-versa */
.own-blue { --o1: #3b82f6; --o2: #22c3ee; --o-soft: #dbe8ff; --o-ink: #1d4ed8; --o-grad: linear-gradient(135deg, #5aa2ff, #3b82f6 48%, #22c3ee); --o-hero: linear-gradient(135deg, #3b6ff6, #3b9bf6 45%, #22c3ee); }
.own-pink { --o1: #f0468e; --o2: #ff8fbb; --o-soft: #ffe0ed; --o-ink: #c0175d; --o-grad: linear-gradient(135deg, #ff8fbf, #f0468e 50%, #b18cff); --o-hero: linear-gradient(135deg, #f0468e, #ff7aa8 45%, #b18cff); }

/* ───────── base ───────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); font-size: 15px; line-height: 1.75;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; transition: background-color .5s;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.4; }
ul { margin: 0; padding: 0; list-style: none; }
q { quotes: "«" "»"; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; }
.ltr { direction: ltr; text-align: left; }
.muted { color: var(--ink-3); }
.grow { flex: 1; }
.pre { white-space: pre-wrap; }
.flip { transform: scaleX(-1); }
.link { display: inline-flex; align-items: center; gap: 2px; color: var(--accent-ink); font-weight: 700; font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

/* animated background */
.bg-deco { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: radial-gradient(1100px 620px at 100% -10%, var(--bg-2), transparent 62%), radial-gradient(900px 560px at -10% 110%, var(--bg-3), transparent 60%), var(--bg); transition: background .6s; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; animation: blob 20s ease-in-out infinite alternate; }
.b1 { width: 440px; height: 440px; background: var(--accent-soft); top: -140px; right: -90px; }
.b2 { width: 380px; height: 380px; background: color-mix(in srgb, var(--accent-3) 26%, transparent); bottom: -140px; left: -80px; animation-delay: -7s; }
.b3 { width: 300px; height: 300px; background: color-mix(in srgb, var(--accent-2) 24%, transparent); top: 38%; left: 40%; animation-delay: -13s; }
@keyframes blob { to { transform: translate(50px, -40px) scale(1.12); } }
.sparkles i { position: absolute; font-style: normal; color: var(--accent); font-size: var(--s); opacity: 0; animation: twinkle var(--t) ease-in-out infinite; animation-delay: var(--dl); }
.sparkles i::before { content: var(--glyph); }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: translateY(0) scale(.6); } 50% { opacity: .32; transform: translateY(-16px) scale(1); } }

/* ───────── buttons ───────── */
.btn { --h: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--h); padding: 0 18px; border-radius: 14px; border: 0;
  font-weight: 700; font-size: 14.5px; cursor: pointer; white-space: nowrap; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform .2s var(--spring), box-shadow .25s, background-color .2s, opacity .2s; }
.btn:active { transform: scale(.95); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-sm { --h: 38px; padding: 0 14px; font-size: 13.5px; border-radius: 12px; }
.btn-lg { --h: 52px; padding: 0 24px; font-size: 16px; border-radius: 16px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 24px -10px var(--glow), inset 0 1px 0 rgba(255, 255, 255, .28); }
.btn-primary:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 16px 30px -10px var(--glow), inset 0 1px 0 rgba(255, 255, 255, .28); }
.btn-soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn-soft:not(:disabled):hover { background: color-mix(in srgb, var(--accent-soft) 78%, var(--accent) 22%); }
.btn-ghost { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost:hover { background: var(--card-2); }
.btn-white { background: #fff; color: var(--accent-ink); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .4); }
.btn-white:hover { transform: translateY(-2px); }
.btn-glass { background: rgba(255, 255, 255, .2); color: #fff; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .4); }
.btn-glass:hover { background: rgba(255, 255, 255, .3); }
.btn-danger { background: #ffe4e8; color: #c01048; }
.danger-text { color: #c01048; }
.icon-btn { width: 40px; height: 40px; flex: none; border: 0; border-radius: 12px; background: transparent; color: var(--ink-2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: background-color .2s, color .2s, transform .15s; -webkit-tap-highlight-color: transparent; }
.icon-btn:hover { background: var(--accent-softer); color: var(--accent-ink); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; font-weight: 800; }
.icon-btn.danger:hover { background: #ffe4e8; color: #c01048; }
.spinner { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── form controls ───────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-weight: 700; font-size: 13.5px; color: var(--ink-2); }
.input { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  outline: none; resize: vertical; transition: border-color .2s, box-shadow .2s; }
.input::placeholder { color: var(--ink-3); opacity: .85; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }
.input-lg { min-height: 54px; font-size: 17px; font-weight: 600; }
textarea.input { line-height: 1.8; }
.hint { color: var(--ink-3); font-size: 12px; }
.form-err { color: #c01048; background: #fff0f3; border-radius: 12px; padding: 8px 12px; font-size: 13.5px; font-weight: 600; }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.select-wrap { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding-inline: 12px 8px; border-radius: 12px; background: var(--card); border: 1.5px solid var(--line); color: var(--ink-2); }
.select-wrap select { border: 0; background: transparent; font-weight: 700; font-size: 13.5px; outline: none; cursor: pointer; }
input[type="range"] { accent-color: var(--accent); width: 100%; }

/* chips & segmented control */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card);
  color: var(--ink-2); font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: all .2s; -webkit-tap-highlight-color: transparent; }
.chip:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); color: var(--accent-ink); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 8px 16px -8px var(--glow); }
.chip-sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.chip-lg { height: 44px; padding: 0 18px; font-size: 14.5px; }
.chip-glass { height: 28px; padding: 0 10px; border: 0; font-size: 12px; background: rgba(255, 255, 255, .82); color: var(--ink); cursor: default; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.chip-glass:hover { color: var(--ink); }
.chip-person .av { margin-inline-start: -6px; }
.chip-person.on { background: var(--o1); border-color: var(--o1); }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-scroll { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; min-width: 0; }
.chips-scroll::-webkit-scrollbar { display: none; }
.seg { display: inline-flex; gap: 2px; padding: 4px; border-radius: 14px; background: color-mix(in srgb, var(--accent-soft) 55%, var(--card)); }
.seg button { height: 36px; padding: 0 14px; border: 0; border-radius: 11px; background: transparent; color: var(--ink-2); font-weight: 700; font-size: 13.5px; cursor: pointer; transition: all .2s; white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--accent-ink); box-shadow: 0 3px 10px -3px var(--shadow-c); }
.seg-block { display: flex; }
.seg-block button { flex: 1; }

/* cards, pills, bars, rings, avatars */
.card { background: var(--card); border-radius: var(--r-lg); padding: 20px; border: 1px solid var(--line-2); box-shadow: 0 1px 2px rgba(20, 20, 60, .04), 0 14px 34px -20px var(--shadow-c); }
.card-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 16px; font-weight: 800; }
.card-title .muted { margin-inline-start: auto; font-size: 13px; font-weight: 700; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; border-radius: 99px; background: var(--o-soft); color: var(--o-ink); font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill-soon { background: #fff2d4; color: #9a5800; }
.pill-late { background: #ffe6ea; color: #c01048; }
.pill-gold { background: #fff5d1; color: #8f6200; }
.bar { display: block; height: 8px; border-radius: 99px; overflow: hidden; background: color-mix(in srgb, var(--o1) 14%, transparent); }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--o-grad); transition: width .9s var(--ease); }
.bar-lg { height: 12px; }
.ring-bg { stroke: color-mix(in srgb, var(--o1) 15%, transparent); }
.ring-fg { stroke: var(--o1); transition: stroke-dashoffset 1.1s var(--ease); }
.hearts { display: inline-flex; font-size: 13px; line-height: 1; color: color-mix(in srgb, var(--o1) 22%, transparent); }
.hearts i { font-style: normal; }
.hearts i.on { color: var(--o1); }
.av { width: var(--s); height: var(--s); flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: calc(var(--s) * .34);
  font-size: calc(var(--s) * .56); line-height: 1; background: var(--o-soft); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--o1) 22%, transparent); }
.av-xl { --s: 88px; }
.logo-mark { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 30%; background: var(--grad); box-shadow: 0 8px 20px -8px var(--glow); }
.stamp { position: absolute; top: 46%; left: 50%; z-index: 2; transform: translate(-50%, -50%) rotate(-13deg); padding: 0 18px; border-radius: 12px; border: 3px solid #fff;
  background: rgba(245, 176, 10, .88); color: #fff; font-family: var(--display); font-size: 26px; line-height: 1.6; white-space: nowrap; box-shadow: 0 10px 26px -8px rgba(0, 0, 0, .4); }
.stamp-lg { font-size: 40px; padding: 0 28px; }

/* empty states & skeletons */
.empty { column-span: all; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 20px; text-align: center; }
.empty.sm { padding: 24px 8px; }
.empty.fatal { min-height: 100vh; justify-content: center; }
.empty-emoji { font-size: 64px; line-height: 1.2; animation: bob 3.2s ease-in-out infinite; }
.empty h3 { font-size: 18px; font-weight: 800; }
.empty p { max-width: 440px; color: var(--ink-3); }
.empty .btn { margin-top: 8px; }
@keyframes bob { 50% { transform: translateY(-10px) rotate(-4deg); } }
.skel { border-radius: 18px; background: linear-gradient(90deg, var(--line-2) 25%, var(--card-2) 50%, var(--line-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skel-hero { height: 340px; border-radius: 28px; margin-bottom: 18px; }
.skel-line { height: 22px; width: 60%; margin-bottom: 10px; }
.skel-line.short { width: 35%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ───────── modal / bottom sheet ───────── */
.mdl { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.mdl-back { position: absolute; inset: 0; background: color-mix(in srgb, var(--ink) 42%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .28s; }
.mdl-card { position: relative; width: 100%; max-width: 520px; max-height: min(90vh, 920px); overflow: auto; overscroll-behavior: contain; background: var(--card); border-radius: 28px;
  box-shadow: 0 34px 90px -24px rgba(0, 0, 0, .42); opacity: 0; transform: translateY(26px) scale(.97); transition: transform .36s var(--spring), opacity .25s; }
.mdl.in .mdl-back { opacity: 1; }
.mdl.in .mdl-card { opacity: 1; transform: none; }
.mdl-wide .mdl-card { max-width: 720px; }
.mdl-sm .mdl-card { max-width: 430px; }
.mdl-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px 10px;
  background: color-mix(in srgb, var(--card) 88%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.mdl-head h2 { font-family: var(--display); font-weight: 400; font-size: 23px; }
.mdl-body { padding: 4px 22px 22px; }
.mdl-x { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 3; }
.mdl-grab { display: none; }
html.mdl-open body { overflow: hidden; }
html.mdl-open .main { overflow: hidden; }
@media (max-width: 1023px) {
  .mdl { align-items: flex-end; padding: 0; }
  .mdl-card { max-width: none !important; max-height: 93vh; border-radius: 28px 28px 0 0; transform: translateY(100%); padding-bottom: env(safe-area-inset-bottom); }
  .mdl-grab { display: block; width: 44px; height: 5px; margin: 10px auto 0; border-radius: 9px; background: var(--line); }
  .mdl-x { top: 18px; }
}
.confirm { text-align: center; padding: 22px 4px 4px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.confirm-ic { font-size: 54px; line-height: 1.2; }
.confirm h3 { font-size: 18px; font-weight: 800; }
.confirm p { color: var(--ink-2); font-size: 14px; }
.confirm-row { display: flex; gap: 10px; width: 100%; margin-top: 10px; }
.confirm-row .btn { flex: 1; }
.row-btns { display: flex; gap: 10px; margin-top: 14px; }
.row-btns .btn { flex: 1; }

/* toast, confetti, bursts */
.toasts { position: fixed; z-index: 400; top: calc(14px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); width: min(92vw, 440px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 16px; background: var(--ink); color: #fff; font-weight: 600; font-size: 14px;
  box-shadow: 0 16px 34px -12px rgba(0, 0, 0, .45); opacity: 0; transform: translateY(-20px) scale(.94); transition: all .38s var(--spring); }
.toast.in { opacity: 1; transform: none; }
.toast-ic { font-size: 20px; }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 380; pointer-events: none; }
.burst { position: fixed; z-index: 390; width: 0; height: 0; pointer-events: none; }
.burst-main { position: absolute; left: 0; top: 0; font-size: 66px; line-height: 1; transform: translate(-50%, -50%) scale(0); filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .25)); animation: burst-pop 1s var(--spring) forwards; }
.burst-mini { position: absolute; left: 0; top: 0; font-size: 18px; line-height: 1; animation: burst-fly .95s ease-out forwards; }
@keyframes burst-pop { 0% { transform: translate(-50%, -50%) scale(0); } 35% { transform: translate(-50%, -50%) scale(1.25); } 65% { transform: translate(-50%, -50%) scale(.95); opacity: 1; } 100% { transform: translate(-50%, -110%) scale(1); opacity: 0; } }
@keyframes burst-fly { from { opacity: 1; transform: translate(-50%, -50%) rotate(var(--a)) translateY(0) scale(.5); } to { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateY(-78px) scale(1.05); } }

/* entrance animation (first paint of a route only) */
.anim > * { animation: rise .55s var(--ease) backwards; }
.anim > *:nth-child(2) { animation-delay: .06s; }
.anim > *:nth-child(3) { animation-delay: .12s; }
.anim > *:nth-child(4) { animation-delay: .18s; }
.anim > *:nth-child(n+5) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

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