/* SMC v0.2.0 — three themes, one layout (design §3.8). Phase 2 adds the
   lightbox, search, tag panel, infinite scroll, and the mobile bottom bar. */
:root, [data-theme="midnight"] {
  --bg: #0a0a0c; --panel: #151518; --panel2: #1d1d21; --text: #f4f4f5;
  --muted: #a1a1aa; --accent: #e03131; --accent-text: #fff; --line: #26262b;
  --pill: #e03131;
}
[data-theme="clean"] {
  --bg: #f4f4f2; --panel: #ffffff; --panel2: #ececea; --text: #16161a;
  --muted: #5c5c66; --accent: #b91c1c; --accent-text: #fff; --line: #dddcd8;
  --pill: #b91c1c;
}
[data-theme="blue"] {
  --bg: #04070f; --panel: #0a1120; --panel2: #101a30; --text: #eaf2ff;
  --muted: #8fa5c8; --accent: #3b82f6; --accent-text: #fff; --line: #1c2a47;
  --pill: #3b82f6;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
/* pin the footer to the viewport bottom on short pages (public pages only) */
body:not(.admin) { display: flex; flex-direction: column; min-height: 100vh; }
body:not(.admin) main { flex: 1 0 auto; }
a { color: inherit; }
.wordmark { font-weight: 900; letter-spacing: .06em; text-decoration: none; font-size: 1.05rem; }
.wordmark span { color: var(--accent); }
.wordmark.big { font-size: 1.8rem; }

/* header */
.site-header { position: sticky; top: 0; z-index: 20; display: flex; gap: 1rem; align-items: center;
  padding: .6rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.main-nav { display: flex; gap: .25rem; }
.main-nav a { padding: .4rem .8rem; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 600; }
.main-nav a.active { background: var(--accent); color: var(--accent-text); }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.theme-switch { display: flex; gap: .25rem; }
.theme-switch a { padding: .3rem .6rem; border: 1px solid var(--line); border-radius: 999px;
  text-decoration: none; font-size: .8rem; color: var(--muted); }
.theme-switch a.active { border-color: var(--accent); color: var(--text); }

/* tag bar */
.tagbar { padding: .8rem 1rem .2rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.pill { --pill: var(--accent); padding: .28rem .7rem; border-radius: 999px; font-size: .83rem;
  color: var(--text);
  text-decoration: none; background: color-mix(in srgb, var(--pill) 18%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--pill) 55%, transparent); }
.pill:hover { border-color: var(--pill); }
.active-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.chip { padding: .28rem .7rem; border-radius: 999px; background: var(--accent); color: var(--accent-text);
  text-decoration: none; font-size: .83rem; font-weight: 600; }
.chip.clear { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.sort-form { margin-top: .6rem; display: flex; gap: 1rem; align-items: center; color: var(--muted); font-size: .9rem; }
.sort-form select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: .5rem; padding: .3rem .5rem; }

/* wall */
.wall { columns: 2; column-gap: .8rem; padding: 1rem; }
@media (min-width: 700px) { .wall { columns: 3; } }
@media (min-width: 1100px) { .wall { columns: 4; } }
@media (min-width: 1500px) { .wall { columns: 5; } }
.tile { margin: 0 0 .8rem; break-inside: avoid; background: var(--panel); border: 1px solid var(--line);
  border-radius: .9rem; overflow: hidden; position: relative; }
.tile img { width: 100%; display: block; }
.tile figcaption { display: flex; justify-content: space-between; gap: .5rem; padding: .5rem .7rem; font-size: .88rem; }
.tile-votes { color: var(--muted); white-space: nowrap; }
.badge-play { position: absolute; top: .6rem; left: .6rem; background: rgba(0,0,0,.65); color: #fff;
  border-radius: 999px; padding: .25rem .55rem; font-size: .8rem; }
.badge-dur { position: absolute; top: .6rem; right: .6rem; background: rgba(0,0,0,.65); color: #fff;
  border-radius: .4rem; padding: .2rem .45rem; font-size: .78rem; }
.empty { color: var(--muted); padding: 2rem 1rem; }

/* footer + modal */
.site-footer { display: flex; gap: 1.2rem; flex-wrap: wrap; padding: 1.2rem 1rem 2rem; color: var(--muted);
  border-top: 1px solid var(--line); margin-top: 1rem; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex;
  align-items: center; justify-content: center; padding: 1rem; z-index: 50; }
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 1rem;
  max-width: 560px; width: 100%; max-height: 82vh; overflow: auto; padding: 1.4rem; position: relative; }
.modal-close { position: absolute; top: .6rem; right: .8rem; background: none; border: none;
  color: var(--muted); font-size: 1.5rem; cursor: pointer; }

/* age gate */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.gate-card { background: var(--panel); border: 1px solid var(--line); border-radius: 1.2rem;
  padding: 2rem; max-width: 430px; width: 100%; text-align: center; }
.gate-form { display: grid; gap: .8rem; margin-top: 1rem; }
.gate-form input { width: 100%; padding: .7rem; border-radius: .6rem; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); font-size: 1rem; }
.gate-form button, .btn { background: var(--accent); color: var(--accent-text); border: none; cursor: pointer;
  padding: .75rem 1.2rem; border-radius: .6rem; font-weight: 700; font-size: 1rem; }
.gate-fine { color: var(--muted); font-size: .85rem; }

/* admin */
body.admin { display: flex; min-height: 100vh; }
.admin-side { width: 230px; flex: none; background: var(--panel); border-right: 1px solid var(--line);
  padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.admin-side nav { display: grid; gap: .4rem; }
.admin-side nav a { text-decoration: none; padding: .45rem .6rem; border-radius: .5rem; }
.admin-side nav a.active { background: var(--accent); color: var(--accent-text); }
.admin-side .soon { color: var(--muted); padding: .45rem .6rem; font-size: .9rem; }
.admin-side .version { margin-top: auto; color: var(--muted); font-size: .85rem; }
.admin-main { padding: 1.4rem; flex: 1; min-width: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: .9rem; padding: 1rem; }
.card-num { font-size: 1.7rem; font-weight: 800; }
.card-label { color: var(--muted); font-size: .88rem; }
.setup-form { display: grid; gap: .9rem; max-width: 480px; }
.setup-form label { display: grid; gap: .3rem; font-size: .92rem; color: var(--muted); }
.setup-form input { padding: .65rem; border-radius: .55rem; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); }
.err { color: #ff6b6b; }
.health li { margin: .3rem 0; }
.phase-note { color: var(--muted); }
@media (max-width: 640px) { .admin-side { width: 180px; } }

/* header search */
.header-search { flex: 1; max-width: 340px; }
.header-search input { width: 100%; padding: .45rem .8rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-size: .92rem; }
@media (max-width: 700px) { .header-search { order: 3; flex-basis: 100%; max-width: none; } }

/* tag headings + panel */
.tag-heading { font-size: 1.35rem; margin: .2rem 0 .1rem; }
.tag-desc { color: var(--muted); margin: 0 0 .6rem; font-size: .92rem; }
.tag-panel { margin: 0 1rem; padding: 1rem; background: var(--panel); border: 1px solid var(--line);
  border-radius: 1rem; }
.tag-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.tag-panel-head button { background: none; border: none; color: var(--muted); font-size: 1.4rem; cursor: pointer; }
.pill-count { opacity: .75; font-size: .78rem; }
.all-tags-btn { cursor: pointer; font: inherit; font-weight: 600; color: var(--text); }

/* tiles: quick tags + link */
.tile-link { display: block; }
.tile-quicktags { position: absolute; left: .5rem; bottom: 3rem; display: none; gap: .3rem; flex-wrap: wrap; }
.tile:hover .tile-quicktags { display: flex; }
.mini-pill { --pill: var(--accent); background: color-mix(in srgb, var(--pill) 78%, black);
  color: #fff; border-radius: 999px; padding: .12rem .5rem; font-size: .72rem; font-weight: 600; }
.scroll-sentinel { height: 2px; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 60; }
.lightbox[hidden] { display: none; }
.lb-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.88); }
.lb-box { position: relative; height: 100%; display: flex; align-items: stretch; justify-content: center; }
.lb-main { display: flex; flex-direction: column; max-width: min(1060px, 100%); width: 100%;
  padding: 3.2rem 1rem 1rem; overflow: auto; }
.lb-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .7rem; }
.lb-tags .pill { background: color-mix(in srgb, var(--pill) 24%, #111); color: #fff; text-decoration: none; }
.lb-media { display: flex; justify-content: center; }
.lb-media img { max-width: 100%; max-height: 68vh; border-radius: .6rem; }
.lb-media video { max-width: 100%; max-height: 68vh; border-radius: .6rem; background: #000; }
.lb-meta { color: #f4f4f5; max-width: 760px; margin: .8rem auto 0; width: 100%; }
.lb-meta h2 { margin: 0 0 .3rem; font-size: 1.15rem; }
.lb-meta p { margin: 0 0 .7rem; color: #c9c9cf; }
.lb-actions { display: flex; gap: .6rem; align-items: center; }
.lb-votes { color: #c9c9cf; margin-right: .4rem; }
.lb-btn { background: #1d1d21; color: #f4f4f5; border: 1px solid #33333a; border-radius: 999px;
  padding: .45rem 1rem; cursor: pointer; font-size: .9rem; }
.lb-btn:hover { border-color: var(--accent); }
.lb-close { position: absolute; top: .7rem; right: .9rem; z-index: 2; background: none; border: none;
  color: #fff; font-size: 2rem; cursor: pointer; line-height: 1; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; background: rgba(20,20,24,.6);
  color: #fff; border: 1px solid #33333a; border-radius: 999px; width: 44px; height: 44px;
  font-size: 1.5rem; cursor: pointer; }
.lb-prev { left: .7rem; }
.lb-next { right: .7rem; }
.modal-item-ref { color: var(--muted); }

/* mobile bottom bar */
.bottom-bar { display: none; }
@media (max-width: 700px) {
  .bottom-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--panel); border-top: 1px solid var(--line); }
  .bottom-bar a { flex: 1; text-align: center; padding: .8rem .2rem; text-decoration: none;
    font-size: .85rem; font-weight: 600; color: var(--text); }
  body { padding-bottom: 52px; }
  .lb-nav { width: 38px; height: 38px; }
}

/* Phase 3: tile + lightbox actions, passkey UI, report form */
.tile-actions { display: inline-flex; gap: .45rem; align-items: center; }
.tile-vote, .tile-fav { background: none; border: 0; color: var(--muted); font: inherit; font-size: .85rem; cursor: pointer; padding: .1rem .2rem; }
.tile-vote b { font-weight: 600; }
.tile-vote.voted, .lb-btn.voted { color: var(--accent); }
.tile-fav.faved, .lb-btn.faved { color: #e5484d; }
.pk-btn { background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: .42rem .95rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.pk-btn.big { padding: .6rem 1.3rem; }
#report-form label, .modal label { display: block; margin: .6rem 0; font-size: .9rem; color: var(--muted); }
#report-form input, #report-form select, #report-form textarea, .modal input, .modal select, .modal textarea { width: 100%; margin-top: .25rem; padding: .5rem; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; }
.lb-btn.faved { border-color: #e5484d; }

/* Phase 4: admin depth */
.admin-filter { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0; }
.admin-filter input, .admin-filter select, .edit-form input, .edit-form textarea, .edit-form select, .admin-main label input, .admin-main label textarea { padding: .45rem; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; }
.admin-main label { display: block; margin: .6rem 0; }
.admin-main label.check { display: inline-flex; gap: .4rem; align-items: center; margin: .3rem .8rem .3rem 0; }
.btn { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: .5rem 1rem; font: inherit; font-weight: 600; cursor: pointer; }
.btn.small { padding: .25rem .6rem; font-size: .85rem; }
.btn.danger { background: #7a1f22; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-top: 1rem; }
.lib-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lib-card img { width: 100%; height: 130px; object-fit: cover; display: block; }
.lib-nothumb { height: 130px; display: grid; place-items: center; color: var(--muted); }
.lib-meta { padding: .6rem; display: grid; gap: .3rem; font-size: .85rem; }
.badge { border-radius: 999px; padding: .1rem .55rem; font-size: .75rem; background: var(--line); width: fit-content; }
.badge.st-published { background: #1d5c2e; color: #fff; }
.badge.st-hidden { background: #5c1d1d; color: #fff; }
.badge.st-unprocessed { background: #6b5a1e; color: #fff; }
.admin-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.admin-table th, .admin-table td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table input { max-width: 160px; }
/* Upload Center (v0.5.2): status chips, drop zone, bulk queue, steps */
.page-lede { color: var(--muted); font-size: 1.05rem; margin: .2rem 0 1.1rem; max-width: 62ch; }
.page-lede strong { color: var(--text); }
.stat-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .7rem; margin-bottom: 1.1rem; }
.stat-chip { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; display: grid; gap: .15rem; }
.stat-chip .chip-label { font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.stat-chip .chip-value { font-weight: 700; font-size: 1rem; }
.stat-chip .chip-sub { color: var(--muted); font-size: .85rem; }
.stat-chip.warn { border-color: #8a6d1f; }
.stat-chip.warn .chip-value { color: #e5b83b; }
.dropzone { border: 2px dashed var(--line); border-radius: 16px; padding: 2.2rem 1.5rem; margin-top: 1rem; text-align: center; background: var(--panel); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--accent); background: var(--panel2); }
.dz-icon { width: 44px; height: 44px; color: var(--accent); }
.dz-title { font-size: 1.25rem; font-weight: 800; margin: .5rem 0 .1rem; }
.dz-or { color: var(--muted); margin: .2rem 0 .6rem; }
.dz-btn { display: inline-block; }
.dz-hint { color: var(--muted); font-size: .9rem; margin: .8rem auto 0; max-width: 52ch; }
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.queue-panel { margin-top: 1.2rem; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; }
.queue-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.queue-head h2 { font-size: 1.05rem; margin: 0; }
.queue-summary { color: var(--muted); font-size: .9rem; }
.queue-head .btn { margin-left: auto; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.overall-bar { height: 8px; background: var(--panel2); border-radius: 999px; overflow: hidden; margin: .7rem 0 .4rem; }
.overall-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .25s; }
.up-row { display: flex; gap: .7rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; flex-wrap: wrap; }
.up-row:last-child { border-bottom: none; }
.up-badge { font-size: .68rem; font-weight: 800; letter-spacing: .07em; padding: .18rem .45rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); flex: none; }
.up-badge.video { color: var(--text); border-color: var(--accent); }
.up-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; }
.up-size { color: var(--muted); font-size: .85rem; flex: none; }
.up-bar { flex: 1; min-width: 110px; height: 6px; background: var(--panel2); border-radius: 999px; overflow: hidden; }
.up-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.up-status { flex: none; font-size: .82rem; font-weight: 700; padding: .22rem .6rem; border-radius: 999px; background: var(--panel2); color: var(--muted); }
.up-status a { color: inherit; }
.up-status.st-active { color: var(--accent); }
.up-status.st-done { background: #14532d; color: #bbf7d0; }
.up-status.st-dupe { background: #5b4a12; color: #fde68a; }
.up-status.st-err { background: #5f1d1d; color: #fecaca; }
.up-remove { background: none; border: none; color: var(--muted); font-size: 1rem; cursor: pointer; padding: .1rem .3rem; }
.up-remove:hover { color: var(--text); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .7rem; margin-top: 1.2rem; }
.step { display: flex; gap: .7rem; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .85rem .95rem; }
.step-num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 800; display: grid; place-items: center; font-size: .9rem; }
.step h3 { margin: .1rem 0 .25rem; font-size: .98rem; }
.step p { margin: 0; color: var(--muted); font-size: .9rem; }
.edit-form { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin: 1rem 0; }
.edit-form input[type="text"], .edit-form input:not([type]), .edit-form textarea, .edit-form select { width: 100%; }
.tag-checks { display: flex; flex-wrap: wrap; }
.ok-note { color: #4caf7d; }
form.inline { display: inline; }

/* Direct-uploaded videos preview in tiles without a poster frame */
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Phase 5: AI review queue */
.review-card { display: flex; gap: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin: 1rem 0; flex-wrap: wrap; }
.review-thumb { width: 180px; flex: none; }
.review-thumb img, .review-thumb video { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; display: block; }
.review-form { flex: 1; min-width: 260px; }
.review-head { display: flex; justify-content: space-between; align-items: center; }
.who-line { background: var(--bg); border: 1px dashed var(--line); border-radius: 8px; padding: .5rem .7rem; }
.review-actions { margin-top: .6rem; }
