:root {
  --bg: #050505;
  --surface: #111;
  --fg: #f2f2f2;
  --muted: #8a8a8a;
  --faint: #5c5c5c;
  --border: #222;
  --line: #1a1a1a;
  --danger: #c4544a;
  --font: "Manrope", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); min-height: 100dvh; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img, video { display: block; max-width: 100%; user-select: none; }
button, [role="button"] { font: inherit; color: inherit; }
button:not(:disabled) { cursor: pointer; }
.hidden { display: none !important; }

.site-header { z-index: 40; }
.site-header.is-solid { position: sticky; top: 0; border-bottom: 1px solid var(--line); background: var(--bg); }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 16px; }
.brand { font-size: 14px; font-weight: 600; letter-spacing: 0.02em; text-decoration: none; }
.site-header nav { display: flex; gap: 12px; font-size: 12px; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--fg); }

.flash { margin: 0; padding: 10px 16px; font-size: 13px; }
.flash-ok { background: #132017; color: #b7e0c4; }
.flash-error { background: #2a1210; color: #f0b4ae; }

.wall {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
}
@media (min-width: 720px) { .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .wall { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.gallery-card-main {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}
.cover-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gallery-fade {
  pointer-events: none;
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 48px 12px 12px;
  background: linear-gradient(to top, rgb(5 5 5 / 0.82), rgb(5 5 5 / 0.18), transparent);
}
.card-meta p { margin: 2px 0 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-title { display: flex; align-items: center; gap: 8px; }
.card-title h2 { margin: 0; font-size: 18px; font-weight: 500; letter-spacing: -0.02em; }
.pin { flex: 0 0 auto; }

.gallery-card-thumbs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; margin-top: 3px; }
.thumb { position: relative; aspect-ratio: 1; overflow: hidden; padding: 0; border: 0; background: var(--surface); }
.thumb img, .thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb.is-active { outline: 1px solid rgb(242 242 242 / 0.8); outline-offset: -1px; }
.thumb:not(.is-active)::after { content: ""; position: absolute; inset: 0; background: rgb(5 5 5 / 0.25); }
.thumb:not(.is-active):hover::after { background: transparent; }

.spoiler-media { filter: blur(22px) brightness(0.38) saturate(0.6); transform: scale(1.08); }
.thumb .spoiler-media { filter: blur(10px) brightness(0.5) saturate(0.7); transform: scale(1.15); }
.spoiler-veil {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: rgb(5 5 5 / 0.28); pointer-events: none;
}
.spoiler-mark {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  border: 1px solid rgb(242 242 242 / 0.45); padding: 3px 7px;
}
.spoiler-copy { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.spoiler-thumb { position: absolute; inset: 0; background: rgb(5 5 5 / 0.2); }
.nsfw-chip {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  border: 1px solid rgb(242 242 242 / 0.35); background: rgb(5 5 5 / 0.72);
  padding: 2px 6px; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
}
.nsfw-chip-inline { position: static; }

.play-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.62);
  border: 2px solid rgb(255 255 255 / 0.92);
  box-shadow: 0 2px 12px rgb(0 0 0 / 0.5);
}
.play-badge::after {
  content: "";
  position: absolute;
  left: 21px;
  top: 16px;
  border-style: solid;
  border-width: 12px 0 12px 20px;
  border-color: transparent transparent transparent #fff;
}
.mosaic-item .play-badge {
  width: 72px;
  height: 72px;
  left: 12px;
  bottom: 12px;
}
.mosaic-item .play-badge::after {
  left: 27px;
  top: 21px;
  border-width: 15px 0 15px 26px;
}
.thumb .play-badge {
  width: 34px;
  height: 34px;
  left: 4px;
  bottom: 4px;
}
.thumb .play-badge::after {
  left: 12px;
  top: 9px;
  border-width: 8px 0 8px 13px;
}

.empty-wall { display: grid; min-height: 70dvh; place-items: center; text-align: center; padding: 24px; }
.empty-wall h1, .auth h1, .narrow h1, .admin h1 { font-weight: 500; letter-spacing: -0.03em; }
.eyebrow { margin: 0; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.muted { color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }
.hint a { color: var(--fg); }

.gallery-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 16px 10px;
}
.gallery-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.gallery-title-row h1 { margin: 4px 0 0; font-size: 28px; font-weight: 500; }
.gallery-desc { max-width: 36rem; margin: 6px 0 0; font-size: 14px; }
.back { font-size: 12px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--fg); }
.count { margin: 0; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.pad { padding: 16px; }

.mosaic-wrap {
  display: block;
  width: 100%;
  padding: 0 8px 32px;
}
.mosaic {
  display: flex;
  gap: 2px;
  align-items: flex-start;
  width: 100%;
}
.mosaic-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mosaic-item {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  line-height: 0;
  font-size: 0;
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--surface);
  aspect-ratio: var(--ar, 3 / 4);
}
.mosaic-item img,
.mosaic-item video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  vertical-align: top;
}

.age-splash {
  min-height: 100dvh;
  margin: 0;
  background: #000;
  color: var(--fg);
  display: grid;
  place-items: center;
  padding: 24px;
}
.age-splash-card {
  width: min(36rem, 100%);
  border: 1px solid #2a2a2a;
  background: #0a0a0a;
  padding: 48px 40px;
}
.age-splash-card .eyebrow { margin: 0 0 16px; letter-spacing: 0.2em; }
.age-splash-card h1 { margin: 0; font-size: clamp(2rem, 5vw, 3rem); font-weight: 500; letter-spacing: -0.04em; }
.age-splash-card p { margin: 18px 0 0; font-size: 1.05rem; line-height: 1.5; color: var(--muted); max-width: 28rem; }
.age-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 36px; }
.age-actions .btn { min-height: 48px; font-size: 16px; }
@media (min-width: 600px) { .age-actions { flex-direction: row; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 0 14px;
  border: 1px solid #333;
  background: #111;
  color: var(--fg);
  font-size: 14px; text-decoration: none;
}
.btn:hover { background: #181818; border-color: #4a4a4a; }
.btn-outline, .btn-ghost { background: transparent; color: var(--fg); border: 1px solid #2a2a2a; }
.btn-outline:hover, .btn-ghost:hover { background: #141414; border-color: #444; }
.btn-ghost { border-color: transparent; }
.btn-ghost.is-on { border-color: #3a3a3a; background: #161616; }
.btn-danger { background: transparent; color: #c98a84; border: 1px solid #3a2220; }
.btn-danger:hover { background: #1a1010; border-color: #5a3030; }
.btn:disabled { opacity: 0.45; cursor: default; }
.text-btn, .icon-btn { background: none; border: 0; color: var(--fg); text-decoration: none; font-size: 14px; }
.icon-btn { width: 40px; height: 40px; }

.auth { width: min(24rem, calc(100% - 32px)); margin: 80px auto 40px; }
.brand-plain { font-size: 14px; font-weight: 600; text-decoration: none; }
.stack { display: grid; gap: 12px; margin-top: 24px; }
.stack.tight { margin-top: 12px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea, input[type="file"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); background: #0b0b0b; color: var(--fg); font: inherit;
}
.check { display: flex; align-items: center; gap: 8px; color: var(--fg); }
.error { color: #f0b4ae; }
.narrow { width: min(28rem, calc(100% - 32px)); margin: 80px auto; }
.center { text-align: center; }

.admin { width: min(960px, calc(100% - 32px)); margin: 24px auto 64px; }
.admin-nav { display: flex; gap: 12px; margin: 0 0 20px; font-size: 13px; }
.admin-nav a { color: var(--muted); text-decoration: none; border-bottom: 1px solid transparent; padding-bottom: 2px; }
.admin-nav a:hover, .admin-nav a.is-on { color: var(--fg); border-bottom-color: #444; }
.admin-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: end; }
.admin-create { display: grid; gap: 12px; margin: 16px 0 8px; }
.member-row { display: grid; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form input { min-width: 220px; }
.admin-list { display: grid; gap: 10px; margin-top: 24px; }
.admin-row { display: grid; grid-template-columns: 72px 1fr; gap: 12px; padding: 10px; border: 1px solid var(--line); background: #0b0b0b; }
@media (min-width: 800px) { .admin-row { grid-template-columns: 72px 1fr auto; } }
.admin-preview { position: relative; aspect-ratio: 3/4; overflow: hidden; background: var(--surface); }
.admin-preview .cover-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.admin-meta h2 { margin: 0; font-size: 16px; font-weight: 500; }
.chips { display: flex; gap: 6px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.admin-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: start; }
.admin-panel { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.member-list { padding: 0; list-style: none; display: grid; gap: 6px; font-size: 14px; }
.drop-zone {
  margin: 8px 0 28px;
  padding: 16px 16px 14px;
  border: 2px dashed #8a8a8a;
  background: #161616;
  text-align: center;
}
.drop-zone.is-over { border-color: #f2f2f2; background: #242424; }
.drop-zone.is-busy { opacity: 0.7; pointer-events: none; }
.drop-title { margin: 0 0 6px; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.drop-zone .muted { margin: 0 auto 16px; max-width: 34rem; }
.drop-zone label { text-align: left; max-width: 28rem; margin: 0 auto; }
.drop-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.drop-status {
  margin: 12px auto 0;
  max-width: 40rem;
  text-align: left;
  white-space: pre-wrap;
  color: var(--muted);
}
.drop-status.is-error { color: #f0b4ae; }

.admin-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 12px; }
.admin-media-item {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: grab;
}
.admin-media-item.is-cover { border-color: #666; }
.admin-media-item.is-dragging { opacity: 0.4; }
.admin-media-item.is-over { border-color: #f2f2f2; }
.admin-media-frame {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface);
}
.admin-media-item img,
.admin-media-item video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: cover;
  pointer-events: none;
  display: block;
}
.admin-media-item .play-badge { left: auto; right: 8px; bottom: auto; top: 8px; }
.admin-cover-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  padding: 2px 6px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgb(8 8 8 / 0.86);
  border: 1px solid #555;
}
.admin-video-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  padding: 2px 6px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgb(8 8 8 / 0.86);
  border: 1px solid #555;
}
.admin-media-item.is-video .play-badge { display: none; }
.admin-media-tools {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  gap: 4px;
  padding: 8px 6px 6px;
  background: linear-gradient(to top, rgb(5 5 5 / 0.92), rgb(5 5 5 / 0.2), transparent);
}
.admin-tool-form { flex: 1 1 0; min-width: 0; margin: 0; }
.admin-tool {
  width: 100%;
  padding: 6px 4px;
  border: 1px solid #3a3a3a;
  background: #111;
  color: var(--fg);
  font-size: 11px;
  line-height: 1.1;
}
.admin-tool:hover { border-color: #666; background: #181818; }
.admin-tool-danger { color: #c98a84; border-color: #3a2220; }
.admin-tool-danger:hover { background: #1a1010; }

.lightbox { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: var(--bg); }
.lightbox-bar { display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 12px; }
.lightbox-bar div { display: flex; align-items: center; gap: 8px; }
.lightbox-stage { position: relative; flex: 1; min-height: 0; }
.lightbox-stage img, .lightbox-stage video {
  position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%; object-fit: contain;
}
.lightbox-stage .nav { position: absolute; top: 0; height: 100%; width: 64px; border: 0; background: none; font-size: 40px; color: rgb(242 242 242 / 0.8); }
.lightbox-stage .prev { left: 0; }
.lightbox-stage .next { right: 0; }
.lightbox-thumbs { display: flex; gap: 3px; overflow-x: auto; padding: 8px; }
.lightbox-thumbs button {
  position: relative;
  flex: 0 0 auto;
  width: 64px;
  height: 76px;
  padding: 0;
  border: 0;
  background: #111;
  opacity: 0.55;
  overflow: hidden;
}
.lightbox-thumbs button.is-active { opacity: 1; outline: 1px solid var(--fg); }
.lightbox-thumbs button.is-video { opacity: 0.85; }
.lightbox-thumbs img, .lightbox-thumbs video { width: 100%; height: 100%; object-fit: cover; display: block; }
.lightbox-thumbs .play-badge {
  width: 28px;
  height: 28px;
  left: 4px;
  bottom: 4px;
  border-width: 1px;
}
.lightbox-thumbs .play-badge::after {
  left: 10px;
  top: 7px;
  border-width: 7px 0 7px 11px;
}

.feed-sentinel { height: 1px; }
.feed-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 22px 16px 28px;
  font-size: 13px;
  color: var(--muted);
}
.feed-status[hidden] { display: none !important; }
.feed-status.is-error .feed-spinner { display: none; }
.feed-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid #333;
  border-top-color: #e6e6e6;
  border-radius: 50%;
  animation: feed-spin 0.7s linear infinite;
}
@keyframes feed-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
