:root {
  --bg: #0b0d12;
  --bg-2: #10131a;
  --surface: #151923;
  --surface-2: #1b2030;
  --border: #262c3b;
  --text: #e7eaf1;
  --muted: #8b93a7;
  --accent: #8b6cff;
  --accent-2: #b09bff;
  --approve: #37d69b;
  --danger: #ff5d7d;
  --pending: #ffb648;
  --radius: 14px;
  --head: 'Chakra Petch', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(139, 108, 255, .14), transparent 60%),
    radial-gradient(900px 400px at -10% 10%, rgba(55, 214, 155, .06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.55 var(--body);
  min-height: 100vh;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--head); letter-spacing: .01em; line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h2 { font-size: 1.25rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--bg-2); padding: .15em .4em; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 28px; padding-bottom: 64px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(11, 13, 18, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 20px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 1.15rem var(--head); color: var(--text); white-space: nowrap; text-transform: uppercase; letter-spacing: .06em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 14px; height: 14px; background: linear-gradient(135deg, var(--accent), var(--approve)); transform: rotate(45deg); border-radius: 3px; box-shadow: 0 0 14px rgba(139, 108, 255, .6); }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a, .nav .linkish {
  color: var(--muted); padding: 8px 12px; border-radius: 10px; white-space: nowrap; font-weight: 500; font-size: .92rem;
  display: inline-flex; align-items: center; gap: 6px;
}
.nav a:hover, .nav .linkish:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.nav-logout { margin: 0; }
.linkish { background: none; border: 0; font: inherit; cursor: pointer; }
.badge { background: var(--pending); color: #1a1200; font-size: .72rem; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; }

@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; gap: 0; padding-top: 10px; }
  .nav { width: 100%; margin: 0 -8px; padding: 6px 0 8px; }
  .nav a, .nav .linkish { padding: 7px 9px; font-size: .88rem; }
}

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: 600 .92rem var(--body); cursor: pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: #36405a; background: #20263a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #6a4fe6); border-color: transparent; box-shadow: 0 6px 20px -8px rgba(139, 108, 255, .8); }
.btn-primary:hover { background: linear-gradient(135deg, #9a7fff, var(--accent)); border-color: transparent; }
.btn-approve { background: rgba(55, 214, 155, .14); border-color: rgba(55, 214, 155, .45); color: var(--approve); }
.btn-approve:hover { background: rgba(55, 214, 155, .24); border-color: var(--approve); }
.btn-danger { background: rgba(255, 93, 125, .1); border-color: rgba(255, 93, 125, .4); color: var(--danger); }
.btn-danger:hover { background: rgba(255, 93, 125, .2); border-color: var(--danger); }
.btn-small { padding: 6px 10px; font-size: .82rem; border-radius: 8px; }

input, textarea {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-2); color: var(--text); font: 400 .95rem var(--body);
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 108, 255, .22); }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: .9rem; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row input { flex: 1; min-width: 180px; width: auto; }
form { margin: 0; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; border: 1px solid; font-weight: 500; }
.flash-success { background: rgba(55, 214, 155, .1); border-color: rgba(55, 214, 155, .35); color: #8ff0c8; }
.flash-error { background: rgba(255, 93, 125, .1); border-color: rgba(255, 93, 125, .35); color: #ffabbc; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head h1 { margin: 0; }

/* ---------- auth ---------- */
.auth { max-width: 440px; margin: 6vh auto 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; }
.auth h2 { margin-top: 28px; }
@media (max-width: 480px) { .auth { padding: 22px; margin-top: 2vh; } }

/* ---------- chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 18px; scrollbar-width: thin; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .85rem; white-space: nowrap; }
.chip span { opacity: .6; margin-left: 2px; }
.chip:hover { color: var(--text); text-decoration: none; border-color: #36405a; }
.chip-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-on span { opacity: .8; }

/* ---------- gallery grid ---------- */
.grid { columns: 4 260px; column-gap: 16px; }
.card {
  display: block; break-inside: avoid; margin-bottom: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.card:hover { text-decoration: none; transform: translateY(-3px); border-color: #3a3363; box-shadow: 0 14px 30px -14px rgba(139, 108, 255, .55); }
.card-media { position: relative; background: #07080b; }
.card-media img, .card-media video { display: block; width: 100%; height: auto; }
.card-media video { aspect-ratio: 16 / 9; object-fit: cover; }
.play-chip { position: absolute; top: 10px; right: 10px; background: rgba(0, 0, 0, .65); color: #fff; font-size: .7rem; padding: 4px 8px; border-radius: 6px; pointer-events: none; }
.card-body { padding: 12px 14px 14px; }
.card-title { font: 600 1rem var(--head); margin-bottom: 4px; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .82rem; }
.tag { background: rgba(139, 108, 255, .14); color: var(--accent-2); padding: 2px 8px; border-radius: 6px; font-weight: 600; font-size: .78rem; }

.pager { display: flex; justify-content: space-between; margin-top: 20px; }
.empty { text-align: center; padding: 64px 16px; border: 1px dashed var(--border); border-radius: var(--radius); background: rgba(21, 25, 35, .5); }
.empty .btn { margin-top: 10px; }

/* ---------- single post ---------- */
.post { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.post-media { background: #07080b; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.post-media img, .post-media video { display: block; width: 100%; max-height: 80vh; object-fit: contain; }
.post-info h1 { margin-top: 6px; overflow-wrap: anywhere; }
.caption { white-space: pre-wrap; overflow-wrap: anywhere; margin: 16px 0; }
.post-info .row { margin-top: 20px; }
@media (max-width: 900px) { .post { grid-template-columns: 1fr; gap: 18px; } }
.gone { display: grid; place-items: center; min-height: 120px; color: var(--muted); font-size: .85rem; }

/* ---------- pills ---------- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; margin-bottom: 6px; }
.pill-pending { background: rgba(255, 182, 72, .14); color: var(--pending); }
.pill-approved { background: rgba(55, 214, 155, .14); color: var(--approve); }
.pill-denied { background: rgba(255, 93, 125, .14); color: var(--danger); }

/* ---------- my uploads ---------- */
.list { display: flex; flex-direction: column; gap: 12px; }
.list-item { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.list-thumb { display: block; position: relative; border-radius: 10px; overflow: hidden; background: #07080b; aspect-ratio: 4 / 3; }
.list-thumb img, .list-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.list-thumb .gone { min-height: 0; height: 100%; }
.deny-reason { margin: 6px 0 0; color: #ffabbc; font-size: .88rem; }
@media (max-width: 560px) {
  .list-item { grid-template-columns: 88px minmax(0, 1fr); }
  .list-item form { grid-column: 1 / -1; }
  .list-item form .btn { width: 100%; }
}

/* ---------- review ---------- */
.review { display: flex; flex-direction: column; gap: 18px; }
.review-item { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--pending); border-radius: var(--radius); padding: 16px; }
.review-media { background: #07080b; border-radius: 10px; overflow: hidden; }
.review-media img, .review-media video { display: block; width: 100%; max-height: 60vh; object-fit: contain; }
.review-body { display: flex; flex-direction: column; gap: 6px; }
.review-actions { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.review-actions .btn-approve { width: 100%; padding: 12px; }
.deny-form { display: flex; gap: 8px; }
.deny-form input { flex: 1; min-width: 0; }
@media (max-width: 820px) { .review-item { grid-template-columns: 1fr; } }

/* ---------- upload ---------- */
.upload { max-width: 640px; }
.drop {
  position: relative; display: block; border: 2px dashed #34405c; border-radius: var(--radius);
  background: rgba(21, 25, 35, .6); cursor: pointer; transition: border-color .15s, background .15s; overflow: hidden;
}
.drop:hover, .drop.drag { border-color: var(--accent); background: rgba(139, 108, 255, .08); }
.drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 44px 16px; font-weight: 400; }
.drop-inner strong { font: 600 1.1rem var(--head); }
.drop-preview { padding: 12px; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.drop-preview img, .drop-preview video { max-width: 100%; max-height: 320px; border-radius: 10px; display: block; }
.drop-preview .muted { font-size: .85rem; font-weight: 400; }
.progress { position: relative; height: 32px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.progress-bar { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--accent), var(--approve)); transition: width .2s ease; }
.progress span { position: relative; display: grid; place-items: center; height: 100%; font-size: .85rem; font-weight: 600; }

/* ---------- admin ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.panel .row { margin-top: 12px; }
.invite { display: flex; gap: 10px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.invite code { flex: 1; min-width: 0; overflow-wrap: anywhere; padding: 10px 12px; font-size: .88rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
td.actions { display: flex; gap: 6px; justify-content: flex-end; }
