/* ============================================================
   AlgoRay Workbench — design system
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", monospace;

  --shell: 1200px;
  --r-xl: 30px;
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 11px;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-soft: cubic-bezier(.4, 0, .2, 1);
}

[data-theme="dark"] {
  --bg: #05060a;
  --bg-soft: #080a10;
  --text: #eef1f8;
  --text-2: #c2cad8;
  --muted: #98a2b6;
  --faint: #697183;

  --stroke: rgba(255, 255, 255, .09);
  --stroke-2: rgba(255, 255, 255, .17);
  --panel: rgba(255, 255, 255, .05);
  --panel-2: rgba(255, 255, 255, .075);
  --panel-solid: #0c0e16;

  --input-bg: rgba(255, 255, 255, .04);
  --shadow-lg: 0 40px 90px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .04);
  --shadow-card: 0 24px 60px -34px rgba(0, 0, 0, .95);
  --glow: 1;
  --grain-opacity: .035;
  --line-opacity: .5;

  --x1: #818cf8;
  --x2: #c084fc;
  --x3: #22d3ee;
}

[data-theme="light"] {
  --bg: #eef0f7;
  --bg-soft: #ffffff;
  --text: #0b0e15;
  --text-2: #3b4354;
  --muted: #5d6679;
  --faint: #8a92a4;

  --stroke: rgba(12, 18, 32, .1);
  --stroke-2: rgba(12, 18, 32, .2);
  --panel: rgba(255, 255, 255, .9);
  --panel-2: #ffffff;
  --panel-solid: #ffffff;

  --input-bg: rgba(255, 255, 255, .92);
  --shadow-lg: 0 40px 90px -40px rgba(24, 34, 64, .45), 0 0 0 1px rgba(12, 18, 32, .05);
  --shadow-card: 0 14px 34px -24px rgba(20, 30, 60, .45), 0 0 0 1px rgba(12, 18, 32, .035);
  --glow: .62;
  --grain-opacity: .022;
  --line-opacity: .8;

  --x1: #4f46e5;
  --x2: #9333ea;
  --x3: #0891b2;
}

[data-theme="light"] body {
  background:
    radial-gradient(72% 52% at 10% -8%, rgba(99, 102, 241, .18), transparent 62%),
    radial-gradient(62% 46% at 94% -4%, rgba(168, 85, 247, .16), transparent 64%),
    radial-gradient(56% 44% at 52% 104%, rgba(34, 211, 238, .12), transparent 72%),
    var(--bg);
  background-attachment: fixed;
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 1px;
  z-index: 60;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 8%, rgba(129, 140, 248, .55) 34%, rgba(192, 132, 252, .42) 58%, rgba(34, 211, 238, .38) 76%, transparent 94%);
}

body.no-scroll { overflow: hidden; }

::selection { background: rgba(129, 140, 248, .32); color: var(--text); }

h1, h2, h3, h4, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }

.ico { width: 18px; height: 18px; flex: none; }

.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding-left: 32px;
  padding-right: 32px;
}

/* ============================================================
   Background
   ============================================================ */

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.aurora span {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(110px);
  opacity: calc(.42 * var(--glow));
  will-change: transform;
}

.aurora span:nth-child(1) {
  width: 58vw; height: 58vw;
  top: -34vw; left: -22vw;
  background: radial-gradient(circle at 40% 40%, rgba(99, 102, 241, .9), transparent 66%);
  animation: drift-a 26s var(--ease-soft) infinite alternate;
}
.aurora span:nth-child(2) {
  width: 52vw; height: 52vw;
  top: -30vw; right: -20vw;
  background: radial-gradient(circle at 50% 50%, rgba(168, 85, 247, .78), transparent 66%);
  animation: drift-b 32s var(--ease-soft) infinite alternate;
}
.aurora span:nth-child(3) {
  width: 44vw; height: 44vw;
  top: 30vw; left: 40vw;
  background: radial-gradient(circle at 50% 50%, rgba(34, 211, 238, .34), transparent 70%);
  animation: drift-c 38s var(--ease-soft) infinite alternate;
}

@keyframes drift-a { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(6vw, 5vw, 0) scale(1.12); } }
@keyframes drift-b { from { transform: translate3d(0, 0, 0) scale(1.05); } to { transform: translate3d(-5vw, 7vw, 0) scale(.94); } }
@keyframes drift-c { from { transform: translate3d(0, 0, 0) scale(.95); } to { transform: translate3d(-7vw, -4vw, 0) scale(1.1); } }

.grid-lines {
  position: absolute;
  inset: -2px;
  opacity: calc(.35 * var(--line-opacity));
  background-image:
    linear-gradient(to right, var(--stroke) 1px, transparent 1px),
    linear-gradient(to bottom, var(--stroke) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 12%, transparent 72%);
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 12%, transparent 72%);
}

.grain {
  position: absolute;
  inset: 0;
  opacity: var(--grain-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='.86' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.spotlight {
  position: absolute;
  inset: 0;
  background: radial-gradient(520px circle at var(--px, 50%) var(--py, 12%), rgba(129, 140, 248, .12), transparent 62%);
  opacity: calc(1 * var(--glow));
  transition: opacity .4s var(--ease-soft);
}

/* ============================================================
   Topbar
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 14px 0;
  transition: background .35s var(--ease-soft), backdrop-filter .35s var(--ease-soft), border-color .35s;
  border-bottom: 1px solid transparent;
}

.topbar.stuck {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border-bottom-color: var(--stroke);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 13px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .02em;
  color: #fff;
  background: linear-gradient(140deg, #6366f1, #a855f7 52%, #22d3ee);
  box-shadow: 0 8px 22px -8px rgba(99, 102, 241, .9), inset 0 1px 0 rgba(255, 255, 255, .35);
}

.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.brand-copy span {
  font-size: 9.5px;
  letter-spacing: .19em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 550;
}

.topbar-right { display: flex; align-items: center; gap: 10px; }

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 268px;
  height: 40px;
  padding: 0 12px;
  border-radius: 13px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  transition: border-color .25s, background .25s, width .3s var(--ease);
}
.search:focus-within {
  border-color: color-mix(in srgb, #818cf8 55%, transparent);
  background: var(--panel-2);
  width: 300px;
}
.search .ico { color: var(--faint); width: 16px; height: 16px; }
.search input {
  flex: 1;
  min-width: 0;
  border: 0; outline: 0; background: transparent;
  font-size: 13.5px;
}
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--faint);
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, .04);
  white-space: nowrap;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 13px;
  color: var(--muted);
  border: 1px solid var(--stroke);
  background: var(--panel);
  transition: color .2s, background .2s, border-color .2s, transform .2s;
}
.icon-btn:hover { color: var(--text); background: var(--panel-2); border-color: var(--stroke-2); }
.icon-btn:active { transform: scale(.95); }
.icon-btn.ghost { border-color: transparent; background: transparent; width: 34px; height: 34px; border-radius: 10px; }

[data-theme="dark"] .icon-btn .sun { display: none; }
[data-theme="light"] .icon-btn .moon { display: none; }

.admin-slot { display: flex; align-items: center; gap: 8px; }

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 13px;
  font-size: 13.5px;
  font-weight: 550;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: transform .22s var(--ease), background .22s, border-color .22s, box-shadow .3s, color .2s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn .ico { width: 16px; height: 16px; }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6 55%, #7c3aed);
  box-shadow: 0 10px 26px -12px rgba(99, 102, 241, .95), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.btn-primary:hover {
  box-shadow: 0 16px 34px -12px rgba(139, 92, 246, .95), inset 0 1px 0 rgba(255, 255, 255, .34);
  transform: translateY(-1px);
}

.btn-glass {
  color: var(--text-2);
  background: var(--panel);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(12px);
}
.btn-glass:hover { color: var(--text); background: var(--panel-2); border-color: var(--stroke-2); transform: translateY(-1px); }

.btn-ghost { color: var(--muted); border: 1px solid transparent; }
.btn-ghost:hover { color: var(--text); background: var(--panel); border-color: var(--stroke); }

.btn-danger {
  color: #fff;
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  box-shadow: 0 10px 26px -12px rgba(244, 63, 94, .9), inset 0 1px 0 rgba(255, 255, 255, .24);
}
.btn-danger:hover { transform: translateY(-1px); }

.btn-block { width: 100%; height: 44px; }

.link-btn {
  color: var(--faint);
  font-size: 12.5px;
  padding: 4px 0;
  transition: color .2s;
}
.link-btn:hover { color: var(--text-2); }

/* ============================================================
   Hero
   ============================================================ */

main { position: relative; z-index: 1; flex: 1 0 auto; }

.hero { position: relative; padding: 74px 0 40px; }

.hero::before {
  content: "";
  position: absolute;
  left: -12%;
  top: -22%;
  width: min(760px, 66vw);
  height: 420px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(99, 102, 241, .2), rgba(139, 92, 246, .08) 55%, transparent 78%);
  filter: blur(22px);
}

[data-theme="dark"] body {
  background: linear-gradient(180deg, #07080f 0%, var(--bg) 38%, #04050a 100%);
}

[data-theme="light"] .hero::before {
  background: radial-gradient(closest-side, rgba(99, 102, 241, .2), rgba(139, 92, 246, .1) 55%, transparent 78%);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 11px;
  border-radius: 99px;
  border: 1px solid var(--stroke);
  background: var(--panel);
}
.eyebrow.dim { border: 0; background: none; padding: 0; color: var(--faint); letter-spacing: .1em; }
.meta-sep { width: 22px; height: 1px; background: var(--stroke-2); }

.hero-title {
  font-size: clamp(38px, 5.4vw, 66px);
  line-height: 1.06;
  font-weight: 640;
  letter-spacing: -0.035em;
  max-width: 16em;
  text-wrap: balance;
}

.hero-title .grad {
  background: linear-gradient(96deg, var(--x1) 8%, var(--x2) 46%, var(--x3) 92%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 9s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-sub {
  margin-top: 20px;
  max-width: 33em;
  font-size: 16px;
  line-height: 1.75;
  color: var(--muted);
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 54px;
  border-top: 1px solid var(--stroke);
  padding-top: 22px;
}
.stat { padding-right: 46px; margin-right: 46px; border-right: 1px solid var(--stroke); }
.stat:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.stat b {
  display: block;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.stat span {
  display: block;
  margin-top: 4px;
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 550;
}

/* ============================================================
   Collection
   ============================================================ */

.collection { padding: 26px 0 60px; }

.collection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 26px;
}

.collection-title { display: flex; align-items: center; gap: 10px; }
.collection-title h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.count-pill {
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--stroke);
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  height: 32px;
  padding: 0 13px;
  border-radius: 99px;
  font-size: 12.5px;
  color: var(--muted);
  border: 1px solid var(--stroke);
  background: transparent;
  transition: color .2s, background .2s, border-color .2s;
}
.chip:hover { color: var(--text); background: var(--panel); }
.chip.active {
  color: var(--text);
  background: var(--panel-2);
  border-color: color-mix(in srgb, #818cf8 50%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #818cf8 18%, transparent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 18px;
}

/* ---------- card ---------- */

@keyframes card-in {
  from { opacity: 0; translate: 0 18px; }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 216px;
  padding: 24px 24px 20px;
  border-radius: var(--r-lg);
  border: 1px solid var(--stroke);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .022) 62%),
    linear-gradient(150deg, color-mix(in srgb, var(--a1) 7%, transparent), transparent 38%),
    var(--panel);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  isolation: isolate;
  animation: card-in .72s var(--ease) both;
  transition: transform .45s var(--ease), border-color .35s, box-shadow .45s, background .35s;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--a1) 22%, transparent), transparent 68%);
  transition: opacity .45s var(--ease-soft);
}

.card::after {
  content: "";
  position: absolute;
  top: 0; left: 12%; right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--a1) 70%, white), transparent);
  opacity: 0;
  transition: opacity .45s;
}

.card:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--a1) 42%, var(--stroke));
  box-shadow: 0 34px 70px -34px rgba(0, 0, 0, calc(.9 * var(--glow))), 0 0 0 1px color-mix(in srgb, var(--a1) 22%, transparent);
}
.card:hover::before { opacity: 1; }
.card:hover::after { opacity: 1; }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.tile {
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  border-radius: 18px;
  font-size: 27px;
  line-height: 1;
  background:
    linear-gradient(152deg, color-mix(in srgb, var(--a1) 72%, #0b0d14), color-mix(in srgb, var(--a2) 42%, #0b0d14));
  border: 1px solid color-mix(in srgb, var(--a1) 52%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .3),
    inset 0 -8px 18px -10px rgba(0, 0, 0, .6),
    0 14px 30px -16px color-mix(in srgb, var(--a1) 100%, transparent);
  transition: transform .45s var(--ease);
}

[data-theme="light"] .tile {
  background: linear-gradient(152deg, color-mix(in srgb, var(--a1) 26%, #fff), color-mix(in srgb, var(--a2) 16%, #fff));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 10px 22px -14px color-mix(in srgb, var(--a1) 90%, transparent);
}

.tile.mono { font-family: var(--font-mono); font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.card:hover .tile { transform: scale(1.06) rotate(-2deg); }

.pill {
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, .03);
  white-space: nowrap;
}

.card-title {
  margin-top: 20px;
  font-size: 19.5px;
  font-weight: 600;
  letter-spacing: -0.024em;
  line-height: 1.35;
}

.card-desc {
  margin-top: 7px;
  font-size: 13.5px;
  line-height: 1.62;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag {
  font-size: 11px;
  color: var(--faint);
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--stroke);
}

.card-foot {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--stroke);
}
.card-desc + .card-foot, .tags + .card-foot { margin-top: 18px; }

.open-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-2);
  transition: color .3s, gap .3s var(--ease);
}
.open-link .ico { width: 14px; height: 14px; transition: transform .35s var(--ease); }
.card:hover .open-link { color: var(--text); gap: 9px; }
.card:hover .open-link .ico { transform: translateX(2px); }

.card-date { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }

.card-hit { position: absolute; inset: 0; z-index: 2; }
.card-hit:focus-visible { outline: 2px solid #818cf8; outline-offset: 3px; border-radius: var(--r-lg); }

/* admin controls */
.card-admin {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 3;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--panel-solid) 82%, transparent);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(14px);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .25s, transform .25s var(--ease);
}
.card:hover .card-admin, .card-admin:focus-within { opacity: 1; transform: none; }
.card-admin button {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 7px;
  color: var(--muted);
  transition: background .2s, color .2s;
}
.card-admin button:hover { background: var(--panel-2); color: var(--text); }
.card-admin button.danger:hover { background: rgba(244, 63, 94, .16); color: #fb7185; }
.card-admin .ico { width: 14px; height: 14px; }

.card.hidden-app { opacity: .5; border-style: dashed; }
.card.hidden-app .open-link::after { content: "（已隐藏）"; color: var(--faint); font-weight: 400; }

/* add card */
.card-add {
  display: grid;
  place-items: center;
  min-height: 216px;
  border-radius: var(--r-lg);
  border: 1px dashed var(--stroke-2);
  background: transparent;
  color: var(--muted);
  transition: border-color .3s, color .3s, background .3s;
}
.card-add:hover {
  color: var(--text);
  border-color: color-mix(in srgb, #818cf8 55%, transparent);
  background: color-mix(in srgb, #6366f1 7%, transparent);
}
.card-add-inner { display: flex; flex-direction: column; align-items: center; gap: 9px; font-size: 13.5px; }
.card-add .plus {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--stroke-2);
  font-size: 20px;
  font-weight: 300;
  transition: transform .4s var(--ease), border-color .3s;
}
.card-add:hover .plus { transform: rotate(90deg) scale(1.06); border-color: color-mix(in srgb, #818cf8 60%, transparent); }

/* empty */
.empty {
  padding: 70px 20px;
  text-align: center;
  border: 1px dashed var(--stroke);
  border-radius: var(--r-lg);
}
.empty-glyph { font-size: 26px; color: var(--faint); }
.empty p { margin-top: 12px; font-size: 14.5px; color: var(--text-2); }
.empty span { font-size: 12.5px; color: var(--faint); }

/* ============================================================
   Footer
   ============================================================ */

/* signature ghost wordmark */
.signature {
  position: relative;
  overflow: hidden;
  margin-top: auto;
  padding: 10px 0 0;
  text-align: center;
  user-select: none;
  pointer-events: none;
}
.signature span {
  display: block;
  font-size: clamp(72px, 15.5vw, 210px);
  font-weight: 700;
  letter-spacing: .02em;
  line-height: .82;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, .075);
  mask-image: linear-gradient(180deg, #000 8%, rgba(0, 0, 0, .35) 62%, transparent 96%);
  -webkit-mask-image: linear-gradient(180deg, #000 8%, rgba(0, 0, 0, .35) 62%, transparent 96%);
}
[data-theme="light"] .signature span { -webkit-text-stroke-color: rgba(12, 18, 32, .1); }

.footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 32px 44px;
  border-top: 1px solid var(--stroke);
  color: var(--faint);
  font-size: 12.5px;
}
.footer-left { display: flex; align-items: center; gap: 10px; }
.footer-mark {
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, #6366f1, #a855f7 60%, #22d3ee);
  opacity: .9;
}

/* ============================================================
   Modal
   ============================================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 4, 8, .62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in .3s var(--ease-out, ease) both;
}

[data-theme="light"] .modal-backdrop { background: rgba(28, 34, 52, .34); }

.modal-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: min(88vh, 860px);
  display: flex;
  flex-direction: column;
  border-radius: var(--r-xl);
  border: 1px solid var(--stroke-2);
  background:
    linear-gradient(170deg, rgba(255, 255, 255, .05), transparent 40%),
    var(--panel-solid);
  box-shadow: var(--shadow-lg);
  animation: rise .42s var(--ease) both;
  overflow: hidden;
}
.modal-sm { max-width: 420px; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 28px 18px;
  border-bottom: 1px solid var(--stroke);
}
.modal-head h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.modal-head p { margin-top: 5px; font-size: 12.5px; color: var(--muted); line-height: 1.55; }

.modal-body {
  padding: 22px 28px 26px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 4px;
  margin-top: 4px;
}

/* fields */
.field { display: flex; flex-direction: column; gap: 7px; }
.field-row { display: flex; gap: 12px; }
.field.grow { flex: 1 1 0; min-width: 0; }
.field.narrow { width: 96px; }
.field.icon-field { width: 96px; }
.field-label {
  font-size: 11px;
  font-weight: 550;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
}
.field input, .field textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--stroke);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13.5px;
  outline: 0;
  transition: border-color .22s, box-shadow .22s, background .22s;
  resize: vertical;
}
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:focus, .field textarea:focus {
  border-color: color-mix(in srgb, #818cf8 62%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, #6366f1 16%, transparent);
  background: var(--panel-2);
}
.field input[type="password"] { letter-spacing: .18em; }
.field.icon-field input { text-align: center; font-size: 18px; }

.emoji-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.emoji-pick {
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 16px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  transition: transform .2s var(--ease), border-color .2s, background .2s;
}
.emoji-pick:hover { transform: translateY(-2px); border-color: var(--stroke-2); background: var(--panel-2); }

.swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.swatch {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 2px solid transparent;
  transition: transform .22s var(--ease), border-color .22s;
  position: relative;
}
.swatch:hover { transform: translateY(-2px); }
.swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--panel-solid) inset; }

.switch-row {
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  user-select: none;
}
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  width: 40px; height: 23px;
  border-radius: 99px;
  background: var(--panel-2);
  border: 1px solid var(--stroke-2);
  position: relative;
  transition: background .28s, border-color .28s;
  flex: none;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .3s var(--ease), background .3s;
}
.switch-row input:checked + .switch {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
}
.switch-row input:checked + .switch::after { transform: translateX(17px); background: #fff; }
.switch-text { font-size: 13px; color: var(--text-2); }

.divider { height: 1px; background: var(--stroke); margin: 6px 0 2px; }
.section-label {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 600;
}

.form-error {
  font-size: 12.5px;
  color: #fb7185;
  background: rgba(244, 63, 94, .1);
  border: 1px solid rgba(244, 63, 94, .26);
  border-radius: 10px;
  padding: 9px 12px;
  line-height: 1.5;
}
.hint { font-size: 11.5px; color: var(--faint); text-align: center; line-height: 1.6; }

/* ============================================================
   Toasts
   ============================================================ */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel-solid) 90%, transparent);
  border: 1px solid var(--stroke-2);
  box-shadow: 0 20px 44px -20px rgba(0, 0, 0, .8);
  backdrop-filter: blur(16px);
  animation: toast-in .38s var(--ease) both;
}
.toast.out { animation: toast-out .3s var(--ease-soft) both; }
.toast .dot { width: 6px; height: 6px; border-radius: 50%; background: #34d399; }
.toast.err .dot { background: #fb7185; }

@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ============================================================
   Reveal
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 900px) {
  .shell { padding-left: 22px; padding-right: 22px; }
  .search { width: 200px; }
  .search:focus-within { width: 220px; }
  .search kbd { display: none; }
  .hero { padding: 46px 0 34px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

@media (max-width: 680px) {
  body { font-size: 14.5px; }
  .shell { padding-left: 18px; padding-right: 18px; }
  .topbar { padding: 10px 0; }
  .brand-copy span { display: none; }
  .topbar-right { gap: 7px; }
  .search { width: 40px; padding: 0; justify-content: center; }
  .search input { display: none; }
  .search:focus-within { width: 40px; }
  .search.open { position: fixed; left: 14px; right: 14px; top: 10px; width: auto; z-index: 60; padding: 0 14px; background: var(--panel-solid); }
  .search.open input { display: block; }
  .hero-title { font-size: clamp(32px, 9vw, 44px); }
  .hero-sub { font-size: 14.5px; }
  .stats { margin-top: 36px; gap: 18px 0; }
  .stat { padding-right: 24px; margin-right: 24px; }
  .stat b { font-size: 21px; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .card { min-height: 190px; padding: 20px; }
  .collection-head { flex-direction: column; align-items: flex-start; }
  .chips { overflow-x: auto; flex-wrap: nowrap; width: 100%; padding-bottom: 4px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .modal { padding: 12px; }
  .modal-head { padding: 20px 20px 15px; }
  .modal-body { padding: 18px 20px 22px; }
  .field-row { flex-direction: column; gap: 15px; }
  .field.narrow, .field.icon-field { width: 100%; }
  .admin-slot .btn-txt { display: none; }
  .admin-slot .btn-primary { padding: 0 13px; font-size: 14px; }
  .footer { flex-direction: column; align-items: flex-start; gap: 10px; padding: 22px 18px 32px; }
}

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