:root {
  --bg: #0b0b10;
  --bg-2: #11111a;
  --bg-3: #181826;
  --fg: #f4f4f5;
  --fg-dim: #a1a1aa;
  --fg-mute: #71717a;
  --accent: #a78bfa;
  --accent-2: #6d28d9;
  --success: #34d399;
  --danger: #f87171;
  --warn: #fbbf24;
  --border: #1f1f2e;
  --border-2: #2c2c40;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

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

button {
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--border-2);
  background: var(--bg-3);
  color: var(--fg);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
button:hover { background: var(--border); }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent-2); border-color: var(--accent-2); color: white; }
button.primary:hover { background: var(--accent); border-color: var(--accent); }
button.ghost { background: transparent; }
button.danger { background: transparent; border-color: rgba(248, 113, 113, 0.4); color: var(--danger); }
button.danger:hover { background: rgba(248, 113, 113, 0.1); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  background: var(--bg-2);
  color: var(--fg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent-2);
  outline-offset: 1px;
  border-color: var(--accent);
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.muted { color: var(--fg-dim); }
.dim   { color: var(--fg-mute); }
.row   { display: flex; gap: 12px; align-items: center; }
.grow  { flex: 1; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 11, 16, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.brand-dot {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #ec4899);
}
.nav { display: flex; gap: 18px; align-items: center; }
.nav a { font-size: 14px; color: var(--fg-dim); }
.nav a:hover, .nav a.active { color: var(--fg); }
.search-box {
  position: relative;
  flex: 1;
  max-width: 460px;
}
.search-box input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 14px 9px 38px;
}
.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  max-height: 240px;
  overflow: auto;
  z-index: 60;
  box-shadow: var(--shadow);
}
.search-suggestions div {
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}
.search-suggestions div:hover { background: var(--bg-2); }
.search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--fg-mute);
}

.user-menu { display: flex; gap: 10px; align-items: center; }
.user-menu .pill {
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--fg-dim);
}

/* hero */
.hero {
  padding: 64px 0 32px;
  text-align: center;
  background: radial-gradient(circle at 50% 0%, rgba(124, 58, 237, 0.25), transparent 60%);
}
.hero h1 {
  font-size: clamp(32px, 5vw, 56px);
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  line-height: 1.05;
  background: linear-gradient(120deg, #fff, #c4b5fd 60%, #f0abfc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  font-size: 18px;
  color: var(--fg-dim);
  margin: 0 auto 24px;
  max-width: 640px;
}
.hero .row { justify-content: center; flex-wrap: wrap; }

/* sections */
section { padding: 40px 0; }
section h2 { font-size: 22px; margin: 0 0 18px; letter-spacing: -0.01em; }
section .section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }

/* category strip */
.cat-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin: 0 -6px;
}
.cat-strip::-webkit-scrollbar { height: 6px; }
.cat-strip::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }
.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  font-size: 13px;
  color: var(--fg-dim);
  white-space: nowrap;
  cursor: pointer;
}
.cat-pill:hover, .cat-pill.active { background: var(--accent-2); border-color: var(--accent-2); color: white; }

/* grid */
.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.wallpaper-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--border);
  aspect-ratio: 16 / 10;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.wallpaper-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.wallpaper-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.wallpaper-card .card-meta {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  display: flex; justify-content: space-between; align-items: end;
  gap: 8px;
  font-size: 12px;
  color: white;
  opacity: 0;
  transition: opacity 0.15s;
}
.wallpaper-card:hover .card-meta { opacity: 1; }
.wallpaper-card .fav-btn {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 999px;
  display: grid; place-items: center;
  font-size: 14px;
  color: white;
  cursor: pointer;
}
.wallpaper-card .fav-btn.active { background: var(--accent-2); }

/* detail */
.detail {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
}
@media (max-width: 900px) {
  .detail { grid-template-columns: 1fr; }
}
.detail .preview {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  min-height: 400px;
}
.detail .preview img { max-height: 80vh; width: 100%; object-fit: contain; }
.detail .meta { display: flex; flex-direction: column; gap: 16px; }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-list .tag {
  font-size: 12px;
  padding: 4px 10px;
  background: var(--bg-3);
  border-radius: 999px;
  color: var(--fg-dim);
}
.kv { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.kv:last-child { border: none; }
.kv .k { color: var(--fg-dim); font-size: 13px; }
.kv .v { font-weight: 600; }

/* buttons / toolbar */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* forms */
.form-grid { display: grid; gap: 14px; max-width: 520px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--fg-dim); }
.helper { font-size: 12px; color: var(--fg-mute); }

/* tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--fg-dim);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-2);
}
tbody tr:hover { background: var(--bg-2); }

/* badge */
.badge {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  color: var(--fg-dim);
}
.badge.success { color: #064e3b; background: rgba(52, 211, 153, 0.18); border-color: rgba(52, 211, 153, 0.4); }
.badge.warn { color: #78350f; background: rgba(251, 191, 36, 0.18); border-color: rgba(251, 191, 36, 0.4); }
.badge.danger { color: #7f1d1d; background: rgba(248, 113, 113, 0.18); border-color: rgba(248, 113, 113, 0.4); }
.badge.muted { color: var(--fg-mute); }

/* footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding: 32px 0;
  color: var(--fg-mute);
  font-size: 13px;
}
.site-footer .container { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; }

/* toasts */
.toast-stack {
  position: fixed;
  bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200;
}
.toast {
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow);
  max-width: 320px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

/* responsive nav */
.menu-toggle { display: none; }
@media (max-width: 800px) {
  .site-header .container { gap: 8px; }
  .nav { display: none; }
  .nav.open {
    display: flex;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    flex-direction: column;
    align-items: flex-start;
  }
  .menu-toggle { display: inline-block; }
  .search-box { max-width: none; }
}

/* auth form */
.auth-card {
  max-width: 420px;
  margin: 64px auto;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.auth-card h1 { margin: 0 0 6px; font-size: 24px; }
.auth-card p { margin: 0 0 18px; color: var(--fg-dim); font-size: 14px; }
.auth-card .demo {
  background: var(--bg-3);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--fg-dim);
  margin-top: 12px;
}
