/* ======================================================================
   Milktea — design.css  (Part 1 of 2)
   Consolidated from style.css · polish.css · polish2.css · polish3.css
   Tokens → reset → body → topbar → search → pills → meta → autocomplete
   ====================================================================== */

/* ====================================================================
   SECTION 1 — DESIGN TOKENS
   ==================================================================== */

:root {
  /* Backgrounds */
  --bg-base:    #0a0a10;
  --bg-surface: #111118;
  --bg-raised:  #1a1a24;
  --bg-overlay: #222230;
  --bg-hover:   rgba(255, 154, 85, 0.06);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border:        rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* Text */
  --text-primary:   #f0eff4;
  --text-secondary: #a0a0b0;
  --text-tertiary:  #6a6a7a;
  --text-muted:     #4a4a56;

  /* Accent */
  --accent:       #ff9a55;
  --accent-hover: #ff8c40;
  --accent-dim:   rgba(255, 154, 85, 0.12);
  --accent-2:     #ff3d7f;
  --accent-3:     #6a6aff;

  /* Status */
  --ok:   #4ade80;
  --warn: #f5a524;
  --bad:  #f43f5e;

  /* Radius */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-pill: 999px;

  /* Motion */
  --ease:     cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 150ms;
  --dur-mid:  250ms;
  --dur-slow: 400ms;

  /* Glass */
  --glass-bg:   rgba(17, 17, 24, 0.75);
  --glass-blur: blur(16px) saturate(180%);

  /* Topbar */
  --topbar-h: 56px;
}

/* ====================================================================
   SECTION 2 — RESET
   ==================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

*::-webkit-scrollbar          { width: 10px; height: 10px; }
*::-webkit-scrollbar-track    { background: transparent; }
*::-webkit-scrollbar-thumb    {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: var(--radius-pill);
  border: 2px solid var(--bg-base);
}

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

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--accent-hover); }

img { display: block; max-width: 100%; }

::selection {
  background: rgba(255, 154, 85, 0.35);
  color: var(--text-primary);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ====================================================================
   SECTION 3 — BODY BACKGROUND LAYERS
   ==================================================================== */

/* Layer 1: Three drifting radial-gradient orbs */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -2;
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 154, 85, 0.12), transparent 45%),
    radial-gradient(circle at 85% 70%, rgba(106, 106, 255, 0.10), transparent 50%),
    radial-gradient(circle at 50% 100%, rgba(255, 61, 127, 0.08), transparent 55%);
  filter: blur(60px);
  animation: bg-drift 30s var(--ease) infinite alternate;
  pointer-events: none;
  will-change: transform;
}

@keyframes bg-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  33%  { transform: translate3d(3%, -2%, 0) scale(1.06); }
  66%  { transform: translate3d(-2%, 3%, 0) scale(0.97); }
  100% { transform: translate3d(1%, -1%, 0) scale(1.03); }
}

/* Layer 2: Static noise texture at 3% opacity */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.03;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
}

/* ====================================================================
   SECTION 4 — PAGE LOADER
   ==================================================================== */

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--dur-slow) var(--ease);
}

/* ====================================================================
   SECTION 5 — SCROLL PROGRESS BAR
   ==================================================================== */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 9998;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  background-size: 200% 100%;
  box-shadow: 0 0 12px rgba(255, 154, 85, 0.6);
  animation: progress-gradient 4s linear infinite;
  transition: width 0.05s linear;
  pointer-events: none;
}

@keyframes progress-gradient {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ====================================================================
   SECTION 6 — TOPBAR
   ==================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 28px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-subtle);
}

/* Light theme topbar override */
[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(16px);
}

/* ====================================================================
   SECTION 7 — LOGO
   ==================================================================== */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
}

.logo-icon {
  width: 24px;
  height: 24px;
  color: var(--accent);
  flex-shrink: 0;
  animation: logo-pulse 2s var(--ease) infinite;
}

@keyframes logo-pulse {
  0%, 100% { opacity: 0.75; transform: scale(1); }
  50%       { opacity: 1;    transform: scale(1.14); }
}

/* ====================================================================
   SECTION 8 — TOPBAR NAV LINKS
   ==================================================================== */

nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

nav a {
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  position: relative;
}

nav a:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Animated underline for user/profile links */
.user-link {
  position: relative;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
.user-link::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-mid) var(--ease);
}
.user-link:hover::after { transform: scaleX(1); }

/* ====================================================================
   SECTION 9 — THEME TOGGLE
   ==================================================================== */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--border-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.theme-toggle:hover {
  background: var(--accent-dim);
  border-color: rgba(255, 154, 85, 0.3);
}

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

[data-theme="light"] .theme-toggle {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.10);
}
[data-theme="light"] .theme-toggle:hover {
  background: rgba(224, 85, 0, 0.08);
  border-color: rgba(224, 85, 0, 0.25);
}

/* ====================================================================
   SECTION 10 — KBD HINT
   ==================================================================== */

.kbd-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--border-subtle);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.kbd-hint:hover {
  background: var(--accent-dim);
  border-color: rgba(255, 154, 85, 0.25);
  color: var(--text-primary);
}

[data-theme="light"] .kbd-hint {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

kbd {
  background: var(--border);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  font-family: inherit;
}

/* ====================================================================
   SECTION 11 — SEARCH HERO (landing page)
   ==================================================================== */

.search-hero {
  text-align: center;
  padding: 80px 20px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: relative;
}

.search-hero h1 {
  font-size: clamp(56px, 10vw, 128px);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.0;
  background: linear-gradient(180deg, var(--text-primary) 20%, var(--text-tertiary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: hero-reveal var(--dur-slow) var(--ease);
}

@keyframes hero-reveal {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    letter-spacing: 0.1em;
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    letter-spacing: -0.03em;
  }
}

.search-hero .subtitle {
  color: var(--text-secondary);
  font-size: 17px;
  margin: 0 0 28px;
  opacity: 0.75;
}

/* Anamorphic lens flare */
.search-hero::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 20%;
  width: 2px;
  height: 300px;
  transform: translateX(-50%) rotate(12deg);
  background: radial-gradient(ellipse 200px 2px at center, rgba(255, 220, 180, 0.5), transparent 70%);
  filter: blur(1px);
  pointer-events: none;
  animation: flare-drift 8s var(--ease) infinite alternate;
}

@keyframes flare-drift {
  0%   { opacity: 0.3; transform: translateX(-50%) rotate(12deg) scale(0.9); }
  100% { opacity: 0.7; transform: translateX(-40%) rotate(-8deg) scale(1.1); }
}

/* ====================================================================
   SECTION 12 — SEARCHBAR DOCK (sticky results page bar)
   ==================================================================== */

.searchbar-dock {
  position: sticky;
  top: var(--topbar-h);
  z-index: 40;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  margin: -32px calc(-1 * clamp(20px, 3vw, 48px)) 16px;
  padding: 16px clamp(20px, 3vw, 48px);
  border-bottom: 1px solid var(--border-subtle);
}

/* Category-dynamic tints */
.searchbar-dock[data-cat="Films & Séries"]  { background-image: linear-gradient(135deg, rgba(147, 51, 234, 0.06), transparent 60%); }
.searchbar-dock[data-cat="Jeux"]            { background-image: linear-gradient(135deg, rgba(34, 197, 94, 0.06),  transparent 60%); }
.searchbar-dock[data-cat="Musique & Audio"] { background-image: linear-gradient(135deg, rgba(236, 72, 153, 0.06), transparent 60%); }
.searchbar-dock[data-cat="Animation"]       { background-image: linear-gradient(135deg, rgba(59, 130, 246, 0.06),  transparent 60%); }
.searchbar-dock[data-cat="Livres"]          { background-image: linear-gradient(135deg, rgba(245, 158, 11, 0.06),  transparent 60%); }

/* ====================================================================
   SECTION 13 — SEARCHBAR FORM
   ==================================================================== */

.searchbar {
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: none;
  margin: 0;
}

/* Hero (landing) pill variant */
.searchbar.hero-mode {
  flex-direction: column;
  max-width: 640px;
  width: 100%;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 6px 4px 20px;
  backdrop-filter: blur(20px);
  box-shadow:
    0 10px 50px -10px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 var(--border-subtle);
  transition:
    box-shadow var(--dur-mid) var(--ease),
    border-color var(--dur-fast) var(--ease),
    transform var(--dur-mid) var(--ease);
}

.searchbar.hero-mode:focus-within {
  border-color: rgba(255, 154, 85, 0.4);
  box-shadow:
    0 0 0 6px var(--accent-dim),
    0 20px 60px -10px rgba(255, 106, 42, 0.3);
  transform: translateY(-2px);
}

.search-input-wrap {
  position: relative;
  flex: 1;
  width: 100%;
}

/* Search icon */
.search-input-wrap::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0a0b0' stroke-width='2'><circle cx='11' cy='11' r='7'/><path d='m21 21-4.3-4.3'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
}

.searchbar input[type="search"] {
  width: 100%;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 10px 14px 10px 40px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  transition:
    border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-mid) var(--ease);
  -webkit-appearance: none;
}

.searchbar input[type="search"]::placeholder {
  color: var(--text-tertiary);
}

.searchbar input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow:
    0 0 0 4px var(--accent-dim),
    0 8px 24px -10px rgba(255, 106, 42, 0.4);
  background: var(--bg-surface);
}

/* Hero-mode input sizing */
.searchbar.hero-mode input[type="search"] {
  font-size: 18px;
  font-weight: 500;
  padding: 18px 20px 18px 48px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: none;
  color: var(--text-primary);
}

.searchbar.hero-mode input[type="search"]:focus {
  outline: none;
  border: none;
  box-shadow: none;
  background: transparent;
}

.searchbar.hero-mode .search-input-wrap::before {
  left: 18px;
  width: 20px;
  height: 20px;
}

/* Keyboard shortcut hint inside input */
.search-shortcut-hint {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 12px;
  pointer-events: none;
  opacity: 0.5;
}

/* ====================================================================
   SECTION 14 — CATEGORY PILLS
   ==================================================================== */

.pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.pills::-webkit-scrollbar { display: none; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transform-style: preserve-3d;
  backdrop-filter: blur(8px);
  transition:
    transform var(--dur-mid) var(--ease),
    background var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-mid) var(--ease);
}

.pill:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.pill:active {
  transform: translateY(1px) scale(0.97);
  transition-duration: 80ms;
}

.pill.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -6px rgba(255, 154, 85, 0.45);
}

[data-theme="light"] .pill {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: var(--text-secondary);
}

/* ====================================================================
   SECTION 15 — SUBCATEGORY PILLS
   ==================================================================== */

.pills-sub {
  margin-top: 6px;
  padding-left: 20px;
  border-left: 2px solid var(--accent-dim);
}

.pill-sub {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 400;
  background: transparent;
}

.pill-sub.active {
  background: var(--accent);
  color: var(--bg-base);
  border-color: var(--accent);
}

/* ====================================================================
   SECTION 16 — DID YOU MEAN BANNER
   ==================================================================== */

.did-you-mean {
  margin: 16px 0;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-dim), rgba(255, 61, 127, 0.05));
  border: 1px solid rgba(255, 154, 85, 0.25);
  font-size: 15px;
  color: var(--text-secondary);
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.did-you-mean .dym-label { color: var(--text-tertiary); }

.did-you-mean .dym-link {
  color: var(--accent);
  font-weight: 600;
  font-style: italic;
  text-decoration: none;
  border-bottom: 1.5px dashed rgba(255, 154, 85, 0.5);
  padding-bottom: 1px;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.did-you-mean .dym-link:hover {
  color: var(--accent-2);
  border-bottom-color: var(--accent-2);
}

.did-you-mean .dym-q { color: var(--text-tertiary); }

[data-theme="light"] .did-you-mean {
  background: linear-gradient(135deg, rgba(224, 85, 0, 0.06), rgba(224, 85, 0, 0.03));
  border-color: rgba(224, 85, 0, 0.2);
}

/* ====================================================================
   SECTION 17 — META BAR
   ==================================================================== */

.meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0 12px;
  font-size: 13px;
  color: var(--text-secondary);
  gap: 12px;
  flex-wrap: wrap;
}

/* ====================================================================
   SECTION 18 — SORT CHIPS + ALIVE TOGGLE
   ==================================================================== */

.sort-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transform-style: preserve-3d;
  backdrop-filter: blur(8px);
  transition:
    transform var(--dur-mid) var(--ease),
    background var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-mid) var(--ease);
}

.sort-chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.sort-chip:active {
  transform: translateY(1px) scale(0.97);
  transition-duration: 80ms;
}

.sort-chip.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -6px rgba(255, 154, 85, 0.35);
}

.sort-chip .caret {
  opacity: 0.6;
  font-size: 10px;
}

[data-theme="light"] .sort-chip {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

/* Alive toggle — orange accent only, NO green */
.alive-toggle {
  background: var(--accent-dim);
  border-color: rgba(255, 154, 85, 0.3);
  color: var(--accent);
}

.alive-toggle.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px -6px rgba(255, 154, 85, 0.5);
}

/* ====================================================================
   SECTION 19 — QUICK LINKS
   ==================================================================== */

.quick-links {
  display: flex;
  gap: 8px;
  margin: 0 0 0 auto;
}

.quick-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--border-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
  transition:
    background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}

.quick-link:hover {
  background: var(--accent-dim);
  border-color: rgba(255, 154, 85, 0.3);
  color: var(--accent);
}

.quick-link .ql-icon { font-size: 13px; }

[data-theme="light"] .quick-link {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
  color: var(--text-secondary);
}
[data-theme="light"] .quick-link:hover {
  background: rgba(224, 85, 0, 0.06);
  border-color: rgba(224, 85, 0, 0.2);
  color: #e05500;
}

/* ====================================================================
   SECTION 20 — AUTOCOMPLETE DROPDOWN
   ==================================================================== */

#ac-wrap { position: relative; }

.ac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  margin-top: 4px;
  background: linear-gradient(180deg, var(--bg-raised), var(--bg-surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  max-height: 380px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

[data-theme="light"] .ac-dropdown {
  background: linear-gradient(180deg, #fff, #f8f6f3);
  border-color: rgba(0, 0, 0, 0.10);
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.15);
}

.ac-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  cursor: pointer;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--dur-fast) var(--ease);
}

.ac-item:last-child { border-bottom: none; }

.ac-item:hover,
.ac-item.active {
  background: var(--bg-hover);
}

[data-theme="light"] .ac-item:hover,
[data-theme="light"] .ac-item.active {
  background: rgba(224, 85, 0, 0.06);
}

.ac-item .ac-title {
  font-size: 14px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.ac-item .ac-seeds {
  font-size: 12px;
  color: var(--ok);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ====================================================================
   ACCESSIBILITY — Reduced motion
   ==================================================================== */

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

/* ======================================================================
   Milktea — design.css  (Part 2 of 2)
   Results table · buttons · pager · modal · preview · toast · cmdk
   bento · marquee · skeleton · favorites · detail · auth · admin
   profile · error · utilities · view-transition · light · responsive
   ====================================================================== */

/* ====================================================================
   SECTION 21 — MAIN LAYOUT
   ==================================================================== */

main {
  padding: 32px clamp(20px, 3vw, 48px);
  max-width: none;
  margin: 0;
  transition: padding-right var(--dur-mid) var(--ease);
}

/* Keep the hero search page content centered (landing with no results) */
body:has(.search-hero) main {
  max-width: 1100px;
  margin: 0 auto;
}

/* When mini-preview is visible, reserve space on the right so content doesn't hide under it */
@media (min-width: 1201px) {
  body:has(.mini-preview:not([hidden])) main {
    padding-right: calc(max(380px, 32vw) + 32px);
  }
}

/* ====================================================================
   SECTION 22 — RESULTS TABLE
   ==================================================================== */

.results {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.results thead th {
  background: var(--bg-surface);
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  user-select: none;
}

.results thead th.sortable {
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease);
}
.results thead th.sortable:hover { color: var(--text-secondary); }
.results thead th.active { color: var(--accent); }
.results thead th .caret { opacity: 0.6; margin-left: 4px; }

.results th:first-child,
.results td.title { width: 40%; }
.results td.cat-cell { width: 12%; white-space: nowrap; }

.results tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  vertical-align: middle;
}

.results tbody tr {
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
  animation: fadeInRow var(--dur-mid) var(--ease) both;
}

@keyframes fadeInRow {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.results tbody tr:hover {
  background: var(--bg-hover);
}
.results tbody tr:last-child td { border-bottom: 0; }

/* Left accent bar on first cell — NOT on tr (that caused column shift) */
.results tbody td:first-child {
  position: relative;
}
.results tbody td:first-child::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  transform: scaleY(0);
  transform-origin: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.results tbody tr:hover td:first-child::before {
  transform: scaleY(1);
}

/* Title cell */
.results td.title {
  min-width: 300px;
}
.results td.title a {
  color: var(--text-primary);
  font-weight: 500;
  background-image: linear-gradient(90deg, var(--accent), var(--accent-2));
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition:
    color var(--dur-fast) var(--ease),
    background-size var(--dur-slow) var(--ease);
}
.results tbody tr:hover td.title a {
  color: var(--accent);
  background-size: 100% 2px;
}

/* Title wrap (flex layout with aligned tags) */
.title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.title-link {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-tags {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 170px;
  justify-content: flex-start;
}

/* Source badge */
.src-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  text-align: center;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-overlay);
  border-radius: 3px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-left: 6px;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.src-badge::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
  transition: left 0.7s var(--ease);
}
.src-badge:hover { transform: translateY(-1px) scale(1.05); }
.src-badge:hover::after { left: 130%; }

.src-badge.src-ygg        { color: var(--accent); background: var(--accent-dim); }
.src-badge.src-fitgirl    { color: #ec4899; background: rgba(236, 72, 153, 0.10); }
.src-badge.src-skidrowreloaded { color: #22d3ee; background: rgba(34, 211, 238, 0.10); }
.src-badge.src-dodi       { color: #a78bfa; background: rgba(167, 139, 250, 0.12); }
.src-badge.src-prowlarr   { color: var(--ok); background: rgba(74, 222, 128, 0.10); }

.src-badge.src-placeholder {
  visibility: hidden;
  min-width: 58px;
}

/* Safety pill */
.safety-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 56px;
  justify-content: center;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 3px;
  margin-left: 6px;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  cursor: help;
}
.safety-pill.sf-safe {
  color: var(--ok);
  background: rgba(74, 222, 128, 0.10);
  border-color: rgba(74, 222, 128, 0.25);
  text-shadow: 0 0 8px rgba(46, 230, 176, 0.5);
}
.safety-pill.sf-ok {
  color: var(--text-secondary);
  background: var(--bg-overlay);
}
.safety-pill.sf-warn {
  color: var(--warn);
  background: rgba(245, 165, 36, 0.10);
  border-color: rgba(245, 165, 36, 0.3);
  animation: pulse-soft 2.6s var(--ease) infinite;
}
.safety-pill.sf-bad {
  color: var(--bad);
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.35);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255, 61, 127, 0.5);
  animation: pulse-soft 2.6s var(--ease) infinite;
}

@keyframes pulse-soft {
  0%, 100% { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
  50%      { box-shadow: 0 0 0 6px transparent; opacity: 0.85; }
}

/* Safety detail bar & flags */
.safety-detail { margin: 14px 0 22px; }
.safety-bar {
  height: 6px;
  background: var(--bg-overlay);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}
.safety-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.safety-bar-fill.sf-safe { background: linear-gradient(90deg, #4ade80, #22c55e); }
.safety-bar-fill.sf-ok   { background: linear-gradient(90deg, var(--text-secondary), var(--text-tertiary)); }
.safety-bar-fill.sf-warn { background: linear-gradient(90deg, var(--warn), #eab308); }
.safety-bar-fill.sf-bad  { background: linear-gradient(90deg, var(--bad), #e11d48); }

.safety-flags {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sf-flag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-overlay);
  color: var(--text-secondary);
  font-family: 'Geist Mono', ui-monospace, monospace;
}
.sf-flag-good { color: var(--ok); background: rgba(74, 222, 128, 0.08); }
.sf-flag-warn { color: var(--warn); background: rgba(245, 165, 36, 0.08); }
.sf-flag-bad  { color: var(--bad); background: rgba(244, 63, 94, 0.10); }

/* Category badge */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  background: var(--bg-overlay);
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.cat-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7dd3fc;
  box-shadow: 0 0 8px currentColor;
  animation: dot-breathe 3s ease-in-out infinite;
}

@keyframes dot-breathe {
  0%, 100% { box-shadow: 0 0 4px currentColor; }
  50%      { box-shadow: 0 0 12px currentColor; }
}

.cat-badge.movie .dot { background: #f97316; }
.cat-badge.tv    .dot { background: #a78bfa; }
.cat-badge.audio .dot { background: #f472b6; }
.cat-badge.anim  .dot { background: #fb7185; }
.cat-badge.game  .dot { background: #4ade80; }
.cat-badge.app   .dot { background: #60a5fa; }
.cat-badge.book  .dot { background: #fbbf24; }

/* Seed pill */
.seed-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: rgba(74, 222, 128, 0.08);
  color: var(--ok);
  border: 1px solid rgba(74, 222, 128, 0.2);
}
.seed-pill.warn {
  background: rgba(245, 165, 36, 0.08);
  color: var(--warn);
  border-color: rgba(245, 165, 36, 0.2);
}
.seed-pill.dead {
  background: rgba(244, 63, 94, 0.08);
  color: var(--bad);
  border-color: rgba(244, 63, 94, 0.2);
}

/* Seeders cell: dbl-click to refresh live from UDP trackers */
td.seed-cell { cursor: help; }
td.seed-cell.seed-refreshing .seed-pill { opacity: 0.5; animation: seed-pulse 0.8s ease-in-out infinite alternate; }
@keyframes seed-pulse { from { opacity: 0.4; } to { opacity: 0.9; } }
td.seed-cell.seed-just-refreshed .seed-pill {
  animation: seed-flash 1.2s ease-out;
}
@keyframes seed-flash {
  0%   { box-shadow: 0 0 0 0 rgba(255,180,80,0.8); }
  40%  { box-shadow: 0 0 0 6px rgba(255,180,80,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,180,80,0); }
}

/* Bulk-refresh: button spinning state + progress bar */
#refresh-seeds-btn .rs-icon { display: inline-block; }
#refresh-seeds-btn.rs-running .rs-icon {
  animation: rs-spin 1s linear infinite;
}
@keyframes rs-spin { to { transform: rotate(360deg); } }

.rs-progress[hidden] { display: none !important; }
.rs-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 4px;
  padding: 6px 10px;
  background: var(--surface-1, rgba(255,255,255,0.03));
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary, #aaa);
}
.rs-progress progress {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
}
.rs-progress progress::-webkit-progress-bar {
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
}
.rs-progress progress::-webkit-progress-value {
  background: linear-gradient(90deg, #f5a623, #ff7a00);
  border-radius: 4px;
  transition: width 0.2s ease;
}
.rs-progress progress::-moz-progress-bar {
  background: linear-gradient(90deg, #f5a623, #ff7a00);
  border-radius: 4px;
}
.rs-progress #refresh-seeds-status {
  min-width: 80px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.rs-cancel {
  background: transparent;
  border: none;
  color: var(--text-tertiary, #888);
  cursor: pointer;
  padding: 0 4px;
  font-size: 14px;
  line-height: 1;
}
.rs-cancel:hover { color: var(--text-primary, #fff); }

/* Leech, size, completed, age */
.leech-num {
  color: var(--text-tertiary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.size-cell {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  white-space: nowrap;
}
.completed-cell {
  color: var(--text-tertiary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.age-cell {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.age-label {
  display: inline-block;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-left: 8px;
  font-variant-numeric: tabular-nums;
}

/* Magnet actions */
.magnet-actions {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-pill);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.magnet-actions:hover {
  background: var(--bg-hover);
  border-color: rgba(255, 154, 85, 0.2);
}

.magnet-copy {
  margin-left: 4px;
  min-width: 34px;
  text-align: center;
}

/* Keyboard focus on rows */
.results tbody tr.kb-focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--accent-dim);
}

/* ====================================================================
   SECTION 23 — BUTTONS
   ==================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--accent);
  color: #1a0c00;
  border: 0;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow var(--dur-mid) var(--ease),
    filter var(--dur-fast) var(--ease);
}

/* Shimmer sweep on hover (Linear style) */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.1) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.5s var(--ease);
}
.btn:hover::after {
  transform: translateX(100%);
}

.btn:hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.08);
  box-shadow: 0 12px 28px -10px rgba(255, 106, 42, 0.55);
}
.btn:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 80ms;
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--accent);
  color: #1a0c00;
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow var(--dur-mid) var(--ease);
}
.btn-sm:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -8px rgba(255, 106, 42, 0.4);
}
.btn-sm:active {
  transform: scale(0.96);
  transition-duration: 80ms;
}
.btn-sm.copied { background: var(--ok); color: #062e12; }
.btn-sm.danger { background: var(--bad); color: #3b0a13; }
.btn-sm.danger:hover { background: #ff5670; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition:
    background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* Magnet button (special CTA) */
.magnet-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #1a0c00;
  border: 0;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  will-change: transform;
  box-shadow: 0 4px 14px -4px rgba(255, 106, 42, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow var(--dur-mid) var(--ease),
    filter var(--dur-fast) var(--ease);
}
.magnet-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 30%, rgba(255, 255, 255, 0.2) 50%, transparent 70%);
  transform: translateX(-150%);
  transition: transform 0.8s var(--ease);
}
.magnet-btn:hover::after { transform: translateX(150%); }
.magnet-btn:hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.08);
  box-shadow: 0 12px 28px -10px rgba(255, 106, 42, 0.55);
}
.magnet-btn:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 80ms;
}

/* ====================================================================
   SECTION 24 — PAGER
   ==================================================================== */

.pager {
  display: flex;
  justify-content: center;
  gap: 20px;
  align-items: center;
  margin: 32px 0 16px;
  color: var(--text-secondary);
  font-size: 13px;
}

.pager a,
.pager-link {
  color: var(--text-primary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  transition:
    border-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}
.pager a:hover,
.pager-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ====================================================================
   SECTION 25 — TORRENT DETAIL MODAL
   ==================================================================== */

.torrent-modal {
  position: fixed;
  inset: 0;
  z-index: 9997;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
.torrent-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.torrent-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 12, 0.72);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
}

.torrent-modal-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: min(960px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 40px 100px -20px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 154, 85, 0.08);
  transition: transform 0.35s var(--ease);
}
.torrent-modal.open .torrent-modal-panel {
  transform: translate(-50%, -50%) scale(1);
}

.torrent-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.torrent-modal-close:hover {
  background: rgba(255, 61, 127, 0.2);
  border-color: rgba(255, 61, 127, 0.4);
  transform: rotate(90deg);
}

.modal-loading {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 14px;
}

/* Modal poster banner */
.modal-poster {
  height: 140px;
  position: relative;
  overflow: hidden;
  border-radius: 22px 22px 0 0;
}
.modal-poster::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(15, 15, 20, 0.9) 100%);
}
.modal-poster-inner {
  position: absolute;
  bottom: 12px;
  left: 20px;
  display: flex;
  gap: 8px;
  z-index: 1;
}

/* Modal body */
.modal-body {
  padding: 22px 28px 28px;
}
.modal-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 18px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

/* Modal stats grid */
.modal-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.mstat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mstat-num {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.mstat-lbl {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Modal actions */
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* Modal sections */
.modal-section {
  margin: 20px 0;
}
.modal-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin: 0 0 10px;
}

/* Modal description — NO max-height */
.modal-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  padding-right: 8px;
}

/* Modal files list */
.modal-files {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
}
.modal-file {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}
.modal-file:last-child { border-bottom: 0; }
.modal-file .mf-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}
.modal-file .mf-size {
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.modal-file.more {
  color: var(--text-tertiary);
  font-style: italic;
  justify-content: center;
}

/* Modal meta */
.modal-meta {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12px;
  color: var(--text-muted);
}
.modal-meta .mono {
  font-family: 'Geist Mono', ui-monospace, monospace;
  word-break: break-all;
}

/* ====================================================================
   SECTION 26 — MINI PREVIEW PANEL
   ==================================================================== */

.mini-preview {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  bottom: 0;
  width: max(380px, 32vw);
  overflow-y: auto;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-left: 1px solid var(--border);
  padding: 22px 24px;
  z-index: 100;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.3);
  transition: opacity var(--dur-mid) var(--ease);
  opacity: 1;
}
.mini-preview[hidden] { display: none; }

.mp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.mp-cat {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}
.mp-safety { font-size: 12px; }

.mp-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 16px;
  line-height: 1.35;
}

.mp-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.mp-stats > div {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mp-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.mp-lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mp-desc {
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  word-break: break-word;
}
.mp-desc img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 6px 0;
}

.mp-files {
  margin-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 10px;
}
.mp-file {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 12px;
  color: var(--text-tertiary);
  gap: 8px;
}
.mp-file .mf-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}
.mp-file .mf-size { flex-shrink: 0; }

.mp-actions {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.mp-hint {
  margin-top: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

/* ====================================================================
   SECTION 27 — TOAST
   ==================================================================== */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: 0 12px 40px -10px rgba(0, 0, 0, 0.5);
  z-index: 9990;
  opacity: 0;
  transition:
    opacity 0.3s var(--ease),
    transform 0.3s var(--ease);
  pointer-events: none;
  backdrop-filter: blur(8px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.toast-ok {
  border-left: 3px solid var(--ok);
}
.toast-err {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.35);
  color: #ff9a9a;
}

/* ====================================================================
   SECTION 28 — ONBOARDING
   ==================================================================== */

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(8, 8, 12, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: fadeIn var(--dur-slow) var(--ease) forwards;
}

.onboarding-card {
  background: linear-gradient(180deg, var(--bg-raised), var(--bg-surface));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px 40px;
  max-width: 480px;
  text-align: center;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.6);
}
.onboarding-card h2 {
  font-size: 28px;
  margin: 20px 0 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.onboarding-card p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 8px;
}
.onboarding-card .ob-shortcuts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 20px 0;
  text-align: left;
}
.onboarding-card .ob-shortcut {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}
.onboarding-card .ob-shortcut kbd {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  min-width: 32px;
  text-align: center;
}

/* ====================================================================
   SECTION 29 — COMMAND PALETTE (Cmd+K)
   ==================================================================== */

.cmdk-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 8, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  animation: cmdk-in 0.2s var(--ease);
}
.cmdk-backdrop.open {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

@keyframes cmdk-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cmdk-panel {
  width: min(560px, 90vw);
  background: rgba(23, 23, 29, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: cmdk-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cmdk-pop {
  from { transform: translateY(-12px) scale(0.96); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.cmdk-input {
  width: 100%;
  padding: 18px 20px;
  font-size: 17px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  font-family: inherit;
}
.cmdk-input:focus { outline: none; }
.cmdk-input::placeholder { color: var(--text-tertiary); }

.cmdk-list {
  padding: 6px;
  max-height: 320px;
  overflow-y: auto;
}

.cmdk-item {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-size: 14px;
  transition: background var(--dur-fast) var(--ease);
}
.cmdk-item:hover,
.cmdk-item.active {
  background: linear-gradient(90deg, rgba(255, 154, 85, 0.15), rgba(255, 154, 85, 0.04));
}

.cmdk-icon {
  width: 24px;
  opacity: 0.7;
}

.cmdk-key {
  display: inline-block;
  background: var(--border);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  font-family: inherit;
  color: var(--text-tertiary);
}

.cmdk-hint {
  padding: 8px 14px;
  font-size: 11px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
}

/* ====================================================================
   SECTION 30 — BENTO GRID
   ==================================================================== */

.bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 140px;
  gap: 16px;
  max-width: 1100px;
  margin: 40px auto;
}

.bento-item {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition:
    transform 0.35s var(--ease),
    box-shadow 0.35s var(--ease);
  cursor: pointer;
}
.bento-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 30px 60px -20px rgba(255, 106, 42, 0.3);
  border-color: rgba(255, 154, 85, 0.3);
}
.bento-item.b-wide { grid-column: span 2; }
.bento-item.b-tall { grid-row: span 2; }
.bento-item.b-hero { grid-column: span 2; grid-row: span 2; }

.bento-item::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -30%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255, 154, 85, 0.15), transparent 60%);
  pointer-events: none;
  transition: transform 0.5s var(--ease);
}
.bento-item:hover::before { transform: translate(-20px, 20px) scale(1.2); }

.bento-item h3 { font-size: 22px; margin: 0 0 8px; }
.bento-item p { color: var(--text-tertiary); font-size: 13px; margin: 0; }

.bento-big {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text-primary), var(--text-tertiary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ====================================================================
   SECTION 31 — MARQUEE
   ==================================================================== */

.marquee {
  overflow: hidden;
  white-space: nowrap;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 0;
  margin: 16px 0;
  mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 10%, black 90%, transparent);
}

.marquee-track {
  display: inline-block;
  animation: marquee-scroll 40s linear infinite;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.marquee-track span { margin: 0 32px; }
.marquee-track .m-accent { color: var(--accent); }
.marquee-track .m-dot { color: var(--text-muted); }

@keyframes marquee-scroll { to { transform: translateX(-50%); } }

/* ====================================================================
   SECTION 32 — SKELETON LOADING
   ==================================================================== */

.skeleton {
  background: linear-gradient(90deg, var(--bg-raised) 25%, var(--bg-overlay) 50%, var(--bg-raised) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
  color: transparent;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.skeleton-row .sk-title { width: 45%; height: 16px; }
.skeleton-row .sk-cat   { width: 10%; height: 14px; }
.skeleton-row .sk-size  { width: 8%; height: 14px; }
.skeleton-row .sk-seed  { width: 6%; height: 14px; }
.skeleton-row .sk-date  { width: 10%; height: 14px; }
.skeleton-row .sk-btn   { width: 80px; height: 30px; margin-left: auto; }

/* ====================================================================
   SECTION 33 — FAVORITES
   ==================================================================== */

.fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  opacity: 0.4;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  line-height: 1;
}
.fav-btn:hover { opacity: 0.7; }
.fav-btn.faved { opacity: 1; color: var(--bad); }
.fav-btn.faved:hover { transform: scale(1.2); }

.fav-section { margin: 24px 0; }
.fav-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

/* ====================================================================
   SECTION 34 — DETAIL PAGE
   ==================================================================== */

.detail-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 32px;
  align-items: start;
}

.poster {
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 20px;
}
.poster::before {
  content: "";
  position: absolute;
  inset: 0;
  background: inherit;
  animation: ken-burns 14s ease-out infinite alternate;
}
.poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.5) 100%);
  pointer-events: none;
}
.poster .label {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

@keyframes ken-burns {
  0%   { transform: scale(1.0) translate(0, 0); }
  100% { transform: scale(1.08) translate(-1%, -1%); }
}

.detail-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.detail-side .btn { justify-content: center; }

.detail-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 14px;
  padding: 18px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
}
.detail-meta dt {
  color: var(--text-tertiary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  align-self: center;
}
.detail-meta dd {
  margin: 0;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.detail-meta dd.mono { font-size: 12px; }

.detail-main h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  word-break: break-word;
}
.detail-main .chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 16px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
  background: none;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  font-family: inherit;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; animation: fadeIn var(--dur-mid) var(--ease); }
.tab-panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* File tree */
.file-tree {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.file-tree .row {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.file-tree .row:last-child { border-bottom: 0; }
.file-tree .row:hover { background: var(--bg-hover); }
.file-tree .name {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 12px;
}
.file-tree .size {
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Description body */
.desc-body {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  line-height: 1.7;
  color: var(--text-primary);
  font-size: 14px;
}
.desc-body img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 8px 0;
  display: block;
}
.desc-body a { word-break: break-all; }
.desc-body blockquote {
  margin: 12px 0;
  padding: 8px 14px;
  border-left: 2px solid var(--accent);
  color: var(--text-secondary);
  background: var(--bg-base);
}
.desc-body pre {
  background: var(--bg-base);
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}
.desc-body details.spoiler {
  margin: 10px 0;
  padding: 10px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.desc-body details.spoiler summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 500;
}
.desc-body ul { padding-left: 20px; }

/* Tracker list */
.tracker-list { list-style: none; padding: 0; margin: 0; }
.tracker-list li {
  padding: 8px 14px;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  word-break: break-all;
}

/* Magnet box */
.magnet-box { display: flex; gap: 8px; }
.magnet-box input {
  flex: 1;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11px;
  padding: 8px 12px;
  background: var(--bg-base);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Related grid */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.related-card {
  display: block;
  padding: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition:
    border-color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
  color: var(--text-primary);
}
.related-card:hover {
  border-color: var(--accent);
  background: var(--bg-raised);
  transform: translateY(-2px);
}
.related-card .t {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.related-card .m {
  color: var(--text-tertiary);
  font-size: 11px;
  display: flex;
  gap: 10px;
}

/* Breadcrumb */
.breadcrumb {
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }

/* ====================================================================
   SECTION 35 — AUTH / GATE (login page)
   ==================================================================== */

body.gate {
  display: flex;
  min-height: 100vh;
  margin: 0;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  background-image:
    radial-gradient(circle at 50% 40%, rgba(255, 154, 85, 0.08), transparent 60%);
}
.gate-main { width: 100%; }

.auth-box {
  max-width: 400px;
  margin: 40px auto;
  padding: 36px 32px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 -1px 0 rgba(0, 0, 0, 0.3) inset,
    0 4px 20px -4px rgba(0, 0, 0, 0.35),
    0 30px 80px -20px rgba(0, 0, 0, 0.5);
}
.auth-box h2 {
  margin: 0 0 4px;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.auth-box label {
  display: block;
  margin: 18px 0 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.auth-box input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition:
    border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-mid) var(--ease);
}
.auth-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim), 0 0 24px -4px rgba(255, 154, 85, 0.45);
}
.auth-box button {
  margin-top: 24px;
  width: 100%;
  justify-content: center;
}
.auth-box .muted {
  margin-top: 20px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

.error {
  background: rgba(244, 63, 94, 0.08);
  color: #fda4af;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid rgba(244, 63, 94, 0.2);
}

/* Invite link box */
.invite-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.invite-link-box input {
  flex: 1;
  min-width: 360px;
  padding: 6px 10px;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 12px;
  background: var(--bg-overlay);
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  color: var(--accent);
  cursor: pointer;
}
.invite-link-box .copy-hint {
  font-size: 10px;
  color: var(--text-tertiary);
  white-space: nowrap;
}
.invite-greeting {
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text-primary);
}
.invite-greeting strong { color: var(--accent); }

/* ====================================================================
   SECTION 36 — ADMIN
   ==================================================================== */

.admin-section {
  margin: 24px 0;
  padding: 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.admin-section h3 {
  margin-top: 0;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.admin-section.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 -1px 0 rgba(0, 0, 0, 0.3) inset,
    0 4px 20px -4px rgba(0, 0, 0, 0.35),
    0 30px 80px -20px rgba(0, 0, 0, 0.5);
}

.inline-form { display: inline-flex; gap: 8px; margin: 0; }
.inline-form input[type="text"] {
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  min-width: 240px;
  font-family: inherit;
}

/* Stat cards */
.stat-cards {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  min-width: 130px;
  position: relative;
  overflow: hidden;
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.3s var(--ease);
}
.stat-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from 0deg,
    transparent 0deg,
    rgba(255, 154, 85, 0.6) 60deg,
    transparent 120deg,
    rgba(255, 61, 127, 0.4) 200deg,
    transparent 260deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  animation: spin-border 6s linear infinite;
  transition: opacity var(--dur-slow) var(--ease);
  pointer-events: none;
}
.stat-card:hover::before { opacity: 1; }
.stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 154, 85, 0.10), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}
.stat-card:hover::after { opacity: 1; }
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px -14px rgba(255, 106, 42, 0.35);
}

@keyframes spin-border { to { transform: rotate(360deg); } }

.stat-num {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  background: linear-gradient(135deg, #ffbb80, #ff6a2a);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-label {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-title {
  margin: 16px 0 6px;
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* Bars chart */
.bars-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 80px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.bars-chart.bars-wide { gap: 6px; height: 90px; }

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 10px;
}

.bar {
  width: 100%;
  background: linear-gradient(180deg, var(--accent), var(--accent-hover));
  border-radius: 2px 2px 0 0;
  transition:
    height 0.3s var(--ease),
    filter var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
  transform-origin: bottom;
}
.bar:hover { filter: drop-shadow(0 0 6px currentColor) brightness(1.3); }
.bar-col:hover .bar { filter: brightness(1.3); transform: scaleY(1.04); }

.bar-alt  { background: linear-gradient(180deg, #5aa0ff, #2a6adf); }
.bar-alt2 { background: linear-gradient(180deg, #c58dff, #8842d4); }

.bar-label {
  font-size: 9px;
  color: var(--text-tertiary);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* ====================================================================
   SECTION 37 — USER PROFILE (me page)
   ==================================================================== */

.me-hero { padding: 40px 0 24px; }

.me-title {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  line-height: 1.05;
}

.accent-text {
  background: linear-gradient(135deg, #ffbb80, #ff6a2a 60%, var(--accent-2));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-shift 5s ease-in-out infinite;
}

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

.me-stats { margin-bottom: 24px; }
.tilt {
  cursor: default;
  transition: transform var(--dur-fast) var(--ease);
  will-change: transform;
}
.pwd-form {
  display: grid;
  gap: 12px;
  max-width: 420px;
}

/* ====================================================================
   SECTION 38 — ERROR PAGE
   ==================================================================== */

.err-hero { text-align: center; padding: 80px 20px; }

.err-code {
  font-size: clamp(120px, 22vw, 240px);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
  display: inline-block;
}

.err-label {
  color: var(--text-secondary);
  font-size: 18px;
  margin: 16px 0;
}

/* Glitch effect on err-code */
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  -webkit-text-fill-color: currentColor;
  opacity: 0.7;
  mix-blend-mode: screen;
}
.glitch::before { color: var(--accent-3); animation: glitch-x 2.6s infinite steps(2); }
.glitch::after  { color: var(--accent-2); animation: glitch-x 2.1s infinite steps(2) reverse; }

@keyframes glitch-x {
  0%, 92%, 100% { transform: translate(0, 0); clip-path: inset(0 0 0 0); }
  93% { transform: translate(-2px, 1px); clip-path: inset(10% 0 70% 0); }
  95% { transform: translate(2px, -1px); clip-path: inset(60% 0 20% 0); }
  97% { transform: translate(-1px, 2px); clip-path: inset(30% 0 50% 0); }
}

.err-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 28px;
  flex-wrap: wrap;
}

/* ====================================================================
   SECTION 39 — UTILITY CLASSES
   ==================================================================== */

.right { text-align: right; }
.muted { color: var(--text-secondary); font-size: 13px; }
.mono, code, pre {
  font-family: 'Geist Mono', 'JetBrains Mono', 'Fira Code', ui-monospace, Menlo, Consolas, monospace;
  font-variant-ligatures: none;
}

code {
  background: var(--bg-overlay);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--accent);
}

/* Gradient text utility */
.scramble { display: inline-block; font-variant-numeric: tabular-nums; }
.odo { display: inline-flex; overflow: hidden; font-variant-numeric: tabular-nums; }

/* Fade-in-up animation helper */
.fade-in-up { animation: fadeInUp var(--dur-mid) var(--ease) both; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Glass surface utility */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Spotlight cursor */
.spotlight {
  position: fixed;
  top: 0;
  left: 0;
  width: 400px;
  height: 400px;
  margin-left: -200px;
  margin-top: -200px;
  background: radial-gradient(circle, rgba(255, 154, 85, 0.15), transparent 60%);
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  transition: transform 0.35s var(--ease), opacity 0.3s var(--ease);
  opacity: 0;
  will-change: transform;
  filter: blur(10px);
}
body:hover .spotlight { opacity: 1; }

/* Particle (magnet click effect) */
.particle {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 0 8px var(--accent);
}

/* Link shimmer */
a.link-shimmer { position: relative; color: inherit; text-decoration: none; }
a.link-shimmer::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, white, transparent);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: link-shimmer-move 2.5s linear infinite;
  opacity: 0;
}
a.link-shimmer:hover::after { opacity: 1; }
@keyframes link-shimmer-move {
  0%   { background-position: -100% 0; }
  100% { background-position: 200% 0; }
}

/* Heading underline animations */
h2::after {
  content: "";
  position: absolute;
  left: 0;
  right: 30%;
  bottom: -4px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), transparent);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  animation: underline-grow 0.7s 0.3s var(--ease) forwards;
}
h2, h3 {
  position: relative;
  display: inline-block;
  letter-spacing: -0.02em;
}
@keyframes underline-grow { to { transform: scaleX(1); } }

/* ====================================================================
   SECTION 40 — VIEW TRANSITIONS
   ==================================================================== */

@view-transition { navigation: auto; }

::view-transition-old(root) { animation: vt-fade-out 0.15s var(--ease); }
::view-transition-new(root) { animation: vt-fade-in 0.2s var(--ease); }

@keyframes vt-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes vt-fade-in  { from { opacity: 0; } to { opacity: 1; } }

/* ====================================================================
   SECTION 41 — LIGHT THEME OVERRIDES
   ==================================================================== */

[data-theme="light"] {
  --bg-base:    #f8f6f3;
  --bg-surface: #ffffff;
  --bg-raised:  #f0ede8;
  --bg-overlay: #e8e4de;
  --bg-hover:   rgba(224, 85, 0, 0.06);

  --border-subtle: rgba(0, 0, 0, 0.04);
  --border:        rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);

  --text-primary:   #1a1815;
  --text-secondary: #6b635e;
  --text-tertiary:  #a8a09a;
  --text-muted:     #c8c0b8;

  --accent:       #e05500;
  --accent-hover: #ff6a00;
  --accent-dim:   rgba(224, 85, 0, 0.1);

  --glass-bg: rgba(255, 255, 255, 0.75);
}

[data-theme="light"] .torrent-modal-backdrop {
  background: rgba(200, 195, 188, 0.5);
}
[data-theme="light"] .torrent-modal-panel {
  background: linear-gradient(180deg, #fff 0%, #f8f6f3 100%);
  border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .mini-preview {
  background: linear-gradient(180deg, #fff, #f8f6f3);
  border-left-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .mp-title { color: var(--text-primary); }
[data-theme="light"] .mp-stats > div {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .toast {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 12px 40px -10px rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .bento-item {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.01));
  border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .bento-item:hover {
  box-shadow: 0 20px 40px -15px rgba(224, 85, 0, 0.15);
  border-color: rgba(224, 85, 0, 0.2);
}
[data-theme="light"] .mstat {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .scroll-progress {
  box-shadow: 0 0 12px rgba(224, 85, 0, 0.3);
}
[data-theme="light"] .marquee-track { color: var(--text-tertiary); }
[data-theme="light"] .magnet-actions {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .cmdk-backdrop { background: rgba(200, 195, 188, 0.5); }
[data-theme="light"] .cmdk-panel {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .cmdk-input {
  background: rgba(0, 0, 0, 0.02);
  color: var(--text-primary);
}
[data-theme="light"] .onboarding-overlay { background: rgba(200, 195, 188, 0.6); }
[data-theme="light"] .onboarding-card {
  background: linear-gradient(180deg, #fff, #f8f6f3);
  border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .skeleton {
  background: linear-gradient(90deg, var(--bg-raised) 25%, var(--bg-overlay) 50%, var(--bg-raised) 75%);
  background-size: 200% 100%;
}

/* ====================================================================
   SECTION 42 — RESPONSIVE
   ==================================================================== */

@media (max-width: 1200px) {
  .mini-preview { display: none; }
}

@media (max-width: 900px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
  .bento-item.b-hero { grid-column: span 2; grid-row: span 1; }
  .bento-item.b-wide { grid-column: span 2; }
  .bento-item.b-tall { grid-row: span 1; }
}

@media (max-width: 820px) {
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px; }
  .topbar nav { flex-wrap: wrap; gap: 8px; }
  .stat-cards { gap: 8px; }
  .stat-card { flex: 1 1 140px; min-width: 120px; padding: 10px 12px; }
  .stat-num { font-size: 22px; }
  .results { font-size: 13px; }
  .results th,
  .results td { padding: 8px 6px; }
  .results .cat-cell,
  .age-cell { display: none; }
  .me-title { font-size: 28px; }
  .pills { flex-wrap: wrap; gap: 6px; }
  .searchbar { flex-direction: column; width: 100%; }
  .searchbar input[type="search"] { width: 100%; }
  .err-code { font-size: 28vw; }
  .search-hero h1 { font-size: clamp(44px, 14vw, 80px); }
  .title-tags { min-width: 0; }
  .torrent-modal-panel { width: 96vw; max-height: 94vh; border-radius: var(--radius-lg); }
  .modal-body { padding: 18px; }
  .modal-title { font-size: 19px; }
}

@media (max-width: 480px) {
  .results .size-cell { display: none; }
  .src-badge { font-size: 9px; padding: 1px 4px; }
  .age-label,
  .safety-pill { font-size: 10px; }
}

/* ====================================================================
   SECTION 43 — REDUCED MOTION
   ==================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
  }
  body::before { animation: none; }
  body::after  { animation: none; }
  .scroll-progress { animation: none; }
  .spotlight { display: none; }
  body > main::before { display: none; }
}

/* === END design.css === */
