/* ============================================================
   DPLANEX Agent Marketplace
   Visual Identity: BS 04-01/04-02 (Primary/Secondary Colors)
   Typography: Avenir LT Std (en) / Noto Sans CJK KR (ko)
   ============================================================ */

:root {
  /* DPLANEX VI — Primary (변하지 않음) */
  --dpx-violet:        #60269E;
  --dpx-violet-soft:   #F2EBFA;
  --dpx-violet-dark:   #421B6E;
  --dpx-green:         #93D500;
  --dpx-green-soft:    #EDF8D2;
  --dpx-green-dark:    #6BA300;
  --dpx-blue-green:    #00AF9A;
  --dpx-orange:        #FF6C0E;
  --dpx-dark-gray:     #54565A;
  --dpx-gray:          #898A8D;

  /* Semantic theme tokens — Light */
  --bg:             #FFFFFF;
  --bg-soft:        #FAFAFB;
  --surface:        #FFFFFF;
  --surface-2:      #F4F4F6;
  --text:           #161620;
  --text-muted:     #2E2E36;
  --text-faint:     #6B6B75;
  --border:         #E7E7EC;
  --border-strong:  #D2D2D9;
  --header-bg:      rgba(255, 255, 255, 0.92);
  --hero-bg-grad:   linear-gradient(180deg, #FFFFFF 0%, var(--dpx-violet-soft) 100%);
  --hero-radial:    radial-gradient(1200px 600px at 80% -10%, rgba(96,38,158,0.10), transparent 60%);

  --accent:         var(--dpx-violet);
  --accent-strong:  var(--dpx-violet-dark);
  --accent-soft:    var(--dpx-violet-soft);
  --accent-on:      #FFFFFF;
  --pattern-opacity: 0.55;

  --shadow-card:        0 1px 2px rgba(22, 22, 32, 0.04), 0 4px 16px rgba(96, 38, 158, 0.06);
  --shadow-card-hover:  0 2px 4px rgba(22, 22, 32, 0.06), 0 12px 32px rgba(96, 38, 158, 0.12);
  --shadow-modal:       0 24px 64px rgba(22, 22, 32, 0.24);
  --shadow-sticky:      0 4px 16px rgba(22, 22, 32, 0.06);

  /* System */
  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 20px;

  --font-sans: 'Avenir Next', 'Avenir LT Std', 'Noto Sans KR', -apple-system, BlinkMacSystemFont,
               'Segoe UI', system-ui, sans-serif;

  --header-h: 72px;
}

/* Semantic theme tokens — Dark */
[data-theme="dark"] {
  --bg:             #0F0F18;
  --bg-soft:        #14141E;
  --surface:        #1A1A26;
  --surface-2:      #20202E;
  --text:           #ECECF2;
  --text-muted:     #B8B8C2;
  --text-faint:     #6B6B78;
  --border:         #2A2A38;
  --border-strong:  #3A3A48;
  --header-bg:      rgba(15, 15, 24, 0.88);
  --hero-bg-grad:   linear-gradient(180deg, #0F0F18 0%, #1B1230 100%);
  --hero-radial:    radial-gradient(1200px 600px at 80% -10%, rgba(157,107,208,0.18), transparent 60%);

  --accent:         #A574DF;          /* Violet 밝게 — 다크에서 가독성 */
  --accent-strong:  #B98DEC;
  --accent-soft:    rgba(165, 116, 223, 0.15);
  --accent-on:      #0F0F18;
  --pattern-opacity: 0.22;

  --shadow-card:        0 1px 2px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.4);
  --shadow-card-hover:  0 2px 4px rgba(0,0,0,0.5), 0 12px 32px rgba(165,116,223,0.18);
  --shadow-modal:       0 24px 64px rgba(0, 0, 0, 0.6);
  --shadow-sticky:      0 4px 16px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* Auth gate visibility — hide marketplace content until authenticated */
body.auth-pending .site-header,
body.auth-pending .hero,
body.auth-pending main,
body.auth-pending .site-footer,
body.auth-pending .compare-bar { display: none !important; }
body:not(.auth-pending) .auth-gate { display: none !important; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.55;
  transition: background-color 0.2s ease, color 0.2s ease;
  /* Sticky footer: layout grows to fill viewport, pushing footer to bottom */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body > .layout { flex: 1 0 auto; }
body > .site-footer { flex: 0 0 auto; margin-top: auto; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ============== Header ============== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h); gap: 20px;
}
.brand { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }

/* Header search — aitmpl-style centered search with ⌘K hint */
.header-search {
  position: relative; flex: 1 1 auto; max-width: 540px;
  display: flex; align-items: center;
}
.header-search .search-icon {
  position: absolute; left: 14px; color: var(--text-faint);
  pointer-events: none;
}
.header-search input {
  width: 100%; height: 40px; padding: 0 56px 0 38px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font-size: 14px; font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.header-search input::placeholder { color: var(--text-faint); }
.header-search input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-kbd {
  position: absolute; right: 10px;
  padding: 2px 7px; border-radius: 4px;
  background: var(--surface-2); color: var(--text-faint);
  font-size: 11px; font-family: var(--font-sans); font-weight: 600;
  border: 1px solid var(--border);
  pointer-events: none; letter-spacing: 0.04em;
}
.brand-logo { height: 32px; width: auto; display: block; }
[data-theme="dark"] .brand-logo path,
[data-theme="dark"] .brand-logo line { stroke: var(--accent); }
.brand-divider { width: 1px; height: 22px; background: var(--border-strong); }
.brand-sub {
  font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); font-weight: 700;
}
.site-nav { display: flex; gap: 28px; }
.site-nav a {
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  position: relative; padding: 6px 0;
}
.site-nav a:hover { color: var(--accent); }
.site-nav a:hover::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; background: var(--dpx-green);
}
.header-tools { display: flex; align-items: center; gap: 12px; }

.theme-toggle, .lang-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  height: 38px; min-width: 38px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted);
  font-size: 14px; font-weight: 600; line-height: 1;
  transition: all 0.15s;
}
.theme-toggle { padding: 0; width: 38px; }
.theme-toggle:hover, .lang-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle .icon-light { display: inline; }
.theme-toggle .icon-dark  { display: none; }
[data-theme="dark"] .theme-toggle .icon-light { display: none; }
[data-theme="dark"] .theme-toggle .icon-dark  { display: inline; }
.lang-toggle .lang-current { letter-spacing: 0.06em; }

/* ============== Auth ============== */
.auth-area { position: relative; display: inline-flex; }
.btn-auth-login {
  height: 38px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--accent); background: transparent;
  color: var(--accent); font-weight: 600; font-size: 13px;
  cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.btn-auth-login:hover { background: var(--accent); color: var(--accent-on); }

.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 4px 10px 4px 4px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  cursor: pointer; user-select: none; font-family: inherit;
  transition: border-color 0.15s, background-color 0.15s;
}
.user-chip:hover { border-color: var(--accent); }
.user-avatar {
  width: 30px; height: 30px; border-radius: 999px;
  background: linear-gradient(135deg, var(--dpx-violet), var(--dpx-blue-green));
  color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.user-name {
  font-size: 13px; font-weight: 500; color: var(--text);
  max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-caret { font-size: 10px; color: var(--text-faint); margin-right: 2px; }

.user-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 240px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-card-hover); padding: 6px;
  z-index: 60;
}
.user-menu-meta {
  padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.user-menu-name { font-size: 14px; font-weight: 600; color: var(--text); }
.user-menu-email { font-size: 12px; color: var(--text-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu-item {
  width: 100%; text-align: left; padding: 9px 12px;
  background: none; border: none; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text); cursor: pointer; font-family: inherit;
}
.user-menu-item:hover { background: var(--surface-2); color: var(--accent); }

@media (max-width: 560px) {
  .user-name { display: none; }
  .user-caret { display: none; }
}

/* ============== Auth gate (login wall) ============== */
.auth-gate {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--bg);
  overflow: hidden;
}
.auth-gate-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(900px 480px at 70% 25%, rgba(96,38,158,0.20), transparent 60%),
    radial-gradient(720px 420px at 25% 80%, rgba(147,213,0,0.10), transparent 60%),
    var(--hero-bg-grad);
}
.auth-gate-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image: url('../assets/pattern.svg');
  background-size: 380px 380px; background-repeat: repeat;
  opacity: var(--pattern-opacity);
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.5), rgba(0,0,0,0.1));
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.5), rgba(0,0,0,0.1));
}
[data-theme="dark"] .auth-gate-bg::after { filter: invert(1) hue-rotate(180deg); }

.auth-gate-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 460px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 40px 28px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(22, 22, 32, 0.16);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
[data-theme="dark"] .auth-gate-card { box-shadow: 0 24px 64px rgba(0,0,0,0.6); }
.auth-gate-logo { height: 28px; opacity: 0.85; margin-bottom: 4px; }
[data-theme="dark"] .auth-gate-logo path,
[data-theme="dark"] .auth-gate-logo line { stroke: var(--accent); }

.auth-gate-title {
  margin: 0; font-size: clamp(34px, 5vw, 44px);
  font-weight: 800; letter-spacing: -0.02em;
  color: var(--text); line-height: 1.05;
}
.auth-gate-desc {
  margin: 0 0 6px; font-size: 14px; line-height: 1.55;
  color: var(--text-muted);
}
.auth-gate-actions { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.btn-lg { height: 52px; padding: 0 28px; font-size: 15px; }
.auth-gate-actions .btn { width: 100%; gap: 10px; }
.auth-gate-actions .btn[disabled] { opacity: 0.7; cursor: not-allowed; }

.auth-gate-btn-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 999px; animation: spin 0.8s linear infinite;
}
.btn:not([disabled]) .auth-gate-btn-spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-gate-error {
  margin: 0; font-size: 13px; line-height: 1.5;
  color: var(--dpx-orange); background: rgba(255,108,14,0.08);
  border: 1px solid rgba(255,108,14,0.25);
  padding: 10px 14px; border-radius: 8px; width: 100%;
  text-align: left;
}
.auth-gate-foot { margin: 6px 0 0; font-size: 11px; color: var(--text-faint); }

/* ============== Hero ============== */
.hero {
  position: relative; overflow: hidden;
  background: var(--hero-radial), var(--hero-bg-grad);
  border-bottom: 1px solid var(--border);
}
.hero-pattern {
  position: absolute; inset: 0;
  background-image: url('../assets/pattern.svg');
  background-size: 380px 380px;
  background-repeat: repeat;
  opacity: var(--pattern-opacity); pointer-events: none;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.6), rgba(0,0,0,0.15));
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.6), rgba(0,0,0,0.15));
}
[data-theme="dark"] .hero-pattern { filter: invert(1) hue-rotate(180deg); }
.hero-inner {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 18px;
  padding: 64px 24px 56px;
  max-width: 880px;
}
.hero-eyebrow {
  margin: 0; font-size: 12px; letter-spacing: 0.18em;
  text-transform: uppercase; font-weight: 700; color: var(--accent);
}
.hero-title {
  font-size: clamp(36px, 4.6vw, 56px);
  line-height: 1.1; letter-spacing: -0.02em;
  margin: 0; font-weight: 800; color: var(--text);
}
.accent-dot { color: var(--dpx-green); }
.hero-desc { font-size: 15px; color: var(--text-muted); margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 48px; padding: 0 22px; border-radius: 999px;
  font-size: 15px; font-weight: 600; line-height: 1;
  border: 1px solid transparent; transition: all 0.18s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent); color: var(--accent-on);
}
.btn-primary:hover { background: var(--accent-strong); transform: translateY(-1px); }
.btn-ghost {
  background: transparent; color: var(--accent); border-color: var(--accent);
}
.btn-ghost:hover { background: var(--accent); color: var(--accent-on); }
.btn-text {
  background: none; border: none; padding: 0;
  font-size: 13px; color: var(--accent); font-weight: 500;
}
.btn-text:hover { text-decoration: underline; }

/* ============== Layout grid (sidebar + main) ============== */
.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 36px;
  padding-top: 24px;
}
.layout-main { min-width: 0; }

.cat-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow-y: auto;
  padding: 6px 0 8px;
}
.cat-sidebar-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-faint);
  margin: 0 0 10px; padding: 0 10px;
}
.cat-sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.cat-sidebar-nav .cat-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px;
  background: transparent; border: 1px solid transparent;
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  font-family: inherit; cursor: pointer; text-align: left;
  transition: background-color 0.12s, color 0.12s, border-color 0.12s;
}
.cat-sidebar-nav .cat-link:hover {
  background: var(--surface-2); color: var(--text);
}
.cat-sidebar-nav .cat-link.is-active {
  background: var(--accent-soft); color: var(--accent);
  border-color: var(--accent-soft);
}

/* Services — small 🔥 indicator inline next to label (hot) */
.cat-sidebar-nav .cat-link .cat-hot {
  margin-left: 4px;
  font-size: 12px;
  line-height: 1;
  vertical-align: -1px;
}
.cat-sidebar-nav .cat-link .cat-icon {
  width: 18px; flex: 0 0 18px;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1; color: currentColor;
}
.cat-sidebar-nav .cat-link .cat-icon svg { display: block; }
.cat-sidebar-nav .cat-link .cat-label { flex: 1 1 auto; }
.cat-sidebar-nav .cat-link .cat-count {
  font-size: 11px; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-faint); font-weight: 600;
  min-width: 22px; text-align: center;
}
.cat-sidebar-nav .cat-link.is-active .cat-count {
  background: var(--accent); color: var(--accent-on);
}
.cat-sidebar-nav .cat-sep {
  height: 1px; background: var(--border); margin: 8px 10px;
}

/* Inline stat row — aitmpl-style */
.hero-stats {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 8px;
}
.stat {
  display: inline-flex; align-items: baseline; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 14px;
  box-shadow: none;
}
.stat-num { font-size: 14px; font-weight: 700; color: var(--accent); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat .stat-bar { display: none; }  /* simpler inline form */

/* ============== Status LED chips (lifecycle colour code) ============== */
.chips-led .chip {
  padding-left: 10px;  /* tighter left padding to host the LED dot */
}
.chips-led .chip .led {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--gray-400);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.05) inset;
  flex: 0 0 8px;
}
.chips-led .chip[data-id="prerelease"] .led { background: var(--dpx-orange); box-shadow: 0 0 6px rgba(255,108,14,0.45); }
.chips-led .chip[data-id="release"]    .led { background: var(--dpx-green);  box-shadow: 0 0 6px rgba(147,213,0,0.55); }
.chips-led .chip[data-id="deprecated"] .led { background: var(--dpx-dark-gray); }

/* Subtle ring around Release to mark "stable" — even when inactive */
.chips-led .chip[data-id="release"]:not(.is-active) {
  border-color: var(--dpx-green-dark);
}
/* Deprecated: dim label + strike-through */
.chips-led .chip[data-id="deprecated"]:not(.is-active) {
  color: var(--text-faint);
}
.chips-led .chip[data-id="deprecated"]:not(.is-active) .chip-text {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* Active state: keep the bright LED visible on violet bg */
.chips-led .chip.is-active .led {
  box-shadow: 0 0 0 2px rgba(255,255,255,0.4);
}

/* Category as tabs in filter row */
.tabs-row { align-items: center; }
.chips-tabs { gap: 4px; }
.chips-tabs .chip {
  height: 34px; border-radius: 8px; padding: 0 14px;
  border-color: transparent; background: transparent;
  font-weight: 500;
}
.chips-tabs .chip:hover { background: var(--surface-2); border-color: var(--border); }
.chips-tabs .chip.is-active {
  background: var(--accent-soft); border-color: var(--accent-soft);
  color: var(--accent);
}
.chips-tabs .chip.is-active .chip-count {
  background: var(--accent); color: var(--accent-on);
}

/* ============== Filters ============== */
.filters {
  background: var(--bg);
  padding: 12px 16px;
  margin: 0 0 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filter-row + .filter-row { margin-top: 10px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

.filter-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-hint { font-size: 12px; color: var(--text-faint); margin-left: 4px; font-style: italic; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 13px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  transition: all 0.15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-active {
  background: var(--accent); border-color: var(--accent); color: var(--accent-on);
}
.chip .chip-count {
  font-size: 11px; padding: 2px 6px; border-radius: 999px;
  background: rgba(0,0,0,0.06); color: inherit;
}
[data-theme="dark"] .chip .chip-count { background: rgba(255,255,255,0.08); }
.chip.is-active .chip-count { background: rgba(255,255,255,0.22); }
[data-theme="dark"] .chip.is-active .chip-count { background: rgba(0,0,0,0.25); }
.chip-icon { font-size: 12px; }

/* Sort selector */
.sort {
  display: inline-flex; align-items: center; gap: 8px;
  margin-left: auto;
}
.sort-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
}
.sort select {
  height: 32px; padding: 0 30px 0 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-family: inherit; font-size: 13px;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23898A8D' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.sort select:hover { border-color: var(--accent); }
.sort select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ============== Results ============== */
.results-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin: 24px 0 16px; font-size: 13px; color: var(--text-muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  padding-bottom: 80px;
}

/* ============== Card ============== */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  display: flex; flex-direction: column; gap: 14px;
  text-align: left;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  cursor: pointer;
  overflow: hidden;
}
.card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent); opacity: 0;
  transition: opacity 0.18s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--accent);
}
.card:hover::before { opacity: 1; }
.card.is-deprecated { background: var(--bg-soft); }
.card.is-deprecated .card-title,
.card.is-deprecated .card-tagline { color: var(--text-faint); }
.card.is-deprecated::before { background: var(--dpx-dark-gray); }

.card-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.card-cat {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent);
}
.card-cat .cat-icon { display: inline-flex; align-items: center; line-height: 1; }
.card-cat .cat-icon svg { display: block; }
.modal-cat svg, .compare-cat svg { vertical-align: -2px; margin-right: 2px; }
.empty-icon svg { display: block; }

.sample-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 3px;
  vertical-align: 1px;
}
.modal-cat .sample-pill { vertical-align: 2px; font-size: 11px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  padding: 4px 10px; border-radius: 999px;
  text-transform: uppercase;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge-release    { background: var(--dpx-green-soft);    color: var(--dpx-green-dark); }
.badge-prerelease { background: rgba(255,108,14,0.10);    color: var(--dpx-orange); }
.badge-deprecated { background: var(--surface-2);         color: var(--text-faint); text-decoration: line-through; text-decoration-thickness: 1px; }
[data-theme="dark"] .badge-release    { background: rgba(147,213,0,0.14); color: #B5E444; }
[data-theme="dark"] .badge-prerelease { background: rgba(255,108,14,0.18); color: #FF9D5F; }

.card-title { font-size: 19px; font-weight: 700; margin: 0; color: var(--text); letter-spacing: -0.01em; }
.card-tagline { font-size: 14px; color: var(--text-muted); margin: -6px 0 0; line-height: 1.45; }

.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11px; padding: 3px 9px; border-radius: 4px;
  background: var(--surface-2); color: var(--text-muted); font-weight: 500;
}

.card-foot {
  margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--text-muted);
}
.card-owner { display: inline-flex; align-items: center; gap: 6px; }
.owner-dot {
  width: 22px; height: 22px; border-radius: 999px;
  background: linear-gradient(135deg, var(--dpx-violet), var(--dpx-blue-green));
  color: #fff; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.card-arrow {
  color: var(--accent); font-weight: 700; font-size: 13px;
  transition: transform 0.18s;
}
.card:hover .card-arrow { transform: translateX(3px); }

/* ============== Compare ============== */
.btn-sm { height: 36px; padding: 0 16px; font-size: 13px; }

.card-foot-actions { display: inline-flex; align-items: center; gap: 6px; }
.card-icon-btn {
  width: 26px; height: 26px; border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface); color: var(--text-faint);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; line-height: 1;
  cursor: pointer; transition: all 0.15s; padding: 0;
}
.card-icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.card-icon-btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* Compare specific state */
.card.is-comparing .card-compare {
  background: var(--accent); border-color: var(--accent); color: var(--accent-on);
}
/* Favorite specific state — orange accent (DPX secondary) */
.card-fav { font-size: 14px; }
.card-fav:hover { border-color: var(--dpx-orange); color: var(--dpx-orange); }
.card.is-fav .card-fav {
  background: var(--dpx-orange); border-color: var(--dpx-orange); color: #fff;
}

.compare-bar {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 90; max-width: calc(100vw - 32px);
}
.compare-bar-inner {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 12px 8px 18px;
  box-shadow: 0 12px 36px rgba(22,22,32,0.18);
}
[data-theme="dark"] .compare-bar-inner { box-shadow: 0 12px 36px rgba(0,0,0,0.6); }
.compare-bar-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
}
.compare-list {
  display: inline-flex; gap: 6px; list-style: none; margin: 0; padding: 0;
}
.compare-list li {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); color: var(--text);
  padding: 4px 8px 4px 12px; border-radius: 999px; font-size: 12px;
  max-width: 200px;
}
.compare-list li .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compare-list li button {
  border: none; background: transparent; color: var(--text-faint);
  font-size: 14px; line-height: 1; padding: 2px 4px; border-radius: 999px;
}
.compare-list li button:hover { color: var(--accent); }
.compare-actions { display: inline-flex; align-items: center; gap: 8px; }

.modal-panel-wide { max-width: 1080px !important; }
.compare-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 18px;
}
.compare-col {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; background: var(--surface); position: relative;
  display: flex; flex-direction: column; gap: 10px;
}
.compare-col h3 { font-size: 17px; margin: 0; line-height: 1.3; color: var(--text); }
.compare-col .compare-cat {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent);
}
.compare-col .row { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.compare-col .row .k {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-faint);
}
.compare-col .row .v { color: var(--text); }
.compare-col .actions { margin-top: auto; padding-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.compare-col .actions a, .compare-col .actions span {
  font-size: 12px; padding: 6px 10px; border-radius: 6px;
  background: var(--surface-2); color: var(--text); font-weight: 600;
}
.compare-col .actions a:hover { background: var(--accent); color: var(--accent-on); }
.compare-col-remove {
  position: absolute; top: 10px; right: 10px;
  width: 24px; height: 24px; border-radius: 999px;
  border: none; background: var(--surface-2); color: var(--text-faint);
  font-size: 14px; line-height: 1; cursor: pointer;
}
.compare-col-remove:hover { color: var(--accent); }

/* ============== Admin bar + edit form ============== */
.admin-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; margin: 0 0 14px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius);
  font-size: 13px;
}
.admin-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px;
  background: var(--accent); color: var(--accent-on);
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
}
.admin-badge::before { content: '★'; font-size: 10px; }
.admin-edit-count { color: var(--text-muted); font-size: 12px; }
.admin-actions { margin-left: auto; display: inline-flex; gap: 14px; }
.admin-actions .btn-text { font-weight: 600; }

.edited-pill {
  display: inline-block; margin-left: 6px; padding: 2px 7px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  background: var(--dpx-orange); color: #fff;
  border-radius: 3px; vertical-align: 1px;
}

/* Edit form */
.modal-edit .modal-panel { max-width: 680px; }
.edit-form { display: flex; flex-direction: column; gap: 14px; }
.edit-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.edit-field.is-readonly input { background: var(--surface-2); }
.edit-field .k {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-muted);
}
.edit-field input,
.edit-field select,
.edit-field textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.edit-field textarea { font-family: inherit; resize: vertical; min-height: 90px; }
.edit-field input:focus,
.edit-field select:focus,
.edit-field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.edit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.edit-check {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text); cursor: pointer;
}
.edit-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.edit-actions {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-top: 6px;
}
.edit-actions .danger {
  color: var(--dpx-orange); border-color: var(--dpx-orange);
  margin-left: auto;
}
.edit-actions .danger:hover { background: var(--dpx-orange); color: #fff; }

@media (max-width: 560px) {
  .edit-row { grid-template-columns: 1fr; }
  .admin-actions { margin-left: 0; width: 100%; }
}

/* ============== Empty state ============== */
.empty {
  text-align: center; padding: 56px 24px;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  margin-bottom: 80px;
  background: var(--bg-soft);
}
.empty-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 24px; margin-bottom: 16px;
}
.empty-title { font-size: 18px; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.empty-desc { font-size: 14px; color: var(--text-muted); margin: 0 0 22px; }
.empty-actions { display: inline-flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ============== Modal ============== */
[hidden] { display: none !important; }
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(22,22,32,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,0.7); }
.modal-panel {
  position: relative;
  width: 100%; max-width: 640px; max-height: 86vh;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  overflow: auto;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-close {
  position: absolute; top: 16px; right: 18px;
  width: 36px; height: 36px; border-radius: 999px;
  border: none; background: var(--surface-2);
  font-size: 22px; line-height: 1; color: var(--text-muted);
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 36px 36px 32px; }
.modal-cat {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent);
}
.modal-title { font-size: 30px; font-weight: 800; margin: 8px 0 6px; letter-spacing: -0.02em; color: var(--text); }
.modal-tagline { font-size: 16px; color: var(--text-muted); margin: 0 0 20px; }
.modal-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  background: var(--bg-soft); border-radius: var(--radius);
  padding: 16px 18px; margin: 16px 0 20px;
}
.modal-meta-item .k {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
  display: block; margin-bottom: 4px;
}
.modal-meta-item .v { font-size: 14px; font-weight: 600; color: var(--text); }
.modal-desc { font-size: 15px; line-height: 1.65; color: var(--text-muted); margin-bottom: 24px; }
.modal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.modal-actions .btn-link {
  background: none; border: none; padding: 4px 8px;
  font-size: 13px; color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 6px;
}
.modal-actions .btn-link:hover { color: var(--accent); background: var(--accent-soft); }

/* Toast */
.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%) translateY(8px);
  z-index: 110;
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  white-space: nowrap;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============== Footer ============== */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 40px 0 32px;
}
.footer-inner {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center;
}
.footer-logo { height: 28px; opacity: 0.9; }
[data-theme="dark"] .footer-logo path,
[data-theme="dark"] .footer-logo line { stroke: var(--accent); }
.footer-copy { font-size: 12px; color: var(--text-faint); margin: 0; }

/* ============== Responsive ============== */
@media (max-width: 900px) {
  .hero-inner { padding: 48px 24px 40px; }
  .site-nav { display: none; }
  .sort { margin-left: 0; }
  .header-search { max-width: none; }

  /* Sidebar → horizontal scroll bar at top of main */
  .layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .cat-sidebar {
    position: static; max-height: none; overflow-y: visible;
    margin: 0 -24px; padding: 8px 24px;
    border-bottom: 1px solid var(--border);
  }
  .cat-sidebar-label { display: none; }
  .cat-sidebar-nav {
    flex-direction: row; gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
  }
  .cat-sidebar-nav::-webkit-scrollbar { display: none; }
  .cat-sidebar-nav .cat-link { flex: 0 0 auto; padding: 7px 12px; }
  .cat-sidebar-nav .cat-link .cat-label { white-space: nowrap; }
  .cat-sidebar-nav .cat-sep {
    height: auto; width: 1px; margin: 4px 4px; flex: 0 0 auto;
  }
}
@media (max-width: 720px) {
  .search-kbd { display: none; }
  .header-search input { font-size: 13px; padding-right: 14px; }
}
@media (max-width: 560px) {
  :root { --header-h: 60px; }
  .header-inner { height: var(--header-h); }
  .brand-sub { display: none; }
  .brand-divider { display: none; }
  .brand-logo { height: 26px; }
  .modal-body { padding: 28px 22px 24px; }
  .modal-meta { grid-template-columns: 1fr; }
  .filter-row { gap: 12px; }
  .filter-group { width: 100%; }
  .sort { width: 100%; justify-content: space-between; }
  .hero-stats { gap: 6px; }
}
