:root {
  --bg: #0b0b0d;
  --surface: #141418;
  --surface-2: #1b1b21;
  --text: #ececf1;
  --muted: #9a9aa6;
  --border: #27272f;
  --accent: #e0567a;
  --accent-ink: #fff;
  --danger: #ff6b6b;
  --ok: #5bd6a2;
  --radius: 14px;
  --max: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; display: block; }
code { font-family: var(--mono); font-size: .92em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.02em; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }

.site-head {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: var(--max); margin: 0 auto; padding: 14px 20px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font-size: .78rem; font-weight: 800; letter-spacing: .02em;
}
.site-nav { display: flex; align-items: center; gap: 18px; font-size: .92rem; }
.site-nav a { color: var(--muted); }
.site-nav a:hover { color: var(--text); text-decoration: none; }
.inline-form { display: inline; }
.link-button { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }
.link-button:hover { color: var(--text); }
.link-button.danger { color: var(--danger); }

.site-main { max-width: var(--max); margin: 0 auto; padding: 40px 20px 80px; }
.site-foot {
  max-width: var(--max); margin: 0 auto; padding: 24px 20px 40px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  color: var(--muted); font-size: .82rem; border-top: 1px solid var(--border);
}
.site-foot a { color: var(--muted); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); border: 1px solid transparent;
  padding: 11px 18px; border-radius: 999px; font: inherit; font-weight: 650; cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
}
.button:hover { text-decoration: none; opacity: .92; transform: translateY(-1px); }
.button:disabled { opacity: .5; cursor: wait; transform: none; }
.button.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.button.small { padding: 7px 13px; font-size: .86rem; }

.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: .7rem; color: var(--muted); margin-bottom: 12px; }
.hero { padding: clamp(30px, 7vw, 90px) 0 50px; max-width: 760px; }
.hero h1 { font-size: clamp(2.7rem, 7vw, 5.2rem); letter-spacing: -.045em; }
.lede { color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.3rem); max-width: 620px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }

.section { margin-top: 56px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 20px 0 22px; }
.section-head h1, .section-head h2 { margin: 0; }
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.page-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; color: var(--text); transition: border-color .15s ease, transform .15s ease; }
.page-card:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-2px); }
.page-card-cover { aspect-ratio: 16/10; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.page-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.page-card-empty { font-size: 2.2rem; font-weight: 800; color: var(--muted); opacity: .5; }
.page-card-body { padding: 12px 14px 14px; display: grid; gap: 2px; }
.page-card-body span { color: var(--muted); font-size: .8rem; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 22px; }
.feature-grid > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.feature-grid p { color: var(--muted); margin: 0; }
.prose-block { max-width: 720px; }
.prose-block p { color: color-mix(in srgb, var(--text) 84%, var(--muted)); }

.auth-wrap { display: grid; place-items: center; min-height: 58vh; }
.auth-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); padding: 30px; }
.auth-card h1 { font-size: 2rem; }
.auth-card .switch { color: var(--muted); font-size: .9rem; margin: 18px 0 0; }
.stack { display: grid; gap: 14px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { display: grid; gap: 6px; font-size: .86rem; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 9px; color: var(--text); }
input, textarea, select {
  width: 100%; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px;
  font: inherit; font-size: .94rem;
}
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; border-color: transparent; }
input[type="color"] { padding: 4px; height: 42px; }
input[type="checkbox"] { width: auto; }
textarea { resize: vertical; }
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; }
.hint { color: var(--muted); font-size: .78rem; }
.notice { padding: 11px 14px; border-radius: 9px; font-size: .9rem; margin: 0 0 16px; }
.notice.error { background: color-mix(in srgb, var(--danger) 14%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); color: #ffb3b3; }
.notice.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); color: #a9f0d0; }

/* 18+ gate */
.gate-body .site-head, .gate-body .site-foot { display: none; }
.gate { min-height: 86vh; display: grid; place-items: center; }
.gate-card { width: min(520px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 6px); padding: 36px; text-align: center; }
.gate-mark { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border)); color: var(--accent); font-weight: 800; font-size: 1.25rem; margin-bottom: 14px; }
.gate-card h1 { font-size: 1.9rem; }
.gate-card p { color: var(--muted); }

/* profile */
.profile { --page-accent: var(--accent); }
.profile-banner { height: clamp(150px, 26vw, 260px); border-radius: var(--radius); background-size: cover; background-position: center; margin-bottom: -46px; border: 1px solid var(--border); }
.profile-head { position: relative; display: flex; gap: 20px; align-items: flex-end; padding: 0 10px 22px; }
.avatar { width: 104px; height: 104px; flex: 0 0 104px; border-radius: 50%; overflow: hidden; background: var(--surface-2); border: 4px solid var(--bg); display: grid; place-items: center; font-size: 2rem; font-weight: 800; color: var(--muted); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-id { flex: 1; min-width: 0; padding-bottom: 4px; }
.profile-id h1 { margin: 0 0 2px; font-size: clamp(1.8rem, 4vw, 2.8rem); }
.handle { color: var(--muted); margin: 0 0 10px; font-size: .9rem; }
.bio { max-width: 640px; color: color-mix(in srgb, var(--text) 86%, var(--muted)); margin: 0 0 12px; white-space: pre-line; }
.profile-links { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-links a { border: 1px solid var(--border); background: var(--surface); padding: 6px 11px; border-radius: 999px; font-size: .8rem; color: var(--text); }
.profile-links a:hover { border-color: var(--accent); text-decoration: none; }
.owner-edit { align-self: flex-start; margin-left: auto; }
.album-tabs { display: flex; gap: 7px; overflow-x: auto; padding: 18px 0 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px; scrollbar-width: none; }
.album-tab { white-space: nowrap; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font-size: .82rem; }
.album-tab:hover { color: var(--text); text-decoration: none; }
.album-tab.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.gallery { display: grid; gap: 10px; }
.layout-grid .gallery { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.layout-masonry .gallery { columns: 4 200px; column-gap: 10px; display: block; }
.layout-masonry .tile { break-inside: avoid; margin: 0 0 10px; }
.layout-list .gallery { grid-template-columns: 1fr; max-width: 820px; margin: 0 auto; gap: 22px; }
.tile { position: relative; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; cursor: zoom-in; }
.layout-grid .tile { aspect-ratio: 1/1; }
.layout-list .tile { cursor: zoom-in; }
.layout-grid .tile img, .layout-masonry .tile img { width: 100%; height: 100%; object-fit: cover; }
.layout-masonry .tile img { height: auto; }
.layout-list .tile img { width: 100%; max-height: 78vh; object-fit: contain; background: #000; }
.tile figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 10px 9px;
  background: linear-gradient(transparent, rgba(0,0,0,.78)); color: #fff; font-size: .78rem;
  opacity: 0; transition: opacity .15s ease;
}
.tile:hover figcaption { opacity: 1; }
.layout-list .tile figcaption { position: static; opacity: 1; background: var(--surface); color: var(--muted); padding: 9px 12px; }
.play { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 46px; height: 46px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; font-size: .95rem; padding-left: 3px; }
.empty { text-align: center; padding: 70px 20px; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }

.font-serif { --font: Georgia, "Times New Roman", serif; }
.font-mono { --font: var(--mono); }

.theme-noir { --bg:#0b0b0d; --surface:#141418; --surface-2:#1b1b21; --text:#ececf1; --muted:#9a9aa6; --border:#27272f; --accent-ink:#fff; }
.theme-ivory { --bg:#f5f1ea; --surface:#fffdf8; --surface-2:#efe9df; --text:#241f1b; --muted:#7a6f63; --border:#ddd2c2; --accent-ink:#fff; }
.theme-velvet { --bg:#160a11; --surface:#210f1a; --surface-2:#2b1421; --text:#f6e7ee; --muted:#b995a6; --border:#3b1e2d; --accent-ink:#fff; }
.theme-slate { --bg:#0c1216; --surface:#111b21; --surface-2:#17252d; --text:#e6eef2; --muted:#93a6b0; --border:#22343d; --accent-ink:#fff; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(4,4,6,.95); display: none; align-items: center; justify-content: center; padding: 30px; }
.lightbox.open { display: flex; }
.lightbox img, .lightbox video { max-width: 92vw; max-height: 86vh; border-radius: 8px; }
.lb-close, .lb-prev, .lb-next { position: absolute; background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; width: 42px; height: 42px; font-size: 1.2rem; cursor: pointer; display: grid; place-items: center; }
.lb-close { top: 18px; right: 18px; }
.lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
.lb-counter { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.7); font-size: .8rem; }

/* settings */
.settings-body .site-main { max-width: 980px; }
.settings-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.settings-head h1 { margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 18px; }
.panel h2 { margin-bottom: 18px; }
.panel .stack { max-width: 760px; }
.profile-uploads { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.upload-mini { display: inline; }
.quota { height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 8px 0 18px; }
.quota span { display: block; height: 100%; background: var(--accent); }
.upload-box { border: 1.5px dashed var(--border); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); margin-bottom: 20px; }
.upload-box.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.upload-box input[type=file] { margin: 0 auto 10px; max-width: 320px; }
.inline-label { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; }
.inline-label select { width: auto; }
.upload-list { display: grid; gap: 6px; margin-top: 12px; text-align: left; }
.upload-row { display: grid; grid-template-columns: 1fr 120px; gap: 10px; font-size: .8rem; align-items: center; }
.upload-row progress { width: 100%; height: 6px; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.admin-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 7px; background: var(--surface-2); }
.row-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-form input[name=caption] { min-width: 180px; flex: 1; }
.row-form select { width: auto; }
.move-form { display: flex; flex-direction: column; gap: 3px; }
.move-form button { width: 26px; height: 20px; padding: 0; border-radius: 5px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: .7rem; cursor: pointer; }
.move-form button:hover { color: var(--text); border-color: var(--accent); }
.num { color: var(--muted); white-space: nowrap; }
.album-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.album-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; background: var(--surface-2); border-radius: 9px; padding: 8px 12px; }
.album-row { flex-wrap: wrap; }
.album-row .row-form { flex: 1; }
.album-protect { flex-basis: 100%; display: flex; align-items: center; gap: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.album-protect form { display: flex; gap: 8px; align-items: center; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: .7rem; letter-spacing: .02em; }
.badge.danger { color: #ff9a9a; border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.album-tab.locked { border-style: dashed; }
.admin-actions { display: grid; gap: 6px; min-width: 260px; }

.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: clamp(1.8rem, 4vw, 3rem); }

@media (max-width: 720px) {
  .site-head { padding: 12px 16px; }
  .site-head { flex-wrap: wrap; }
  .site-nav { gap: 10px; font-size: .8rem; flex-wrap: wrap; }
  .site-nav a:not(.button) { display: inline; }
  .site-main { padding: 26px 16px 60px; }
  .two-col { grid-template-columns: 1fr; }
  .profile-head { flex-wrap: wrap; align-items: flex-start; }
  .avatar { width: 84px; height: 84px; flex-basis: 84px; }
  .owner-edit { margin-left: 0; }
  .layout-grid .gallery { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .layout-masonry .gallery { columns: 2 140px; }
  .auth-card, .gate-card { padding: 24px; }
  .settings-head { flex-direction: column; align-items: flex-start; }
  .album-row { flex-direction: column; align-items: stretch; }
}
