/* =====================================================================
   Deeliar Startpage — styles
   Vanilla CSS, no build step. Strict-CSP friendly (no inline styles).
   ===================================================================== */

/* ---------- Fonts (self-hosted, OFL) ---------- */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/space-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@property --angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* ---------- Design tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #05050a;
  --bg-elev: #0b0b14;
  --surface: rgba(255, 255, 255, .035);
  --surface-2: rgba(255, 255, 255, .06);
  --surface-3: rgba(255, 255, 255, .095);
  --card: rgba(15, 15, 26, .78);
  --card-solid: #0d0d17;
  --input-bg: rgba(255, 255, 255, .04);
  --border: rgba(255, 255, 255, .08);
  --border-2: rgba(255, 255, 255, .14);
  --border-3: rgba(255, 255, 255, .22);
  --text: #f5f5fb;
  --text-2: #b6b8cf;
  --text-3: #868aa6;
  --brand-1: #7c5cff;
  --brand-2: #22d3ee;
  --brand-3: #ec4899;
  --grad-brand: linear-gradient(135deg, #7c5cff 0%, #22d3ee 100%);
  --grad-btn: linear-gradient(135deg, #7457ff 0%, #5a3cf2 55%, #3d5bf0 100%);
  --grad-text: linear-gradient(100deg, #b7a6ff 0%, #7c5cff 22%, #22d3ee 48%, #ec4899 74%, #b7a6ff 100%);
  --grad-plain: linear-gradient(180deg, #ffffff 0%, #d4d4ea 100%);
  --ok: #34d399;
  --bad: #fb7185;
  --warn: #fbbf24;
  --focus: #9b85ff;
  --header-bg: rgba(6, 6, 12, .62);
  --dialog-bg: rgba(14, 14, 24, .94);
  --dock-bg: rgba(14, 14, 24, .78);
  --backdrop: rgba(3, 3, 9, .66);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 24px 48px -28px rgba(0, 0, 0, .75);
  --shadow-lg: 0 40px 90px -24px rgba(0, 0, 0, .8);
  --ring-border: rgba(255, 255, 255, .08);
  --aurora-1: rgba(124, 92, 255, .30);
  --aurora-2: rgba(34, 211, 238, .18);
  --aurora-3: rgba(236, 72, 153, .16);
  --grid-line: rgba(255, 255, 255, .045);
  --noise-opacity: .05;
  --radius: 22px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --container: 1320px;
  --gutter: clamp(16px, 4vw, 40px);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Space Grotesk", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5fb;
  --bg-elev: #ffffff;
  --surface: rgba(20, 20, 60, .03);
  --surface-2: rgba(20, 20, 60, .05);
  --surface-3: rgba(20, 20, 60, .085);
  --card: rgba(255, 255, 255, .86);
  --card-solid: #ffffff;
  --input-bg: rgba(255, 255, 255, .8);
  --border: rgba(20, 20, 60, .09);
  --border-2: rgba(20, 20, 60, .15);
  --border-3: rgba(20, 20, 60, .24);
  --text: #0c0c1a;
  --text-2: #464a66;
  --text-3: #62667f;
  --grad-text: linear-gradient(100deg, #6d4aff 0%, #5b3df5 22%, #0891b2 48%, #db2777 74%, #6d4aff 100%);
  --grad-plain: linear-gradient(180deg, #0c0c1a 0%, #2c2c48 100%);
  --focus: #5b3df5;
  --header-bg: rgba(255, 255, 255, .7);
  --dialog-bg: rgba(255, 255, 255, .97);
  --dock-bg: rgba(255, 255, 255, .82);
  --backdrop: rgba(20, 20, 45, .34);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 20px 44px -26px rgba(30, 30, 80, .35);
  --shadow-lg: 0 40px 90px -30px rgba(30, 30, 80, .4);
  --ring-border: rgba(20, 20, 60, .1);
  --aurora-1: rgba(124, 92, 255, .20);
  --aurora-2: rgba(34, 211, 238, .18);
  --aurora-3: rgba(236, 72, 153, .12);
  --grid-line: rgba(20, 20, 60, .05);
  --noise-opacity: .035;
  --ok: #047857;
  --bad: #e11d48;
  --warn: #b45309;
}

/* Brand gradient text: interpolate in OKLCH (cyan → pink passes through violet, not grey). */
@supports (background: linear-gradient(in oklch, red, blue)) {
  :root { --grad-text: linear-gradient(100deg in oklch, #8b6cff 0%, #7c5cff 22%, #22d3ee 48%, #ec4899 74%, #8b6cff 100%); }
  :root[data-theme="light"] { --grad-text: linear-gradient(100deg in oklch, #6d4aff 0%, #5b3df5 22%, #0891b2 48%, #db2777 74%, #6d4aff 100%); }
}

@media (min-width: 1900px) { :root { --container: 1560px; } }
@media (min-width: 2600px) { :root { --container: 1960px; } html { font-size: 18px; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 96px;
  background: var(--bg);
}
html:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  text-rendering: optimizeLegibility;
}
main { flex: 1 0 auto; }
img, svg { display: block; }
img { max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }
[hidden] { display: none !important; }
::selection { background: rgba(124, 92, 255, .38); color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.nowrap { white-space: nowrap; }
.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;
}
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.skip-link {
  position: fixed; left: 16px; top: -60px; z-index: 200; padding: 10px 16px; border-radius: 12px;
  background: var(--bg-elev); color: var(--text); border: 1px solid var(--border-2); font-weight: 600;
  text-decoration: none; transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }
.kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 7px; border: 1px solid var(--border-2); border-bottom-width: 2px;
  background: var(--surface); color: var(--text-3);
  font: 600 .72rem/1 var(--mono);
}

/* ---------- Background: aurora + grid + noise ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; contain: strict; }
.aurora {
  position: absolute; border-radius: 50%;
  width: 70vmax; height: 70vmax;
  will-change: transform;
  animation: drift 32s ease-in-out infinite alternate;
}
.a1 { top: -38vmax; left: -18vmax; background: radial-gradient(closest-side, var(--aurora-1), transparent 72%); }
.a2 { top: -30vmax; right: -30vmax; background: radial-gradient(closest-side, var(--aurora-2), transparent 70%); animation-duration: 40s; animation-delay: -8s; }
.a3 { bottom: -45vmax; left: 20vmax; background: radial-gradient(closest-side, var(--aurora-3), transparent 70%); animation: none; will-change: auto; }
@keyframes drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(6vmax, 4vmax, 0) scale(1.08); }
  100% { transform: translate3d(-4vmax, 7vmax, 0) scale(.96); }
}
.bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 85% 60% at 50% 0%, #000 25%, transparent 80%);
  mask-image: radial-gradient(ellipse 85% 60% at 50% 0%, #000 25%, transparent 80%);
}
.bg-noise {
  position: absolute; inset: 0; opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme="light"] .bg-noise { filter: invert(1); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, box-shadow .3s, background-color .3s;
}
/* The blur is only needed once content scrolls under the header (it is costly without a GPU). */
.site-header.is-scrolled {
  border-bottom-color: var(--border); box-shadow: 0 12px 40px -24px rgba(0, 0, 0, .6);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 68px; }
.brand {
  display: inline-flex; align-items: center; gap: 11px; flex: none;
  text-decoration: none; color: var(--text);
  font: 700 1.2rem/1 var(--font-display); letter-spacing: -.025em;
  border-radius: 12px;
}
.brand-mark { width: 34px; height: 34px; border-radius: 10px; filter: drop-shadow(0 6px 16px rgba(124, 92, 255, .45)); transition: transform .5s var(--ease-spring); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }
.search {
  position: relative; flex: 1 1 auto; min-width: 0; max-width: 540px; margin-inline: auto;
  display: flex; align-items: center; height: 44px;
  border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border);
  transition: border-color .25s, box-shadow .25s, background-color .25s;
}
.search:hover { border-color: var(--border-2); }
.search:focus-within { border-color: rgba(124, 92, 255, .65); box-shadow: 0 0 0 4px rgba(124, 92, 255, .18), 0 10px 30px -12px rgba(124, 92, 255, .45); background: var(--surface-3); }
.search-icon { position: absolute; left: 14px; color: var(--text-3); pointer-events: none; }
.search input {
  flex: 1; min-width: 0; width: 100%; height: 100%; padding: 0 10px 0 42px;
  background: transparent; border: 0; outline: 0; color: var(--text);
}
.search input::placeholder { color: var(--text-3); opacity: 1; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-kbd { margin-right: 11px; }
.search:focus-within .search-kbd { opacity: 0; }
.search-clear {
  display: grid; place-items: center; width: 30px; height: 30px; margin-right: 7px;
  border-radius: 9px; color: var(--text-2);
}
.search-clear:hover { background: var(--surface-3); color: var(--text); }
.search-clear .i { width: 16px; height: 16px; }
.search-clear:not([hidden]) ~ .search-kbd, .search-clear:not([hidden]) + .search-kbd { display: none; }
.header-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.status-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 13px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: .82rem; font-weight: 600; color: var(--text-2); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.status-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.status-chip.is-ok .dot { background: var(--ok); }
.status-chip.is-warn .dot { background: var(--warn); }
.status-chip.is-pending .dot { animation: blink 1.2s ease-in-out 8; } /* ~10 s, then rests */
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); transition: background-color .2s, color .2s, border-color .2s, transform .2s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-2); }
.icon-btn:active { transform: scale(.94); }
.theme-toggle .i { transition: transform .6s var(--ease-spring), opacity .3s; }
.theme-toggle .i-sun, .theme-toggle .i-moon { grid-area: 1 / 1; }
:root[data-theme="dark"] .theme-toggle .i-moon { opacity: 0; transform: rotate(-90deg) scale(.4); }
:root[data-theme="light"] .theme-toggle .i-sun { opacity: 0; transform: rotate(90deg) scale(.4); }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 40px;
  overflow-x: clip; overflow-clip-margin: 24px;
  padding-top: clamp(40px, 8vw, 96px); padding-bottom: clamp(28px, 5vw, 56px);
}
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 22px; }
.greet-chip {
  display: inline-flex; align-items: center; gap: 9px; height: 34px; padding: 0 14px 0 12px;
  border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface);
  font-size: .86rem; font-weight: 550; color: var(--text-2);
  box-shadow: 0 0 0 1px rgba(124, 92, 255, .08), 0 10px 30px -16px rgba(124, 92, 255, .6);
}
.greet-chip .sep { color: var(--text-3); }
.greet-chip time { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 650; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.eyebrow {
  font-size: .78rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent;
}
:root[data-theme="light"] .eyebrow { background: linear-gradient(90deg, #5b3df5, #0e7490); -webkit-background-clip: text; background-clip: text; }
.hero-title {
  font: 700 clamp(2.35rem, 1.2rem + 4.6vw, 5.4rem)/1.02 var(--font-display);
  letter-spacing: -.045em;
  max-width: 15ch;
  text-wrap: balance;
}
.hero-title .t-plain {
  display: block;
  background: var(--grad-plain); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-title .t-grad {
  background: var(--grad-text); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: grad-pan 9s ease-in-out 2 alternate; /* one sweep there and back, then it rests */
  padding-bottom: .06em;
}
@keyframes grad-pan { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
.hero-sub {
  margin-top: 22px; max-width: 56ch;
  font-size: clamp(1rem, .95rem + .35vw, 1.2rem); line-height: 1.6; color: var(--text-2);
  text-wrap: balance;
}
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.stat {
  display: inline-flex; align-items: center; gap: 12px; padding: 9px 18px 9px 10px;
  border-radius: 16px; border: 1px solid var(--border); background: var(--surface);
}
.stat-icon {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  color: #fff;
}
.stat-icon .i { width: 18px; height: 18px; }
.si-1 { background: linear-gradient(135deg, #7c5cff, #5a3cf2); box-shadow: 0 8px 20px -8px rgba(124, 92, 255, .8); }
.si-2 { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 8px 20px -8px rgba(16, 185, 129, .8); }
.si-3 { background: linear-gradient(135deg, #ec4899, #c026d3); box-shadow: 0 8px 20px -8px rgba(236, 72, 153, .8); }
.stat-text { display: inline-flex; align-items: baseline; gap: 7px; }
.stat-num { font: 700 1.45rem/1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; min-width: 1ch; }
.stat-label { color: var(--text-2); font-size: .9rem; }

/* Hero visual: orbiting projects */
.hero-visual { position: relative; width: clamp(340px, 30vw, 460px); aspect-ratio: 1; margin-right: -10px; }
.hv-glow {
  position: absolute; inset: 18%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(124, 92, 255, .5), rgba(124, 92, 255, .22) 40%, rgba(34, 211, 238, .1) 65%, transparent 100%);
  animation: breathe 6s ease-in-out infinite;
}
.hv-sweep {
  position: absolute; inset: 3%; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 62%, rgba(124, 92, 255, .10) 84%, rgba(34, 211, 238, .26) 99.4%, transparent 100%);
  -webkit-mask-image: radial-gradient(closest-side, transparent 28%, rgba(0, 0, 0, .9) 45%, rgba(0, 0, 0, .35) 88%, transparent 100%);
  mask-image: radial-gradient(closest-side, transparent 28%, rgba(0, 0, 0, .9) 45%, rgba(0, 0, 0, .35) 88%, transparent 100%);
  animation: spin 9s linear infinite;
}
:root[data-theme="light"] .hv-sweep { opacity: .35; }
.ring { position: absolute; border-radius: 50%; border: 1px solid var(--ring-border); }
.ring-1 { inset: 30%; border-color: rgba(124, 92, 255, .35); box-shadow: 0 0 40px -6px rgba(124, 92, 255, .35) inset; }
.ring-2 { inset: 17%; border-style: dashed; }
.ring-3 { inset: 3%; }
.hv-planets { position: absolute; inset: 0; }
.orbit { position: absolute; border-radius: 50%; animation: spin var(--dur, 60s) linear infinite; animation-direction: var(--dir, normal); }
.orbit-1 { inset: 30%; --dur: 38s; }
.orbit-2 { inset: 17%; --dur: 58s; --dir: reverse; --cdir: normal; }
.orbit-3 { inset: 3%; --dur: 84s; }
.arm { position: absolute; inset: 0; transform: rotate(var(--a, 0deg)); }
.planet {
  position: absolute; left: 50%; top: 0; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  animation: spin var(--dur, 60s) linear infinite; animation-direction: var(--cdir, reverse);
}
.planet-face {
  display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%;
  transform: rotate(calc(var(--a, 0deg) * -1));
  font-size: 21px; line-height: 1;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--c, #7c5cff) 55%, #fff 10%), color-mix(in srgb, var(--c, #7c5cff) 30%, #05050a) 70%);
  border: 1px solid color-mix(in srgb, var(--c, #7c5cff) 70%, #fff 10%);
  box-shadow: 0 0 24px -2px color-mix(in srgb, var(--c, #7c5cff) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35);
  color: #fff; font-family: var(--font-display); font-weight: 700;
}
.planet-face.is-text { font-size: 15px; letter-spacing: -.02em; }
:root[data-theme="light"] .planet-face {
  background: radial-gradient(circle at 30% 25%, #fff, color-mix(in srgb, var(--c, #7c5cff) 30%, #fff) 72%);
  border-color: color-mix(in srgb, var(--c, #7c5cff) 45%, #fff);
  box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--c, #7c5cff) 60%, transparent), inset 0 1px 0 #fff;
}
:root[data-theme="light"] .planet-face.is-text { color: color-mix(in srgb, var(--cu-l, var(--c, #5b3df5)) 85%, #0c0c1a); }
.planet.is-dot { width: 10px; height: 10px; margin: -5px 0 0 -5px; }
.planet.is-dot .planet-face { font-size: 0; }
.hv-core {
  position: absolute; inset: 39%; display: grid; place-items: center; border-radius: 28%;
  animation: float 6s ease-in-out infinite;
}
.hv-core img { width: 100%; height: 100%; filter: drop-shadow(0 12px 34px rgba(124, 92, 255, .7)); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { opacity: .75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* pause decorative motion while a dialog is open, a tile is dragged or the hero is scrolled away */
html:has(dialog[open]) :is(.aurora, .orbit, .planet, .hv-sweep, .hv-core, .hv-glow, .t-grad),
html.is-dragging :is(.aurora, .orbit, .planet, .hv-sweep, .hv-core, .hv-glow, .t-grad),
html.hero-off :is(.aurora, .orbit, .planet, .hv-sweep, .hv-core, .hv-glow, .t-grad) {
  animation-play-state: paused;
}
html:has(dialog[open]) .grid :is(.pulse, .dot)::after, html:has(dialog[open]) .site-header .dot::after,
html.hero-off .pulse::after { animation-play-state: paused; }

/* ---------- Toolbar / chips ---------- */
.projects { padding-bottom: clamp(56px, 8vw, 96px); outline: none; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.chips-wrap { position: relative; min-width: 0; flex: 1 1 auto; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 4px; margin: -4px; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; flex: none; height: 38px; padding: 0 8px 0 15px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: .9rem; font-weight: 580; white-space: nowrap; scroll-snap-align: start;
  transition: background-color .25s, color .25s, border-color .25s, box-shadow .3s, transform .25s var(--ease), opacity .25s;
}
.chip:hover { color: var(--text); border-color: var(--border-2); background: var(--surface-2); }
.chip:active { transform: scale(.96); }
.chip .count {
  display: grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2); font-size: .74rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.chip.is-zero .chip-label { color: var(--text-3); } /* dimmed, but still AA (it stays clickable) */
.chip[aria-pressed="true"] {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, #6d4aff, #3a55ea);
  box-shadow: 0 10px 28px -12px rgba(109, 74, 255, .9), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.chip[aria-pressed="true"] .count { background: rgba(255, 255, 255, .22); color: #fff; }
.chip .chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ca, var(--brand-1)); margin-left: -3px; box-shadow: 0 0 10px var(--ca, var(--brand-1)); }
.result-info { flex: none; font-size: .85rem; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- Grid ---------- */
.grid-wrap { container-type: inline-size; container-name: tiles; }
.grid {
  position: relative; /* offsetParent for drag & drop hit-testing */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
  grid-auto-flow: row dense;
  gap: 20px;
}
/* accent: readable variant of the tile colour for the current theme */
.chip { --ca: var(--cu, var(--c)); }
:root[data-theme="light"] :is(.tile, .chip, .planet) { --ca: var(--cu-l, var(--c)); }
@container tiles (min-width: 600px) {
  .grid > .tile.is-featured { grid-column: span 2; }
  .grid > .tile.is-featured .tile-cover { aspect-ratio: 21 / 9; }
  .grid > .tile.is-featured .tile-title { font-size: 1.4rem; }
}
/* 4 columns (4 × 290 + 3 × 20): featured tiles also span 2 rows; every second one sits on the right. */
@container tiles (min-width: 1220px) {
  .grid > .tile.is-featured { grid-row: span 2; }
  .grid > .tile.is-featured.is-feat-alt { grid-column: -3 / -1; }
  .grid > .tile.is-featured .tile-cover { aspect-ratio: auto; flex: 1 1 auto; min-height: 250px; }
  .grid > .tile.is-featured .tile-title { font-size: 1.5rem; }
  .grid > .tile.is-featured .tile-desc { -webkit-line-clamp: 3; line-clamp: 3; font-size: 1rem; }
  .grid > .tile.is-featured .cover-icon { --ic: clamp(96px, 20cqi, 128px); }
}

/* ---------- Tile ---------- */
.tile {
  --c: #7c5cff; --c2: #a855f7; --c3: #3b82f6;
  --ca: var(--cu, var(--c)); /* small accents: dots, #, icons – readable even for #111 or #ff0 */
  --rx: 0deg; --ry: 0deg; --lift: 0px; --mx: 50%; --my: 0%;
  position: relative; display: flex; min-width: 0;
}
.tile.will-enter { opacity: 0; transform: translateY(26px) scale(.975); }
.tile.will-enter.in {
  opacity: 1; transform: none;
  transition: opacity .7s var(--ease), transform .9s var(--ease);
  transition-delay: var(--d, 0ms);
}
.tile-card {
  position: relative; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column;
  border-radius: var(--radius); background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transform: perspective(1100px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(var(--lift));
  transition: transform .7s var(--ease), box-shadow .45s var(--ease), border-color .45s;
  isolation: isolate;
}
.tile-card.is-tilting { transition: transform .14s linear, box-shadow .45s var(--ease), border-color .45s; }
.tile-card:hover, .tile-card:focus-within {
  --lift: -4px;
  border-color: color-mix(in srgb, var(--ca) 42%, var(--border));
  box-shadow: var(--shadow-card), 0 34px 70px -34px color-mix(in srgb, var(--c) 75%, transparent), 0 0 0 1px color-mix(in srgb, var(--c) 12%, transparent);
}
/* animated glowing border */
.tile-card::before {
  content: ""; position: absolute; inset: -1px; z-index: 3; border-radius: inherit; padding: 1.5px;
  background: conic-gradient(from var(--angle), transparent 0% 52%, var(--c) 68%, var(--c2) 80%, #fff 84%, transparent 92%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0; transition: opacity .45s; pointer-events: none;
  animation: spin-angle 4.5s linear infinite; animation-play-state: paused;
}
.tile-card:hover::before, .tile-card:focus-within::before { opacity: 1; animation-play-state: running; }
.tile.is-featured .tile-card::before { opacity: .5; --angle: 200deg; }
.tile.is-featured .tile-card:hover::before { opacity: 1; }
@keyframes spin-angle { to { --angle: 360deg; } }
/* cursor spotlight */
.tile-card::after {
  content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; pointer-events: none;
  background:
    radial-gradient(560px circle at var(--mx) var(--my), color-mix(in srgb, var(--c) 20%, transparent), transparent 42%),
    radial-gradient(240px circle at var(--mx) var(--my), rgba(255, 255, 255, .07), transparent 60%);
  opacity: 0; transition: opacity .4s;
}
.tile-card:hover::after { opacity: 1; }
.tile-link {
  position: relative; z-index: 1; flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0;
  color: inherit; text-decoration: none; border-radius: inherit; overflow: hidden; outline: none;
  -webkit-tap-highlight-color: transparent;
}
.tile-link:focus-visible { box-shadow: 0 0 0 2px var(--focus) inset; }
.tile-card:has(.tile-link:focus-visible) { outline: 2px solid var(--focus); outline-offset: 3px; }

/* cover */
.tile-cover {
  container: cover / inline-size;
  position: relative; aspect-ratio: 16 / 9; flex: none; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(90% 90% at 0% 0%, color-mix(in srgb, var(--c2) 45%, transparent), transparent 60%),
    linear-gradient(135deg, color-mix(in srgb, var(--c) 60%, #05050a), color-mix(in srgb, var(--c) 22%, #05050a));
}
.tile-cover > img, .cover-gen {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform 1s var(--ease), opacity .6s var(--ease);
  transform: scale(1.001);
}
.tile-cover > img { opacity: 0; }
.tile-cover.is-loaded > img, .tile.is-preview .tile-cover > img { opacity: 1; }
.tile.is-preview .tile-cover > img { transition: transform 1s var(--ease); }
.tile-card:hover .tile-cover > img, .tile-card:hover .cover-gen { transform: scale(1.06); }
.cover-shade {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(4, 4, 10, .42) 0%, rgba(4, 4, 10, 0) 32%, rgba(4, 4, 10, 0) 62%, rgba(4, 4, 10, .5) 100%);
}
/* generated cover */
.cover-gen {
  display: grid; place-items: center; overflow: hidden;
  background:
    radial-gradient(110% 90% at 0% 0%, color-mix(in srgb, var(--c2) 80%, transparent), transparent 55%),
    radial-gradient(90% 90% at 100% 100%, color-mix(in srgb, var(--c3) 75%, transparent), transparent 60%),
    radial-gradient(60% 60% at var(--gx, 70%) var(--gy, 20%), rgba(255, 255, 255, .22), transparent 70%),
    linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 45%, #05050a));
}
/* big cropped watermark of the icon / initials (white silhouette, also for colour emoji) */
.cover-gen::after {
  content: attr(data-glyph); position: absolute; right: -5%; bottom: -30%;
  font: 700 min(60cqi, 240px)/1 var(--font-display); letter-spacing: -.05em; white-space: nowrap; color: #fff;
  opacity: .14; transform: rotate(var(--rot, -8deg)); filter: brightness(0) invert(1); pointer-events: none;
}
.cover-gen::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .28) 1px, transparent 1.4px);
  background-size: 18px 18px;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 50% 50%, #000 10%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 80% at 50% 50%, #000 10%, transparent 75%);
  opacity: .55;
}
.cover-ring { position: absolute; left: 50%; top: 50%; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .2); transform: translate(-50%, -50%); }
.cover-ring.r1 { width: 170px; height: 170px; }
.cover-ring.r2 { width: 270px; height: 270px; border-color: rgba(255, 255, 255, .11); }
.cover-ring.r3 { width: 390px; height: 390px; border-color: rgba(255, 255, 255, .06); }
/* variants (picked per tile): v0 rings + dots · v1 diagonal lines · v2 grid · v3 soft dots, no rings */
.cover-gen.v1::before {
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .12) 0 1px, transparent 1px 16px);
  background-size: auto; opacity: .8;
}
.cover-gen.v2::before {
  background-image: linear-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .09) 1px, transparent 1px);
  background-size: 28px 28px; opacity: .9;
}
.cover-gen:is(.v1, .v2, .v3) .cover-ring { display: none; }
.cover-gen:is(.v1, .v2) .cover-icon { justify-self: start; margin-left: 11%; }
.cover-icon {
  /* size follows the cover (width and 16:9 height) so it never runs into the pills on small tiles */
  --ic: clamp(48px, min(24cqi, 56.25cqi - 90px), 96px);
  position: relative; z-index: 1; display: grid; place-items: center;
  width: var(--ic); height: var(--ic); border-radius: 30%;
  font-size: calc(var(--ic) * .5); line-height: 1;
  background: linear-gradient(160deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, .06));
  border: 1px solid rgba(255, 255, 255, .32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 24px 44px -14px rgba(0, 0, 0, .5), 0 0 60px -10px color-mix(in srgb, var(--c) 90%, transparent);
  transition: transform .8s var(--ease-spring);
}
.cover-icon.is-text { font: 700 calc(var(--ic) * .38)/1 var(--font-display); color: #fff; letter-spacing: -.03em; text-shadow: 0 2px 12px rgba(0, 0, 0, .25); }
.tile-card:hover .cover-icon { transform: translateY(-4px) rotate(-4deg) scale(1.04); }

/* pills on cover */
.tile-badge, .tile-status, .tile-clicks {
  position: absolute; z-index: 2; display: inline-flex; align-items: center; gap: 7px; height: 27px;
  border-radius: 999px; color: #fff; font-size: .74rem; font-weight: 650; letter-spacing: .01em; white-space: nowrap;
  background: rgba(8, 8, 16, .62); border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .5);
}
/* max-width leaves room for the status pill incl. response time ("Online · 1.234 ms") */
.tile-badge { top: 14px; left: 14px; padding: 0 11px 0 10px; max-width: calc(100% - 180px); }
.tile-badge > span { overflow: hidden; text-overflow: ellipsis; }
.tile-badge::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--badge, var(--cu, var(--c))); box-shadow: 0 0 10px var(--badge, var(--cu, var(--c))); }
.tile-badge.b-live { --badge: #34d399; }
.tile-badge.b-beta { --badge: #fbbf24; }
.tile-badge.b-neu { --badge: #22d3ee; }
.tile-badge.b-bald { --badge: #f0abfc; }
.tile-status { top: 14px; right: 14px; padding: 0 11px 0 10px; font-variant-numeric: tabular-nums; transition: color .3s, border-color .3s; }
.tile-status .dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #9ca3af; }
.tile-status.is-up .dot { background: #34d399; }
.tile-status.is-down { color: #fecdd3; border-color: rgba(251, 113, 133, .45); }
.tile-status.is-down .dot { background: #fb7185; box-shadow: 0 0 10px #fb7185; }
.tile-status.is-pending .dot { opacity: .6; } /* static: dozens of blinking dots are costly without a GPU */
.tile-status.is-preview .dot { background: var(--brand-2); }
.tile-status .st-ms:empty { display: none; }
.tile-status .st-ms { margin-left: -4px; }
/* narrow tiles with a long custom badge (> 9 chars, set in tiles.js): the badge gets the room and
   the status shows only "Online" (ms in the tooltip). Short badges (Live, Beta …) fit next to the ms. */
@container cover (max-width: 360px) {
  .has-long-badge .tile-status .st-ms { display: none; }
  .has-long-badge .tile-badge { max-width: calc(100% - 120px); }
}
.tile-clicks { bottom: 12px; left: 12px; padding: 0 11px 0 9px; font-variant-numeric: tabular-nums; }
.tile-clicks .i { width: 14px; height: 14px; }
/* pulsing status dots: transform/opacity only (runs on the compositor) */
.pulse, .status-chip.is-ok .dot, .status-chip.is-warn .dot, .tile-status.is-up .dot,
.admin-active .dot, .dock-label .dot { position: relative; animation: none; }
.pulse::after, .status-chip.is-ok .dot::after, .status-chip.is-warn .dot::after, .tile-status.is-up .dot::after,
.admin-active .dot::after, .dock-label .dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit;
  animation: ping 2.2s cubic-bezier(0, 0, .2, 1) infinite;
}
@keyframes ping { 0% { transform: scale(1); opacity: .7; } 75%, 100% { transform: scale(2.8); opacity: 0; } }
@keyframes blink { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* body */
.tile-body { display: flex; flex-direction: column; gap: 12px; flex: 1 0 auto; padding: 18px 20px 16px; }
.tile.is-featured .tile-body { flex-grow: 0; }
.tile-head { display: flex; align-items: center; gap: 13px; min-width: 0; }
.tile-icon {
  display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 13px;
  font-size: 21px; line-height: 1;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 34%, transparent), color-mix(in srgb, var(--c2) 16%, transparent));
  border: 1px solid color-mix(in srgb, var(--ca) 40%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}
.tile-icon.is-text { font: 700 .95rem/1 var(--font-display); color: color-mix(in srgb, var(--ca) 55%, var(--text)); letter-spacing: -.02em; }
.tile-heading { min-width: 0; display: grid; gap: 3px; }
.tile-title {
  font: 650 1.12rem/1.25 var(--font); letter-spacing: -.01em; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile.is-featured .tile-title {
  white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow-wrap: anywhere;
}
.tile-host {
  display: inline-flex; align-items: center; gap: 4px; min-width: 0;
  color: var(--text-3); font-size: .82rem; font-weight: 500;
}
.tile-host > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-host .i { width: 14px; height: 14px; transition: transform .4s var(--ease), color .3s; }
.tile-card:hover .tile-host .i { transform: translate(2px, -2px); color: color-mix(in srgb, var(--ca) 70%, var(--text)); }
.tile-desc {
  color: var(--text-2); font-size: .93rem; line-height: 1.55;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  overflow-wrap: anywhere;
}
.tile-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: .74rem; font-weight: 600; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tag::before { content: "#"; color: color-mix(in srgb, var(--ca) 80%, var(--text-3)); margin-right: 2px; }
.tile-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto;
  padding-top: 13px; border-top: 1px solid var(--border);
  font-size: .8rem; color: var(--text-3);
}
.tile-cat { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.tile-cat > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-cat .dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ca); box-shadow: 0 0 10px var(--ca); }
.tile-open { display: inline-flex; align-items: center; gap: 6px; flex: none; color: var(--text-2); font-weight: 650; transition: color .3s; }
.tile-open .i { width: 16px; height: 16px; transition: transform .45s var(--ease); }
.tile-card:hover .tile-open { color: var(--text); }
.tile-card:hover .tile-open .i { transform: translateX(4px); }
.tile.is-featured .tile-foot::after { content: none; }
.feat-flag {
  display: inline-flex; align-items: center; gap: 5px; margin-left: auto; margin-right: 12px;
  color: color-mix(in srgb, var(--ca) 60%, var(--text)); font-weight: 650;
}
.feat-flag .i { width: 14px; height: 14px; fill: currentColor; stroke: none; }

/* flash after save */
.tile.is-flash .tile-card { animation: flash 1.4s var(--ease); }
@keyframes flash {
  0% { box-shadow: var(--shadow-card), 0 0 0 0 color-mix(in srgb, var(--c) 80%, transparent); }
  35% { box-shadow: var(--shadow-card), 0 0 0 6px color-mix(in srgb, var(--c) 40%, transparent); }
  100% { box-shadow: var(--shadow-card), 0 0 0 14px color-mix(in srgb, var(--c) 0%, transparent); }
}

/* ---------- Admin overlay on tiles ---------- */
.tile-admin {
  position: absolute; z-index: 6; top: 12px; right: 12px; display: flex; gap: 6px;
  padding: 4px; border-radius: 14px;
  background: rgba(8, 8, 16, .7); border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 10px 26px -10px rgba(0, 0, 0, .6);
}
.tile-tool {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #e8e8f4;
  transition: background-color .2s, color .2s, transform .2s;
}
.tile-tool .i { width: 17px; height: 17px; }
.tile-tool:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.tile-tool:active { transform: scale(.92); }
.tile-tool.is-danger:hover { background: rgba(244, 63, 94, .9); }
.tile-tool.is-drag { cursor: grab; touch-action: none; }
.tile-tool.is-drag:active { cursor: grabbing; }
.tile-tool:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
/* admin: the status moves to the bottom row (next to the clicks), so it always shows the ms;
   the badge shares the top row with the tool bar */
.is-admin .grid > .tile .tile-status { top: auto; bottom: 12px; }
.is-admin .grid > .tile .tile-status .st-ms:not(:empty) { display: inline; }
.is-admin .grid > .tile .tile-badge { max-width: calc(100% - 170px); }
/* mouse: tool bars appear on hover / keyboard focus (touch keeps them visible);
   the badge only makes way for the bar while it is shown */
@media (hover: hover) and (pointer: fine) {
  .tile-admin { opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .2s var(--ease); }
  .tile-card:hover .tile-admin, .tile-card:focus-within .tile-admin, .tile.is-kbd-moving .tile-admin { opacity: 1; transform: none; }
  .is-admin .grid > .tile .tile-badge { max-width: calc(100% - 28px); }
  .is-admin .grid > .tile > .tile-card:is(:hover, :focus-within) .tile-badge,
  .is-admin .grid > .tile.is-kbd-moving .tile-badge { max-width: calc(100% - 170px); }
}

/* drag & drop */
html.is-dragging, html.is-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
/* no scroll anchoring while dragging: moving the tile would shift the page under the finger (1-column layout) */
html.is-dragging { overflow-anchor: none; }
.tile.is-placeholder .tile-card { opacity: 0; }
.tile.is-placeholder::after {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius);
  border: 1.5px dashed color-mix(in srgb, var(--c) 65%, transparent);
  background: color-mix(in srgb, var(--c) 9%, transparent);
  animation: placeholder-pulse 1.6s ease-in-out infinite;
}
@keyframes placeholder-pulse { 50% { background: color-mix(in srgb, var(--c) 16%, transparent); } }
.tile.is-ghost {
  position: fixed; z-index: 1000; margin: 0; pointer-events: none;
  rotate: 1.6deg; scale: 1.035;
  transition: rotate .25s var(--ease), scale .25s var(--ease);
}
.tile.is-ghost .tile-card {
  background: var(--card-solid);
  box-shadow: 0 50px 90px -30px rgba(0, 0, 0, .85), 0 0 0 1px color-mix(in srgb, var(--c) 60%, transparent), 0 0 60px -10px color-mix(in srgb, var(--c) 60%, transparent);
  border-color: color-mix(in srgb, var(--c) 60%, transparent);
}
.tile.is-ghost .tile-card::before { opacity: 1; animation-play-state: running; }
.tile.is-kbd-moving .tile-card { outline: 2px solid color-mix(in srgb, var(--c) 80%, #fff); outline-offset: 3px; }

/* add tile */
.tile-add-btn {
  position: relative; flex: 1 1 auto; min-height: 300px; display: grid; place-content: center; justify-items: center; gap: 14px;
  border-radius: var(--radius); border: 1.5px dashed var(--border-3); color: var(--text-2);
  background: radial-gradient(120% 90% at 50% 0%, rgba(124, 92, 255, .08), transparent 70%);
  text-align: center; padding: 24px;
  transition: border-color .3s, background-color .3s, color .3s, transform .4s var(--ease);
}
.tile-add-btn:hover { border-color: rgba(124, 92, 255, .8); color: var(--text); background-color: rgba(124, 92, 255, .06); transform: translateY(-3px); }
.tile-add-btn .plus {
  display: grid; place-items: center; width: 60px; height: 60px; border-radius: 20px; color: #fff;
  background: var(--grad-btn); box-shadow: 0 16px 40px -14px rgba(124, 92, 255, .95), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: transform .6s var(--ease-spring);
}
.tile-add-btn .plus .i { width: 26px; height: 26px; }
.tile-add-btn:hover .plus { transform: rotate(90deg) scale(1.06); }
.tile-add-btn strong { font: 650 1.1rem/1.2 var(--font); letter-spacing: -.01em; }
.tile-add-btn small { color: var(--text-3); font-size: .85rem; }

/* skeleton */
.tile.is-skeleton .tile-card { overflow: hidden; }
.sk { background: var(--surface-2); border-radius: 8px; position: relative; overflow: hidden; }
.sk::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent);
  animation: shimmer 1.6s infinite;
}
:root[data-theme="light"] .sk::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .8), transparent); }
.sk-cover { aspect-ratio: 16 / 9; border-radius: 0; }
.sk-line { height: 14px; }
.sk-line.w-60 { width: 60%; height: 18px; }
.sk-line.w-40 { width: 40%; }
.sk-line.w-90 { width: 90%; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- Empty state ---------- */
.empty {
  display: grid; justify-items: center; gap: 14px; text-align: center;
  padding: clamp(40px, 8vw, 80px) 24px; border-radius: 28px;
  border: 1px dashed var(--border-2);
  background: radial-gradient(80% 100% at 50% 0%, rgba(124, 92, 255, .09), transparent 70%), var(--surface);
  animation: fade-up .6s var(--ease);
}
.empty-icon {
  display: grid; place-items: center; width: 76px; height: 76px; border-radius: 24px; color: #fff;
  background: var(--grad-btn); box-shadow: 0 20px 50px -16px rgba(124, 92, 255, .9), inset 0 1px 0 rgba(255, 255, 255, .3);
  margin-bottom: 6px;
}
.empty-icon .i { width: 32px; height: 32px; }
.empty h3 { font: 650 1.4rem/1.25 var(--font); letter-spacing: -.015em; overflow-wrap: anywhere; }
.empty p { color: var(--text-2); max-width: 46ch; }
.empty .btn { margin-top: 8px; }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Footer ---------- */
.site-footer { position: relative; padding: 44px 0 36px; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg) 70%, transparent)); }
.footer-line {
  position: absolute; top: 0; left: 50%; width: min(1100px, 90%); height: 1px; transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(124, 92, 255, .6), rgba(34, 211, 238, .6), rgba(236, 72, 153, .5), transparent);
}
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 24px 32px; align-items: center; }
.footer-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.footer-brand img { width: 40px; height: 40px; border-radius: 12px; filter: drop-shadow(0 8px 20px rgba(124, 92, 255, .4)); }
.footer-name { display: block; font: 700 1.1rem/1.2 var(--font-display); letter-spacing: -.02em; }
.footer-text { color: var(--text-2); font-size: .92rem; overflow-wrap: anywhere; }
.footer-nav { display: flex; align-items: center; gap: 8px 22px; flex-wrap: wrap; justify-content: flex-end; }
.footer-nav a, .link-btn {
  display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: .92rem; font-weight: 550;
  text-decoration: none; border-radius: 8px; transition: color .2s;
}
.footer-nav a:hover, .link-btn:hover { color: var(--text); }
.footer-nav .i { width: 15px; height: 15px; }
.footer-bottom {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-top: 22px; border-top: 1px solid var(--border); color: var(--text-3); font-size: .85rem;
}
.footer-admin { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-active {
  display: inline-flex; align-items: center; gap: 8px; color: var(--ok); font-weight: 650; font-size: .85rem;
}
.admin-active .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.admin-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 12px;
  border-radius: 11px; border: 1px solid var(--border-2); background: var(--surface);
  color: var(--text-2); font-size: .86rem; font-weight: 600;
  transition: color .2s, border-color .2s, background-color .2s, box-shadow .3s;
}
.admin-btn .i { width: 16px; height: 16px; }
.admin-btn:hover { color: var(--text); border-color: rgba(124, 92, 255, .6); background: rgba(124, 92, 255, .1); box-shadow: 0 8px 24px -12px rgba(124, 92, 255, .8); }

/* ---------- Admin dock ---------- */
.is-admin .site-footer { padding-bottom: 116px; }
.admin-dock {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 60;
  display: flex; align-items: center; gap: 4px; padding: 6px;
  border-radius: 20px; background: var(--dock-bg); border: 1px solid var(--border-2);
  -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%);
  box-shadow: 0 24px 60px -16px rgba(0, 0, 0, .7), 0 0 0 1px rgba(124, 92, 255, .12), 0 0 50px -20px rgba(124, 92, 255, .6);
  transform: translateX(-50%);
  animation: dock-in .6s var(--ease-spring);
  max-width: calc(100vw - 20px);
}
.admin-dock::before {
  content: ""; position: absolute; top: -1px; left: 18%; right: 18%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124, 92, 255, .9), rgba(34, 211, 238, .9), transparent);
}
@keyframes dock-in { from { opacity: 0; transform: translate(-50%, 30px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
.dock-label {
  display: inline-flex; align-items: center; gap: 8px; padding: 0 10px 0 12px;
  font-size: .78rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2);
}
.dock-label .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.dock-sep { width: 1px; height: 24px; background: var(--border-2); margin: 0 4px; }
.dock-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border-radius: 14px;
  color: var(--text-2); font-size: .88rem; font-weight: 600; white-space: nowrap;
  transition: background-color .2s, color .2s, transform .2s;
}
.dock-btn:hover { background: var(--surface-3); color: var(--text); }
.dock-btn:active { transform: scale(.95); }
.dock-btn.is-primary {
  color: #fff; background: var(--grad-btn);
  box-shadow: 0 10px 26px -10px rgba(124, 92, 255, .95), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.dock-btn.is-primary:hover { filter: brightness(1.1); background: var(--grad-btn); }

/* ---------- Buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 13px; border: 1px solid transparent;
  font-size: .94rem; font-weight: 650; white-space: nowrap; text-decoration: none;
  transition: transform .2s var(--ease), filter .2s, background-color .2s, border-color .2s, box-shadow .3s, color .2s;
}
.btn:active { transform: scale(.97); }
.btn .i { width: 17px; height: 17px; }
.btn-primary {
  color: #fff; background: var(--grad-btn);
  box-shadow: 0 12px 30px -12px rgba(109, 74, 255, .95), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 16px 36px -12px rgba(109, 74, 255, 1), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-danger {
  color: #fff; background: linear-gradient(135deg, #f43f5e, #be123c);
  box-shadow: 0 12px 30px -12px rgba(244, 63, 94, .9), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-danger:hover { filter: brightness(1.08); }
.btn-ghost { color: var(--text); background: var(--surface-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-3); border-color: var(--border-2); }
.btn-glass {
  color: #fff; background: rgba(8, 8, 16, .6); border-color: rgba(255, 255, 255, .18);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.btn-glass:hover { background: rgba(8, 8, 16, .8); }
.btn-glass.is-danger:hover { background: rgba(225, 29, 72, .92); }
.btn-sm { height: 34px; padding: 0 12px; font-size: .84rem; border-radius: 10px; }
.btn-sm .i { width: 15px; height: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn-ghost.is-loading::after { border-color: var(--border-2); border-top-color: var(--text); }
.spinner {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 2.5px solid rgba(124, 92, 255, .25); border-top-color: var(--brand-1); animation: spin .7s linear infinite;
}

/* ---------- Dialogs ---------- */
.modal {
  padding: 0; margin: auto; border: 1px solid var(--border-2); border-radius: 26px;
  background: var(--dialog-bg); color: var(--text);
  width: min(440px, calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, .15), 0 0 80px -30px rgba(124, 92, 255, .5);
  overflow: auto; overscroll-behavior: contain;
}
.modal::backdrop { background: var(--backdrop); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.modal[open] { animation: modal-in .42s var(--ease-spring); }
.modal[open]::backdrop { animation: fade-in .3s ease; }
.modal.is-closing { animation: modal-out .2s ease forwards; }
.modal.is-closing::backdrop { animation: fade-out .2s ease forwards; }
@keyframes modal-in { from { opacity: 0; transform: translateY(18px) scale(.965); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(10px) scale(.975); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
.modal-md { width: min(620px, calc(100vw - 24px)); }
.modal-body { position: relative; display: grid; gap: 16px; padding: 30px 28px 26px; }
.modal-body::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 160px; pointer-events: none; border-radius: 26px 26px 0 0;
  background: radial-gradient(70% 100% at 50% 0%, rgba(124, 92, 255, .16), transparent 70%);
}
.modal-body > * { position: relative; }
.modal-close { position: absolute !important; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 11px; z-index: 2; }
.modal-icon {
  display: grid; place-items: center; width: 58px; height: 58px; border-radius: 18px; color: #fff; margin-bottom: 2px;
  background: var(--grad-btn); box-shadow: 0 16px 40px -14px rgba(124, 92, 255, .95), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.modal-icon .i { width: 26px; height: 26px; }
.modal-icon.is-danger { background: linear-gradient(135deg, #f43f5e, #be123c); box-shadow: 0 16px 40px -14px rgba(244, 63, 94, .9), inset 0 1px 0 rgba(255, 255, 255, .3); }
.modal-title { font: 700 1.4rem/1.25 var(--font); letter-spacing: -.015em; overflow-wrap: anywhere; padding-right: 36px; }
.confirm .modal-title { padding-right: 0; }
.modal-text { color: var(--text-2); font-size: .95rem; overflow-wrap: anywhere; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.kicker {
  display: inline-flex; align-items: center; gap: 7px; font-size: .74rem; font-weight: 750; letter-spacing: .14em;
  text-transform: uppercase; color: color-mix(in srgb, var(--brand-1) 70%, var(--text));
}
.kicker .i { width: 15px; height: 15px; }
.login-note {
  padding: 10px 12px; border-radius: 12px; font-size: .88rem; font-weight: 550; color: var(--text);
  background: color-mix(in srgb, var(--warn) 13%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
}
.login.is-shaking { animation: shake .45s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

/* ---------- Forms ---------- */
.field { display: grid; gap: 8px; min-width: 0; align-content: start; }
.label {
  display: flex; align-items: baseline; gap: 6px; font-size: .84rem; font-weight: 650; color: var(--text-2);
}
.label em { color: var(--brand-3); font-style: normal; }
.counter { margin-left: auto; font-size: .76rem; font-weight: 550; color: var(--text-3); font-variant-numeric: tabular-nums; }
.counter.is-near { color: var(--warn); }
.hint-inline { font-weight: 500; color: var(--text-3); font-size: .78rem; }
.hint { color: var(--text-3); font-size: .8rem; line-height: 1.45; }
.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px;
  background: var(--input-bg); border: 1px solid var(--border-2); color: var(--text); outline: none;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.input::placeholder { color: var(--text-3); opacity: 1; }
.input:hover { border-color: var(--border-3); }
.input:focus { border-color: rgba(124, 92, 255, .8); box-shadow: 0 0 0 4px rgba(124, 92, 255, .18); background: var(--surface-2); }
.input[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 16%, transparent); }
textarea.input { height: auto; min-height: 88px; padding: 11px 14px; resize: vertical; line-height: 1.5; }
.input-sm { height: 40px; font-size: .92rem; }
.field-error { color: var(--bad); font-size: .8rem; font-weight: 550; min-height: 0; }
.field-error:empty { display: none; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 50px; }
.pw-toggle {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; color: var(--text-3);
}
.pw-toggle:hover { color: var(--text); background: var(--surface-3); }
.pw-toggle .i-eye-off { display: none; }
.pw-toggle[aria-pressed="true"] .i-eye { display: none; }
.pw-toggle[aria-pressed="true"] .i-eye-off { display: block; }
.input-icon { position: relative; }
.input-icon > .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 17px; height: 17px; pointer-events: none; }
.input-icon .input { padding-left: 40px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

/* switch */
.switches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.switch {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.switch:hover { border-color: var(--border-2); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative; flex: none; width: 44px; height: 26px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border-2); transition: background-color .25s, border-color .25s;
}
.switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35); transition: transform .35s var(--ease-spring);
}
.switch input:checked + .switch-track { background: linear-gradient(135deg, #7457ff, #3d5bf0); border-color: transparent; }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch:has(input:checked) { border-color: rgba(124, 92, 255, .45); background: rgba(124, 92, 255, .07); }
.switch-text { display: grid; gap: 1px; min-width: 0; }
.switch-text strong { font-size: .9rem; font-weight: 650; }
.switch-text small { font-size: .78rem; color: var(--text-3); }

/* ---------- Editor ---------- */
.modal-editor {
  width: min(1120px, calc(100vw - 24px)); height: min(880px, calc(100dvh - 24px));
  overflow: hidden;
}
.editor { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
.editor-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 22px 16px 26px; border-bottom: 1px solid var(--border);
  background: radial-gradient(60% 140% at 0% 0%, rgba(124, 92, 255, .14), transparent 70%);
}
.editor-title { font: 700 1.3rem/1.2 var(--font); letter-spacing: -.015em; margin-top: 3px; }
.editor-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); min-height: 0; }
.editor-form { display: grid; gap: 20px; align-content: start; padding: 22px 26px 28px; overflow-y: auto; overscroll-behavior: contain; }
.editor-preview {
  position: relative; display: flex; flex-direction: column; gap: 16px; padding: 22px 26px;
  border-left: 1px solid var(--border); overflow-y: auto;
  background:
    radial-gradient(80% 50% at 50% 30%, color-mix(in srgb, var(--pc, #7c5cff) 16%, transparent), transparent 70%),
    radial-gradient(var(--border) 1px, transparent 1.3px) 0 0 / 18px 18px,
    var(--surface);
  transition: background .5s;
}
.preview-label {
  display: inline-flex; align-items: center; gap: 8px; font-size: .74rem; font-weight: 750; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-2);
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); animation: blink 1.4s ease-in-out infinite; }
.preview-stage { display: flex; }
.preview-stage > .tile { flex: 1; }
.preview-hint { text-align: center; }
.editor-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface);
}
.editor-foot-hint { margin-right: auto; }
.pick-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pick {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); font-size: .85rem; font-weight: 600;
  transition: all .2s;
}
.pick:hover { color: var(--text); border-color: var(--border-3); }
.pick[aria-pressed="true"] { color: var(--text); border-color: rgba(124, 92, 255, .8); background: rgba(124, 92, 255, .16); box-shadow: 0 0 0 3px rgba(124, 92, 255, .14); }
.pick .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--badge, var(--text-3)); }
.pick.b-live { --badge: #34d399; } .pick.b-beta { --badge: #fbbf24; } .pick.b-neu { --badge: #22d3ee; } .pick.b-bald { --badge: #f0abfc; }
.icon-row { display: flex; gap: 12px; align-items: flex-start; }
.icon-input { width: 70px; flex: none; text-align: center; font-size: 1.35rem; padding: 0 6px; height: 48px; }
.emoji-picks { display: flex; flex-wrap: wrap; gap: 4px; }
.emoji {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; font-size: 1.2rem; line-height: 1;
  border: 1px solid transparent; transition: background-color .2s, transform .25s var(--ease-spring), border-color .2s;
}
.emoji:hover { background: var(--surface-3); transform: scale(1.14); }
.emoji[aria-pressed="true"] { border-color: rgba(124, 92, 255, .8); background: rgba(124, 92, 255, .16); }
.emoji.is-clear { font: 700 .8rem/1 var(--font-display); color: var(--text-2); border: 1px dashed var(--border-3); }
.color-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.color-input {
  position: relative; width: 44px; height: 44px; border-radius: 14px; overflow: hidden; flex: none; cursor: pointer;
  border: 1px solid var(--border-3);
  background: conic-gradient(from 0deg, #f43f5e, #f59e0b, #84cc16, #10b981, #22d3ee, #3b82f6, #7c5cff, #ec4899, #f43f5e);
}
.color-input input { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); opacity: 0; cursor: pointer; }
.color-input:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; background: var(--sw);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25), 0 4px 12px -4px var(--sw);
  transition: transform .25s var(--ease-spring), box-shadow .2s;
}
.swatch:hover { transform: scale(1.15); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--bg-elev), 0 0 0 4px var(--sw), 0 6px 16px -4px var(--sw); transform: scale(1.08); }
.color-code { font: 600 .82rem/1 var(--mono); color: var(--text-2); padding: 7px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.tag-preview { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-preview:empty { display: none; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; color: var(--text); background: rgba(124, 92, 255, .14); border: 1px solid rgba(124, 92, 255, .35);
}
.tag-chip.is-over { opacity: .45; text-decoration: line-through; }
.tag-chip button { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: var(--text-2); }
.tag-chip button:hover { background: rgba(255, 255, 255, .12); color: var(--text); }
.tag-chip .i { width: 12px; height: 12px; }

/* dropzone */
.dz { position: relative; }
.dropzone {
  position: relative; display: grid; place-items: center; min-height: 150px; border-radius: 16px; overflow: hidden;
  border: 1.5px dashed var(--border-3); background: var(--surface); cursor: pointer; text-align: center;
  transition: border-color .25s, background-color .25s, box-shadow .25s;
  aspect-ratio: 16 / 7;
}
.dropzone:hover { border-color: rgba(124, 92, 255, .7); background: rgba(124, 92, 255, .05); }
.dropzone:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.dropzone.is-over { border-color: var(--brand-2); background: rgba(34, 211, 238, .08); box-shadow: 0 0 0 5px rgba(34, 211, 238, .14); }
.dz-empty { display: grid; justify-items: center; gap: 6px; padding: 18px; }
.dz-empty strong { font-size: .95rem; font-weight: 650; }
.dz-icon {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; margin-bottom: 4px; color: #fff;
  background: linear-gradient(135deg, #22d3ee, #7c5cff); box-shadow: 0 12px 30px -12px rgba(34, 211, 238, .9);
  transition: transform .5s var(--ease-spring);
}
.dropzone:hover .dz-icon, .dropzone.is-over .dz-icon { transform: translateY(-4px) rotate(-6deg); }
.dz-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dropzone.has-image { border-style: solid; border-color: var(--border-2); }
.dropzone.has-image .dz-empty { visibility: hidden; }
.dz-progress {
  position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 10px;
  background: color-mix(in srgb, var(--bg-elev) 82%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-size: .88rem; font-weight: 600;
}
.dz-bar { width: 180px; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.dz-bar > span { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--grad-brand); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform .2s; }
.dz-actions { position: absolute; right: 10px; bottom: 10px; z-index: 3; display: flex; gap: 8px; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; inset: auto 20px 20px auto; z-index: 3000; margin: 0; padding: 0; border: 0; background: transparent;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none;
  width: min(400px, calc(100vw - 32px)); overflow: visible; color: var(--text);
}
.toasts:empty { display: none; }
.is-admin .toasts { bottom: 92px; }
.toast {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 10px 12px 12px; border-radius: 16px; overflow: hidden; pointer-events: auto;
  background: var(--dialog-bg); border: 1px solid var(--border-2);
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 20px 50px -18px rgba(0, 0, 0, .7);
  animation: toast-in .5s var(--ease-spring);
}
.toast.is-leaving { animation: toast-out .28s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px) scale(.97); } }
.toast-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; flex: none; color: #fff; }
.toast-icon .i { width: 17px; height: 17px; }
.toast-success .toast-icon { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 8px 20px -8px rgba(16, 185, 129, .9); }
.toast-error .toast-icon { background: linear-gradient(135deg, #f43f5e, #be123c); box-shadow: 0 8px 20px -8px rgba(244, 63, 94, .9); }
.toast-info .toast-icon { background: var(--grad-btn); box-shadow: 0 8px 20px -8px rgba(124, 92, 255, .9); }
.toast-msg { flex: 1; min-width: 0; font-size: .9rem; font-weight: 550; overflow-wrap: anywhere; }
.toast-close { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--text-3); flex: none; }
.toast-close:hover { background: var(--surface-3); color: var(--text); }
.toast-close .i { width: 15px; height: 15px; }
.toast::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; transform-origin: left;
  background: var(--grad-brand); opacity: .7; animation: toast-timer var(--dur, 4200ms) linear forwards;
}
.toast:hover::after { animation-play-state: paused; }
.toast-error::after { background: linear-gradient(90deg, #f43f5e, #fb7185); }
@keyframes toast-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- View transition (theme reveal) ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* ---------- Responsive ---------- */
/* category chips wrap instead of being cut off mid-word (phones keep the swipeable row) */
@media (min-width: 721px) {
  .chips { flex-wrap: wrap; overflow: visible; }
  .toolbar { align-items: flex-start; }
  .result-info { padding-top: 10px; }
}
@media (max-width: 1080px) {
  .hero-title { max-width: 18ch; }
}
/* tablets / small laptops: keep a smaller orbit instead of an empty right half */
@media (max-width: 1080px) and (min-width: 761px) {
  .hero { gap: 24px; }
  .hero-visual { width: 260px; margin-right: -24px; }
  .planet { width: 34px; height: 34px; margin: -17px 0 0 -17px; }
  .planet-face { font-size: 16px; }
  .planet-face.is-text { font-size: 12px; }
  .stats { gap: 8px; }
  .stat { gap: 8px; padding: 7px 12px 7px 7px; border-radius: 14px; }
  .stat-icon { width: 28px; height: 28px; border-radius: 9px; }
  .stat-icon .i { width: 15px; height: 15px; }
  .stat-num { font-size: 1.2rem; }
  .stat-label { font-size: .82rem; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .hero-visual { display: none; }
}
@media (max-width: 860px) {
  .status-chip { display: none; }
  .modal-editor { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .editor-main { grid-template-columns: 1fr; overflow-y: auto; overscroll-behavior: contain; }
  .editor-form { overflow: visible; padding: 20px 18px 8px; }
  /* live preview first, so title / colour / icon changes are visible while typing */
  .editor-preview { order: -1; gap: 10px; border-left: 0; border-bottom: 1px solid var(--border); overflow: visible; padding: 14px 18px 16px; }
  .preview-stage { max-width: 280px; width: 100%; margin-inline: auto; }
  .preview-hint { display: none; }
  .editor-head { padding: 14px 14px 12px 18px; }
  .editor-foot { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
  .editor-foot-hint { display: none; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-nav { justify-content: flex-start; }
}
@media (max-width: 720px) {
  .dock-btn span, .dock-label-text { display: none; }
  .dock-btn { width: 44px; padding: 0; justify-content: center; }
  .dock-label { padding: 0 8px; }
  .dock-sep { margin: 0 2px; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .chips-wrap { margin-inline: calc(var(--gutter) * -1); }
  .chips { padding-inline: var(--gutter); margin-inline: 0; scroll-padding-inline: var(--gutter); }
  .chips-wrap::after {
    content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 32px; pointer-events: none;
    background: linear-gradient(90deg, transparent, var(--bg));
  }
  .result-info { font-size: .8rem; }
  .form-row, .switches { grid-template-columns: 1fr; }
  .toasts { left: 16px; right: 16px; bottom: 16px; width: auto; align-items: stretch; }
  .is-admin .toasts { bottom: 86px; }
}
@media (max-width: 560px) {
  .header-inner { gap: 10px; height: 62px; }
  .brand-name { display: none; }
  .search { height: 42px; }
  .search-kbd { display: none; }
  .search input { padding-left: 38px; font-size: 16px; }
  .search-icon { left: 12px; }
  /* compact hero: the first tiles should be visible on the first screen */
  .aurora { animation: none; }
  .hero { padding-top: 22px; padding-bottom: 18px; }
  .hero-meta { margin-bottom: 12px; }
  .hero-title { font-size: clamp(2rem, 8.4vw, 2.35rem); }
  .hero-sub { margin-top: 12px; font-size: .95rem; line-height: 1.55; }
  .stats { display: flex; flex-wrap: nowrap; gap: 8px; margin-top: 16px; }
  .stat { flex: 1 1 0; min-width: 0; gap: 8px; padding: 8px 10px 8px 8px; border-radius: 14px; }
  .stat-icon { width: 26px; height: 26px; border-radius: 8px; flex: none; }
  .stat-icon .i { width: 14px; height: 14px; }
  .stat-text { flex-direction: column; gap: 1px; min-width: 0; }
  .stat-num { font-size: 1.15rem; }
  .stat-label { font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tile-cover { aspect-ratio: 2 / 1; }
  .cover-icon { --ic: clamp(44px, min(24cqi, 50cqi - 90px), 96px); }
  .tile-body { gap: 10px; padding: 14px 16px 14px; }
  .modal-body { padding: 26px 20px 20px; }
  .modal-actions .btn { flex: 1; }
  .emoji { width: 36px; height: 36px; }
  .icon-row { flex-direction: column; }
  .dock-btn { width: 42px; height: 42px; }
  .admin-dock { gap: 2px; padding: 5px; }
  .dropzone { aspect-ratio: 16 / 9; }
}
@media (hover: none) {
  .search-kbd { display: none; }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important;
  }
  .aurora, .orbit, .planet, .hv-sweep, .hv-core, .hv-glow { animation: none !important; }
  .tile.will-enter { opacity: 1; transform: none; }
  .tile-card { transform: none !important; }
}

/* ---------- Print ---------- */
@media print {
  .bg, .site-header, .admin-dock, .toasts, .hero-visual, .tile-admin, .footer-admin { display: none !important; }
  body { background: #fff; color: #000; }
  .tile.will-enter { opacity: 1 !important; transform: none !important; }
}
