:root {
  --bg: #08090b;
  --text: #e7eaee;
  --muted: #878e99;
  --faint: #5d636d;
  --accent: #b28dfa;
  --accent-deep: #9169e8;
  --accent-ink: #170f2b;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --glass: rgba(255, 255, 255, .045);
  --glass-hi: rgba(255, 255, 255, .08);
  --ok: #8fd6a8;
  --bad: #f2807f;
  --radius: 16px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
img, svg { display: block; }
button { font-family: inherit; }
::selection { background: rgba(178, 141, 250, .3); }
[hidden] { display: none !important; }

/* starfield + glow */
#stars { position: fixed; inset: 0; z-index: -2; pointer-events: none; }
.glow {
  position: fixed; z-index: -1; pointer-events: none;
  width: 900px; height: 600px; left: 50%; top: -320px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(178, 141, 250, .11), transparent);
}

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------- topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(8, 9, 11, .72); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; text-decoration: none; letter-spacing: -.01em; font-size: 15px; }
.brand img { border-radius: 6px; }
.brand .sub { color: var(--muted); font-weight: 500; }
.tabs-nav { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line); }
.tabs-nav button {
  height: 34px; padding: 0 16px; border-radius: 9px; border: 0; background: transparent;
  color: var(--muted); font: 600 13.5px Inter, sans-serif; cursor: pointer; transition: background .15s, color .15s;
}
.tabs-nav button.active { background: var(--accent); color: var(--accent-ink); }
.tabs-nav button:not(.active):hover { color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.icon-link {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border-radius: 11px; border: 1px solid var(--line); background: var(--glass); color: var(--muted); transition: color .15s, border-color .15s, background .15s;
}
.icon-link:hover { color: var(--text); border-color: var(--line-strong); background: var(--glass-hi); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 12px;
  font: 600 14px Inter, sans-serif; text-decoration: none; white-space: nowrap;
  border: 1px solid var(--line); background: var(--glass); color: var(--text);
  cursor: pointer; transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--glass-hi); border-color: var(--line-strong); }
.btn:active { transform: scale(.97); }
.btn-accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-accent:hover { background: #c3a4fb; border-color: transparent; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- page head ---------- */
.eyebrow { font: 400 12px var(--mono); color: var(--muted); margin: 0 0 10px; letter-spacing: .02em; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 40px 0 24px; }
.pagehead h1 { margin: 0 0 8px; font-size: clamp(26px, 3.4vw, 34px); letter-spacing: -.02em; font-weight: 600; }
.pagehead h1 em { font-style: normal; color: var(--accent); }
.pagehead p { margin: 0; color: var(--muted); font-size: 14.5px; max-width: 48ch; }
.chips { display: flex; gap: 10px; }
.chip { display: flex; align-items: baseline; gap: 6px; border: 1px solid var(--line); background: var(--glass); border-radius: 12px; padding: 10px 16px; }
.chip b { font-size: 17px; font-weight: 600; }
.chip span { color: var(--muted); font-size: 12.5px; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; padding: 4px 0 18px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 200px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input {
  width: 100%; height: 44px; padding: 0 14px 0 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--glass); color: var(--text);
  font: 400 14.5px Inter, sans-serif; transition: border-color .15s, background .15s;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; border-color: var(--line-strong); background: var(--glass-hi); }
.sort { display: flex; gap: 4px; padding: 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); flex: none; }
.sort button {
  height: 36px; padding: 0 14px; border-radius: 9px; border: 0;
  background: transparent; color: var(--muted); font: 600 12.5px Inter, sans-serif; cursor: pointer; white-space: nowrap;
}
.sort button[aria-pressed="true"] { background: var(--glass-hi); color: var(--text); }
.count { font: 500 12px var(--mono); color: var(--faint); white-space: nowrap; }

/* ---------- pack cards ---------- */
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; padding-bottom: 56px; }
.pack { border: 1px solid var(--line); background: var(--glass); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: border-color .2s, background .2s, transform .2s; cursor: pointer; }
.pack:hover { border-color: var(--line-strong); background: var(--glass-hi); transform: translateY(-2px); }
.pack .thumb { width: 100%; aspect-ratio: 16/9; background: var(--glass-hi); display: grid; place-items: center; color: var(--faint); overflow: hidden; }
.pack .thumb img { width: 100%; height: 100%; object-fit: cover; }
.pack .body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pack h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pack .desc { color: var(--muted); font-size: 13px; margin: 0; flex: 1; }
.pack .credit { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pack .credit a { color: var(--accent); text-decoration: none; }
.pack .credit a:hover { text-decoration: underline; }
.pack .meta { display: flex; justify-content: space-between; align-items: center; font: 500 11.5px var(--mono); color: var(--faint); }

.placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 64px 24px; gap: 14px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); background: var(--glass); grid-column: 1 / -1; }
.placeholder .ic { width: 52px; height: 52px; border-radius: 14px; background: rgba(178, 141, 250, .12); border: 1px solid rgba(178, 141, 250, .3); color: var(--accent); display: grid; place-items: center; }
.placeholder h3 { color: var(--text); font-size: 17px; margin: 0; }
.placeholder p { margin: 0; max-width: 36ch; font-size: 14px; }

/* ---------- detail view ---------- */
.detail-shell { max-width: 760px; margin: 0 auto; padding: 24px 0 64px; }
.detail-banner { width: 100%; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: var(--glass); border: 1px solid var(--line); display: grid; place-items: center; color: var(--faint); margin-bottom: 20px; }
.detail-banner img { width: 100%; height: 100%; object-fit: cover; }
.detail-content h2 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 10px; }
.detail-credit { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); border: 1px solid var(--line); background: var(--glass); border-radius: 10px; padding: 7px 12px; margin-bottom: 18px; }
.detail-credit a { color: var(--accent); text-decoration: none; }
.detail-credit a:hover { text-decoration: underline; }
.detail-desc { color: #c7cbd2; max-width: 64ch; margin: 0 0 24px; font-size: 15px; }
.detail-preview { margin-bottom: 24px; }
.detail-preview h4 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 10px; font-weight: 600; }
.detail-preview .embed { width: 100%; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--glass); }
.detail-preview .embed iframe, .detail-preview .embed video, .detail-preview .embed img { width: 100%; height: 100%; object-fit: cover; border: 0; }
.detail-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.detail-gallery img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; background: var(--glass); transition: border-color .15s; }
.detail-gallery img:hover { border-color: var(--line-strong); }
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .82); display: flex; align-items: center; justify-content: center; padding: 32px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }
.detail-stats { display: flex; gap: 28px; margin-bottom: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.detail-stats div { display: flex; flex-direction: column; gap: 2px; }
.detail-stats b { font-size: 17px; }
.detail-stats span { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- upload view ---------- */
.upload-shell { max-width: 620px; margin: 0 auto; padding: 40px 0 64px; }
.upload-shell h2 { font-size: 24px; letter-spacing: -.02em; margin: 0 0 8px; }
.upload-shell > p { color: var(--muted); margin: 0 0 24px; }

/* stepper */
.steps-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 22px; }
.step-dot { display: flex; align-items: center; gap: 8px; color: var(--faint); font: 600 13px Inter, sans-serif; white-space: nowrap; }
.step-dot span { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); display: grid; place-items: center; font: 700 12px Inter, sans-serif; color: var(--faint); transition: background .15s, border-color .15s, color .15s; }
.step-dot.active { color: var(--text); }
.step-dot.active span { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.step-dot.done span { background: rgba(178, 141, 250, .18); border-color: rgba(178, 141, 250, .4); color: var(--accent); }
.step-line { flex: 1; height: 1px; background: var(--line); }

.upload-form { display: grid; gap: 16px; border: 1px solid var(--line); background: var(--glass); border-radius: var(--radius); padding: 24px; }
.step-panel { display: grid; gap: 16px; }
.step-actions { display: flex; gap: 10px; justify-content: flex-end; }
.step-actions .btn:first-child { margin-right: auto; }

/* dropzone */
.dropzone {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px;
  padding: 26px 16px; border: 1px dashed var(--line); border-radius: 12px; cursor: pointer;
  background: rgba(0, 0, 0, .16); color: var(--faint); transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: rgba(178, 141, 250, .06); color: var(--accent); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone .dz-text { font-size: 13px; color: var(--muted); }
.dropzone .dz-name { font-size: 12.5px; color: var(--text); font-weight: 600; word-break: break-all; }
.dropzone .dz-name:empty { display: none; }
#previewImageLinks { margin-top: 10px; min-height: 60px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.field input[type="text"], .field textarea, .field input[type="url"] {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(0, 0, 0, .18); color: var(--text);
  font: 400 14px Inter, sans-serif; transition: border-color .15s, background .15s;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--line-strong); background: rgba(0, 0, 0, .3); }
.field textarea { resize: vertical; min-height: 72px; font-family: Inter, sans-serif; }
.field .hint { color: var(--faint); font-size: 12px; }
.filefield { display: flex; align-items: center; gap: 10px; border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; }
.filefield input[type="file"] { flex: 1; color: var(--muted); font-size: 13px; }
.toggle-row { display: flex; align-items: center; gap: 10px; }
.toggle-row label { font-size: 14px; color: var(--text); font-weight: 500; }
.credit-fields { display: grid; gap: 12px; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, .16); }
.form-msg { font-size: 13.5px; padding: 10px 14px; border-radius: 10px; display: none; }
.form-msg.error { display: block; color: var(--bad); background: rgba(242, 128, 127, .1); border: 1px solid rgba(242, 128, 127, .25); }
.form-msg.ok { display: block; color: var(--ok); background: rgba(143, 214, 168, .1); border: 1px solid rgba(143, 214, 168, .25); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); z-index: 100;
  background: #1a1c20; border: 1px solid var(--line-strong); color: var(--text);
  padding: 10px 16px; border-radius: 12px; font-size: 14px;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

footer { border-top: 1px solid var(--line); margin-top: 32px; }
.foot { display: flex; align-items: center; gap: 20px; height: 72px; color: var(--muted); font-size: 13px; }
.foot nav { display: flex; gap: 18px; margin-left: auto; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--text); }

/* ---------- mobile ---------- */
.back-row { display: none; align-items: center; gap: 8px; margin-bottom: 16px; background: transparent; border: 0; color: var(--muted); font: 600 13px Inter, sans-serif; cursor: pointer; padding: 0; }
@media (max-width: 860px) {
  .back-row { display: flex; }
  .packs { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .topbar-in { height: 56px; gap: 10px; }
  .brand .sub { display: none; }
  .tabs-nav button { padding: 0 11px; font-size: 12.5px; }
  .pagehead { padding: 28px 0 18px; }
  .chips { width: 100%; }
  .chip { flex: 1; justify-content: center; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .count { text-align: right; }
}
