:root {
  color-scheme: light;
  --bg: #f6f2ff;
  --paper: #fffdfa;
  --raised: #ffffff;
  --ink: #241832;
  --line: #e4d9f7;
  --dim: #8577a0;
  --pink: #ff6f9c;
  --mint: #22c99a;
  --sun: #ffb648;
  --sky: #4fa8ff;

  --accent-h: 328;
  --accent: hsl(var(--accent-h) 78% 58%);
  --accent-soft: hsl(var(--accent-h) 90% 94%);
  --accent-ink: hsl(var(--accent-h) 55% 24%);

  --font-display: 'Baloo 2', 'Segoe UI Rounded', system-ui, sans-serif;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --pop-shadow: 4px 4px 0 var(--ink);
  --pop-shadow-sm: 3px 3px 0 var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--font-sans);
}

a {
  color: var(--accent-ink);
}

:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 23px;
  text-decoration: none;
  color: var(--ink);
}

.brand::before {
  content: '●';
  color: var(--accent);
  margin-right: 0.3em;
  font-size: 0.65em;
  vertical-align: middle;
}

.brand__domain {
  color: var(--pink);
  display: inline-block;
  transform: rotate(-3deg);
  text-shadow: 0 0 0.4em rgba(255, 111, 156, 0.55);
}

.btn {
  padding: 9px 18px;
  border-radius: 999px;
  border: 2.5px solid var(--ink);
  background: var(--raised);
  color: var(--ink);
  cursor: pointer;
  font: 600 14px var(--font-sans);
  box-shadow: var(--pop-shadow-sm);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn:hover {
  background: var(--accent-soft);
  box-shadow: var(--pop-shadow-sm), 0 0 18px -4px var(--accent);
}
.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--ink);
}
.btn--danger {
  border-color: #b3234f;
  color: #b3234f;
  box-shadow: 3px 3px 0 #b3234f;
}
.btn--danger:hover {
  background: #ffe3ec;
}
.btn--danger:active {
  box-shadow: 0 0 0 #b3234f;
}

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

.watch {
  width: 100%;
  padding: 18px 15vw 10vh;
  /* A definite height (not min-height) so .watch__frame's percentage
     max-height below actually resolves against something, letting flex
     shrink the video to fit one screen in the normal case. overflow-y
     (not hidden) is what lets the page scroll instead of clipping once
     the frame's floor no longer fits. */
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.watch__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  width: var(--stage-width, 100%);
  margin: 0 auto 14px;
}

.watch__tag {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 5px 12px;
  box-shadow: 0 0 16px -4px var(--accent);
}

.watch__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: var(--stage-width, 100%);
  margin: 0 auto 4px;
  flex: 0 0 auto;
}

.watch__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(20px, 3.2vw, 32px);
  line-height: 1.15;
  margin: 0;
  min-width: 0;
}

.watch__edit-btn {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--raised);
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
}
.watch__edit-btn:hover {
  background: var(--accent-soft);
}

/* Sized relative to whatever text it sits next to (a title, a table cell, a
   <dt>) rather than a fixed size, so it drops into any of those contexts.
   Colors, trace technique and filter copied 1:1 from clippinator's own
   header paw (tailwind pink-400 fill, white outline trace via
   .premium-paw-trace below); size bumped up from clippinator's 1em since
   this is a standalone badge rather than a small inline title-bar mark.
   inline-flex + align-items/vertical-align keep it centered on the
   surrounding text's line instead of sitting on its baseline. */
.premium-paw {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  color: #f472b6;
}

.premium-paw svg {
  width: 1.6em;
  height: 1.6em;
  overflow: visible;
  transform: rotate(12deg);
}

@keyframes premium-paw-trace {
  to {
    stroke-dashoffset: -1;
  }
}

.premium-paw-trace {
  /* A 6%-of-the-outline dash with a huge gap, so only one short glowing
     segment is ever visible at a time rather than the whole outline lit. */
  stroke-dasharray: 0.06 1;
  animation: premium-paw-trace 4.5s linear infinite;
  filter: drop-shadow(0 0 1.5px #fff) drop-shadow(0 0 3px #fff);
}

.watch__title-edit {
  display: flex;
  gap: 8px;
  width: var(--stage-width, 100%);
  margin: 0 auto 12px;
  flex: 0 0 auto;
}
/* The [hidden] attribute is what data-edit-toggle flips in watch.js - needs
   an explicit override since author display: flex above otherwise beats the
   UA stylesheet's [hidden] { display: none }. */
.watch__title-edit[hidden] {
  display: none;
}
.watch__title-edit .login__field {
  flex: 1 1 auto;
  min-width: 0;
}

.watch__stamp {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--dim);
  width: var(--stage-width, 100%);
  margin: 0 auto 12px;
  flex: 0 0 auto;
}

.watch__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  width: var(--stage-width, 100%);
  margin: 16px auto 0;
  flex: 0 0 auto;
}

.watch__meta-left,
.watch__meta-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.watch__dot {
  color: var(--accent);
  font-size: 13px;
  line-height: 1;
}

.watch__frame {
  position: relative;
  flex: 1 1 auto;
  /* A floor, not a target: once the surrounding chrome + this no longer fit
     the viewport, the page scrolls instead of squishing the video smaller
     than this to force everything into view. */
  min-height: 220px;
  min-width: 0;
  /* Deliberately NOT var(--stage-width): that's measured from this frame's
     own child (the player) via ResizeObserver, so tying the frame's width to
     it creates a feedback loop - any tiny shrink (a scrollbar appearing, a
     font swap reflow) shrinks the video, which reports a smaller width,
     which shrinks the frame further, collapsing to a few px over a couple of
     cycles. The frame stays full width; the video centers itself inside via
     max-width/max-height/aspect-ratio, and the narrower sibling rows track
     --stage-width to visually match it instead. */
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.watch__player {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  background: #000;
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: var(--pop-shadow), 0 0 40px -6px var(--accent);
}

.home-solo {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  background: radial-gradient(circle at 50% 50%, var(--accent-soft), var(--bg) 65%);
}

.home-solo .brand--big {
  font-size: clamp(32px, 9vw, 68px);
}

.home-solo__stats {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 7px 18px;
  box-shadow: var(--pop-shadow-sm), 0 0 16px -4px var(--accent);
}

.watch__footer {
  display: flex;
  gap: 8px;
  width: var(--stage-width, 100%);
  margin: 12px auto 0;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.watch__link {
  flex: 1 1 260px;
  min-width: 0;
  padding: 10px 16px;
  border-radius: 999px;
  border: 2.5px solid var(--ink);
  background: var(--raised);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Full-bleed regardless of the centered --stage-width column everything
   else tracks - a status-bar-style strip spanning the whole viewport. Plain
   100% (not 100vw + a position/transform breakout) deliberately: .watch is
   itself a self-scrolling region (overflow-y: auto), so its own scrollbar
   can make its content box a few px narrower than the true viewport - a vw-
   based breakout measures against the viewport regardless and ends up
   misaligned by that gap. 100% tracks .watch's actual box exactly. */
.watch__admin {
  width: 100%;
  margin-top: 20px;
  flex: 0 0 auto;
  padding: 10px 5vw;
  border-top: 2.5px dashed var(--accent);
  border-bottom: 2.5px dashed var(--accent);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent-ink);
  white-space: nowrap;
  overflow-x: auto;
}

.watch__admin a {
  color: var(--accent-ink);
  font-weight: 700;
  flex: 0 0 auto;
}

/* Tablet and narrower: the fixed 15vw side gutter eats too much of the
   screen, so it steps down as the viewport shrinks. */
@media (max-width: 1024px) {
  .watch {
    padding: 16px 6vw 4vh;
  }
}

@media (max-width: 700px) {
  .watch {
    /* No horizontal gutter here: the frame (and so the video) go full-bleed
       to the viewport edges. The other elements track --stage-width, which
       JS sets to the video's rendered width, so they'd stretch edge to edge
       too without their own padding below. */
    padding: 12px 0 3vh;
    height: auto;
    min-height: 100dvh;
    overflow-y: visible;
  }

  .watch__bar,
  .watch__title-row,
  .watch__title-edit,
  .watch__stamp,
  .watch__meta,
  .watch__footer {
    padding-left: 4vw;
    padding-right: 4vw;
  }

  .watch__bar {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .watch__frame {
    flex: 0 1 auto;
    max-height: 52vh;
  }
}

/* Short/landscape phones: height is the scarce dimension, not width, so the
   video gets a tighter cap and everything below it can still fit or scroll. */
@media (max-width: 700px) and (max-height: 480px) {
  .watch__frame {
    max-height: 40vh;
  }
}

/* A short but still-wide viewport - e.g. devtools docked to the bottom,
   leaving a window that's very wide but only a few hundred px tall. The
   15vw desktop gutter was sized for a normal aspect ratio and eats most of
   the width for no reason once height is the scarce dimension, squishing
   the video (and everything tracking its rendered width) into a narrow
   column despite plenty of horizontal room. Narrow+short phones already
   get the full-bleed treatment above, so this is gated to wider viewports
   to avoid fighting that rule. */
@media (min-width: 701px) and (max-height: 500px) {
  .watch {
    padding: 10px 4vw 2vh;
    height: auto;
    min-height: 100dvh;
    overflow-y: visible;
  }

  .watch__frame {
    flex: 0 1 auto;
    max-height: 46vh;
  }
}

/* ---------- notices (login, pending, not-found) ---------- */

.notice {
  max-width: 460px;
  margin: 12vh auto;
  padding: 28px 24px;
  text-align: center;
  background: var(--raised);
  border: 3px solid var(--ink);
  border-radius: 24px;
  box-shadow: var(--pop-shadow);
}

.notice h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 25px;
  margin: 14px 0 8px;
}
.notice p {
  color: var(--dim);
  margin: 4px 0;
}
.notice__muted {
  font-size: 13px;
}

.login {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
  text-align: left;
}

.login__field {
  padding: 11px 14px;
  border-radius: 14px;
  border: 2.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
.login__field::placeholder {
  color: var(--dim);
}

.login__error {
  color: #b3234f;
  font-weight: 600;
}

/* ---------- admin: the ledger ---------- */

.admin {
  max-width: 1440px;
  margin: 0 auto;
  padding: 26px 20px 52px;
}

.admin__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.admin__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--raised);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 4px;
}

.admin__nav a {
  color: var(--dim);
  text-decoration: none;
  font-weight: 600;
  font-size: 13.5px;
  padding: 6px 14px;
  border-radius: 999px;
}
.admin__nav a:hover {
  color: var(--ink);
}
.admin__nav a[aria-current='page'] {
  color: var(--paper);
  background: var(--ink);
}

.admin__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.admin__summary {
  color: var(--dim);
  font-size: 13px;
  margin: 18px 0 14px;
}

.admin__table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-bottom: 24px;
}

.admin__table {
  table-layout: fixed;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  font-size: 14px;
  white-space: nowrap;
}

.admin__ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin__ellipsis > a,
.admin__ellipsis > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin__col-center {
  text-align: center;
}

.admin__table th {
  text-align: left;
  padding: 0 10px 4px;
  color: var(--dim);
  font-weight: 600;
  font-size: 12px;
}

.admin__table tbody td,
.admin__filters td {
  text-align: left;
  padding: 10px;
  vertical-align: middle;
  background: var(--raised);
  border-top: 2.5px solid var(--ink);
  border-bottom: 2.5px solid var(--ink);
}
.admin__table tbody td:first-child,
.admin__filters td:first-child {
  border-left: 2.5px solid var(--ink);
  border-radius: 16px 0 0 16px;
}
.admin__table tbody td:last-child,
.admin__filters td:last-child {
  border-right: 2.5px solid var(--ink);
  border-radius: 0 16px 16px 0;
}

.admin__row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.admin__row-actions .btn {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 6px 10px;
  font-size: 12.5px;
}

.admin__filter {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 6px 9px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
}
.admin__filter::placeholder {
  color: var(--dim);
}

.admin__sort-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.admin__sort-btn svg {
  display: block;
}
.admin__sort-btn:hover {
  border-color: var(--mint);
  color: var(--mint);
}

.admin__filters--center {
  text-align: center;
}

.admin__thumb-wrap {
  position: relative;
  width: 100%;
  max-width: 84px;
}

.admin__thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--ink);
  display: block;
  background: #000;
}

.admin__thumb--empty {
  border: 2px dashed var(--line);
  background: var(--bg);
}

.admin__expand-toggle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--raised);
  color: var(--ink);
  cursor: pointer;
}
.admin__expand-toggle svg {
  transition: transform 0.15s ease;
}
.admin__expand-toggle[aria-expanded='true'] svg {
  transform: rotate(90deg);
}
.admin__expand-toggle:hover {
  border-color: var(--mint);
  color: var(--mint);
}
/* Used outside the thumbnail wrapper (e.g. a plain table cell), where the
   absolute positioning above has nothing to anchor to. */
.admin__expand-toggle--static {
  position: static;
}
.admin__muted {
  color: var(--dim);
  font-size: 13px;
}
.admin__status {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}
.admin__mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.admin__titlecell {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin__pager {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge--ready {
  color: #12805f;
  background: #d6f7ec;
}
.badge--failed {
  color: #b3234f;
  background: #ffe3ec;
}
.badge--pending,
.badge--processing {
  color: #9a6300;
  background: #fff1d6;
}
.badge--deleted {
  color: #5c5c66;
  background: #e6e6ec;
}

.admin__expand-row td {
  white-space: normal;
}

.admin__expand {
  display: flex;
  gap: 18px;
  padding: 4px;
  white-space: normal;
}

.admin__expand-media {
  flex: 0 0 200px;
}

.admin__play {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #000;
  cursor: pointer;
  overflow: hidden;
}
.admin__play img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.75;
}
.admin__play-icon {
  position: absolute;
  inset: 0;
  margin: auto;
  color: #fff;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
}
.admin__play:hover img {
  opacity: 0.9;
}

.admin__expand-media--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  border: 2px dashed var(--line);
  border-radius: 10px;
  color: var(--dim);
  font-size: 12px;
}

.admin__expand-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #000;
}

.admin__expand-info {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 24px;
  margin: 0;
  align-content: start;
}
.admin__expand-info dt {
  color: var(--dim);
  font-size: 11px;
  margin-bottom: 2px;
}
.admin__expand-info dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  word-break: break-all;
}

/* ---------- admin: mobile ---------- */

@media (max-width: 700px) {
  .admin {
    padding: 18px 14px 40px;
  }

  .admin__bar {
    flex-wrap: wrap;
    row-gap: 10px;
  }
  .admin__actions {
    flex-wrap: wrap;
    width: 100%;
  }
  .admin__nav {
    width: 100%;
    overflow-x: auto;
  }

  .stats__tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  /* The table degrades into a stack of labeled cards: every row becomes its
     own block, every cell prints a data-label above its value instead of
     relying on a column header it no longer sits under. */
  .admin__table-wrap {
    overflow-x: visible;
  }
  .admin__table {
    white-space: normal;
  }
  .admin__table,
  .admin__table thead,
  .admin__table tbody,
  .admin__table tr,
  .admin__table th,
  .admin__table td {
    display: block;
    width: 100%;
  }
  .admin__table thead tr:not(.admin__filters) {
    display: none;
  }
  .admin__table tbody tr:not(.admin__expand-row),
  .admin__table thead tr.admin__filters {
    margin-bottom: 10px;
    border: 2.5px solid var(--ink);
    border-radius: 16px;
    overflow: hidden;
  }
  .admin__table tbody td,
  .admin__filters td {
    border-left: none;
    border-right: none;
    border-top: none;
    border-radius: 0;
    border-bottom: 1.5px dashed var(--line);
  }
  .admin__table tbody td:first-child,
  .admin__filters td:first-child {
    border-left: none;
    border-radius: 0;
  }
  .admin__table tbody td:last-child,
  .admin__filters td:last-child {
    border-right: none;
    border-radius: 0;
    border-bottom: none;
  }
  .admin__table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--dim);
    margin-bottom: 4px;
  }

  .admin__ellipsis,
  .admin__ellipsis > a,
  .admin__ellipsis > span,
  .admin__titlecell {
    max-width: none;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
  }
  .admin__col-center {
    text-align: left;
  }
  .admin__row-actions {
    flex-wrap: wrap;
  }
  .admin__mono {
    word-break: break-word;
  }

  .admin__expand {
    flex-direction: column;
  }
  .admin__expand-media {
    flex: none;
    width: 100%;
    max-width: 260px;
  }

  .index__word--wide {
    flex-wrap: wrap;
  }
  .installer__info {
    word-break: break-all;
  }
  .index__add {
    flex-wrap: wrap;
  }
  .index__add .login__field {
    flex: 1 1 160px;
  }
}

/* ---------- admin: naming index (slug words) ---------- */

.index__intro {
  color: var(--dim);
  font-size: 13.5px;
  max-width: 62ch;
  margin: 18px 0 20px;
}

.index__stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.index__stat {
  flex: 1 1 160px;
  padding: 12px 16px;
  border: 2.5px solid var(--ink);
  border-radius: 16px;
  background: var(--raised);
}

.index__stat-label {
  display: block;
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 3px;
}

.index__stat-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
}

.index__stat--link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.index__stat--link:hover {
  border-color: var(--ink);
  background: var(--paper);
}
.index__stat--active,
.index__stat--active:hover {
  background: var(--ink);
}
.index__stat--active .index__stat-label,
.index__stat--active .index__stat-value {
  color: var(--paper);
}

.index {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.index__heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  margin: 0 0 12px;
}

.index__add {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.index__add .login__field {
  flex: 1;
  padding: 9px 14px;
  border-radius: 999px;
}

/* ---------- admin: settings ---------- */

.settings__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 420px));
  gap: 32px;
  align-items: start;
  margin-top: 10px;
}

.settings__panel-title {
  margin: 0 0 6px;
  font-size: 16px;
}

.settings__form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 420px;
  margin-top: 6px;
}

.settings__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings__field label {
  font-weight: 700;
  font-size: 13.5px;
}

.settings__field .login__field {
  max-width: 220px;
}

.settings__hint {
  color: var(--dim);
  font-size: 12.5px;
  max-width: 52ch;
}

.settings__actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.settings__resets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 2px dashed var(--line);
}

@media (max-width: 900px) {
  .settings__grid {
    grid-template-columns: minmax(0, 420px);
  }
}

.index__words {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.index__word {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 12px;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--raised);
}

.index__word:nth-of-type(3n + 1) {
  background: #ffe3ec;
}
.index__word:nth-of-type(3n + 2) {
  background: #d6f7ec;
}
.index__word:nth-of-type(3n) {
  background: #fff1d6;
}

.index__remove {
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font: 700 12px var(--font-sans);
  line-height: 1;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.index__remove:hover {
  background: #b3234f;
  border-color: #b3234f;
  color: #fff;
}

@media (max-width: 700px) {
  .index {
    grid-template-columns: 1fr;
  }
}

.index__words--stacked {
  flex-direction: column;
}

.index__word--wide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 12px 12px 12px 18px;
  border-radius: 16px;
  font-family: var(--font-sans);
  font-size: 13px;
}

.installer__info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.installer__version {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
}

.installer__rename {
  display: flex;
  gap: 6px;
  align-items: center;
}
.installer__rename .admin__filter {
  flex: 1;
  min-width: 120px;
}

.admin__hwid-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.admin__reencode-form {
  display: block;
  margin-top: 6px;
}

.device__banner {
  margin: 4px 0 20px;
}

.admin__list-hidden {
  display: none !important;
}

.admin__list-search {
  display: block;
  width: 100%;
  max-width: 360px;
  padding: 8px 12px;
  margin-bottom: 14px;
}

.admin__list-more {
  margin: 12px 0 20px;
}

.admin__list-empty {
  margin: 12px 0 20px;
}

.admin__size-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin__error-detail {
  margin: 6px 0 0;
  padding: 10px 12px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--paper);
  border: 2.5px solid var(--line);
  border-radius: 10px;
}

.admin__ban-dialog {
  width: min(90vw, 380px);
  padding: 20px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: var(--raised);
  color: var(--ink);
  box-shadow: var(--pop-shadow);
}
.admin__ban-dialog::backdrop {
  background: rgba(36, 24, 50, 0.45);
}
.admin__ban-dialog-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
}
.admin__ban-dialog-label {
  display: block;
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 4px;
}
.admin__ban-dialog textarea.admin__filter {
  width: 100%;
  resize: vertical;
}
.admin__ban-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

/* ---------- admin: stats ---------- */

.stats__tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2.5px solid var(--line);
  margin-bottom: 18px;
}
.stats__tabs a {
  color: var(--dim);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 16px;
  border-bottom: 3px solid transparent;
  margin-bottom: -2.5px;
}
.stats__tabs a:hover {
  color: var(--ink);
}
.stats__tabs a[aria-current='page'] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.stats__range {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--raised);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 20px;
}
.stats__range a {
  color: var(--dim);
  text-decoration: none;
  font-weight: 600;
  font-size: 13.5px;
  padding: 6px 14px;
  border-radius: 999px;
}
.stats__range a:hover {
  color: var(--ink);
}
.stats__range a[aria-current='page'] {
  color: var(--paper);
  background: var(--ink);
}
.stats__range-close {
  margin-left: 4px;
  color: var(--dim) !important;
}
.stats__range-close:hover {
  color: var(--ink) !important;
}

.stats__charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.stats__chart-card {
  padding: 16px 18px 12px;
  border: 2.5px solid var(--ink);
  border-radius: 18px;
  background: var(--raised);
  margin-bottom: 20px;
}

.stats__error-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.stats__error-filters .login__field {
  flex: 1 1 220px;
  max-width: 320px;
  padding: 8px 12px;
}

.stats__error-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.stats__error-search .login__field {
  flex: 1 1 260px;
  max-width: 420px;
  padding: 8px 12px;
}

.stats__error-detail {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
  margin: 0;
}
.stats__error-detail dt {
  color: var(--dim);
  font-weight: 600;
  font-size: 13px;
}
.stats__error-detail dd {
  margin: 0;
  font-size: 13.5px;
}
.stats__error-message {
  white-space: pre-wrap;
  word-break: break-word;
}

.stats__chart-card .index__heading {
  margin-bottom: 2px;
}

.stats__chart {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 1;
  margin-top: 10px;
  overflow: visible;
}

.stats__chart-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.stats__chart-line--storage {
  stroke: var(--mint);
}
.stats__chart-line--views {
  stroke: var(--sun);
}
.stats__chart-line--devices {
  stroke: var(--sky);
}
.stats__chart-line--installs {
  stroke: var(--accent);
}
.stats__chart-line--errors {
  stroke: var(--pink);
}

.stats__chart-area {
  stroke: none;
}
.stats__chart-area--storage {
  fill: var(--mint);
  opacity: 0.16;
}
.stats__chart-area--views {
  fill: var(--sun);
  opacity: 0.16;
}
.stats__chart-area--devices {
  fill: var(--sky);
  opacity: 0.16;
}
.stats__chart-area--installs {
  fill: var(--accent);
  opacity: 0.16;
}
.stats__chart-area--errors {
  fill: var(--pink);
  opacity: 0.16;
}

.stats__vbars {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 10px;
  height: 160px;
}
.stats__vbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  height: 100%;
  color: inherit;
  text-decoration: none;
}
.stats__vbar:hover .stats__vbar-track {
  background: var(--dim);
}
.stats__vbar--active .stats__vbar-fill {
  background: var(--pink);
}
.stats__vbar-count {
  font-size: 12px;
  color: var(--dim);
}
.stats__vbar-track {
  flex: 1;
  width: 100%;
  max-width: 32px;
  display: flex;
  align-items: flex-end;
  background: var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.stats__vbar-fill {
  width: 100%;
  background: var(--accent);
  border-radius: 6px 6px 0 0;
}
.stats__vbar-label {
  font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .stats__charts {
    grid-template-columns: 1fr;
  }
}
