/* 3DEM — mobile-first, light + dark */
:root {
  --bg: #ffffff;
  --bg-soft: #f4f4f6;
  --surface: #ebebee;
  --surface-2: #e1e1e6;
  --text: #17171c;
  --text-2: #6b6b76;
  --text-3: #9a9aa5;
  --line: #e4e4e9;
  --accent: #e8789b;
  --accent-ink: #ffffff;
  --accent-soft: #fbe3eb;
  --accent-soft-ink: #c74d75;
  --danger: #d9445a;
  --ok: #2f9e6a;
  --shadow: 0 10px 30px rgba(20, 20, 30, .08);
  --radius: 18px;
  --radius-sm: 12px;
  --gutter: 16px;
  --gap: 14px;
  --top-h: 64px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111115;
  --bg-soft: #17171c;
  --surface: #1f1f26;
  --surface-2: #2a2a33;
  --text: #f2f2f5;
  --text-2: #a3a3b0;
  --text-3: #6f6f7c;
  --line: #26262e;
  --accent: #f08bab;
  --accent-ink: #1a0b10;
  --accent-soft: #3a2029;
  --accent-soft-ink: #ffb5cb;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

/* ---------- Skins (each overrides the tokens above; light + dark) ---------- */
:root { --glow: transparent; --heading-font: var(--font); }

/* Mono: pure white / pure black, one sharp accent, tighter corners */
:root[data-skin="mono"] {
  --bg: #ffffff; --bg-soft: #f7f7f7; --surface: #f0f0f0; --surface-2: #e4e4e4;
  --text: #000000; --text-2: #555555; --text-3: #8a8a8a; --line: #e2e2e2;
  --accent: #ff4d00; --accent-ink: #ffffff; --accent-soft: #ffe8dd; --accent-soft-ink: #c23a00;
  --radius: 10px; --radius-sm: 8px; --shadow: 0 8px 24px rgba(0,0,0,.08);
}
:root[data-skin="mono"][data-theme="dark"] {
  --bg: #000000; --bg-soft: #0c0c0c; --surface: #161616; --surface-2: #222222;
  --text: #ffffff; --text-2: #a8a8a8; --text-3: #666666; --line: #1f1f1f;
  --accent: #ff5a14; --accent-ink: #000000; --accent-soft: #2a1408; --accent-soft-ink: #ffb08a;
  --shadow: 0 8px 24px rgba(0,0,0,.6);
}

/* Synth Pop: deep purple, neon pink + cyan, glow */
:root[data-skin="synth"] {
  --bg: #fbf6ff; --bg-soft: #f3eaff; --surface: #ece0ff; --surface-2: #dfcdfb;
  --text: #24103f; --text-2: #6a4f8f; --text-3: #9d86bd; --line: #e4d6f7;
  --accent: #e0189a; --accent-ink: #ffffff; --accent-soft: #fbd9ef; --accent-soft-ink: #b2127a;
  --cyan: #0db8d8; --glow: rgba(224,24,154,.35); --radius: 16px;
}
:root[data-skin="synth"][data-theme="dark"] {
  --bg: #120a24; --bg-soft: #180e30; --surface: #221542; --surface-2: #2e1d58;
  --text: #f6ecff; --text-2: #b9a3dc; --text-3: #7d64a6; --line: #2a1a4f;
  --accent: #ff2fa8; --accent-ink: #1a0520; --accent-soft: #3b1544; --accent-soft-ink: #ff8fd0;
  --cyan: #27e1ff; --glow: rgba(255,47,168,.55); --shadow: 0 12px 36px rgba(0,0,0,.6);
}

/* Mint: fresh green */
:root[data-skin="mint"] {
  --bg: #f6fbf8; --bg-soft: #edf6f1; --surface: #dff1e7; --surface-2: #cde8da;
  --text: #11271c; --text-2: #4f6f5f; --text-3: #86a393; --line: #d9ebe1;
  --accent: #1f9d6a; --accent-ink: #ffffff; --accent-soft: #d6f1e3; --accent-soft-ink: #177a52;
}
:root[data-skin="mint"][data-theme="dark"] {
  --bg: #0d1612; --bg-soft: #121d18; --surface: #182820; --surface-2: #21352b;
  --text: #ecf7f0; --text-2: #9fbfae; --text-3: #5f7d6c; --line: #1f3027;
  --accent: #3ad49a; --accent-ink: #06130d; --accent-soft: #163626; --accent-soft-ink: #8fe8c3;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  min-height: 100dvh; display: flex; flex-direction: column;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -.01em; }
h2 { font-size: 1.45rem; }
p { margin: 0 0 .6rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
h1.h2 { font-size: 1.45rem; }
@media (min-width: 900px) { h1.h2 { font-size: 1.6rem; } }
.muted { color: var(--text-2); }
.small { font-size: .85rem; }
.ico { width: 22px; height: 22px; flex: none; }
.ico-moon { display: none; }
:root[data-theme="dark"] .ico-moon { display: block; }
:root[data-theme="dark"] .ico-sun { display: none; }
[hidden] { display: none !important; }

/* ---------- Image protection (all public pages, owner included; the dash is exempt) ----------
   Blocks the save-image paths a casual visitor reaches: right-click menu, drag-out,
   and the iOS/Android long-press sheet. A transparent layer sits over every photo so
   the press lands on it rather than the <img>. */
.protect img { -webkit-user-drag: none; user-drag: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.protect .card-media, .protect .gallery-slide, .protect .bubble-img, .protect .coll-img, .protect .lbx { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.protect .card-media::after, .protect .gallery-slide::after, .protect .bubble-img::after, .protect .coll-img::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.protect .gallery-slide { position: relative; }
.protect .bubble-img, .protect .coll-img { position: relative; }
.protect .card-badge, .protect .card-meta { z-index: 2; }
.protect .lbx img { pointer-events: none; }
.protect .lbx::after { content: ""; position: absolute; inset: 0; }
.protect .lbx-close, .protect .lbx-arrow, .protect .lbx-count { z-index: 2; }

/* ---------- Watermark band (public pages, optional) ---------- */
.wm {
  position: absolute; left: 0; right: 0; bottom: var(--wm-offset, 0%); z-index: 1; pointer-events: none; overflow: hidden; white-space: nowrap;
  padding: 10px 0 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; line-height: 1;
  color: rgba(255,255,255,.55); text-shadow: 0 1px 2px rgba(0,0,0,.45);
  background: linear-gradient(to top, rgba(0,0,0,.28), rgba(0,0,0,0));
  mix-blend-mode: normal; user-select: none; -webkit-user-select: none;
}
.wm i { display: inline-block; width: 1.6em; }
.card-media .wm { font-size: 9px; padding: 8px 0 5px; }
.coll-img .wm { font-size: 8px; padding: 8px 0 5px; }
.gallery-slide .wm { font-size: 12px; padding: 14px 0 8px; }
.lbx .wm { font-size: 13px; padding: 16px 0 calc(10px + env(safe-area-inset-bottom)); z-index: 1; }
.card-media:has(.wm) .card-meta { padding-bottom: 22px; }
.detail .gallery-dots { z-index: 2; bottom: 22px; }

/* ---------- Top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 20; height: var(--top-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 var(--gutter); padding-top: env(safe-area-inset-top);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
}
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.top-title { flex: 1; margin: 0; text-align: center; font-size: 1.05rem; font-weight: 500; }
.top-sub .top-actions { min-width: 44px; justify-content: flex-end; }
.desk-nav { display: none; gap: 22px; margin-left: 22px; font-size: .95rem; color: var(--text-2); }
.desk-nav a:hover, .desk-nav a[aria-current] { color: var(--text); }
.avatar-link { display: block; border-radius: 50%; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600; color: var(--text-2);
}
.avatar-xl { width: 120px; height: 120px; font-size: 2.6rem; }
.icon-btn {
  width: 42px; height: 42px; border: 0; border-radius: 12px; background: transparent; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface); }
.icon-btn.soft { background: var(--surface); }
.icon-btn.soft:hover { background: var(--surface-2); }
.icon-btn.outline { background: transparent; border: 1.5px solid var(--line); }
.icon-btn.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.icon-btn.danger:hover { background: var(--danger); color: #fff; }
.btn-new span { display: none; }

/* ---------- Search bar ---------- */
.searchbar {
  position: sticky; top: var(--top-h); z-index: 19; display: flex; align-items: center; gap: 10px;
  margin: 0 var(--gutter) 8px; padding: 6px 8px 6px 14px; border-radius: 14px; background: var(--surface);
}
.searchbar .ico { color: var(--text-2); }
.searchbar input { flex: 1; border: 0; background: transparent; font: inherit; color: var(--text); outline: none; min-width: 0; }
.searchbar input::placeholder { color: var(--text-3); }
.open-search .searchbar { display: flex !important; }

/* ---------- Drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.35); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41; width: min(320px, 86vw);
  background: var(--bg); box-shadow: var(--shadow); padding: calc(16px + env(safe-area-inset-top)) 18px 24px;
  display: flex; flex-direction: column; gap: 14px; animation: slide-in .22s ease-out;
}
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; gap: 12px; }
.drawer-head div { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.drawer-head small { color: var(--text-2); }
.drawer-nav { display: flex; flex-direction: column; }
.drawer-nav a { display: flex; align-items: center; gap: 12px; padding: 12px 10px; border-radius: 12px; font-size: 1.05rem; }
.drawer-nav a:hover { background: var(--surface); }
.drawer-nav .ico { color: var(--accent); }
.drawer-theme {
  margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; border-radius: 12px;
  background: var(--surface); cursor: pointer;
}

/* ---------- Layout ---------- */
.page { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 8px var(--gutter) 40px; }
.section { margin-top: 18px; }
.section + .section { margin-top: 32px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.see-all { color: var(--accent-soft-ink); font-size: .9rem; }
.foot { padding: 20px var(--gutter) calc(20px + env(safe-area-inset-bottom)); text-align: center; color: var(--text-3); font-size: .8rem; display: flex; justify-content: center; align-items: center; gap: 12px; }
.foot-login { color: var(--text-3); opacity: .55; }
.foot-login .ico { width: 16px; height: 16px; }
.flash { padding: 12px 14px; border-radius: 12px; margin: 10px 0; background: var(--surface); font-size: .95rem; }
.flash-ok { background: color-mix(in srgb, var(--ok) 16%, var(--bg)); }
.flash-err { background: color-mix(in srgb, var(--danger) 16%, var(--bg)); }
.empty { text-align: center; padding: 56px 16px; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ico { width: 44px; height: 44px; color: var(--text-3); }
.pager { display: flex; justify-content: center; gap: 12px; margin-top: 28px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border: 0; border-radius: 14px; background: var(--surface); color: var(--text); cursor: pointer; font-weight: 500;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn .ico { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: .9rem; border-radius: 12px; }
.btn-block { width: 100%; }

/* ---------- Collections (bubbles) ---------- */
.bubbles { display: flex; gap: 14px; overflow-x: auto; padding: 2px 0 10px; margin: 0 calc(var(--gutter) * -1); padding-left: var(--gutter); padding-right: var(--gutter); scrollbar-width: none; scroll-snap-type: x proximity; }
.bubbles::-webkit-scrollbar { display: none; }
.bubble { flex: none; width: 72px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; scroll-snap-align: start; }
.bubble-img { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--text-3); transition: transform .15s, box-shadow .15s; }
.bubble-img img { width: 100%; height: 100%; object-fit: cover; }
.bubble:hover .bubble-img { transform: scale(1.05); box-shadow: 0 0 0 3px var(--accent-soft); }
.bubble-name { font-size: .82rem; color: var(--text); line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Masonry grid ---------- */
.masonry { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); align-items: start; }
.masonry.is-cols { display: flex; align-items: flex-start; }
.masonry.is-cols .mcol { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.card { display: block; position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.card-media { display: block; position: relative; aspect-ratio: 1 / var(--r, 1.2); background: var(--surface); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card:hover .card-media img { transform: scale(1.03); }
.card-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.card-badge { position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: rgba(17,17,21,.6); color: #fff; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.card-badge .ico { width: 14px; height: 14px; }
.card-meta {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 12px 10px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px;
  color: #fff; font-size: .78rem; background: linear-gradient(to top, rgba(0,0,0,.55), rgba(0,0,0,0)); opacity: 0; transition: opacity .2s;
}
.card:hover .card-meta, .card:focus-visible .card-meta { opacity: 1; }
.card-tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.card-tags span { padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,.22); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
@media (hover: none) { .card-meta { opacity: 1; padding-top: 30px; } .card-meta .card-tags { display: none; } }

/* ---------- Collection page ---------- */
.collection-head { align-items: flex-start; }
.collection-title { font-size: 1.5rem; line-height: 1.2; }
.collection-title .muted { font-size: 1.2rem; }
.sorter { position: relative; flex: none; }
.popover { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 180px; padding: 6px; border-radius: 14px; background: var(--bg); box-shadow: var(--shadow); border: 1px solid var(--line); }
.popover a { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; font-size: .95rem; }
.popover a:hover { background: var(--surface); }
.popover a .ico { width: 16px; height: 16px; visibility: hidden; }
.popover a.on .ico { visibility: visible; color: var(--accent); }
.collection-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--gap); }
.coll-card { display: flex; flex-direction: column; gap: 10px; }
.coll-img { position: relative; aspect-ratio: 1; border-radius: var(--radius); background: var(--surface); overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.coll-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.coll-card:hover .coll-img img { transform: scale(1.04); }
.coll-text { display: flex; flex-direction: column; line-height: 1.25; padding: 0 4px; }
.coll-text small { color: var(--text-2); }

/* ---------- Detail page ---------- */
.detail-wrap { display: flex; flex-direction: column; gap: 18px; }
.gallery { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.gallery-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-slide { position: relative; flex: 0 0 100%; margin: 0; scroll-snap-align: start; aspect-ratio: 1 / var(--r, 1); max-height: 80vh; display: flex; align-items: center; justify-content: center; background: var(--surface); }
.gallery-slide img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.gallery-none { aspect-ratio: 1; color: var(--text-3); }
.gallery-none .ico { width: 48px; height: 48px; }
.gallery-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(17,17,21,.45); color: #fff; display: none; align-items: center; justify-content: center; cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.gallery-arrow.prev { left: 10px; } .gallery-arrow.next { right: 10px; }
.gallery-dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 6px; }
.gallery-dots button { width: 7px; height: 7px; border-radius: 50%; border: 0; padding: 0; background: rgba(255,255,255,.55); box-shadow: 0 0 0 1px rgba(0,0,0,.15); cursor: pointer; transition: transform .15s, background .15s; }
.gallery-dots button.on { background: var(--accent); transform: scale(1.35); }
.detail-info { display: flex; flex-direction: column; gap: 18px; padding: 4px 2px 0; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; font-size: .82rem; color: var(--text-2); letter-spacing: .01em; }
.detail-meta > * { display: inline-flex; align-items: center; gap: 6px; }
.detail-meta .ico { width: 16px; height: 16px; opacity: .8; }
.detail-meta time { color: var(--accent-soft-ink); font-weight: 500; }
.detail .comment { font-size: 1.12rem; line-height: 1.55; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; min-height: 34px; padding: 0 13px; border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: .86rem; font-weight: 500; transition: background .15s, color .15s; }
.chip::before { content: "#"; margin-right: 2px; opacity: .55; }
.chip:hover { background: var(--accent-soft); color: var(--accent-soft-ink); }
.detail-actions { display: flex; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.detail-actions:empty, .detail-actions:not(:has(:not([hidden]))) { display: none; }
.detail-actions .btn { background: transparent; border: 1.5px solid var(--line); }
.detail-actions .btn:hover { border-color: var(--text-3); background: var(--surface); }

/* ---------- Likes ---------- */
.like { user-select: none; -webkit-user-select: none; }
.like .ico { transition: transform .2s cubic-bezier(.34,1.56,.64,1), fill .15s, color .15s; }
.like.is-liked { color: var(--accent-soft-ink); }
.like.is-liked .ico { fill: var(--accent); stroke: var(--accent); }
.detail-actions .btn.like.is-liked { border-color: var(--accent); background: var(--accent-soft); }
.like.is-pop .ico { transform: scale(1.3); }
.like.is-owner { cursor: default; opacity: .7; }
.like[aria-busy="true"] { pointer-events: none; }
.card-like {
  position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 999px;
  font-size: .75rem; font-weight: 600; background: rgba(17,17,21,.6); color: #fff; cursor: pointer; z-index: 2;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: background .15s;
}
.card-like .ico { width: 14px; height: 14px; }
.card-like:hover, .card-like:focus-visible { background: rgba(17,17,21,.8); outline: none; }
.card-like:focus-visible { box-shadow: 0 0 0 2px #fff; }
.card-like.is-liked { color: #fff; }
.card-like.is-liked .ico { fill: var(--accent); stroke: var(--accent); }
.card-like.is-owner { cursor: default; opacity: .85; }
/* chips used elsewhere (search results, composer picker) */
.pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 10px; border: 0; border-radius: 999px; background: var(--surface); font-size: .9rem; cursor: pointer; }
.pill .ico { width: 18px; height: 18px; }
.pill-date { background: var(--accent-soft); color: var(--accent-soft-ink); }
.pill-tag:hover { background: var(--surface-2); }
.post-views { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; font-size: .8rem; color: var(--text-2); vertical-align: middle; }
.post-views .ico { width: 14px; height: 14px; }
.comment { font-size: 1.02rem; line-height: 1.6; white-space: normal; }
.comment a { color: var(--accent-soft-ink); text-decoration: underline; }

/* Lightbox */
.lbx { position: fixed; inset: 0; z-index: 60; background: rgba(8,8,10,.94); display: flex; align-items: center; justify-content: center; animation: fade .18s; touch-action: pinch-zoom; }
@keyframes fade { from { opacity: 0; } }
.lbx img { max-width: 100vw; max-height: 100dvh; object-fit: contain; }
.lbx-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; background: rgba(255,255,255,.12); color: #fff; }
.lbx-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.lbx-arrow.prev { left: 10px; } .lbx-arrow.next { right: 10px; }
.lbx-count { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: rgba(255,255,255,.7); font-size: .85rem; }
body.lbx-open { overflow: hidden; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 var(--gutter); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 480px; width: 100%; padding: 10px 10px 10px 14px; border-radius: 16px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); font-size: .95rem; animation: toast-in .25s ease-out; }
.toast.is-hiding { animation: toast-out .25s ease-in forwards; }
@keyframes toast-in { from { transform: translateY(16px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(16px); opacity: 0; } }
.toast > .ico { width: 20px; height: 20px; color: var(--accent); }
.toast span { flex: 1; }
.toast-copy { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1.5px solid color-mix(in srgb, var(--bg) 35%, transparent); border-radius: 10px; background: transparent; color: inherit; font-weight: 600; font-size: .85rem; white-space: nowrap; cursor: pointer; }
.toast-copy .ico { width: 15px; height: 15px; }
.toast-copy.is-copied { border-color: var(--accent); color: var(--accent); }
.toast { flex-wrap: wrap; }
.toast-link { padding: 6px 12px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: .85rem; white-space: nowrap; }
.toast-x { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: inherit; opacity: .7; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.toast-x .ico { width: 16px; height: 16px; }

/* ---------- Profile ---------- */
.profile-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 12px 0 8px; }
.profile-avatar { position: relative; }
.profile-edit { position: absolute; right: -4px; bottom: 2px; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 10px rgba(0,0,0,.2); }
.profile-edit .ico { width: 18px; height: 18px; }
.profile-name { font-size: 1.6rem; }
.profile-bio { max-width: 520px; color: var(--text-2); }
.socials { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.social { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; transition: transform .15s; }
.social:hover { transform: translateY(-2px); }
.social .ico { width: 20px; height: 20px; }
.stats { display: flex; gap: 22px; color: var(--text-2); font-size: .9rem; }
.stats strong { color: var(--text); font-weight: 600; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--text-2); }
.form label > small { margin-top: -2px; }
.req { font-style: normal; font-size: .72rem; color: var(--accent-soft-ink); text-transform: uppercase; letter-spacing: .04em; margin-left: 4px; }
.form input[type="text"], .form input[type="password"], .form input[type="date"], .form input[type="url"], .form input[type="search"], .form textarea, .form select, .inline-form input, .tag-rename input {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid transparent; border-radius: 14px; background: var(--surface); color: var(--text);
  font: inherit; outline: none; transition: border-color .15s, background .15s; -webkit-appearance: none; appearance: none;
}
.form textarea { resize: vertical; min-height: 110px; }
.form input:focus, .form textarea:focus, .form select:focus, .inline-form input:focus, .tag-rename input:focus { border-color: var(--accent); background: var(--bg); }
.form select { background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 12px 16px; }
.inline-form { display: flex; gap: 10px; margin: 12px 0 18px; }
.inline-form input { flex: 1; }
.chips-pick { margin: -6px 0 4px; }
.chips-pick .pill { min-height: 34px; font-size: .85rem; padding: 0 12px; }
.chips-pick .pill.on { background: var(--accent-soft); color: var(--accent-soft-ink); }

.range-row { max-width: 420px; }
.range-row .range-wrap { display: flex; align-items: center; gap: 12px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.range-row output { min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.form label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: 1rem; }
.form label.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* Auth */
.auth-page { justify-content: center; }
.auth-page .page { display: flex; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; padding: 28px 24px; border-radius: 24px; background: var(--bg-soft); }
.auth-logo { width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.auth-logo .ico { width: 30px; height: 30px; }
.auth-card h1 { font-size: 1.5rem; }
.auth-back { margin-top: 8px; font-size: .9rem; color: var(--text-2); }
.auth-back a { display: inline-flex; align-items: center; gap: 6px; }
.auth-back .ico { width: 16px; height: 16px; }

/* ---------- Dash ---------- */
.stat-row { display: flex; gap: 18px; color: var(--text-2); font-size: .9rem; margin: -4px 0 16px; }
.stat-row strong { color: var(--text); font-weight: 600; }
.post-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.post-row { display: grid; grid-template-columns: 76px 1fr; grid-template-areas: "thumb body" "thumb actions"; gap: 6px 14px; padding: 10px; border-radius: var(--radius); background: var(--bg-soft); }
.post-thumb { grid-area: thumb; position: relative; width: 76px; height: 76px; border-radius: 14px; overflow: hidden; background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-thumb .card-badge { top: 6px; right: 6px; padding: 2px 6px; }
.post-body { grid-area: body; min-width: 0; }
.post-date { font-size: .8rem; color: var(--text-2); }
.post-excerpt { margin: 2px 0 4px; font-size: .95rem; }
.post-tags { margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.post-tags span { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: var(--surface); color: var(--text-2); }
.post-actions { grid-area: actions; display: flex; gap: 6px; align-items: center; }
.post-actions form { display: contents; }
.post-actions .icon-btn { width: 38px; height: 38px; }

/* Composer */
.composer { max-width: 680px; }
.composer-label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: .9rem; color: var(--text-2); margin-bottom: 10px; }
.pq { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pq-item, .pq-add { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--surface); }
.pq-item img { width: 100%; height: 100%; object-fit: cover; }
.pq-item.is-busy img { opacity: .5; }
.pq-item.is-err { outline: 2px solid var(--danger); outline-offset: -2px; }
.pq-item:first-child::after { content: "Cover"; position: absolute; top: 8px; left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .68rem; font-weight: 600; }
.pq-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0,0,0,.2); }
.pq-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.pq-item.is-done .pq-bar { display: none; }
.pq-state { position: absolute; left: 6px; right: 6px; bottom: 8px; font-size: .68rem; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); text-align: center; pointer-events: none; }
.pq-x, .pq-retry { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(17,17,21,.6); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.pq-x .ico { width: 14px; height: 14px; }
.pq-retry { width: auto; border-radius: 999px; padding: 0 10px; font-size: .75rem; top: auto; bottom: 8px; right: 6px; }
.pq-tools { position: absolute; left: 6px; bottom: 6px; display: none; gap: 4px; }
.pq-item.is-done .pq-tools { display: flex; }
.pq-move { width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(17,17,21,.6); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.pq-move .ico { width: 14px; height: 14px; }
.pq-move:disabled { opacity: .3; }
.pq-add button { width: 100%; height: 100%; border: 2px dashed var(--line); border-radius: 14px; background: transparent; color: var(--text-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; font-size: .8rem; }
.pq-add button:hover { border-color: var(--accent); color: var(--accent); }
.pq-add .ico { width: 26px; height: 26px; }
.composer-actions { display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; padding: 12px 0 calc(8px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); }

/* Tags dash */
.tag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tag-row { display: grid; grid-template-columns: 44px 1fr auto; grid-template-areas: "cover name count" "cover actions actions"; gap: 6px 12px; align-items: center; padding: 8px 10px; border-radius: 14px; background: var(--bg-soft); }
.tag-row.is-pinned { box-shadow: inset 3px 0 0 var(--accent); }
.tag-cover { grid-area: cover; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.tag-cover img { width: 100%; height: 100%; object-fit: cover; }
.tag-rename { grid-area: name; display: flex; gap: 6px; align-items: center; }
.tag-rename input { min-height: 40px; padding: 6px 12px; }
.tag-rename .icon-btn { width: 38px; height: 38px; flex: none; }
.tag-count { grid-area: count; }
.tag-actions { grid-area: actions; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tag-actions form { display: contents; }
.tag-actions .icon-btn { width: 36px; height: 36px; }

/* Collection cover picker */
.cover-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cover-opt { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: 14px; overflow: hidden; background: var(--surface); cursor: pointer; }
.cover-opt img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.cover-opt:hover img { transform: scale(1.04); }
.cover-opt.is-current { outline: 3px solid var(--accent); outline-offset: -3px; }
.cover-opt time { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 6px; font-size: .7rem; color: #fff; text-align: left; background: linear-gradient(to top, rgba(0,0,0,.55), transparent); }
.cover-check { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.cover-check .ico { width: 15px; height: 15px; }
.cover-auto { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 2px dashed var(--line); background: transparent; color: var(--text-2); font-size: .85rem; }
.cover-auto:hover { border-color: var(--accent); color: var(--accent); }
.cover-auto .ico { width: 26px; height: 26px; }
.tag-actions .has-cover { color: var(--accent-soft-ink); background: var(--accent-soft); }
@media (min-width: 640px) { .cover-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 900px) { .cover-grid { grid-template-columns: repeat(6, 1fr); } }

/* Quick-post link */
.token-box { display: flex; gap: 8px; margin-bottom: 10px; }
.token-box input { flex: 1; min-width: 0; min-height: 44px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-size: .85rem; font-family: ui-monospace, Menlo, monospace; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row form { display: contents; }
.danger-text { color: var(--danger); }
.btn.is-copied { background: var(--ok); color: #fff; }

/* Watermark settings */
.radio-cards { display: grid; grid-template-columns: 1fr; gap: 8px; }
.radio-card { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; color: var(--text) !important; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-card input { margin-top: 3px; accent-color: var(--accent); }
.radio-card span { display: flex; flex-direction: column; line-height: 1.3; }
.radio-card small { color: var(--text-2); font-size: .82rem; }
.wm-preview { position: relative; width: 100%; max-width: 360px; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: var(--surface); }
.wm-preview img { width: 100%; height: 100%; object-fit: cover; }
.wm-sample { position: absolute; inset: 0; background: linear-gradient(135deg, #f7b2c6, #8e7cf0 55%, #2a2a33); }
.wm-preview .wm { font-size: 11px; padding: 12px 0 8px; }
.wm-preview.is-off .wm { display: none; }
.wm-preview-label { position: absolute; top: 8px; left: 8px; padding: 3px 8px; border-radius: 999px; background: rgba(17,17,21,.55); color: #fff; font-size: .7rem; font-weight: 600; }
.bake-box { margin-top: 4px; padding: 12px 14px; border-radius: 14px; background: var(--bg-soft); }
.bake-box p { margin: 0 0 8px; }
.bake-box progress { width: 100%; height: 8px; accent-color: var(--accent); margin: 8px 0 2px; display: none; }
.bake-box.is-running progress { display: block; }
@media (min-width: 640px) { .radio-cards { grid-template-columns: repeat(3, 1fr); } }

.form textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; line-height: 1.5; white-space: pre; overflow-x: auto; tab-size: 2; }

/* Settings */
.settings-page .section { max-width: 680px; }
.settings-page h2 { margin-bottom: 14px; font-size: 1.2rem; }
.settings-page h3 { font-size: 1rem; margin-top: 8px; }
.avatar-edit { display: flex; align-items: center; gap: 18px; }
.avatar-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Desktop ---------- */
@media (min-width: 640px) {
  :root { --gutter: 24px; --gap: 16px; }
  .masonry { grid-template-columns: repeat(3, 1fr); }
  .btn-new span { display: inline; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .pq { grid-template-columns: repeat(4, 1fr); }
  .bubble { width: 84px; } .bubble-img { width: 76px; height: 76px; }
  .gallery-arrow { display: flex; }
  .post-row { grid-template-columns: 76px 1fr auto; grid-template-areas: "thumb body actions"; }
  .tag-row { grid-template-columns: 44px 1fr auto auto; grid-template-areas: "cover name count actions"; }
}
@media (min-width: 900px) {
  :root { --gutter: 32px; --top-h: 72px; }
  .desk-nav { display: flex; }
  .masonry { grid-template-columns: repeat(4, 1fr); }
  .searchbar { max-width: 520px; margin-left: auto; margin-right: auto; }
  .detail-wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 32px; align-items: start; }
  .detail-info { position: sticky; top: calc(var(--top-h) + 16px); padding-top: 8px; gap: 22px; }
  .detail .comment { font-size: 1.2rem; }
  .gallery-slide { max-height: calc(100dvh - var(--top-h) - 40px); }
  .profile-card { padding-top: 24px; }
  .composer-page .page { max-width: 760px; }
  h2 { font-size: 1.6rem; }
}
/* ---------- Skin flourishes ---------- */
/* Synth Pop: glowing accents, gradient headings, faint horizon grid in dark */
:root[data-skin="synth"] .btn-primary, :root[data-skin="synth"] .social, :root[data-skin="synth"] .profile-edit, :root[data-skin="synth"] .toast-link { box-shadow: 0 0 18px var(--glow); }
:root[data-skin="synth"] h2, :root[data-skin="synth"] h1.h2, :root[data-skin="synth"] .profile-name, :root[data-skin="synth"] .collection-title {
  background: linear-gradient(90deg, var(--accent), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; width: fit-content; font-weight: 600; letter-spacing: -.02em;
}
:root[data-skin="synth"] .collection-title .muted { -webkit-text-fill-color: var(--text-2); }
:root[data-skin="synth"] .pill-tag { background: color-mix(in srgb, var(--cyan) 16%, var(--surface)); color: color-mix(in srgb, var(--cyan) 70%, var(--text)); }
:root[data-skin="synth"] .chip:hover { box-shadow: 0 0 12px var(--glow); }
:root[data-skin="synth"] .detail-meta time { color: var(--cyan); }
:root[data-skin="synth"] .see-all, :root[data-skin="synth"] .comment a { color: var(--cyan); }
:root[data-skin="synth"] .bubble:hover .bubble-img, :root[data-skin="synth"] .card:hover { box-shadow: 0 0 22px var(--glow); }
:root[data-skin="synth"] .card { transition: box-shadow .2s; }
:root[data-skin="synth"] .drawer-nav .ico { color: var(--cyan); }
:root[data-skin="synth"][data-theme="dark"] body { background-image: radial-gradient(ellipse at 50% 120%, rgba(255,47,168,.18), transparent 55%); background-attachment: fixed; }
:root[data-skin="synth"][data-theme="dark"] .foot { background: repeating-linear-gradient(to right, transparent 0 39px, rgba(39,225,255,.08) 39px 40px), linear-gradient(to top, rgba(39,225,255,.08), transparent); }
:root[data-skin="synth"] .top-title, :root[data-skin="synth"] .drawer-head strong { letter-spacing: .02em; }

/* Mono: squarer, bolder, hairline borders instead of soft fills */
:root[data-skin="mono"] .btn, :root[data-skin="mono"] .pill, :root[data-skin="mono"] .icon-btn, :root[data-skin="mono"] .searchbar { border-radius: var(--radius-sm); }
:root[data-skin="mono"] .btn-primary { text-transform: uppercase; letter-spacing: .06em; font-size: .85rem; }
:root[data-skin="mono"] .card { border-radius: var(--radius); }
:root[data-skin="mono"] .pill-date { background: var(--accent); color: var(--accent-ink); }
:root[data-skin="mono"] .pill-tag { background: transparent; border: 1.5px solid var(--text); color: var(--text); }
:root[data-skin="mono"] .chip { background: transparent; border: 1.5px solid var(--line); color: var(--text); border-radius: var(--radius-sm); }
:root[data-skin="mono"] .chip:hover { border-color: var(--accent); color: var(--accent); background: transparent; }
:root[data-skin="mono"] .detail-meta time { color: var(--accent); }
:root[data-skin="mono"] h2, :root[data-skin="mono"] h1.h2, :root[data-skin="mono"] .profile-name, :root[data-skin="mono"] .collection-title { font-weight: 700; letter-spacing: -.03em; }
:root[data-skin="mono"] .section-head h2::after, :root[data-skin="mono"] .section-head h1::after { content: ""; display: block; width: 28px; height: 3px; margin-top: 6px; background: var(--accent); }
:root[data-skin="mono"] .bubble-img { border-radius: var(--radius-sm); }
:root[data-skin="mono"] .social { border-radius: var(--radius-sm); }
:root[data-skin="mono"] .avatar { border-radius: var(--radius-sm); }
:root[data-skin="mono"] .top { border-bottom: 1px solid var(--line); }

/* Settings: skin cards */
.skin-cards .radio-card span { gap: 4px; }
.swatch { display: inline-flex; gap: 4px; margin-bottom: 4px; }
.swatch i { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); display: inline-block; }
.accent-row { max-width: 320px; }
.accent-pick { display: flex; align-items: center; gap: 10px; }
.accent-pick input[type="color"] { width: 48px; height: 40px; padding: 2px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.accent-pick input[type="color"]:disabled { opacity: .4; cursor: not-allowed; }
.accent-pick code { font-size: .9rem; color: var(--text-2); }
@media (min-width: 640px) { .skin-cards { grid-template-columns: repeat(2, 1fr); } }

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