/* ==========================================================================
   FiddlePop — design system + layout
   Tokens first; every component below reads them, so the dark theme is a
   token swap, not a second stylesheet.
   ========================================================================== */

@font-face {
  font-family: 'Nunito';
  src: url('/assets/fonts/nunito-latin-wght-normal.woff2') format('woff2');
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fredoka';
  src: url('/assets/fonts/fredoka-latin-wght-normal.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --font-ui: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Fredoka', 'Nunito', system-ui, sans-serif;

  --bg: #f3f4fa;
  --bg-2: #eaecf6;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-3: #eef0f8;
  --overlay: rgba(20, 17, 52, 0.55);
  --ink: #1e1a4b;
  --ink-2: #4b4870;
  --ink-3: #7d7a9e;
  --ink-inverse: #ffffff;
  --line: #e3e5f0;
  --line-2: #d3d6e7;

  --brand: #ff4d8d;
  --brand-strong: #e6306f;      /* pink that passes 4.5:1 as text on white */
  --brand-2: #8a5cff;
  --brand-2-strong: #6a3ff0;
  --brand-soft: #ffe8f1;
  --brand-2-soft: #efe9ff;
  --grad: linear-gradient(135deg, #ff4d8d 0%, #8a5cff 100%);
  --grad-soft: linear-gradient(135deg, #fff0f6 0%, #f0ebff 100%);

  --yellow: #ffc43d;
  --mint: #2ed9a3;
  --sky: #3da9ff;
  --orange: #ff8a3d;
  --good: #0f9f5f;
  --good-soft: #e3f7ee;
  --warn: #b77800;
  --warn-soft: #fff4d9;
  --bad: #e03656;
  --bad-soft: #ffe8ed;

  --stage: #120f2b;

  --shadow-1: 0 1px 2px rgba(30, 26, 75, 0.06), 0 2px 6px rgba(30, 26, 75, 0.05);
  --shadow-2: 0 4px 14px rgba(30, 26, 75, 0.1);
  --shadow-3: 0 18px 44px rgba(30, 26, 75, 0.2);
  --ring: 0 0 0 3px rgba(138, 92, 255, 0.45);

  --r-xs: 8px;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  --header-h: 64px;
  --sidebar-w: 236px;
  --sidebar-w-mini: 76px;
  --gutter: 24px;
  --page-max: 1720px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Dark theme: the OS setting applies only when the viewer picked "system". */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0f0d22;
    --bg-2: #17152f;
    --surface: #1a1833;
    --surface-2: #211f3d;
    --surface-3: #2a2849;
    --overlay: rgba(5, 4, 16, 0.7);
    --ink: #f3f1ff;
    --ink-2: #c3c0e0;
    --ink-3: #8f8cb2;
    --line: #2d2a4d;
    --line-2: #3b3860;
    --brand-strong: #ff6a9f;
    --brand-2-strong: #a483ff;
    --brand-soft: #3a1830;
    --brand-2-soft: #2a2152;
    --grad-soft: linear-gradient(135deg, #2a1732 0%, #221c49 100%);
    --good: #34d399;
    --good-soft: #10352a;
    --warn: #fbbf24;
    --warn-soft: #3a2e0e;
    --bad: #ff6b85;
    --bad-soft: #3d1522;
    --stage: #07061a;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 6px 18px rgba(0, 0, 0, 0.45);
    --shadow-3: 0 18px 44px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f0d22;
  --bg-2: #17152f;
  --surface: #1a1833;
  --surface-2: #211f3d;
  --surface-3: #2a2849;
  --overlay: rgba(5, 4, 16, 0.7);
  --ink: #f3f1ff;
  --ink-2: #c3c0e0;
  --ink-3: #8f8cb2;
  --line: #2d2a4d;
  --line-2: #3b3860;
  --brand-strong: #ff6a9f;
  --brand-2-strong: #a483ff;
  --brand-soft: #3a1830;
  --brand-2-soft: #2a2152;
  --grad-soft: linear-gradient(135deg, #2a1732 0%, #221c49 100%);
  --good: #34d399;
  --good-soft: #10352a;
  --warn: #fbbf24;
  --warn-soft: #3a2e0e;
  --bad: #ff6b85;
  --bad-soft: #3d1522;
  --stage: #07061a;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 6px 18px rgba(0, 0, 0, 0.45);
  --shadow-3: 0 18px 44px rgba(0, 0, 0, 0.6);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg, video, canvas, iframe { display: block; max-width: 100%; }
img { border: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: -0.005em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-xs); }
::selection { background: rgba(255, 77, 141, 0.25); }
[hidden] { display: none !important; }

.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;
}
.muted { color: var(--ink-3); }
.ink-2 { color: var(--ink-2); }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 6px; }
.stack.loose { gap: 20px; }
.center { display: grid; place-items: center; }
.link { color: var(--brand-2-strong); font-weight: 800; }
.link:hover { text-decoration: underline; }

/* ---------- icons ---------- */
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 24px; height: 24px; }
.icon.xl { width: 32px; height: 32px; }
.icon.filled { fill: currentColor; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- buttons ---------- */
.btn {
  --btn-bg: var(--surface-3);
  --btn-fg: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: var(--r-pill);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 800; font-size: 14.5px; letter-spacing: 0.005em; white-space: nowrap;
  transition: transform 0.15s var(--ease), background-color 0.15s, box-shadow 0.15s, opacity 0.15s;
  user-select: none;
}
.btn:hover { background: color-mix(in srgb, var(--btn-bg) 88%, var(--ink) 12%); }
.btn:active { transform: scale(0.97); }
.btn[disabled], .btn.is-disabled { opacity: 0.5; pointer-events: none; }
.btn.primary { --btn-bg: var(--brand); --btn-fg: #fff; background: var(--grad); box-shadow: 0 4px 14px rgba(255, 77, 141, 0.35); }
.btn.primary:hover { filter: brightness(1.06); background: var(--grad); }
.btn.dark { --btn-bg: var(--ink); --btn-fg: var(--surface); }
.btn.ghost { --btn-bg: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.outline { --btn-bg: transparent; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.btn.outline:hover { background: var(--surface-2); }
.btn.danger { --btn-bg: var(--bad-soft); --btn-fg: var(--bad); }
.btn.good { --btn-bg: var(--good-soft); --btn-fg: var(--good); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn.lg { height: 52px; padding: 0 28px; font-size: 17px; }
.btn.block { width: 100%; }
.btn.icon-only { width: 40px; padding: 0; }
.btn.icon-only.sm { width: 32px; }
.btn.is-active { --btn-bg: var(--brand-2-soft); --btn-fg: var(--brand-2-strong); }
.btn .count { font-variant-numeric: tabular-nums; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-pill);
  color: var(--ink-2); transition: background-color 0.15s, color 0.15s, transform 0.15s var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn:active { transform: scale(0.94); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > .label { font-size: 13px; font-weight: 800; color: var(--ink-2); }
.field > .help { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.field > .error { font-size: 12.5px; color: var(--bad); font-weight: 700; }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 14px; border-radius: var(--r-sm);
  background: var(--surface); border: 1.5px solid var(--line-2); color: var(--ink);
  font-weight: 600; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-2); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); font-weight: 500; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237d7a9e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px; }
.input-group { display: flex; align-items: stretch; }
.input-group > .addon { display: grid; place-items: center; padding: 0 12px; border: 1.5px solid var(--line-2); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); background: var(--surface-2); color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.input-group > .input { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; }
.check input { width: 18px; height: 18px; accent-color: var(--brand-2); }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 42px; height: 24px; border-radius: 99px; background: var(--line-2); position: relative; transition: background 0.2s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform 0.2s var(--ease); }
.switch input:checked + .track { background: var(--brand-2); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

.segmented { display: inline-flex; padding: 4px; gap: 2px; border-radius: var(--r-pill); background: var(--surface-3); }
.segmented button { height: 32px; padding: 0 14px; border-radius: var(--r-pill); font-weight: 800; font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.segmented button[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* ---------- chips & badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: var(--r-pill); background: var(--surface); color: var(--ink-2);
  box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 800; font-size: 13.5px; white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.15s var(--ease);
}
.chip:hover { color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-2); transform: translateY(-1px); }
.chip.is-active { background: var(--ink); color: var(--surface); box-shadow: none; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.chips.scroll::-webkit-scrollbar { display: none; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-2);
}
.badge.new { background: var(--mint); color: #053b2b; }
.badge.hot { background: #ff5a36; color: #fff; }
.badge.brand { background: var(--grad); color: #fff; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--brand-2-soft); color: var(--brand-2-strong); }
.badge .icon { width: 12px; height: 12px; stroke-width: 3; }

/* ---------- cards ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card.pad { padding: 20px; }
.card.pad-lg { padding: 28px; }
.card-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.card-sub { color: var(--ink-3); font-size: 13.5px; }
.divider { height: 1px; background: var(--line); border: 0; margin: 16px 0; }
.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r);
  background: var(--brand-2-soft); color: var(--ink); font-size: 14px;
}
.notice .icon { color: var(--brand-2-strong); margin-top: 1px; }
.notice.warn { background: var(--warn-soft); }
.notice.warn .icon { color: var(--warn); }
.notice.bad { background: var(--bad-soft); }
.notice.bad .icon { color: var(--bad); }
.notice.good { background: var(--good-soft); }
.notice.good .icon { color: var(--good); }
.kbd { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 7px; background: var(--surface); box-shadow: inset 0 -2px 0 var(--line-2), inset 0 0 0 1px var(--line-2); font-size: 12px; font-weight: 900; color: var(--ink-2); }

/* ==========================================================================
   App shell
   ========================================================================== */
.app { min-height: 100vh; }

.header {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--header-h);
  display: flex; align-items: center; gap: 12px; padding: 0 16px 0 12px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header .logo { display: flex; align-items: center; height: 40px; padding: 0 6px; border-radius: var(--r-sm); flex: none; }
.header .logo img { height: 30px; width: auto; }
.logo-dark { display: none; }
:root[data-theme='dark'] .logo-light { display: none; }
:root[data-theme='dark'] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .logo-light { display: none; }
  :root:not([data-theme='light']) .logo-dark { display: block; }
}
.header .spacer { flex: 1; }
.header-actions { display: flex; align-items: center; gap: 4px; flex: none; }

/* search */
.search { position: relative; flex: 1 1 520px; max-width: 560px; margin: 0 auto; }
.search-box {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 8px 0 16px;
  border-radius: var(--r-pill); background: var(--surface-3); border: 1.5px solid transparent;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.search-box:focus-within { background: var(--surface); border-color: var(--brand-2); box-shadow: var(--ring); }
.search-box .icon { color: var(--ink-3); }
.search-box input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none; font-weight: 700; }
.search-box input::placeholder { color: var(--ink-3); font-weight: 600; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box .kbd { margin-right: 4px; }
.search-pop {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: 8px;
  max-height: min(70vh, 560px); overflow-y: auto; border: 1px solid var(--line);
}
.search-pop .group-label { padding: 8px 10px 4px; font-size: 11.5px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.search-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r-sm); }
.search-item[aria-selected='true'], .search-item:hover { background: var(--surface-3); }
.search-item .thumb { width: 64px; aspect-ratio: 16 / 9; border-radius: 8px; object-fit: cover; background: var(--surface-3); flex: none; }
.search-item .meta { min-width: 0; }
.search-item .title { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item .sub { font-size: 12.5px; color: var(--ink-3); }
.search-item mark { background: none; color: var(--brand-strong); }
.search-empty { padding: 18px 12px; color: var(--ink-3); text-align: center; }
.search-toggle { display: none; }

/* sidebar */
.sidebar {
  position: fixed; top: var(--header-h); bottom: 0; left: 0; z-index: 40; width: var(--sidebar-w);
  padding: 14px 12px 24px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  background: var(--surface); border-right: 1px solid var(--line);
  transition: width 0.22s var(--ease), transform 0.25s var(--ease);
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
.nav-group + .nav-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.nav-label { padding: 6px 12px; font-size: 11px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.nav-item {
  display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: var(--r-sm);
  color: var(--ink-2); font-weight: 800; font-size: 14.5px; white-space: nowrap; position: relative;
  transition: background-color 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item.is-active { background: var(--brand-2-soft); color: var(--ink); }
.nav-item .nav-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; color: var(--c, var(--ink-2)); background: color-mix(in srgb, var(--c, var(--ink-3)) 14%, transparent); }
.nav-item .nav-icon .icon { width: 18px; height: 18px; }
.nav-item .nav-text { overflow: hidden; text-overflow: ellipsis; }
.nav-item .nav-count { margin-left: auto; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.nav-item .nav-pill { margin-left: auto; }

.app[data-sidebar='mini'] .sidebar { width: var(--sidebar-w-mini); padding-left: 10px; padding-right: 10px; }
.app[data-sidebar='mini'] .sidebar .nav-text,
.app[data-sidebar='mini'] .sidebar .nav-count,
.app[data-sidebar='mini'] .sidebar .nav-pill,
.app[data-sidebar='mini'] .sidebar .nav-label { display: none; }
.app[data-sidebar='mini'] .sidebar .nav-item { justify-content: center; padding: 0; height: 46px; }
.app[data-sidebar='mini'] .sidebar .nav-item .nav-icon { width: 36px; height: 36px; }

.main { padding-top: var(--header-h); padding-left: var(--sidebar-w); transition: padding-left 0.22s var(--ease); min-width: 0; }
.app[data-sidebar='mini'] .main { padding-left: var(--sidebar-w-mini); }
.page { max-width: var(--page-max); margin: 0 auto; padding: 22px var(--gutter) 40px; min-height: calc(100vh - var(--header-h) - 200px); }
.page.narrow { max-width: 880px; }
.page.medium { max-width: 1200px; }

.scrim { position: fixed; inset: 0; z-index: 45; background: var(--overlay); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.scrim.is-open { opacity: 1; pointer-events: auto; }

@media (max-width: 1099px) {
  :root { --gutter: 18px; }
}
@media (max-width: 767px) {
  :root { --header-h: 58px; --gutter: 14px; }
  body { font-size: 14.5px; }
  .header { gap: 6px; padding: 0 8px; }
  .header .logo img { height: 26px; }
  .search { position: fixed; top: 0; left: 0; right: 0; max-width: none; z-index: 70; padding: 8px 10px; background: var(--surface); border-bottom: 1px solid var(--line); display: none; }
  .search.is-open { display: block; }
  .search-pop { left: 10px; right: 10px; border-radius: var(--r); max-height: calc(100vh - 80px); }
  .search-toggle { display: inline-grid; }
  .search-close { display: inline-grid; }
  .drawer-logo { display: flex; padding: 0 8px 14px; }
  .sidebar { width: min(300px, 86vw); transform: translateX(-102%); top: 0; z-index: 60; padding-top: 16px; box-shadow: var(--shadow-3); }
  .app.drawer-open .sidebar { transform: none; }
  .app[data-sidebar] .main { padding-left: 0; }
  .app[data-sidebar='mini'] .sidebar { width: min(300px, 86vw); }
  .app[data-sidebar='mini'] .sidebar .nav-text, .app[data-sidebar='mini'] .sidebar .nav-label, .app[data-sidebar='mini'] .sidebar .nav-count { display: revert; }
  .app[data-sidebar='mini'] .sidebar .nav-item { justify-content: flex-start; padding: 0 12px; height: 42px; }
  .hide-mobile { display: none !important; }
}
@media (min-width: 768px) {
  .search-close { display: none; }
  .drawer-logo { display: none; }
  .show-mobile { display: none !important; }
}

/* avatar */
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: block; overflow: hidden; }
.avatar svg { width: 100%; height: 100%; }
.avatar.lg { width: 72px; height: 72px; }
.avatar.xl { width: 96px; height: 96px; }
.avatar-btn { padding: 2px; border-radius: 50%; }
.avatar-btn:hover { box-shadow: 0 0 0 3px var(--brand-2-soft); }

/* dropdown menu */
.menu {
  position: absolute; z-index: 80; min-width: 240px; padding: 8px; border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow-3); border: 1px solid var(--line);
  animation: pop-in 0.14s var(--ease);
}
.menu .menu-head { display: flex; gap: 12px; align-items: center; padding: 8px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu .menu-head .name { font-weight: 900; }
.menu .menu-head .email { font-size: 12.5px; color: var(--ink-3); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; height: 40px; padding: 0 10px; border-radius: var(--r-xs); font-weight: 800; font-size: 14px; color: var(--ink-2); text-align: left; }
.menu-item:hover { background: var(--surface-3); color: var(--ink); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 0; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Tiles — the heart of the portal
   ========================================================================== */
.tile {
  position: relative; display: block; border-radius: var(--r); background: var(--surface-3);
  box-shadow: var(--shadow-1); isolation: isolate; outline: none; min-width: 0;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.tile-media { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; background: var(--surface-3); }
.tile-media > img, .tile-media > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-media > img { transition: transform 0.5s var(--ease), opacity 0.3s; }
.tile-media > video { opacity: 0; transition: opacity 0.25s; }
.tile-media > video.is-playing { opacity: 1; }
.tile-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; text-align: center; font-family: var(--font-display); font-weight: 600; color: #fff; font-size: clamp(14px, 2.2vw, 22px); background: var(--grad); }
.tile-shade { position: absolute; inset: auto 0 0 0; height: 60%; background: linear-gradient(to top, rgba(10, 8, 30, 0.82), rgba(10, 8, 30, 0)); opacity: 0; transition: opacity 0.22s; pointer-events: none; }
.tile-title {
  position: absolute; left: 10px; right: 10px; bottom: 8px; z-index: 2; color: #fff;
  font-weight: 900; font-size: 14px; line-height: 1.25; text-shadow: 0 1px 3px rgba(0,0,0,.45);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.22s var(--ease);
  pointer-events: none;
}
.tile-badges { position: absolute; top: 8px; left: 8px; z-index: 2; display: flex; gap: 4px; pointer-events: none; }
.tile-fav { position: absolute; top: 8px; right: 8px; z-index: 2; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.92); color: var(--brand); box-shadow: var(--shadow-1); }
.tile-fav .icon { width: 14px; height: 14px; }
.tile:hover, .tile:focus-visible {
  transform: translateY(-4px) scale(1.035); z-index: 3;
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--brand-2), var(--shadow-3);
}
.tile:focus-visible { border-radius: var(--r); }
.tile:hover .tile-shade, .tile:focus-visible .tile-shade { opacity: 1; }
.tile:hover .tile-title, .tile:focus-visible .tile-title { opacity: 1; transform: none; }
.tile:hover .tile-media > img { transform: scale(1.05); }
.tile:active { transform: translateY(-2px) scale(1.01); }
.tile.is-big .tile-title { font-size: 18px; left: 16px; bottom: 14px; }
.tile.is-big .tile-badges { top: 12px; left: 12px; }

/* touch devices never hover, so the title is always visible there */
@media (hover: none) {
  .tile-shade { opacity: 1; height: 50%; }
  .tile-title { opacity: 1; transform: none; font-size: 12.5px; bottom: 6px; left: 8px; right: 8px; }
  .tile:hover { transform: none; box-shadow: var(--shadow-1); }
  .tile:hover .tile-media > img { transform: none; }
}

.tile.skeleton .tile-media { background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* mosaic grid: exact 16:9 cells from container-query units, 2x2 "big" tiles */
.mosaic { container-type: inline-size; }
.mosaic-grid {
  --cols: 2; --gap: 12px;
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-rows: calc((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols) * 0.5625);
  grid-auto-flow: dense;
}
.mosaic-grid > .tile.is-big { grid-column: span 2; grid-row: span 2; }
@container (min-width: 480px) { .mosaic-grid { --cols: 3; } }
@container (min-width: 720px) { .mosaic-grid { --cols: 4; --gap: 14px; } }
@container (min-width: 960px) { .mosaic-grid { --cols: 5; } }
@container (min-width: 1220px) { .mosaic-grid { --cols: 6; --gap: 16px; } }
@container (min-width: 1480px) { .mosaic-grid { --cols: 7; } }
.mosaic-grid.dense-small { --cols: 2; }
@container (min-width: 480px) { .mosaic-grid.dense-small { --cols: 2; } }
@container (min-width: 600px) { .mosaic-grid.cols-cap-3 { --cols: 3; } }

/* horizontal rows */
.shelf { position: relative; }
.shelf-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: var(--shelf-w, 232px); gap: 14px;
  overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
  padding: 10px 6px 16px; margin: -10px -6px -16px; overscroll-behavior-x: contain;
}
.shelf-track::-webkit-scrollbar { display: none; }
.shelf-track > .tile { aspect-ratio: 16 / 9; scroll-snap-align: start; }
.shelf-nav { position: absolute; top: calc(50% - 20px); z-index: 5; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); opacity: 0; transition: opacity 0.2s, transform 0.15s; }
.shelf:hover .shelf-nav:not([disabled]) { opacity: 1; }
.shelf-nav[disabled] { opacity: 0 !important; pointer-events: none; }
.shelf-nav.prev { left: -14px; }
.shelf-nav.next { right: -14px; }
@media (max-width: 767px) { .shelf-track { grid-auto-columns: var(--shelf-w-mobile, 62vw); gap: 10px; } .shelf-nav { display: none; } }

/* sections */
.section { margin-top: 30px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 22px; display: flex; align-items: center; gap: 10px; }
.section-head h2 .h-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--c, var(--brand-2)); background: color-mix(in srgb, var(--c, var(--brand-2)) 15%, transparent); }
.section-head .see-all { margin-left: auto; font-weight: 800; font-size: 14px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: var(--r-pill); }
.section-head .see-all:hover { background: var(--surface-3); color: var(--ink); }
@media (max-width: 767px) { .section { margin-top: 24px; } .section-head h2 { font-size: 19px; } }

/* hero carousel */
.hero { position: relative; border-radius: 24px; overflow: hidden; background: var(--stage); aspect-ratio: 21 / 8; min-height: 260px; max-height: 420px; width: 100%; box-shadow: var(--shadow-2); isolation: isolate; }
.hero-slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity 0.6s var(--ease), visibility 0.6s; }
.hero-slide.is-active { opacity: 1; visibility: visible; }
.hero-slide .hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.04); transition: transform 7s linear; }
.hero-slide.is-active .hero-bg { transform: scale(1.1); }
.hero-slide::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(12, 9, 36, 0.92) 0%, rgba(12, 9, 36, 0.65) 38%, rgba(12, 9, 36, 0) 70%); }
.hero-content { position: absolute; z-index: 2; left: clamp(20px, 4vw, 48px); bottom: clamp(20px, 4vw, 44px); top: clamp(20px, 4vw, 44px); max-width: min(520px, 60%); display: flex; flex-direction: column; justify-content: flex-end; gap: 12px; color: #fff; }
.hero-content .eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: var(--yellow); }
.hero-content h2 { font-size: clamp(26px, 3.6vw, 46px); font-weight: 700; text-shadow: 0 2px 12px rgba(0,0,0,.35); }
.hero-content p { color: rgba(255,255,255,.85); font-size: clamp(14px, 1.3vw, 16px); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-content .row { margin-top: 6px; }
.hero-dots { position: absolute; z-index: 3; right: 20px; bottom: 18px; display: flex; gap: 6px; }
.hero-dots button { width: 10px; height: 10px; border-radius: 99px; background: rgba(255,255,255,.4); transition: width 0.3s var(--ease), background-color 0.3s; }
.hero-dots button[aria-current='true'] { width: 28px; background: #fff; }
.hero-arrow { position: absolute; z-index: 3; top: calc(50% - 22px); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(255,255,255,.14); backdrop-filter: blur(6px); opacity: 0; transition: opacity 0.2s, background-color 0.2s; }
.hero:hover .hero-arrow { opacity: 1; }
.hero-arrow:hover { background: rgba(255,255,255,.28); }
.hero-arrow.prev { left: 14px; }
.hero-arrow.next { right: 14px; }
@media (max-width: 767px) {
  .hero { aspect-ratio: 16 / 10; border-radius: 18px; min-height: 0; }
  .hero-slide::after { background: linear-gradient(0deg, rgba(12, 9, 36, 0.92) 0%, rgba(12, 9, 36, 0.5) 50%, rgba(12, 9, 36, 0) 80%); }
  .hero-content { max-width: none; right: 20px; top: auto; }
  .hero-content p { display: none; }
  .hero-dots { right: auto; left: 20px; bottom: auto; top: 16px; }
}

/* category cards */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.cat-card {
  position: relative; display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 14px; border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow-1); font-weight: 900; overflow: hidden;
  transition: transform 0.18s var(--ease), box-shadow 0.18s;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.cat-card .cat-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: var(--c); flex: none; box-shadow: 0 4px 10px color-mix(in srgb, var(--c) 40%, transparent); }
.cat-card .cat-count { margin-left: auto; font-size: 12.5px; color: var(--ink-3); font-weight: 800; }

/* page headings */
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(24px, 3vw, 32px); display: flex; align-items: center; gap: 12px; }
.page-head .h-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--c, var(--brand-2)); box-shadow: 0 6px 16px color-mix(in srgb, var(--c, var(--brand-2)) 40%, transparent); }
.page-head .h-icon .icon { width: 24px; height: 24px; }
.page-head .sub { color: var(--ink-3); font-size: 14.5px; }
.page-head .tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.empty { display: grid; place-items: center; text-align: center; gap: 10px; padding: 56px 20px; }
.empty .empty-art { width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center; background: var(--grad-soft); color: var(--brand-2-strong); }
.empty .empty-art .icon { width: 38px; height: 38px; }
.empty h3 { font-size: 20px; }
.empty p { color: var(--ink-3); max-width: 420px; }

/* ==========================================================================
   Game page
   ========================================================================== */
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); font-weight: 700; margin-bottom: 12px; flex-wrap: wrap; }
.crumbs a:hover { color: var(--ink); }
.crumbs .icon { width: 14px; height: 14px; }

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 316px; gap: 22px; align-items: start; }
.game-layout.theater { grid-template-columns: minmax(0, 1fr); }
.game-layout.theater .game-side { display: none; }
@media (max-width: 1180px) { .game-layout { grid-template-columns: minmax(0, 1fr); } .game-side { display: none; } }

.stage {
  position: relative; width: 100%; aspect-ratio: var(--ar, 16 / 9);
  max-height: calc(100vh - var(--header-h) - 150px); min-height: 300px;
  border-radius: var(--r-lg) var(--r-lg) 0 0; overflow: hidden; background: var(--stage);
  isolation: isolate;
}
.game-layout.theater .stage { max-height: calc(100vh - var(--header-h) - 110px); }
.stage.portrait { aspect-ratio: auto; height: min(calc(100vh - var(--header-h) - 150px), 860px); }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.stage:fullscreen { max-height: none; border-radius: 0; aspect-ratio: auto; }
.stage.pseudo-fs { position: fixed; inset: 0; z-index: 200; max-height: none; min-height: 0; border-radius: 0; aspect-ratio: auto; height: 100%; }
.stage-exit { position: absolute; z-index: 20; top: max(10px, env(safe-area-inset-top)); left: 10px; display: none; }
.stage.pseudo-fs .stage-exit, .stage:fullscreen .stage-exit { display: inline-flex; }
.stage-exit .btn { background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(6px); }

.play-cover { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; overflow: hidden; }
.play-cover .bg { position: absolute; inset: -30px; width: calc(100% + 60px); height: calc(100% + 60px); object-fit: cover; filter: blur(26px) saturate(1.3) brightness(0.55); transform: scale(1.1); }
.play-cover .bg-tint { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(18, 15, 43, 0.25), rgba(18, 15, 43, 0.75)); }
.play-card { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; color: #fff; padding: 20px; max-width: 92%; }
.play-card .poster { width: min(360px, 58vw); aspect-ratio: 16 / 9; border-radius: 18px; object-fit: cover; box-shadow: 0 18px 50px rgba(0,0,0,.5), 0 0 0 3px rgba(255,255,255,.15); background: var(--surface-3); }
.play-card h1 { font-size: clamp(22px, 2.6vw, 32px); font-weight: 700; text-shadow: 0 2px 12px rgba(0,0,0,.4); }
.play-card .by { color: rgba(255,255,255,.75); font-size: 14px; margin-top: -8px; }
.play-btn {
  display: inline-flex; align-items: center; gap: 10px; height: 58px; padding: 0 34px 0 26px; border-radius: 99px;
  background: var(--grad); color: #fff; font-size: 20px; font-weight: 900; letter-spacing: 0.02em;
  box-shadow: 0 10px 30px rgba(255, 77, 141, 0.5), inset 0 -3px 0 rgba(0,0,0,.15);
  transition: transform 0.15s var(--ease), filter 0.15s;
  animation: play-pulse 2.4s ease-in-out infinite;
}
.play-btn:hover { transform: scale(1.05); filter: brightness(1.08); }
.play-btn:active { transform: scale(0.97); }
.play-btn .icon { width: 26px; height: 26px; fill: currentColor; }
@keyframes play-pulse { 0%, 100% { box-shadow: 0 10px 30px rgba(255, 77, 141, 0.5), 0 0 0 0 rgba(255, 77, 141, 0.45); } 50% { box-shadow: 0 10px 30px rgba(255, 77, 141, 0.5), 0 0 0 14px rgba(255, 77, 141, 0); } }
.play-card .platforms { display: flex; gap: 14px; font-size: 12.5px; color: rgba(255,255,255,.7); }
.play-card .platforms span { display: inline-flex; align-items: center; gap: 6px; }
.play-card .platforms .icon { width: 15px; height: 15px; }
@media (max-width: 560px) { .play-card .poster { display: none; } .play-btn { height: 52px; font-size: 18px; } }

.stage-overlay { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; background: var(--stage); color: #fff; text-align: center; padding: 20px; transition: opacity 0.35s; }
.stage-overlay.is-hidden { opacity: 0; pointer-events: none; }
.stage-overlay .loader { display: flex; flex-direction: column; align-items: center; gap: 14px; font-weight: 800; color: rgba(255,255,255,.85); }
.loader-bubble { width: 64px; height: 64px; }
.loader-bubble circle { transform-origin: center; animation: bubble-bob 1.1s ease-in-out infinite; }
@keyframes bubble-bob { 0%, 100% { transform: scale(0.92); } 50% { transform: scale(1.04); } }
.progress { width: 200px; height: 6px; border-radius: 99px; background: rgba(255,255,255,.15); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: inherit; transition: width 0.3s var(--ease); }
.progress.indeterminate > i { width: 40%; animation: indet 1.2s infinite var(--ease); }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.rotate-hint .icon { width: 48px; height: 48px; animation: rot 1.8s ease-in-out infinite; }
@keyframes rot { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }

.game-bar {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 12px; background: var(--surface);
  border-radius: 0 0 var(--r-lg) var(--r-lg); box-shadow: var(--shadow-1); flex-wrap: wrap;
}
.game-bar .g-icon { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; flex: none; background: var(--surface-3); }
.game-bar .g-title { font-family: var(--font-display); font-size: 19px; font-weight: 600; line-height: 1.15; }
.game-bar .g-dev { font-size: 13px; color: var(--ink-3); }
.game-bar .g-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vote-group { display: inline-flex; border-radius: var(--r-pill); background: var(--surface-3); padding: 3px; }
.vote-group .btn { height: 34px; padding: 0 12px; --btn-bg: transparent; }
.vote-group .btn.is-on.up { --btn-bg: var(--good-soft); --btn-fg: var(--good); }
.vote-group .btn.is-on.down { --btn-bg: var(--bad-soft); --btn-fg: var(--bad); }
.vote-group .btn.is-on .icon { fill: currentColor; fill-opacity: 0.25; }
.fav-btn.is-on { --btn-bg: var(--brand-soft); --btn-fg: var(--brand-strong); }
.fav-btn.is-on .icon { fill: currentColor; }
.pop { animation: pop 0.35s var(--ease); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
@media (max-width: 767px) {
  .stage { border-radius: var(--r) var(--r) 0 0; min-height: 0; }
  .game-bar { border-radius: 0 0 var(--r) var(--r); gap: 10px; }
  .game-bar .g-actions { margin-left: 0; width: 100%; justify-content: space-between; }
  .game-bar .g-actions .hide-sm { display: none; }
}

.game-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: calc(var(--header-h) + 16px); }
.side-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.side-grid > .tile { aspect-ratio: 16 / 9; }
.side-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 8px; }

.about { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; margin-top: 18px; }
@media (max-width: 960px) { .about { grid-template-columns: 1fr; } }
.prose { color: var(--ink-2); font-weight: 600; line-height: 1.65; }
.prose p + p, .prose p + ul, .prose ul + p { margin-top: 10px; }
.prose ul { padding-left: 20px; }
.prose li + li { margin-top: 4px; }
.prose strong { color: var(--ink); font-weight: 800; }
.prose a { color: var(--brand-2-strong); font-weight: 800; }
.prose h3 { font-size: 17px; margin: 16px 0 8px; color: var(--ink); }
.info-list { display: grid; gap: 10px; }
.info-list .row { justify-content: space-between; font-size: 14px; }
.info-list .k { color: var(--ink-3); font-weight: 700; }
.info-list .v { font-weight: 800; text-align: right; }
.rating-bar { height: 8px; border-radius: 99px; background: var(--bad-soft); overflow: hidden; }
.rating-bar > i { display: block; height: 100%; background: var(--good); border-radius: 99px; }
.controls-list { display: grid; gap: 8px; }
.controls-list .ctl { display: flex; gap: 10px; align-items: center; font-size: 14px; }

/* ad slots — collapse to nothing when AdSense is not configured */
.ad-slot { display: grid; place-items: center; background: var(--surface-2); border-radius: var(--r); overflow: hidden; min-height: 90px; position: relative; }
.ad-slot::before { content: 'Advertisement'; position: absolute; top: 4px; left: 8px; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.ad-slot.side { min-height: 250px; }
.ad-slot ins { display: block; width: 100%; }

/* ==========================================================================
   Modal, toast, misc
   ========================================================================== */
.modal-root { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px; background: var(--overlay); animation: fade-in 0.15s ease; overflow-y: auto; }
.modal { position: relative; width: 100%; max-width: 440px; background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-3); padding: 28px; animation: modal-in 0.22s var(--ease); margin: auto; }
.modal.wide { max-width: 640px; }
.modal-close { position: absolute; top: 12px; right: 12px; }
.modal h2 { font-size: 24px; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (max-width: 520px) { .modal { padding: 22px 18px; border-radius: 20px; } }

.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: var(--r-pill); background: var(--surface-3); margin: 18px 0; }
.auth-tabs button { height: 38px; border-radius: var(--r-pill); font-weight: 900; color: var(--ink-2); }
.auth-tabs button[aria-selected='true'] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.oauth-btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 46px; border-radius: var(--r-pill); font-weight: 900; box-shadow: inset 0 0 0 1.5px var(--line-2); background: var(--surface); width: 100%; transition: background-color 0.15s; }
.oauth-btn:hover { background: var(--surface-2); }
.oauth-btn svg { width: 20px; height: 20px; }
.or-sep { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 12.5px; font-weight: 800; margin: 16px 0; }
.or-sep::before, .or-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.toasts { position: fixed; z-index: 400; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: var(--r-pill); background: var(--ink); color: var(--surface); font-weight: 800; box-shadow: var(--shadow-3); animation: toast-in 0.25s var(--ease); pointer-events: auto; }
.toast.good .icon { color: var(--mint); }
.toast.bad .icon { color: #ff8fa3; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--brand-2); animation: spin 0.8s linear infinite; }
.page-loading { display: grid; place-items: center; padding: 80px 0; }

.demo-banner { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 8px 14px; font-size: 13px; font-weight: 800; background: var(--warn-soft); color: var(--ink); border-radius: var(--r); margin-bottom: 16px; text-align: center; }
.demo-banner .icon { color: var(--warn); }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 40px; }
.footer-inner { max-width: var(--page-max); margin: 0 auto; padding: 32px var(--gutter) 28px; display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 28px; }
.footer .blurb { color: var(--ink-3); font-size: 14px; max-width: 380px; margin-top: 12px; }
.footer h4 { font-family: var(--font-ui); font-size: 12px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.footer ul { list-style: none; display: grid; gap: 8px; }
.footer ul a { color: var(--ink-2); font-weight: 700; font-size: 14px; }
.footer ul a:hover { color: var(--ink); }
.footer-bottom { max-width: var(--page-max); margin: 0 auto; padding: 16px var(--gutter) 28px; display: flex; gap: 12px; justify-content: space-between; color: var(--ink-3); font-size: 13px; flex-wrap: wrap; border-top: 1px solid var(--line); }
@media (max-width: 860px) { .footer-inner { grid-template-columns: 1fr 1fr; } .footer-inner > :first-child { grid-column: span 2; } }

.seo-blurb { margin-top: 40px; padding: 28px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); }
.seo-blurb h2 { font-size: 20px; margin-bottom: 10px; }
.seo-blurb p { color: var(--ink-2); line-height: 1.7; }
.seo-blurb p + p { margin-top: 10px; }

/* static pages */
.doc { max-width: 820px; margin: 0 auto; }
.doc h1 { font-size: clamp(28px, 4vw, 40px); margin-bottom: 8px; }
.doc .lead { font-size: 17px; color: var(--ink-2); margin-bottom: 26px; }
.doc h2 { font-size: 22px; margin: 30px 0 10px; }
.doc h3 { font-size: 17px; margin: 20px 0 8px; }
.doc p, .doc li { color: var(--ink-2); line-height: 1.7; }
.doc p + p { margin-top: 12px; }
.doc ul, .doc ol { padding-left: 22px; display: grid; gap: 6px; margin: 10px 0; }
.doc a { color: var(--brand-2-strong); font-weight: 800; }
.doc code, .code-inline { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; background: var(--surface-3); padding: 2px 6px; border-radius: 6px; }
pre.code { background: #16132f; color: #e9e6ff; border-radius: var(--r); padding: 16px 18px; overflow-x: auto; font-size: 13px; line-height: 1.6; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 500; }
pre.code .c { color: #8f8cb2; }
pre.code .k { color: #ff8fb8; }
pre.code .s { color: #7ee2b8; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 18px 0; }
.feature { padding: 18px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); }
.feature .f-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--c, var(--brand-2)); margin-bottom: 12px; }
.feature h3 { margin: 0 0 6px; font-size: 16px; }
.feature p { font-size: 14px; color: var(--ink-3); }
.dev-hero { border-radius: 24px; padding: clamp(24px, 5vw, 48px); background: var(--grad); color: #fff; position: relative; overflow: hidden; }
.dev-hero h1 { font-size: clamp(28px, 4vw, 44px); font-weight: 700; }
.dev-hero p { color: rgba(255,255,255,.88); font-size: 17px; max-width: 620px; margin-top: 10px; }
.dev-hero .btn { --btn-bg: #fff; --btn-fg: var(--ink); }
.dev-hero .bubbles { position: absolute; right: -40px; top: -40px; width: 320px; height: 320px; opacity: 0.25; }

/* account page */
.profile-card { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.avatar-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 10px; }
.avatar-picker button { border-radius: 50%; padding: 3px; box-shadow: inset 0 0 0 2px transparent; transition: box-shadow 0.15s, transform 0.15s var(--ease); }
.avatar-picker button:hover { transform: scale(1.06); }
.avatar-picker button[aria-pressed='true'] { box-shadow: inset 0 0 0 3px var(--brand-2); }
.avatar-picker .avatar { width: 100%; height: auto; aspect-ratio: 1; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button, .tabs a { position: relative; height: 44px; padding: 0 14px; font-weight: 900; color: var(--ink-3); white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tabs button[aria-selected='true'], .tabs a[aria-current='page'] { color: var(--ink); }
.tabs button[aria-selected='true']::after, .tabs a[aria-current='page']::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--grad); }
.tabs .count { font-size: 12px; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--ink-2); }

/* 404 */
.nf { text-align: center; padding: 60px 20px; }
.nf .big { font-family: var(--font-display); font-size: clamp(80px, 14vw, 150px); font-weight: 700; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

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