/* Community Videos — public page. Self-contained (no framework, no shared bundle); the palette and
   header match ../items/items.css and ../mods/mods.css on purpose so the pages read as one site. */

:root {
  --bg: #151816;
  --panel: #1d211e;
  --panel-2: #252a26;
  --line: #3a413b;
  --ink: #e4e8e1;
  --muted: #99a397;
  --accent: #8cc45e;
  --on-accent: #0f1a0b;
  --gold: #e0a23a;
  --live: #3fd47a;
  --ok: #7fbf6a;
  --bad: #d15c5c;
  /* Platform tile colours — VideoEntry.Platform in the mod. */
  --youtube: #e53935;
  --bilibili: #23ade5;
  --twitch: #9146ff;
  --instagram: #d62976;
  --other: #6b6b6b;
  --radius: 10px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
body::before {
  content: ""; position: fixed; left: 0; bottom: 0; width: 1280px; height: 1040px; pointer-events: none; z-index: 0;
  background: url("bricks.svg") left bottom / contain no-repeat; opacity: 0.6;
  -webkit-mask-image: radial-gradient(ellipse 100% 100% at 0 100%, #000 25%, rgba(0,0,0,0.5) 55%, transparent 85%);
          mask-image: radial-gradient(ellipse 100% 100% at 0 100%, #000 25%, rgba(0,0,0,0.5) 55%, transparent 85%);
}
.top, main, .foot { position: relative; z-index: 1; }
a { color: var(--accent); }
.sr { position: absolute; left: -9999px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

.top { padding: 40px 0 20px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #1c211d, var(--bg)); }
.kicker { margin: 0 0 4px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; }
.kicker a { color: inherit; text-decoration: none; }
.kicker a:hover, .kicker a:focus-visible { text-decoration: underline; }
h1 { margin: 0 0 10px; font-size: 40px; font-weight: 700; line-height: 1.1; }
h2 { margin: 0 0 12px; font-size: 22px; }
.lede { max-width: 72ch; margin: 0 0 14px; font-size: 18px; }
.lede em { color: var(--accent); font-style: normal; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 0; }
.fine { color: var(--muted); font-size: 14px; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font: inherit; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }

/* ---- toolbar ---- */
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0 14px; position: sticky; top: 0; background: var(--bg); padding: 10px 0; z-index: 2; border-bottom: 1px solid transparent; }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.toggle .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--other)); opacity: 0.35; }
.toggle[aria-pressed="true"] { color: var(--ink); border-color: var(--c, var(--accent)); background: var(--panel-2); }
.toggle[aria-pressed="true"] .dot { opacity: 1; }
.toggle:hover { border-color: var(--c, var(--accent)); }
.toggle.streamers { --c: var(--twitch); }
.toggle.star { --c: var(--gold); }
.toggle.star[aria-pressed="true"] { color: var(--gold); }
.uploader { flex: 1 1 200px; min-width: 160px; }
.uploader input, .sort select, .field input, .field textarea {
  width: 100%; padding: 8px 12px; font: inherit; font-size: 15px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
}
.uploader input:focus, .sort select:focus, .field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.sort { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.sort select { width: auto; }

/* ---- states ---- */
.state { margin: 30px 0 6px; text-align: center; color: var(--muted); }
.state.bad { color: #ffb3b3; }
.state:empty { display: none; }
.state-actions { text-align: center; margin: 0; }

/* ---- grid of videos ---- */
.grid { list-style: none; margin: 0 0 30px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; transition: border-color 0.12s, transform 0.12s; }
.card:hover, .card:focus-within { border-color: var(--c, var(--accent)); }
.card > a { display: flex; flex-direction: column; flex: 1; color: inherit; text-decoration: none; }
.card > a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--c, var(--other)); background: linear-gradient(135deg, color-mix(in srgb, var(--c, var(--other)) 60%, #111), color-mix(in srgb, var(--c, var(--other)) 22%, #111)); display: grid; place-items: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .tile { color: #fff; font-weight: 700; font-size: 20px; letter-spacing: 0.02em; text-shadow: 0 1px 2px rgba(0,0,0,0.4); }
.thumb .badge { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,0.65); color: #fff; font-size: 12px; font-weight: 600; }
.thumb .badge.live { background: var(--live); color: #062b14; }
.body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.title { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sub { margin: 0; color: var(--muted); font-size: 13px; }
.sub .live { color: var(--live); font-weight: 600; }
.fav { color: var(--gold); }
.live-dot { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: var(--live); vertical-align: 1px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.flag { position: absolute; right: 8px; top: 8px; z-index: 1; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(0,0,0,0.6); color: #fff; font-size: 14px; cursor: pointer; opacity: 0; transition: opacity 0.12s; }
.card:hover .flag, .flag:focus-visible { opacity: 1; }
@media (hover: none) { .flag { opacity: 0.85; } }
.card.streamer { --c: var(--twitch); background: linear-gradient(180deg, #221a33, var(--panel)); }

/* ---- dialogs ---- */
.dlg { width: min(520px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--ink); }
.dlg form { padding: 22px; }
.dlg::backdrop { background: rgba(0,0,0,0.6); }
.segment { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.segment button { padding: 6px 16px; border: 0; background: var(--panel); color: var(--muted); font: inherit; cursor: pointer; }
.segment button[aria-checked="true"] { background: var(--panel-2); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; font-size: 14px; color: var(--muted); }
.field textarea { resize: vertical; }
.reasons { border: 0; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.reasons label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.live-rule { margin: 4px 0; color: var(--live); font-size: 14px; }
.pulse { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; background: var(--live); animation: pulse 1.6s ease-in-out infinite; }
.msg { min-height: 1.5em; margin: 6px 0; font-size: 14px; }
.msg.ok { color: var(--ok); }
.msg.bad { color: #ffb3b3; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin: 12px 0 0; }

.foot { padding: 30px 20px 50px; color: var(--muted); font-size: 14px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 8px; }
.foot a { text-decoration: none; }
.foot a:hover { text-decoration: underline; }

@media (max-width: 600px) {
  h1 { font-size: 30px; }
  .lede { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .grid { grid-template-columns: 1fr; }
  /* Wrapped onto four rows the toolbar would cover a third of a phone screen: let it scroll away. */
  .tools { position: static; }
  .sort { flex: 1 1 100%; }
  .sort select { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .live-dot, .pulse { animation: none; } }
