:root {
  --bg: #0f1115; --panel: #181b22; --fg: #e8eaed; --muted: #9aa0aa;
  --bd: #2a2f3a; --acc: #4f8cff; --err: #ff6b6b;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--panel); padding: .15em .4em; border-radius: 5px;
  font-size: 1.05em; letter-spacing: 1px; word-break: break-all; }

header { display: flex; align-items: center; gap: 1rem; padding: .8rem 1.2rem;
  border-bottom: 1px solid var(--bd); background: var(--panel); }
header .brand { font-weight: 700; color: var(--fg); margin-right: auto; }
header .who { color: var(--muted); }
main { padding: 1.2rem; max-width: 1200px; margin: 0 auto; }
h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h2 { font-size: 1.05rem; margin: 1.4rem 0 .6rem; }
.hint { color: var(--muted); }
.err { color: var(--err); background: rgba(255,107,107,.12);
  border: 1px solid rgba(255,107,107,.3); padding: .6rem .8rem; border-radius: 8px; }

/* Auth cards */
.authbox { max-width: 420px; margin: 2.5rem auto; background: var(--panel);
  border: 1px solid var(--bd); border-radius: 14px; padding: 1.6rem 1.7rem; }
.authbox form { display: flex; flex-direction: column; gap: .9rem; }
.authbox label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem;
  color: var(--muted); }
.authbox input { padding: .6rem .7rem; background: var(--bg); color: var(--fg);
  border: 1px solid var(--bd); border-radius: 8px; font-size: 15px; }
.authbox input:focus { outline: none; border-color: var(--acc); }
.qr { display: block; background: #fff; padding: 8px; border-radius: 10px; }
button { cursor: pointer; font-size: 15px; }
.authbox button[type=submit], header button.link { font: inherit; }
button[type=submit] { margin-top: .4rem; padding: .65rem 1rem; border: none;
  border-radius: 8px; background: var(--acc); color: #fff; font-weight: 600; }
button[type=submit]:hover { filter: brightness(1.08); }
.linkform { display: inline; }
button.link, a.link { background: none; border: none; color: var(--muted);
  padding: 0; font: inherit; }
button.link:hover { color: var(--fg); text-decoration: underline; }

/* Library grid */
.grid { display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card { display: block; background: var(--panel); border: 1px solid var(--bd);
  border-radius: 12px; overflow: hidden; color: var(--fg); }
.card:hover { border-color: var(--acc); text-decoration: none; }
.thumb { position: relative; aspect-ratio: 16/9; background: #000; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .noimg { display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--muted); font-size: .85rem; }
.thumb .dur { position: absolute; right: .4rem; bottom: .4rem;
  background: rgba(0,0,0,.75); color: #fff; font-size: .75rem;
  padding: .1rem .35rem; border-radius: 4px; }
.meta { display: flex; align-items: baseline; gap: .5rem; padding: .55rem .65rem; }
.meta .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta .res { color: var(--muted); font-size: .8rem; }

.thumb .likebadge { position: absolute; left: .4rem; top: .4rem;
  border-radius: 999px; min-width: 1.7rem; height: 1.7rem; padding: 0 .35rem;
  display: flex; align-items: center; justify-content: center; font-size: .95rem;
  border: 1.5px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.thumb .likebadge.like { background: #2e7d3a; }
.thumb .likebadge.dislike { background: #c0392b; }
.thumb .newbadge { position: absolute; right: .4rem; top: .4rem; font-size: .7rem;
  font-weight: 700; color: #fff; background: #4f8cff; border-radius: 999px;
  padding: .12rem .5rem; box-shadow: 0 1px 4px rgba(0,0,0,.5); }

/* Player */
.player video { width: 100%; max-height: 80vh; background: #000; border-radius: 10px; }
.player .playhead { display: flex; align-items: center; gap: 1rem; margin: 1rem 0 .3rem; }
.player .playhead h1 { margin: 0; font-size: 1.15rem; flex: 1; }
.react { display: inline-flex; gap: .5rem; }
/* Base: identical neutral pills so the pair reads as one control. */
.reactbtn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  cursor: pointer; min-width: 112px; padding: .5rem 1rem; font: inherit; font-weight: 600;
  white-space: nowrap; border-radius: 999px; border: 1.5px solid var(--bd);
  background: var(--panel); color: var(--muted); transition: all .12s ease; }
.reactbtn .ic { font-size: 1.05rem; line-height: 1; filter: grayscale(1); opacity: .8; }
.reactbtn:hover { color: var(--fg); border-color: var(--muted); }
.reactbtn[disabled] { opacity: .55; cursor: default; }
/* Active: solid fill in the reaction's colour — the current status is obvious. */
.reactbtn.on { color: #fff; }
.reactbtn.on .ic { filter: none; opacity: 1; }
.reactbtn.like.on { background: #2e7d3a; border-color: #2e7d3a; }
.reactbtn.dislike.on { background: #c0392b; border-color: #c0392b; }
.reactbtn.like.on:hover { background: #2e7d3a; border-color: #2e7d3a; }
.reactbtn.dislike.on:hover { background: #c0392b; border-color: #c0392b; }
.player .comment { margin: .8rem 0 0; padding: .8rem 1rem; background: var(--panel);
  border: 1px solid var(--bd); border-left: 3px solid var(--acc); border-radius: 8px;
  white-space: pre-wrap; overflow-wrap: anywhere; }

/* Comment thread */
.comments { width: 100%; margin: 1.6rem 0 0; }
.comments h2 { font-size: 1.1rem; margin: 0 0 .9rem; }
.thread { display: flex; flex-direction: column; gap: .7rem; margin-bottom: 1.1rem; }
.cmt { padding: .55rem .8rem; border: 1px solid var(--bd); border-radius: 12px;
  background: var(--panel); max-width: 80%; }
.cmt.mine { align-self: flex-end; border-color: #2f4a7a; background: rgba(79,140,255,.12);
  border-bottom-right-radius: 4px; }
.cmt.admin { align-self: flex-start; border-bottom-left-radius: 4px; }
.cmt-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.cmt .when { color: var(--muted); font-size: .7rem; margin-top: .25rem; text-align: right; }
.cmt-form { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }
.cmt-form textarea { width: 100%; box-sizing: border-box; padding: .6rem .7rem;
  background: var(--bg); color: var(--fg); border: 1px solid var(--bd);
  border-radius: 8px; font: inherit; font-size: 14px; resize: vertical; }
.cmt-form textarea:focus { outline: none; border-color: var(--acc); }
.cmt-form button { padding: .55rem 1rem; border: none; border-radius: 8px;
  background: var(--acc); color: #fff; font-weight: 600; cursor: pointer; }
.cmt-form button:hover { filter: brightness(1.08); }
