:root {
  --bg: #0e0f13;
  --bg2: #15171d;
  --bg3: #1c1f27;
  --line: #2a2e38;
  --text: #e9eaee;
  --muted: #8d93a3;
  --accent: #e8b04a;
  --accent-ink: #1a1305;
  --danger: #e5534b;
  --ok: #3fb68b;
  --radius: 10px;
  --shadow: 0 10px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--danger); min-height: 1.2em; margin: 0; }
input, textarea, select {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 11px; width: 100%; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 5px; text-transform: uppercase; letter-spacing: .04em; }
label.check { display: flex; gap: 8px; align-items: center; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); }
label.check input { width: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--bg3); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #3c4250; background: #232733; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg3); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { padding: 0 10px; }
.btn:disabled { opacity: .5; cursor: default; }

/* auth */
.auth { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 50% -10%, #241d10 0%, var(--bg) 60%); }
.auth-card { width: 100%; max-width: 360px; display: grid; gap: 12px; text-align: center; }
.auth-card h1 { margin: 0; font-size: 22px; }
.auth-card p { margin: 0; }
.auth-logo svg { width: 46px; height: 46px; color: var(--accent); stroke-width: 1.4; }
.auth-card .btn { height: 42px; }

/* header */
.top { position: sticky; top: 0; z-index: 20; display: flex; gap: 10px; align-items: center;
  padding: 10px 16px; background: rgba(14,15,19,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; font-size: 16px; }
.brand svg { color: var(--accent); width: 22px; height: 22px; }
.search { flex: 1; position: relative; max-width: 720px; margin: 0 auto; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 36px; height: 38px; background: var(--bg2); }
.tabs { display: flex; gap: 4px; padding: 8px 16px 0; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 9px 13px 11px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-color: var(--accent); }
.tab .n { font-size: 11px; color: var(--muted); margin-left: 4px; }

main { padding: 14px 16px 120px; max-width: 2200px; margin: 0 auto; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; min-height: 36px; }
.bar .grow { flex: 1; }
.bar select { width: auto; height: 34px; padding: 0 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 12px; border-radius: 99px;
  background: #2b2414; color: var(--accent); border: 1px solid #4a3b18; font-weight: 500; }
.chip button { background: none; border: 0; color: inherit; cursor: pointer; display: grid; place-items: center; padding: 2px; border-radius: 99px; }
.chip button:hover { background: rgba(255,255,255,.08); }
.chip svg { width: 14px; height: 14px; }
.count { color: var(--muted); font-size: 13px; }

/* grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.grid.dense { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.card { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--bg2); cursor: pointer;
  border: 1px solid transparent; transition: border-color .12s; }
.card:hover { border-color: var(--line); }
.card .th { aspect-ratio: 4/3; background: var(--bg3) center/cover no-repeat; display: grid; place-items: center; color: var(--muted); }
.card .th svg { width: 36px; height: 36px; stroke-width: 1.3; }
.card .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .meta { padding: 7px 9px 9px; }
.card .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { position: absolute; left: 7px; top: 7px; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 5px;
  background: rgba(0,0,0,.7); color: #fff; letter-spacing: .02em; }
.card .th { position: relative; }
.dur { position: absolute; right: 7px; bottom: 7px; font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 5px; background: rgba(0,0,0,.75); }
.card .acts { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.card:hover .acts, .card .acts.show { opacity: 1; }
.iconbtn { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; border: 0;
  background: rgba(0,0,0,.72); color: #fff; cursor: pointer; }
.iconbtn:hover { background: #000; }
.iconbtn.del:hover { background: var(--danger); }
.iconbtn.fav.on { color: var(--accent); }
.iconbtn.fav.on svg { fill: currentColor; }
.iconbtn svg { width: 16px; height: 16px; }
.card .sel { position: absolute; top: 7px; left: 7px; width: 22px; height: 22px; border-radius: 6px; border: 2px solid #fff;
  background: rgba(0,0,0,.4); display: none; place-items: center; }
.selecting .card .sel { display: grid; }
.selecting .card .badge { left: 36px; }
.card.picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.card.picked .sel { background: var(--accent); border-color: var(--accent); }
.card.picked .sel::after { content: ""; width: 10px; height: 6px; border: 2px solid var(--accent-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px,-1px); }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 42px; height: 42px; stroke-width: 1.2; margin-bottom: 10px; }
.sentinel { height: 1px; }
.loading { padding: 20px; text-align: center; color: var(--muted); }

/* selection bar */
.selbar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 30; display: flex; flex-wrap: wrap; gap: 6px;
  align-items: center; padding: 8px; background: var(--bg3); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  max-width: calc(100vw - 24px); }
.selbar .n { padding: 0 8px; font-weight: 600; }

/* creators */
.creators { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.ccard { background: var(--bg2); border-radius: var(--radius); overflow: hidden; cursor: pointer; border: 1px solid transparent; position: relative; }
.ccard:hover { border-color: var(--line); }
.ccard .th { aspect-ratio: 16/9; background: var(--bg3) center/cover no-repeat; display: grid; place-items: center; color: var(--muted); }
.ccard .th svg { width: 34px; height: 34px; stroke-width: 1.3; }
.ccard .meta { padding: 10px 12px 12px; }
.ccard .t { font-weight: 600; font-size: 15px; }
.ccard .s { font-size: 12px; color: var(--muted); }
.ccard .acts { position: absolute; top: 6px; right: 6px; opacity: 0; }
.ccard:hover .acts { opacity: 1; }

/* stories */
.stories { display: grid; gap: 10px; max-width: 980px; }
.scard { display: flex; gap: 14px; padding: 14px; background: var(--bg2); border-radius: var(--radius); cursor: pointer; border: 1px solid transparent; }
.scard:hover { border-color: var(--line); }
.scard .thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 120px; height: 120px; flex: none; border-radius: 8px; overflow: hidden; background: var(--bg3); }
.scard .thumbs.one { grid-template-columns: 1fr; }
.scard .thumbs div { background: var(--bg3) center/cover no-repeat; }
.scard .body { min-width: 0; flex: 1; }
.scard .t { font-weight: 600; font-size: 16px; margin-bottom: 3px; }
.scard .s { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.scard .x { color: #c4c7d0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.story { max-width: 900px; margin: 0 auto; }
.story h1 { margin: 6px 0 4px; font-size: 26px; line-height: 1.25; }
.story .s { color: var(--muted); margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.story .s a { color: var(--accent); }
.prose { font-size: 16px; line-height: 1.7; color: #dcdee5; overflow-wrap: anywhere; }
.prose p { margin: 0 0 1em; }
.prose a { color: var(--accent); }
.prose img { max-width: 100%; }
.prose blockquote { margin: 0 0 1em; padding-left: 14px; border-left: 3px solid var(--line); color: var(--muted); }
.plain { white-space: pre-wrap; }
.section-h { display: flex; align-items: center; gap: 10px; margin: 28px 0 12px; }
.section-h h2 { font-size: 15px; margin: 0; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.section-h .grow { flex: 1; height: 1px; background: var(--line); }
.comment { padding: 12px 14px; background: var(--bg2); border-radius: var(--radius); margin-bottom: 10px; position: relative; }
.comment .when { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.comment .del { position: absolute; top: 8px; right: 8px; }
.comment .grid { margin-top: 10px; }
.composer { background: var(--bg2); border-radius: var(--radius); padding: 12px; }
.composer .row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.attached { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.attached .a { width: 64px; height: 64px; border-radius: 6px; background: var(--bg3) center/cover; position: relative; }
.attached .a button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 99px; border: 0; background: var(--danger); color: #fff; cursor: pointer; font-size: 13px; line-height: 1; }

/* viewer */
.viewer { position: fixed; inset: 0; z-index: 50; display: flex; background: rgba(5,6,8,.97); }
.viewer .stage { flex: 1; min-width: 0; position: relative; display: grid; place-items: center; }
.viewer .stage > video, .viewer .stage > img { max-width: 100%; max-height: 100vh; display: block; outline: none; }
.viewer .stage > img.actual { max-width: none; max-height: none; }
.viewer .stage.scroll { overflow: auto; place-items: start center; }
.viewer .stage audio { width: min(600px, 90%); }
.viewer .audiowrap { display: grid; gap: 18px; justify-items: center; width: 100%; }
.viewer .audiowrap img { max-width: 320px; max-height: 320px; border-radius: 10px; }
.viewer .filebox { text-align: center; display: grid; gap: 14px; justify-items: center; color: var(--muted); }
.viewer .filebox svg { width: 64px; height: 64px; stroke-width: 1.1; }
.viewer .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 70px; border: 0; border-radius: 10px;
  background: rgba(255,255,255,.06); color: #fff; cursor: pointer; display: grid; place-items: center; z-index: 2; }
.viewer .nav:hover { background: rgba(255,255,255,.14); }
.viewer .nav.prev { left: 10px; } .viewer .nav.next { right: 10px; }
.viewer .nav svg { width: 26px; height: 26px; }
.viewer .vtop { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; z-index: 3; }
.viewer .panel { width: 360px; flex: none; background: var(--bg2); border-left: 1px solid var(--line); overflow-y: auto; padding: 16px; }
.viewer.nopanel .panel { display: none; }
.viewer .panel h3 { margin: 0 0 2px; font-size: 16px; overflow-wrap: anywhere; }
.viewer .panel .facts { font-size: 12px; color: var(--muted); display: grid; gap: 3px; margin: 10px 0 4px; overflow-wrap: anywhere; }
.viewer .panel .facts a { color: var(--accent); }
.viewer .panel .btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.viewer .panel .storylinks a { display: block; color: var(--accent); margin: 3px 0; }

/* modal */
.modal-bg { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow: auto; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.modal.wide { max-width: 1100px; }
.modal h2 { margin: 0 0 6px; font-size: 18px; }
.modal p { margin: 6px 0; color: #c9ccd4; overflow-wrap: anywhere; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.modal .picker-grid { max-height: 60vh; overflow: auto; margin-top: 12px; }

/* upload */
.drop-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(14,15,19,.85); display: grid; place-items: center; pointer-events: none; }
.drop-overlay div { border: 2px dashed var(--accent); border-radius: 20px; padding: 60px 70px; font-size: 22px; font-weight: 600; text-align: center; color: var(--accent); }
.drop-overlay small { display: block; font-size: 14px; color: var(--muted); font-weight: 400; margin-top: 8px; }
.upload-dock { position: fixed; right: 16px; bottom: 16px; z-index: 40; width: 340px; max-width: calc(100vw - 32px); background: var(--bg3);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.upload-dock .h { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 8px; gap: 8px; }
.progress { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.upload-dock .cur { font-size: 12px; color: var(--muted); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-summary { background: var(--bg); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--muted); max-height: 160px; overflow: auto; }
.upload-summary b { color: var(--text); }

/* settings */
.settings { max-width: 860px; display: grid; gap: 16px; }
.panelbox { background: var(--bg2); border-radius: 12px; padding: 18px; border: 1px solid var(--line); }
.panelbox h2 { margin: 0 0 4px; font-size: 16px; }
.panelbox .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 10px; }
.stat { background: var(--bg); border-radius: 8px; padding: 10px 12px; }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 12px; color: var(--muted); }
.subs { display: grid; gap: 6px; margin-top: 10px; }
.subrow { display: grid; grid-template-columns: 1fr 200px auto auto; gap: 6px; }
.log { background: #07080a; border-radius: 8px; padding: 10px; font: 12px/1.5 ui-monospace, Consolas, monospace; color: #b8bcc7;
  max-height: 320px; overflow: auto; white-space: pre-wrap; margin-top: 12px; overflow-wrap: anywhere; }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
ol.help { margin: 8px 0 0; padding-left: 20px; color: #c9ccd4; }
ol.help li { margin: 3px 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; background: #2a2e38; color: var(--text);
  padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast.bad { background: #4a1d1b; }

@media (max-width: 860px) {
  .viewer { flex-direction: column; overflow-y: auto; }
  .viewer .stage { min-height: 60vh; flex: none; }
  .viewer .stage > video, .viewer .stage > img { max-height: 70vh; }
  .viewer .panel { width: 100%; border-left: 0; border-top: 1px solid var(--line); }
  .viewer.nopanel .panel { display: block; }
  .viewer .nav { width: 38px; height: 54px; }
  .subrow { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .top { gap: 6px; padding: 8px 10px; }
  .brand span, .btn .lbl { display: none; }
  main { padding: 10px 10px 120px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .tabs { padding: 4px 8px 0; }
  .scard .thumbs { width: 80px; height: 80px; }
  .card .acts { opacity: 1; }
}

/* creator header + avatars */
.chead { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.chead-cover { height: 140px; background: var(--bg3) center/cover no-repeat; }
.chead-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; flex-wrap: wrap; }
.chead-row .grow { flex: 1; }
.chead-av { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid var(--bg2); }
.chead-cover + .chead-row .chead-av { margin-top: -38px; width: 72px; height: 72px; border-width: 3px; }
.chead-txt { min-width: 0; }
.chead-txt .t { font-weight: 700; font-size: 18px; }
.chead-txt a { color: var(--accent); font-size: 13px; }
.chead-about { padding: 0 14px 12px; }
.chead-about summary { cursor: pointer; color: var(--muted); }
.chead-about .prose { font-size: 14px; margin-top: 8px; }
.ccard .meta { display: flex; gap: 10px; align-items: center; }
.ccard .cav { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; }

/* archived Patreon comments */
.pcs { display: grid; gap: 4px; }
.pc { display: flex; gap: 10px; padding: 10px 12px; background: var(--bg2); border-radius: var(--radius); }
.pc .pc { background: transparent; padding: 10px 0 0; border-radius: 0; }
.pc.by-creator > .pc-main > .pc-h b { color: var(--accent); }
.pc-av { flex: none; }
.pc-av img, .pc-av span { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; background: var(--bg3); font-weight: 700; color: var(--muted); }
.pc .pc .pc-av img, .pc .pc .pc-av span { width: 28px; height: 28px; }
.pc-main { min-width: 0; flex: 1; }
.pc-h { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 13px; }
.pc-b { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; color: #dcdee5; }
.pc-replies { border-left: 2px solid var(--line); padding-left: 12px; margin-top: 4px; }
.pc-status { font-size: 12px; }
.tag { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: #2b2414; color: var(--accent); }
.tag.warn { background: #3a1a18; color: #f0a39e; }

.subrow .subopts { grid-column: 1 / -1; display: grid; gap: 6px; padding: 2px 0 10px; border-bottom: 1px solid var(--line); }
.subrow .subopts label.check { font-size: 13px; margin: 0; }

/* 3D player */
.stereo { position: fixed; inset: 0; z-index: 120; background: #000; cursor: grab; }
.stereo canvas { width: 100%; height: 100%; display: block; }
.stereo.idle { cursor: none; }
.stereo .st-ui { position: absolute; inset: auto 0 0 0; display: grid; grid-template-columns: 1fr 1fr; pointer-events: none; transition: opacity .3s; }
.stereo.mono .st-ui { grid-template-columns: 1fr; }
.stereo.mono .st-half + .st-half { display: none; }
.stereo.idle .st-ui { opacity: 0; }
.st-half { display: grid; justify-items: center; gap: 4px; padding: 0 4% 22px; }
.st-title { font-size: 12px; color: #aab; text-shadow: 0 1px 3px #000; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; order: -1; }
.st-bar { pointer-events: auto; display: flex; align-items: center; gap: 6px; width: min(560px, 100%); padding: 6px 8px; border-radius: 10px; background: rgba(15,16,20,.82); cursor: default; }
.st-bar button { background: none; border: 0; color: #fff; font: 600 13px system-ui; min-width: 30px; height: 28px; border-radius: 6px; cursor: pointer; }
.st-bar button:hover, .st-bar button.on { background: rgba(255,255,255,.14); }
.st-seek { flex: 1; min-width: 60px; padding: 0; accent-color: var(--accent); }
.st-time { font: 12px ui-monospace, monospace; color: #ccd; white-space: nowrap; }
.stereo .st-msg { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); padding: 8px 14px; border-radius: 8px;
  background: rgba(15,16,20,.85); color: #fff; font-size: 13px; opacity: 0; transition: opacity .3s; pointer-events: none; text-align: center; }
.stereo .st-msg.on { opacity: 1; }

/* engagement (likes / comments from the linked Patreon posts) */
.card .eng { display: flex; gap: 12px; margin-top: 4px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card .eng span { display: inline-flex; align-items: center; gap: 4px; }
.card .eng svg { width: 13px; height: 13px; stroke-width: 2; }
.card .eng span:first-child svg { color: #e5707a; fill: #e5707a33; }
