:root {
  --bg: #121417; --bg2: #1b1e23; --bg3: #24282f; --fg: #e8eaed; --muted: #9aa0a8; --line: #2e333b;
  --accent: #4f8cff; --star: #ffc53d; --like: #4cd37a; --neutral: #8fa3bf; --block: #ff5c5c;
  --radius: 10px; --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .6rem; }
h2 { font-size: 1.15rem; margin: 1.8rem 0 .6rem; color: var(--muted); letter-spacing: .02em; }
p { margin: .5rem 0; }
code, pre, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
pre { background: var(--bg2); padding: .8rem 1rem; border-radius: var(--radius); overflow-x: auto; }
kbd { background: var(--bg3); border: 1px solid var(--line); border-radius: 4px; padding: 0 .35em; }
.muted { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; color: var(--muted); margin: 0; }
.narrow { max-width: 460px; margin: 10vh auto; padding: 0 1.2rem; }
.wide { max-width: 1500px; margin: 0 auto; padding: 1rem 1.2rem 3rem; }
.ic { width: 1.15em; height: 1.15em; vertical-align: -.2em; }
.c-star { color: var(--star); } .c-like { color: var(--like); } .c-neutral { color: var(--neutral); } .c-block { color: var(--block); }

/* forms and buttons */
.stack { display: flex; flex-direction: column; gap: .8rem; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: var(--muted); }
input[type=text], input[type=password], textarea { background: var(--bg2); border: 1px solid var(--line); color: var(--fg); padding: .6rem .7rem; border-radius: 8px; font: inherit; }
textarea { resize: vertical; font-family: var(--font); }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.btn { display: inline-flex; align-items: center; gap: .35em; background: var(--bg3); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .9rem; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #2c313a; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #3f7bea; }
.btn.danger { color: var(--block); }
.btn.small { padding: .35rem .7rem; font-size: .9rem; }
.btn.tiny { padding: .2rem .55rem; font-size: .8rem; border-radius: 6px; }
summary.btn { list-style: none; } summary::-webkit-details-marker { display: none; }
.flash { padding: .7rem .9rem; border-radius: var(--radius); background: var(--bg2); border: 1px solid var(--line); }
.flash.ok { border-color: #2f6b45; } .flash.err { border-color: #7a2f2f; color: #ffb4b4; }
.flash .link { margin-left: .4rem; }

/* header bar */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 1.2rem; background: var(--bg2); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bar.sticky { position: sticky; top: 0; z-index: 5; }
.bar-l, .bar-r, .bar-m { display: flex; align-items: center; gap: .6rem; }
.bar-m { flex: 1; justify-content: center; min-width: 200px; }
.progress { white-space: nowrap; font-size: .9rem; }
.progressbar { width: 160px; height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.progressbar i { display: block; height: 100%; background: var(--like); transition: width .3s; }
.pw { position: relative; }
.pw .pop { position: absolute; right: 0; top: 2.4rem; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; width: 240px; z-index: 10; }

/* admin folder table */
table.folders { width: 100%; border-collapse: collapse; background: var(--bg2); border-radius: var(--radius); overflow: hidden; }
.folders th, .folders td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.folders th { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.folders .num { text-align: right; width: 5rem; }
.folders .fname { font-weight: 600; white-space: nowrap; }
.folders .act { width: 6rem; text-align: right; }
.folders tr.hl td { animation: hl 2.4s ease-out; }
@keyframes hl { 0%, 40% { background: #2a3a2f; } 100% { background: transparent; } }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.share:last-of-type { border-bottom: 0; }
.share.dead { opacity: .55; }
.share .link { color: var(--fg); background: var(--bg3); padding: .15rem .4rem; border-radius: 5px; max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share .meta { color: var(--muted); font-size: .85rem; }
.share .actions { margin-left: auto; display: flex; gap: .3rem; }
.newlink { display: flex; gap: .4rem; margin-top: .4rem; }
.newlink input { padding: .25rem .5rem; font-size: .85rem; width: 12rem; }

/* chips and filters */
.chips { list-style: none; padding: 0; margin: 0 0 .6rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .35em; background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: .3rem .8rem; font: inherit; font-size: .88rem; color: var(--fg); cursor: default; }
button.chip { cursor: pointer; } button.chip:hover { background: var(--bg3); }
.chip.on { border-color: var(--accent); background: #22304a; }
.filters { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0 1rem; }
.help { color: var(--muted); font-size: .9rem; }
.help.kbd { margin-top: 2rem; }
@media (pointer: coarse) { .help.kbd { display: none; } }

/* grid of cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; }
.card { margin: 0; background: var(--bg2); border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s; }
.card[hidden] { display: none; }
.card[data-r=star] { border-color: var(--star); }
.card[data-r=like] { border-color: var(--like); }
.card[data-r=neutral] { border-color: var(--neutral); }
.card[data-r=block] { border-color: var(--block); }
.card[data-r=block] img { opacity: .45; filter: grayscale(.6); }
.card .img { display: block; width: 100%; aspect-ratio: 3 / 4; background: #0b0d10; border: 0; padding: 0; cursor: zoom-in; }
.card .img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card figcaption { padding: .45rem .5rem .5rem; display: flex; flex-direction: column; gap: .4rem; }
.card .fn { font-size: .72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* rating buttons */
.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; }
.rb { display: flex; flex-direction: column; align-items: center; gap: .15rem; background: var(--bg3); border: 1px solid transparent; color: var(--muted); border-radius: 8px; padding: .4rem .2rem; cursor: pointer; font: inherit; font-size: .62rem; line-height: 1; }
.rb .ic { width: 1.35rem; height: 1.35rem; }
.rb:hover { color: var(--fg); background: #2f353f; }
.rb-star[aria-pressed=true] { background: var(--star); color: #2b2000; }
.rb-like[aria-pressed=true] { background: var(--like); color: #062d14; }
.rb-neutral[aria-pressed=true] { background: var(--neutral); color: #0f1720; }
.rb-block[aria-pressed=true] { background: var(--block); color: #3a0606; }
.rb span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* admin results votes */
.results .card .img { cursor: zoom-in; }
.votes { display: flex; flex-wrap: wrap; gap: .25rem; font-size: .75rem; }
.vote { display: inline-flex; align-items: center; gap: .25em; background: var(--bg3); border-radius: 5px; padding: .1rem .4rem; }
.v-star { color: var(--star); } .v-like { color: var(--like); } .v-neutral { color: var(--neutral); } .v-block { color: var(--block); }

/* lightbox */
.lb { position: fixed; inset: 0; z-index: 50; background: rgba(6, 8, 10, .96); display: flex; flex-direction: column; }
.lb[hidden] { display: none; }
.lb-top { display: flex; align-items: center; justify-content: space-between; padding: .5rem .8rem; color: var(--muted); font-size: .9rem; gap: .6rem; }
.lb-stage { flex: 1; position: relative; min-height: 0; display: flex; align-items: center; justify-content: center; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lb-nav { position: absolute; top: 0; bottom: 0; width: 18%; border: 0; background: transparent; color: #fff; opacity: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lb-nav .ic { width: 3rem; height: 3rem; filter: drop-shadow(0 0 6px #000); }
.lb-nav:hover, .lb-nav:focus-visible { opacity: .9; }
.lb-prev { left: 0; } .lb-next { right: 0; }
.lb-bottom { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: .6rem .8rem calc(.6rem + env(safe-area-inset-bottom)); flex-wrap: wrap; }
.lb-bottom .rate { grid-template-columns: repeat(4, minmax(72px, 110px)); width: 100%; max-width: 520px; }
.lb-bottom .rb { font-size: .75rem; padding: .55rem .3rem; }
.lb-bottom .rb .ic { width: 1.6rem; height: 1.6rem; }
.lb-opt { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: .35em; }
.lb .btn.close { background: transparent; border: 0; }
.lb .btn.close .ic { width: 1.5rem; height: 1.5rem; }

.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: #3a1414; color: #ffb4b4; border: 1px solid #7a2f2f; padding: .6rem 1rem; border-radius: var(--radius); z-index: 60; }

@media (max-width: 600px) {
  .wide { padding: .8rem .6rem 2rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
  .rb span { display: none; }
  .bar { padding: .5rem .7rem; }
  .bar-m { order: 3; width: 100%; }
  .progressbar { flex: 1; }
  .folders th:first-child, .folders .fname { white-space: normal; }
  .share .link { max-width: 100%; }
}

/* gallery info panel and admin viewer notes */
.info { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .9rem; margin: .6rem 0; }
.info summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.info summary::-webkit-details-marker { display: none; }
.info summary::before { content: "▸"; color: var(--muted); }
.info[open] summary::before { content: "▾"; }
.info form { margin-top: .8rem; max-width: 640px; }
.chip.small { font-size: .78rem; padding: .15rem .6rem; }
.row { display: flex; align-items: center; gap: .8rem; }
.people { list-style: none; padding: 0; margin: 0 0 .8rem; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.person { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; display: flex; flex-direction: column; gap: .4rem; }
.person .chip { align-self: flex-start; }
.person .note { margin: 0; padding: .4rem .7rem; border-left: 3px solid var(--accent); background: var(--bg3); border-radius: 0 6px 6px 0; white-space: pre-wrap; font-size: .9rem; }
.small { font-size: .85rem; }
.rename { position: relative; display: inline-block; }
.rename summary { list-style: none; }
.rename .pop { position: absolute; right: 0; top: 1.8rem; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; width: 220px; z-index: 10; }

/* admin lightbox votes */
.lb-votes { justify-content: center; font-size: .95rem; gap: .5rem; }
.lb-votes .vote { padding: .3rem .7rem; }
.lb-votes:empty::after { content: "no votes yet"; color: var(--muted); }
