/* ==========================================================================
   app-web-v3 design system
   Based on the datingv2 look (Figtree + Bricolage, soft surfaces, pill CTAs),
   rebuilt from scratch: one token set, light + dark, no Bootstrap.

   1. Fonts        2. Tokens        3. Reset + base     4. Typography
   5. Layout shell 6. Components    7. Utilities        8. Motion
   ========================================================================== */

/* 1. Fonts (self-hosted, OFL) -------------------------------------------- */
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url('../fonts/figtree-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url('../fonts/figtree-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 500 800; font-display: swap;
  src: url('../fonts/bricolage-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 500 800; font-display: swap;
  src: url('../fonts/bricolage-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* 2. Tokens --------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* brand (overridden per brand by /brand/theme.css) */
  --brand-from: #ff6b8a;
  --brand-to: #ff4d6d;
  --brand-grad: linear-gradient(135deg, var(--brand-from), var(--brand-to));
  --accent: #d92d55;          /* fills: buttons, active tab, own bubbles */
  --accent-hover: #c22549;
  --accent-ink: #c21f48;      /* accent-coloured text on light surfaces (>= 4.5:1) */
  --accent-soft: #fdecf0;     /* tinted backgrounds */
  --accent-line: #f5b8c6;
  --on-accent: #ffffff;
  --focus: #c21f48;

  /* neutrals */
  --bg: #ffffff;
  --surface: #f7f6f9;
  --surface-2: #efedf3;
  --card: #ffffff;
  --ink: #1b1924;
  --text-2: #3d3a47;
  --muted: #676373;
  --faint: #8e8a98;
  --line: #e9e6ee;
  --line-strong: #d5d1dc;
  --overlay: rgba(20, 16, 28, .52);
  --glass: rgba(255, 255, 255, .82);

  /* status */
  --online: #1fa463;
  --success: #147a43;  --success-soft: #e5f5eb;
  --danger: #cf2a3b;   --danger-soft: #fdecee;
  --warn: #855600;     --warn-soft: #fff3d6;
  --info: #1d63c6;     --info-soft: #eaf2fd;
  --gold: #d99a12;     --gold-soft: #fff5dc;

  /* chat */
  --bubble-in: #ffffff;
  --bubble-in-ink: #1b1924;
  --bubble-out: var(--accent);
  --bubble-out-ink: #ffffff;
  --chat-bg: #f4f2f7;

  /* type */
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --fs-xs: .75rem;   /* 12 */
  --fs-sm: .875rem;  /* 14 */
  --fs-md: 1rem;     /* 16 */
  --fs-lg: 1.125rem; /* 18 */
  --fs-xl: 1.375rem; /* 22 */
  --fs-2xl: 1.75rem; /* 28 */
  --fs-3xl: 2.25rem; /* 36 */

  /* spacing (4px grid) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-7: 32px; --s-8: 40px; --s-9: 56px;

  /* radius */
  --r-xs: 8px; --r-sm: 12px; --r-md: 16px; --r-lg: 22px; --r-xl: 28px; --r-pill: 999px;

  /* elevation */
  --sh-1: 0 1px 2px rgba(27, 25, 36, .06), 0 1px 6px rgba(27, 25, 36, .05);
  --sh-2: 0 2px 6px rgba(27, 25, 36, .07), 0 8px 24px rgba(27, 25, 36, .08);
  --sh-3: 0 12px 40px rgba(20, 16, 28, .18);
  --sh-accent: 0 6px 18px rgba(217, 45, 85, .32);

  /* shell */
  --bar-h: 58px;
  --tab-h: 64px;
  --rail-w: 0px;
  --content-max: 1080px;
  --gutter: 16px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --z-bar: 50;
  --z-sheet: 80;
  --z-toast: 100;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur: .22s;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --accent: #d92d55; --accent-hover: #e64068; --accent-ink: #ff8aa3;
    --accent-soft: #3a1823; --accent-line: #6e2a3e; --on-accent: #ffffff; --focus: #ff8aa3;
    --bg: #110f15; --surface: #18151d; --surface-2: #221e29; --card: #1b1820;
    --ink: #f4f2f7; --text-2: #d8d4df; --muted: #a8a3b3; --faint: #7f7a8b;
    --line: #2b2733; --line-strong: #3b3645; --overlay: rgba(0, 0, 0, .62); --glass: rgba(24, 21, 29, .82);
    --success: #4cc787; --success-soft: #12301f; --danger: #ff6b78; --danger-soft: #3a1519;
    --warn: #f0b44a; --warn-soft: #33270e; --info: #7fb2ff; --info-soft: #14243c; --gold: #f2b938; --gold-soft: #33280d;
    --bubble-in: #24202b; --bubble-in-ink: #f4f2f7; --chat-bg: #141118;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .4); --sh-2: 0 4px 18px rgba(0, 0, 0, .45); --sh-3: 0 16px 48px rgba(0, 0, 0, .6);
    --sh-accent: 0 6px 20px rgba(255, 79, 119, .28);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --accent: #d92d55; --accent-hover: #e64068; --accent-ink: #ff8aa3;
  --accent-soft: #3a1823; --accent-line: #6e2a3e; --on-accent: #ffffff; --focus: #ff8aa3;
  --bg: #110f15; --surface: #18151d; --surface-2: #221e29; --card: #1b1820;
  --ink: #f4f2f7; --text-2: #d8d4df; --muted: #a8a3b3; --faint: #7f7a8b;
  --line: #2b2733; --line-strong: #3b3645; --overlay: rgba(0, 0, 0, .62); --glass: rgba(24, 21, 29, .82);
  --success: #4cc787; --success-soft: #12301f; --danger: #ff6b78; --danger-soft: #3a1519;
  --warn: #f0b44a; --warn-soft: #33270e; --info: #7fb2ff; --info-soft: #14243c; --gold: #f2b938; --gold-soft: #33280d;
  --bubble-in: #24202b; --bubble-in-ink: #f4f2f7; --chat-bg: #141118;
  --sh-1: 0 1px 2px rgba(0, 0, 0, .4); --sh-2: 0 4px 18px rgba(0, 0, 0, .45); --sh-3: 0 16px 48px rgba(0, 0, 0, .6);
  --sh-accent: 0 6px 20px rgba(255, 79, 119, .28);
}

@media (min-width: 600px) { :root { --gutter: 24px; } }
@media (min-width: 992px) { :root { --rail-w: 92px; --gutter: 32px; --bar-h: 64px; } }

/* 3. Reset + base ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scroll-padding-top: calc(var(--bar-h) + 12px); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--font); font-size: var(--fs-md); line-height: 1.5; font-weight: 450;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
:where(button, [role="button"]) { -webkit-user-select: none; user-select: none; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); color: var(--ink); }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-5) 0; }
dialog { color: inherit; }
[hidden] { display: none !important; }
.ic { flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.fill { fill: currentColor; stroke: none; }

/* 4. Typography ------------------------------------------------------------ */
h1, h2, h3, h4 { margin: 0; line-height: 1.18; font-weight: 750; letter-spacing: -.012em; }
.h1, h1 { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 750; letter-spacing: -.02em; }
.h2, h2 { font-family: var(--font-display); font-size: var(--fs-xl); }
.h3, h3 { font-size: var(--fs-lg); font-weight: 750; }
.display { font-family: var(--font-display); font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.04; letter-spacing: -.03em; font-weight: 800; }
p { margin: 0 0 var(--s-3); }
p:last-child { margin-bottom: 0; }
p, li, dd, .hyph { -webkit-hyphens: auto; hyphens: auto; }
h1, h2, h3, h4, .h1, .h2, .h3, .display, .btn, .chip, .tab { -webkit-hyphens: manual; hyphens: manual; }
.lead { font-size: var(--fs-lg); color: var(--text-2); }
.small, small { font-size: var(--fs-sm); }
.xsmall { font-size: var(--fs-xs); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.strong { font-weight: 750; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.eyebrow { font-size: var(--fs-xs); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.prose { max-width: 68ch; }
.prose h2 { margin: var(--s-7) 0 var(--s-3); font-size: var(--fs-xl); }
.prose h3 { margin: var(--s-6) 0 var(--s-2); }
.prose p, .prose li { color: var(--text-2); }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 var(--s-4); }

/* 5. Layout shell ---------------------------------------------------------- */
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; padding: 10px 16px; border-radius: var(--r-sm); background: var(--ink); color: var(--bg); font-weight: 700; }
.skip:focus { top: 12px; }

.shell { min-height: 100vh; min-height: 100dvh; padding-left: var(--rail-w); }

/* app bar */
.appbar {
  position: sticky; top: 0; z-index: var(--z-bar);
  height: calc(var(--bar-h) + var(--safe-t)); padding: var(--safe-t) var(--gutter) 0;
  display: flex; align-items: center; gap: var(--s-2);
  background: var(--glass); -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid transparent; transition: border-color var(--dur);
}
.appbar.scrolled { border-bottom-color: var(--line); }
.appbar__title { flex: 1; min-width: 0; font-family: var(--font-display); font-size: 1.6rem; font-weight: 750; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar--detail .appbar__title { font-size: var(--fs-xl); }
@media (max-width: 599.98px) { .appbar__title { font-size: clamp(1.15rem, 6.2vw, 1.6rem); } .appbar--detail .appbar__title { font-size: clamp(1.05rem, 5.2vw, 1.375rem); } }
.appbar__brand { display: none; }
.appbar__actions { display: flex; align-items: center; gap: var(--s-2); }
@media (min-width: 992px) { .appbar__inner { max-width: var(--content-max); } }

.main { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--s-4) var(--gutter) calc(var(--tab-h) + var(--safe-b) + var(--s-7)); }
.main--flush { padding: 0; max-width: none; }
.main--narrow { max-width: 640px; }
body.no-tabbar .main { padding-bottom: calc(var(--safe-b) + var(--s-7)); }

/* tab bar (bottom on phones, left rail on desktop) */
.tabbar {
  position: fixed; z-index: var(--z-bar); left: 0; right: 0; bottom: 0;
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; background: var(--glass); -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar__brand { display: none; }
.tab {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11.5px; font-weight: 650; letter-spacing: .01em; text-decoration: none !important;
  transition: color var(--dur);
}
.tab .ic { width: 26px; height: 26px; transition: transform var(--dur) var(--ease); }
.tab[aria-current="page"] { color: var(--accent-ink); font-weight: 800; }
.tab[aria-current="page"] .ic { stroke-width: 2.4; }
.tab:active .ic { transform: scale(.88); }
.tab__badge {
  position: absolute; top: 6px; left: calc(50% + 6px); min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); border: 2px solid var(--bg);
  font-size: 11px; font-weight: 800; line-height: 15px; text-align: center;
}
.tab__badge:empty { min-width: 12px; width: 12px; height: 12px; top: 9px; padding: 0; }
body.no-tabbar .tabbar { display: none; }

@media (min-width: 992px) {
  .tabbar {
    top: 0; right: auto; width: var(--rail-w); height: 100%; padding: var(--s-5) 0 var(--s-5);
    flex-direction: column; justify-content: flex-start; gap: var(--s-2);
    border-top: 0; border-right: 1px solid var(--line); background: var(--bg);
  }
  .tabbar__brand { display: flex; justify-content: center; margin-bottom: var(--s-5); }
  .tabbar__brand img, .tabbar__brand svg { width: 44px; height: 44px; }
  .tab { flex: none; height: 68px; margin: 0 10px; border-radius: var(--r-md); font-size: 12px; }
  .tab:hover { background: var(--surface); color: var(--ink); }
  .tab[aria-current="page"] { background: var(--accent-soft); }
  .tab__badge { top: 8px; left: calc(50% + 8px); }
  body.no-tabbar .tabbar { display: flex; }
  body.no-tabbar .main { padding-bottom: var(--s-7); }
  .main { padding-bottom: var(--s-8); }
}
/* keyboard open on phones: hide the tab bar so it does not ride the keyboard */
@media (max-width: 991.98px) and (max-height: 520px) { .tabbar { display: none; } }

/* credits pill */
.credits {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 4px 0 10px;
  border-radius: var(--r-pill); background: var(--gold-soft); color: var(--ink);
  font-weight: 800; font-size: var(--fs-sm); text-decoration: none !important; white-space: nowrap;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 30%, transparent);
  transition: transform var(--dur) var(--ease);
}
.credits:active { transform: scale(.96); }
.credits__coin { width: 20px; height: 20px; color: var(--gold); }
.credits__plus { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.credits__plus .ic { width: 16px; height: 16px; stroke-width: 3; }
.credits.bump { animation: bump .5s var(--ease); }
@keyframes bump { 30% { transform: scale(1.12); } }

/* guest chrome */
.gbar { position: sticky; top: 0; z-index: var(--z-bar); background: var(--glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.gbar__in { max-width: 1160px; margin: 0 auto; height: 64px; padding: 0 var(--gutter); display: flex; align-items: center; gap: var(--s-3); }
.gbar__spacer { flex: 1; }
.gmain { max-width: 1160px; margin: 0 auto; padding: var(--s-6) var(--gutter) var(--s-9); }
.gmain--narrow { max-width: 520px; }
.gfoot { border-top: 1px solid var(--line); background: var(--surface); }
.gfoot__in { max-width: 1160px; margin: 0 auto; padding: var(--s-7) var(--gutter) calc(var(--s-7) + var(--safe-b)); display: grid; gap: var(--s-4); }
.gfoot nav { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }
.gfoot a { color: var(--text-2); font-weight: 600; font-size: var(--fs-sm); }

/* logo */
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none !important; }
.logo__mark { width: 36px; height: 36px; }
.logo__word { font-family: var(--font-display); font-weight: 800; font-size: 1.45rem; letter-spacing: -.03em; }
.logo__word b { color: var(--accent-ink); font-weight: 800; }

/* 6. Components ------------------------------------------------------------- */
/* buttons */
.btn {
  --btn-h: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--btn-h); padding: 0 var(--s-5); border: 0; border-radius: var(--r-pill);
  font-weight: 800; font-size: var(--fs-md); line-height: 1.1; text-align: center; text-decoration: none !important;
  background: var(--surface-2); color: var(--ink);
  transition: background-color var(--dur), color var(--dur), box-shadow var(--dur), transform .12s var(--ease), opacity var(--dur);
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn .ic { width: 20px; height: 20px; }
.btn--primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--sh-accent); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn--brand { background: var(--brand-grad); color: #fff; box-shadow: var(--sh-accent); }
.btn--secondary { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.btn--secondary:hover:not(:disabled) { box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn--soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover:not(:disabled) { background: var(--surface); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--dark { background: var(--ink); color: var(--bg); }
.btn--sm { --btn-h: 38px; padding: 0 var(--s-4); font-size: var(--fs-sm); }
.btn--lg { --btn-h: 56px; padding: 0 var(--s-6); font-size: var(--fs-lg); }
.btn--block { display: flex; width: 100%; }
.btn.is-loading { pointer-events: none; color: transparent !important; position: relative; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid currentColor; border-color: var(--on-accent) var(--on-accent) transparent transparent;
  animation: spin .7s linear infinite;
}
.btn--secondary.is-loading::after, .btn--ghost.is-loading::after, .btn--soft.is-loading::after { border-color: var(--ink) var(--ink) transparent transparent; }

.icon-btn {
  display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink); text-decoration: none !important; transition: background-color var(--dur), transform .12s var(--ease);
}
.icon-btn:hover { background: var(--surface); }
.icon-btn:active { transform: scale(.92); }
.icon-btn .ic { width: 24px; height: 24px; }
.icon-btn--soft { background: var(--surface); }
.icon-btn--float { background: var(--glass); box-shadow: var(--sh-1); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.icon-btn--sm { width: 36px; height: 36px; }
.icon-btn--sm .ic { width: 20px; height: 20px; }

/* chips + segmented */
.chips { display: flex; gap: var(--s-2); overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none; height: 38px; padding: 0 14px;
  border-radius: var(--r-pill); border: 1.5px solid var(--line-strong); background: var(--card);
  color: var(--ink); font-weight: 700; font-size: var(--fs-sm); white-space: nowrap; text-decoration: none !important;
  transition: background-color var(--dur), border-color var(--dur), color var(--dur);
}
.chip .ic { width: 18px; height: 18px; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"], .chip.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.chip__count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font-size: 11px; line-height: 20px; text-align: center; }

.seg { display: flex; gap: 4px; padding: 4px; border-radius: var(--r-md); background: var(--surface-2); overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg button {
  flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); font-weight: 750; font-size: var(--fs-sm);
  white-space: nowrap; text-decoration: none !important; transition: background-color var(--dur), color var(--dur);
}
.seg [aria-current="page"], .seg [aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--sh-1); }

/* forms */
.field { display: grid; gap: 6px; margin-bottom: var(--s-4); }
.field > label, .label { font-weight: 750; font-size: var(--fs-sm); color: var(--text-2); }
.hint { font-size: var(--fs-sm); color: var(--muted); }
.error-text { font-size: var(--fs-sm); color: var(--danger); font-weight: 650; }
.input, .select, .textarea {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line-strong); background: var(--card); color: var(--ink);
  transition: border-color var(--dur), box-shadow var(--dur); appearance: none; -webkit-appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
.select { padding-right: 42px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%23676373' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 7.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input-group { position: relative; }
.input-group .input { padding-right: 52px; }
.input-group__btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.row-fields { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: var(--s-2); }

.check { display: flex; align-items: flex-start; gap: var(--s-3); cursor: pointer; font-weight: 550; }
.check input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); }

.option { position: relative; display: flex; align-items: center; gap: var(--s-3); min-height: 56px; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border: 1.5px solid var(--line-strong); background: var(--card); cursor: pointer; font-weight: 700; transition: border-color var(--dur), background-color var(--dur), box-shadow var(--dur); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option:hover { border-color: var(--faint); }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.option:has(input:focus-visible) { outline: 2.5px solid var(--focus); outline-offset: 2px; }
.options { display: grid; gap: var(--s-2); grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }

.switch { position: relative; display: inline-block; flex: none; width: 52px; height: 32px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--line-strong); transition: background-color var(--dur); }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform var(--dur) var(--ease); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2.5px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + span { opacity: .45; }

input[type="range"] { width: 100%; accent-color: var(--accent); }

/* cards, panels, list rows */
.card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--sh-1); border: 1px solid var(--line); }
.card--pad { padding: var(--s-5); }
.panel { background: var(--surface); border-radius: var(--r-lg); padding: var(--s-5); }
.section { margin-top: var(--s-7); }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); }

.list { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--r-lg); border: 1px solid var(--line); overflow: hidden; }
.list > li + li { border-top: 1px solid var(--line); }
.lrow { display: flex; align-items: center; gap: var(--s-3); min-height: 60px; padding: var(--s-3) var(--s-4); color: var(--ink); text-decoration: none !important; background: transparent; border: 0; width: 100%; text-align: left; }
a.lrow:hover, button.lrow:hover { background: var(--surface); }
.lrow__icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); }
.lrow__icon .ic { width: 22px; height: 22px; }
.lrow__body { flex: 1; min-width: 0; }
.lrow__title { display: block; font-weight: 750; }
.lrow__sub { display: block; font-size: var(--fs-sm); color: var(--muted); }
.lrow__end { flex: none; display: flex; align-items: center; gap: var(--s-2); color: var(--muted); font-size: var(--fs-sm); font-weight: 650; }
.lrow__chev { color: var(--faint); width: 20px; height: 20px; }

/* avatar */
.avatar { position: relative; flex: none; width: var(--av, 48px); height: var(--av, 48px); border-radius: 50%; background: var(--surface-2); }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar--sm { --av: 36px; } .avatar--lg { --av: 64px; } .avatar--xl { --av: 96px; } .avatar--2xl { --av: 128px; }
.avatar .dot { position: absolute; right: 2%; bottom: 2%; width: 26%; height: 26%; min-width: 10px; min-height: 10px; border: 2.5px solid var(--bg); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--online); }
.dot--away { background: var(--gold); }

/* badges + tags */
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 800; line-height: 1; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 800; letter-spacing: .01em; white-space: nowrap; }
.tag .ic { width: 14px; height: 14px; }
.tag--accent { background: var(--accent-soft); color: var(--accent-ink); }
.tag--new { background: var(--accent); color: var(--on-accent); }
.tag--success { background: var(--success-soft); color: var(--success); }
.tag--gold { background: var(--gold-soft); color: var(--warn); }
.tag--glass { background: rgba(255,255,255,.9); color: #1b1924; }

/* banners (inline alerts) */
.banner { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--info-soft); color: var(--ink); font-weight: 550; }
.banner .ic { flex: none; width: 22px; height: 22px; margin-top: 1px; color: var(--info); }
.banner--success { background: var(--success-soft); } .banner--success .ic { color: var(--success); }
.banner--error { background: var(--danger-soft); } .banner--error .ic { color: var(--danger); }
.banner--warn { background: var(--warn-soft); } .banner--warn .ic { color: var(--warn); }
.banner--accent { background: var(--accent-soft); } .banner--accent .ic { color: var(--accent-ink); }
.banner__body { flex: 1; min-width: 0; }
.banner__title { font-weight: 800; }

/* empty states */
.empty { display: grid; justify-items: center; gap: var(--s-3); padding: var(--s-9) var(--s-4); text-align: center; }
.empty__art { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 28px; background: var(--accent-soft); color: var(--accent-ink); }
.empty__art .ic { width: 40px; height: 40px; stroke-width: 1.8; }
.empty__title { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 750; }
.empty__text { max-width: 36ch; color: var(--muted); }

/* toast */
.toasts { position: fixed; z-index: var(--z-toast); left: 50%; top: calc(var(--safe-t) + 12px); transform: translateX(-50%); width: min(480px, calc(100vw - 24px)); display: grid; gap: var(--s-2); pointer-events: none; }
.toast { display: flex; align-items: center; gap: var(--s-3); padding: 12px 14px 12px 16px; border-radius: var(--r-md); background: #1f1b26; color: #fff; box-shadow: var(--sh-3); font-weight: 650; pointer-events: auto; animation: toast-in .3s var(--ease); }
.toast.out { animation: toast-out .25s ease forwards; }
.toast .ic { flex: none; width: 22px; height: 22px; }
.toast--success .ic { color: #4cd38c; } .toast--error .ic { color: #ff7a86; } .toast--info .ic { color: #8fbaff; }
.toast__body { flex: 1; min-width: 0; }
.toast__action { flex: none; border: 0; background: rgba(255,255,255,.14); color: #fff; height: 34px; padding: 0 12px; border-radius: var(--r-pill); font-weight: 800; font-size: var(--fs-sm); }
.toast__avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px); } }

/* sheet: <dialog class="sheet">. Bottom sheet on phones, centred dialog >= 768px */
.sheet {
  position: fixed; inset: auto 0 0 0; z-index: var(--z-sheet); width: 100%; max-width: none; max-height: min(92dvh, 92vh); margin: 0;
  padding: 0; border: 0; border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--card); color: var(--ink);
  box-shadow: var(--sh-3); display: flex; flex-direction: column; overflow: hidden;
}
.sheet:not([open]) { display: none; }
.sheet::backdrop { background: var(--overlay); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.sheet[open] { animation: sheet-up .3s var(--ease); }
.sheet[open]::backdrop { animation: fade-in .25s ease; }
.sheet.closing { animation: sheet-down .22s ease forwards; }
.sheet.closing::backdrop { animation: fade-out .22s ease forwards; }
.sheet__handle { flex: none; width: 40px; height: 5px; margin: 10px auto 0; border-radius: 3px; background: var(--line-strong); }
.sheet__head { flex: none; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; padding: var(--s-2) var(--s-3) 0; }
.sheet__title { grid-column: 2; text-align: center; font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 750; }
.sheet__close { grid-column: 3; }
.sheet__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: var(--s-4) var(--s-5) var(--s-5); }
.sheet__foot { flex: none; padding: var(--s-3) var(--s-5) calc(var(--s-4) + var(--safe-b)); border-top: 1px solid var(--line); background: var(--card); }
@media (min-width: 768px) {
  .sheet { inset: 0; margin: auto; width: min(560px, calc(100vw - 48px)); max-height: min(86vh, 860px); height: fit-content; border-radius: var(--r-xl); }
  .sheet[open] { animation: pop-in .26s var(--ease); }
  .sheet.closing { animation: pop-out .18s ease forwards; }
  .sheet__handle { display: none; }
  .sheet__head { padding-top: var(--s-4); }
  .sheet__foot { padding-bottom: var(--s-4); }
  .sheet--wide { width: min(760px, calc(100vw - 48px)); }
}
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes pop-out { to { opacity: 0; transform: scale(.97); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

/* menus (popover list anchored to a button) */
.menu { position: fixed; z-index: var(--z-sheet); min-width: 220px; padding: 6px; border-radius: var(--r-md); background: var(--card); border: 1px solid var(--line); box-shadow: var(--sh-3); animation: pop-in .16s var(--ease); }
.menu button, .menu a { display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink); font-weight: 650; text-align: left; text-decoration: none !important; }
.menu button:hover, .menu a:hover { background: var(--surface); }
.menu .ic { width: 20px; height: 20px; color: var(--muted); }
.menu .is-danger { color: var(--danger); } .menu .is-danger .ic { color: var(--danger); }
.menu hr { margin: 6px 4px; }

/* profile grid + card */
.pgrid { display: grid; gap: var(--s-3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 600px) { .pgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); } }
@media (min-width: 880px) { .pgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.pcard { position: relative; display: block; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-2); color: #fff; text-decoration: none !important; aspect-ratio: 3 / 4; isolation: isolate; box-shadow: var(--sh-1); }
.pcard__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.pcard:hover .pcard__img { transform: scale(1.04); }
.pcard::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, rgba(12, 8, 18, .78)); z-index: 0; }
.pcard__top { position: absolute; z-index: 1; top: 10px; left: 10px; right: 10px; display: flex; gap: 6px; justify-content: space-between; align-items: flex-start; }
.pcard__body { position: absolute; z-index: 1; left: 12px; right: 12px; bottom: 12px; }
.pcard__name { font-size: var(--fs-lg); font-weight: 800; line-height: 1.15; text-shadow: 0 1px 8px rgba(0,0,0,.3); }
.pcard__meta { font-size: 13px; font-weight: 600; opacity: .92; display: flex; align-items: center; gap: 4px; }
.pcard__meta .ic { width: 14px; height: 14px; }
.pcard__action { position: absolute; z-index: 2; right: 10px; bottom: 10px; }
.online-tag { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px 0 7px; border-radius: var(--r-pill); background: rgba(255,255,255,.92); color: #14703a; font-size: 12px; font-weight: 800; }
.online-tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--online); }

/* skeleton + spinner */
.skel { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-sm); }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--bg) 55%, transparent), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* steps / progress */
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; width: var(--p, 0%); background: var(--brand-grad); border-radius: 3px; transition: width .4s var(--ease); }

/* page head inside main (for pages without big app bar title) */
.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }

/* auth card (login/signup) */
.auth { max-width: 460px; margin: 0 auto; }
.auth__card { padding: var(--s-6) var(--s-5); }
@media (min-width: 600px) { .auth__card { padding: var(--s-7); } }
.auth__head { text-align: center; margin-bottom: var(--s-6); }
.auth__head .h1 { margin-bottom: var(--s-2); }
.divider-text { display: flex; align-items: center; gap: var(--s-3); color: var(--muted); font-size: var(--fs-sm); font-weight: 650; margin: var(--s-5) 0; }
.divider-text::before, .divider-text::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* 7. Utilities -------------------------------------------------------------- */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stack { display: grid; gap: var(--gap, var(--s-4)); }
.stack-sm { display: grid; gap: var(--s-2); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--s-2)); }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.grow { flex: 1; min-width: 0; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); } .mt-5 { margin-top: var(--s-5); } .mt-6 { margin-top: var(--s-6); } .mt-7 { margin-top: var(--s-7); }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: var(--s-2); } .mb-3 { margin-bottom: var(--s-3); } .mb-4 { margin-bottom: var(--s-4); } .mb-5 { margin-bottom: var(--s-5); } .mb-6 { margin-bottom: var(--s-6); }
.w-full { width: 100%; }
.d-block { display: block; }
.m-0 { margin: 0; }
.accent { color: var(--accent-ink); }
.hide-mobile { display: none; }
@media (min-width: 768px) { .hide-mobile { display: initial; } .hide-desktop { display: none !important; } }

/* 8. Motion ------------------------------------------------------------------ */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  @view-transition { navigation: none; }
}

@media print {
  .appbar, .tabbar, .gbar, .gfoot, .toasts { display: none !important; }
  .shell { padding: 0; }
}

/* language menu (details/summary, works without JS) */
.langmenu { position: relative; }
.langmenu > summary { list-style: none; }
.langmenu > summary::-webkit-details-marker { display: none; }
.langmenu__list { position: absolute; right: 0; top: calc(100% + 6px); min-width: 170px; }
.langmenu__list a[aria-current="true"] { color: var(--accent-ink); font-weight: 800; }
