/* Shadow RP — private video host.
   Palette and type lifted from the main shadowrp.net site so the subdomain
   reads as part of the same product. Dark-only by design: this is a video
   surface, and a light theme would fight the content. */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-base: #000000;
  --bg-raised: #0a0a0a;
  --bg-overlay: #141414;
  --bg-card: #0f0f10;
  --border-subtle: #1f1f1f;
  --border: #2e2e2e;
  --border-strong: #404040;
  --text-primary: #ffffff;
  --text-secondary: #a3a3a3;
  /* #6b6b6b from the main site only reaches 3.9:1 on black; this clears AA. */
  --text-muted: #8a8a8a;
  --accent: #dc2626;
  --accent-hover: #ef4444;
  --accent-deep: #991b1b;
  --accent-glow: rgb(220 38 38 / 0.32);

  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Bebas Neue', Impact, 'Arial Narrow', sans-serif;

  --radius: 10px;
  --radius-lg: 16px;
  --speed: 180ms;

  /* One scale, used everywhere, so overlays never fight each other. */
  --z-base: 1;
  --z-controls: 10;
  --z-header: 20;
  --z-menu: 30;
  --z-modal: 50;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background-color: var(--bg-base);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background:
    radial-gradient(60rem 40rem at 50% -10rem, rgb(220 38 38 / 0.10), transparent 60%),
    radial-gradient(40rem 30rem at 100% 60%, rgb(220 38 38 / 0.04), transparent 60%),
    var(--bg-base);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-watching {
  background: var(--bg-base);
  overflow: hidden;
}

::selection { background-color: rgb(220 38 38 / 0.45); color: #fff; }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 6px;
  border: 2px solid var(--bg-base);
}
*::-webkit-scrollbar-thumb:hover { background: var(--accent-deep); }

:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
  border-radius: 4px;
}

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.icon { width: 22px; height: 22px; display: block; flex: none; }
.sprite { display: none; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ shell */

.shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
}

.masthead {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px);
  background: rgb(0 0 0 / 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { height: 34px; width: auto; display: block; }

.brand-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand-name {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.brand-sub {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  /* accent-hover, not accent: #dc2626 is 4.35:1 on black, just under AA. */
  color: var(--accent-hover);
  font-weight: 600;
}

.masthead-spacer { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--speed) ease, border-color var(--speed) ease, color var(--speed) ease;
}
.btn:hover { background: var(--bg-overlay); border-color: var(--border-strong); }
.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-accent:disabled { background: var(--accent-deep); border-color: var(--accent-deep); cursor: wait; opacity: 0.75; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }

/* ------------------------------------------------------------------ login */

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 40px 32px 32px;
  background: rgb(15 15 16 / 0.86);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 70px rgb(0 0 0 / 0.6), 0 0 0 1px rgb(255 255 255 / 0.02);
  text-align: center;
}

.login-card img.mark { height: 56px; width: auto; margin: 0 auto 20px; display: block; }

.login-title {
  font-family: var(--font-display);
  font-size: 34px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 6px;
}
.login-hint {
  margin: 0 0 28px;
  font-size: 14px;
  color: var(--text-secondary);
}

.field { text-align: left; margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.input {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  font-size: 18px;
  font-family: var(--font-sans);
  letter-spacing: 0.28em;
  text-align: center;
  color: var(--text-primary);
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--speed) ease, box-shadow var(--speed) ease;
}
.input::placeholder { letter-spacing: 0.2em; color: var(--text-muted); }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-card .btn { width: 100%; }

.form-error {
  min-height: 22px;
  margin: 14px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent-hover);
}

.shake { animation: shake 320ms ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

/* ---------------------------------------------------------------- library */

.page-head { padding: 40px 0 24px; }
.page-title {
  font-family: var(--font-display);
  font-size: clamp(34px, 6vw, 52px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 6px;
}
.page-sub { margin: 0; color: var(--text-secondary); font-size: 15px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding-bottom: 64px;
}

.card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--speed) ease, box-shadow var(--speed) ease, background var(--speed) ease;
}
.card:hover, .card:focus-visible {
  border-color: var(--accent-deep);
  background: var(--bg-overlay);
  box-shadow: 0 18px 40px rgb(0 0 0 / 0.5);
}

.card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #141414, #0a0a0a);
  overflow: hidden;
}
.card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity var(--speed) ease;
}
.card:hover .card-thumb img { opacity: 0.72; }

.card-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity var(--speed) ease;
}
.card:hover .card-play, .card:focus-visible .card-play { opacity: 1; }
.card-play span {
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.55);
}
.card-play svg { width: 26px; height: 26px; margin-left: 3px; }

.badge {
  position: absolute;
  bottom: 10px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border-radius: 6px;
  background: rgb(0 0 0 / 0.82);
  border: 1px solid var(--border-subtle);
}
.badge-duration { right: 10px; }
.badge-quality { left: 10px; color: var(--accent-hover); border-color: var(--accent-deep); }

.card-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: rgb(255 255 255 / 0.14);
}
.card-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.card-body { padding: 16px 18px 18px; }
.card-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.empty, .loading-state {
  padding: 80px 24px;
  text-align: center;
  color: var(--text-secondary);
}
.empty h2 { font-family: var(--font-display); font-size: 30px; letter-spacing: 0.05em; margin: 0 0 10px; color: var(--text-primary); text-transform: uppercase; }
.empty code {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.skeleton {
  background: linear-gradient(90deg, #121212 25%, #1c1c1c 50%, #121212 75%);
  background-size: 240% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--radius-lg);
  height: 260px;
}
@keyframes shimmer { to { background-position: -240% 0; } }

/* ------------------------------------------------------------------ watch */

.watch-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.watch-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px clamp(12px, 3vw, 24px);
  border-bottom: 1px solid var(--border-subtle);
  background: rgb(0 0 0 / 0.9);
  flex: none;
}
.watch-bar h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  transition: background var(--speed) ease, color var(--speed) ease;
}
.back-link:hover { background: var(--bg-card); color: var(--text-primary); }

.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  background: #000;
}

.player {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}
.player video {
  object-fit: contain;
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

.player.idle { cursor: none; }
.player.idle .controls { opacity: 0; pointer-events: none; transform: translateY(8px); }

/* Centre affordances */
.big-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(0 0 0 / 0.45);
  z-index: var(--z-controls);
  transition: opacity var(--speed) ease;
}
.big-play[hidden] { display: none; }
.big-play span {
  display: grid;
  place-items: center;
  width: 88px; height: 88px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 10px rgb(220 38 38 / 0.16), 0 20px 50px rgb(0 0 0 / 0.6);
  transition: background var(--speed) ease, box-shadow var(--speed) ease;
}
.big-play:hover span { background: var(--accent-hover); box-shadow: 0 0 0 14px rgb(220 38 38 / 0.2), 0 20px 50px rgb(0 0 0 / 0.6); }
.big-play svg { width: 38px; height: 38px; margin-left: 5px; }

.spinner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: var(--z-controls);
  pointer-events: none;
}
.spinner[hidden] { display: none; }
.spinner i {
  width: 54px; height: 54px;
  border: 4px solid rgb(255 255 255 / 0.16);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: absolute;
  top: 20px; left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.82);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  z-index: var(--z-menu);
  opacity: 0;
  transition: opacity var(--speed) ease;
}
.toast.show { opacity: 1; }

.resume-prompt {
  position: absolute;
  left: 50%;
  bottom: 108px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 18px;
  background: rgb(10 10 10 / 0.95);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 14px 40px rgb(0 0 0 / 0.6);
  font-size: 14px;
  z-index: var(--z-menu);
  max-width: calc(100% - 32px);
}
.resume-prompt[hidden] { display: none; }
.resume-prompt .btn { min-height: 36px; padding: 0 14px; font-size: 13px; }

/* Control bar */
.controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 44px 16px 14px;
  background: linear-gradient(to top, rgb(0 0 0 / 0.92) 0%, rgb(0 0 0 / 0.65) 45%, transparent 100%);
  z-index: var(--z-controls);
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--speed) ease, transform var(--speed) ease;
}

.scrub {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}
.scrub-track {
  position: relative;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: rgb(255 255 255 / 0.22);
  overflow: hidden;
  transition: height var(--speed) ease;
}
.scrub:hover .scrub-track, .scrub:focus-visible .scrub-track { height: 8px; }
.scrub-buffered, .scrub-played {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  border-radius: 3px;
}
.scrub-buffered { background: rgb(255 255 255 / 0.3); }
.scrub-played { background: var(--accent); }
.scrub-thumb {
  position: absolute;
  top: 50%;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgb(220 38 38 / 0.25);
  transform: translate(-50%, -50%) scale(0);
  transition: transform var(--speed) ease;
  pointer-events: none;
}
.scrub:hover .scrub-thumb, .scrub.dragging .scrub-thumb, .scrub:focus-visible .scrub-thumb {
  transform: translate(-50%, -50%) scale(1);
}

.scrub-preview {
  position: absolute;
  bottom: 26px;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 6px;
  background: rgb(0 0 0 / 0.9);
  border: 1px solid var(--border);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--speed) ease;
  white-space: nowrap;
}
.scrub:hover .scrub-preview, .scrub.dragging .scrub-preview { opacity: 1; }

.control-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.ctrl {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px; height: 44px;
  border-radius: 8px;
  color: #fff;
  opacity: 0.9;
  transition: background var(--speed) ease, opacity var(--speed) ease, color var(--speed) ease;
}
.ctrl:hover { background: rgb(255 255 255 / 0.12); opacity: 1; }
.ctrl[aria-pressed='true'] { color: var(--accent-hover); }
.ctrl[disabled] { opacity: 0.32; cursor: not-allowed; }

.time {
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  white-space: nowrap;
}
.time b { color: var(--text-primary); font-weight: 600; }

.control-spacer { flex: 1; }

.volume { display: flex; align-items: center; }
.volume-slider {
  width: 0;
  overflow: hidden;
  transition: width var(--speed) ease, margin var(--speed) ease;
}
.volume:hover .volume-slider,
.volume:focus-within .volume-slider { width: 84px; margin-right: 8px; }

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 84px;
  height: 20px;
  background: transparent;
  cursor: pointer;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--accent) var(--fill, 100%), rgb(255 255 255 / 0.24) var(--fill, 100%));
}
input[type='range']::-moz-range-track {
  height: 5px;
  border-radius: 3px;
  background: rgb(255 255 255 / 0.24);
}
input[type='range']::-moz-range-progress {
  height: 5px;
  border-radius: 3px;
  background: var(--accent);
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  margin-top: -4px;
  border-radius: 50%;
  background: #fff;
  border: none;
}
input[type='range']::-moz-range-thumb {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #fff;
  border: none;
}

/* Pop-up menus (quality, captions, speed) */
.menu-wrap { position: relative; }
.menu {
  position: absolute;
  right: 0;
  bottom: 52px;
  min-width: 210px;
  padding: 6px;
  background: rgb(10 10 10 / 0.97);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 44px rgb(0 0 0 / 0.65);
  z-index: var(--z-menu);
}
.menu[hidden] { display: none; }
.menu-title {
  padding: 8px 12px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  text-align: left;
  transition: background var(--speed) ease;
}
.menu button:hover { background: rgb(255 255 255 / 0.09); }
.menu button[aria-checked='true'] { color: var(--accent-hover); font-weight: 600; }
.menu .check { width: 16px; height: 16px; flex: none; opacity: 0; }
.menu button[aria-checked='true'] .check { opacity: 1; }
.menu .sub {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.35;
}

.watch-meta {
  flex: none;
  padding: 18px clamp(12px, 3vw, 24px) 22px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-base);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}
.watch-meta .facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}
.watch-meta .facts b { color: var(--text-secondary); font-weight: 600; }

video::cue {
  background: rgb(0 0 0 / 0.78);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 1em;
  line-height: 1.4;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 720px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
  .page-head { padding: 28px 0 18px; }
  .controls { padding: 36px 8px 10px; }
  .time { padding: 0 6px; font-size: 12px; }
  .volume-slider { display: none; }
  .big-play span { width: 72px; height: 72px; }
  .big-play svg { width: 32px; height: 32px; }
  .watch-meta { padding-bottom: 16px; }
  .resume-prompt { bottom: 96px; font-size: 13px; }
  /* Keyboard hints are dead weight on a touch device. */
  .watch-meta .shortcuts { display: none; }
}

/* Below this the control row cannot hold every button at a 44px touch target,
   so the least-used ones go rather than letting the rest shrink. Phones have
   hardware volume keys, and picture-in-picture is a desktop habit. */
@media (max-width: 560px) {
  .control-row { gap: 0; }
  .volume, #pip { display: none; }
  .time { padding: 0 4px; }
}

@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  /* 0s, not the usual 0.01ms: a sub-millisecond transition can be left
     running forever at its start value, which pinned the control bar at
     opacity 1 while it was already pointer-events: none — visible but dead
     to clicks. Nothing here listens for transitionend, so 0s is safe. */
  *, *::before, *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }

  /* The buffering spinner is the exception: it is small, it is the only
     signal that playback is loading, and a frozen spinner reads as a hang. */
  .spinner i {
    animation-duration: 900ms !important;
    animation-iteration-count: infinite !important;
  }
}
