:root {
  /* Matched to the channel mark: a pale ice-blue shine on near-black.
     --accent is the hexagon's face, --accent-soft its rim light. */
  --bg: #0a0b0f;
  --bg-elev: #141820;
  --bg-elev-2: #1b212b;
  --border: #272d3a;
  --text: #e9eef5;        /* cool off-white */
  --muted: #8a97a8;       /* cool grey-blue */
  --accent: #96c8f0;      /* the shine's face */
  --accent-soft: #e1f2ff; /* its rim light */
  --accent-deep: #6096cd; /* its hollow core */
  --link: #9bbbe0;
  --radius: 12px;
  --maxw: 820px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; } /* dark native scrollbars/controls */

body {
  position: relative;  /* anchors the .glow */
  overflow-x: hidden;  /* the glow is wider than the page */
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* A soft glow above the hero, like candlelight. Anchored to the top of the
   page (not the viewport) so it stays behind the memorial as you scroll. */
.glow {
  position: absolute;
  top: -30vh;
  left: 50%;
  transform: translateX(-50%);
  width: 120vw;
  height: 70vh;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(150, 200, 240, 0.09), transparent 70%);
  z-index: 0;
}

main { position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto; padding: 0 22px 90px; }

/* ---- Hero / memorial ---- */
.hero {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 72px 22px 8px;
  text-align: center;
}
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 0.72rem;
  color: var(--accent);
  margin: 0 0 26px;
  opacity: 0.85;
}
.portrait {
  margin: 18px auto 0;
  width: min(320px, 78vw);   /* roughly the width of his name */
  aspect-ratio: 4 / 5;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}
.portrait img {
  width: 100%; height: 100%; display: block;
  object-fit: cover;
}

.hero-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  line-height: 1.1;
  margin: 0;
  letter-spacing: 0.01em;
}
.hero-name .real-name { display: block; }
.hero-tag { display: block; color: var(--accent); font-size: 0.5em; margin-top: 0.5em; letter-spacing: 0.04em; }
.hero-dates {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--muted);
  margin: 14px 0 0;
  letter-spacing: 0.06em;
}
.epitaph {
  text-wrap: pretty;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text);
  opacity: 0.86;
  max-width: 540px;
  margin: 26px auto 0;
}

/* gentle divider under the hero */
.hero::after {
  content: "";
  display: block;
  width: 60px;
  height: 1px;
  margin: 40px auto 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.6;
}

/* ---- Player (modal) ---- */
.player-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 24px 24px;
  overflow-y: auto;   /* last resort if it still does not fit */
}
.player-modal[hidden] { display: none; }
.player-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 5, 8, 0.82);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade-in 0.2s ease;
}
.player-dialog {
  position: relative;
  z-index: 1;
  /* Also bounded by height: the frame is 16:9 and the meta row sits under it,
     so on a short window the dialog used to overflow and push "Leave a
     comment" past the bottom edge — unreachable, because body scrolling is
     locked while the modal is open. */
  width: min(960px, 100%, calc((100vh - 190px) * 16 / 9));
  animation: dialog-in 0.22s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.player-close {
  position: absolute;
  right: 0;
  bottom: 100%;
  margin-bottom: 6px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font: 300 30px/1 var(--sans);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.player-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.player-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; color: var(--text); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
body.modal-open { overflow: hidden; }
.player-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
}
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Loading veil: the YouTube embed is a black rectangle for a second or two
   while it spins up, so we cover it with a quiet spinner on black until the
   API reports PLAYING. Fades out; never blocks clicks on the player
   underneath. */
.player-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}
.player-frame.loading .player-loading {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.15s ease;
}
.loading-center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.loading-ring {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid rgba(150, 200, 240, 0.20);
  border-top-color: var(--accent);
  animation: ring-turn 1.6s linear infinite;
}
@keyframes ring-turn { to { transform: rotate(360deg); } }
.loading-text {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.loading-text a { color: var(--link); text-decoration: none; }
.loading-text a:hover { text-decoration: underline; }
/* On error the veil needs to be clickable (link to YouTube) and stop spinning. */
.player-frame.load-error .player-loading { pointer-events: auto; }
.player-frame.load-error .loading-ring { animation: none; border-top-color: rgba(150, 200, 240, 0.20); }
@media (prefers-reduced-motion: reduce) {
  .loading-ring { animation-duration: 3.2s; }
}
.player-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-top: 12px; flex-wrap: wrap;
}
.now-playing { font-size: 0.95rem; color: var(--text); }
.now-playing .np-tag { color: var(--accent); font-weight: 600; }
.now-playing .np-time { color: var(--muted); }
.yt-link {
  display: inline-block;
  padding: 7px 10px;     /* a 24px line of text is a mean target; pad it out */
  margin: -7px -10px;    /* ...without moving it */
  color: var(--accent);
  opacity: 0.85;
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.9rem;
  border-radius: 6px;
  transition: opacity 0.15s, background 0.15s;
}
.yt-link:hover { opacity: 1; text-decoration: underline; background: rgba(150, 200, 240, 0.08); }
.yt-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* ---- Search ---- */
.search-section { margin-top: 48px; }
.search-intro { text-align: center; margin-bottom: 22px; }
.search-intro h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.7rem;
  margin: 0 0 8px;
}
.search-intro p {
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto;
  text-wrap: pretty;  /* no lone word on the last line */
}

.search-box { position: relative; max-width: 560px; margin: 0 auto; }
#search {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  padding: 17px 20px;
  font-size: 1.1rem;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(150,200,240,0.14); }
#search::placeholder { color: var(--muted); }
/* Stats + results float together below the search bar as one solid panel, out
   of normal flow, so the archive keeps a fixed gap from the search box no
   matter what they show. The panel overlays the archive, never pushes it. */
.search-drop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  max-height: min(70vh, 620px);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.6);
  /* The whole panel scrolls as one, with the count pinned at its top. Making
     the panel itself the scroll container (rather than just the results list)
     means a wheel anywhere over it — including the header — scrolls the list
     and stops at its edges instead of running on into the page behind. */
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #394356 transparent;
}
.search-drop::-webkit-scrollbar { width: 8px; }
.search-drop::-webkit-scrollbar-track { background: transparent; }
.search-drop::-webkit-scrollbar-thumb {
  background: #394356;
  border-radius: 4px;
  border: 2px solid var(--bg-elev);
}
.search-drop::-webkit-scrollbar-thumb:hover { background: #4a5670; }
.search-drop.collapsed,
.search-drop.empty { display: none; }

/* Header row of the panel; stays put while the list scrolls under it. */
.stats {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-elev);
  flex: none;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 9px 18px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;    /* never wrap to a 2nd line */
  overflow: hidden;
  text-overflow: ellipsis;
}
.stats:empty { display: none; }

.suggestions:empty { display: none; }

/* Each suggestion is a flush row in the panel — no nested boxes. */
.suggestions { list-style: none; margin: 0; padding: 0; }
.suggestion {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 12px 18px; cursor: pointer;
  border-top: 1px solid var(--border);
  transition: background 0.12s;
}
.suggestion:first-child { border-top: 0; }
.suggestion.active { background: var(--bg-elev-2); }
.sugg-name { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; letter-spacing: 0.01em; }
.sugg-name .alt { font-family: var(--sans); color: var(--muted); font-weight: 400; font-size: 0.8rem; margin-left: 8px; }
.sugg-count { color: var(--accent); font-size: 0.82rem; white-space: nowrap; opacity: 0.9; }
.suggestion.active .sugg-count { opacity: 1; }

/* ---- The chosen player's games ---- */
.found { margin-top: 34px; }
.found[hidden] { display: none; }
.found-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding-bottom: 12px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.found-name { font-family: var(--serif); font-weight: 600; font-size: 1.5rem; margin: 0; }
.found-sub { color: var(--muted); font-size: 0.9rem; margin: 4px 0 0; }
.found-sub .found-codes { margin-left: 8px; opacity: 0.8; }
.found-clear {
  flex: none; padding: 7px 14px;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px;
  font: inherit; font-size: 0.82rem; cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.found-clear:hover { color: var(--text); border-color: var(--muted); }
.found-clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.game-rows { list-style: none; margin: 0; padding: 0; }
.game-row {
  width: 100%; margin: 0; border: 0; background: transparent; color: inherit;
  font: inherit; text-align: left;
  display: grid; grid-template-columns: 104px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 6px; cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.9rem;
}
.game-row:hover { background: var(--bg-elev); }
.game-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.game-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.game-vid { color: var(--text); opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-time { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.game-row.playing { background: rgba(150, 200, 240, 0.10); }

/* ---- Sessions ---- */
.session { list-style: none; }
.session-count { color: var(--accent); font-size: 0.85rem; white-space: nowrap; opacity: 0.9; }
.session-head::after {
  content: "";
  width: 6px; height: 6px; margin-left: 10px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.15s;
}
.session-head[aria-expanded="true"]::after { transform: rotate(-135deg) translateY(-2px); }
.session-head { grid-template-columns: 104px 1fr auto auto; }

/* The individual games in a session, as timestamps you can click. */
.session-times {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 6px 14px 110px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.session-times[hidden] { display: none; }
.time-chip {
  padding: 5px 10px; margin: 0;
  background: var(--bg-elev); color: var(--accent);
  border: 1px solid var(--border); border-radius: 6px;
  font: inherit; font-size: 0.82rem; font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
}
.time-chip:hover { border-color: var(--accent); background: var(--bg-elev-2); }
.time-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.time-chip.playing { background: rgba(150, 200, 240, 0.16); border-color: var(--accent); }

.found-sessions { margin-left: 8px; opacity: 0.8; }
.loading-games { list-style: none; color: var(--muted); padding: 18px 6px; font-size: 0.9rem; }

/* ---- Archive grid ---- */
.archive-section { margin-top: 20px; }
.archive-count {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 12px;
  min-height: 1.2em;
  letter-spacing: 0.01em;
}
.archive-count:empty { display: none; }
.thumb[hidden] { display: none; }
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.thumb {
  position: relative;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 16 / 9;
  display: block;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* crops the letterbox bars off hqdefault.jpg */
  display: block;
  transition: transform 0.3s ease;
}
.thumb-date {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px 12px 9px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent-soft);
  text-align: center;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.18s, transform 0.18s;
  pointer-events: none;
}
.thumb:hover { border-color: var(--accent); box-shadow: 0 8px 26px rgba(0,0,0,0.5); }
.thumb:hover img { transform: scale(1.05); }
.thumb:hover .thumb-date,
.thumb:focus-visible .thumb-date { opacity: 1; transform: translateY(0); }
.thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Footer ---- */
.footer {
  position: relative; z-index: 1;
  max-width: var(--maxw); margin: 0 auto; padding: 34px 22px 56px;
  color: var(--muted); font-size: 0.82rem; text-align: center;
}
.footer p { margin: 0 0 10px; }
.footer .yt { color: var(--text); opacity: 0.85; text-decoration: none; border-bottom: 1px solid var(--border); }
.footer .yt:hover { color: var(--accent); border-bottom-color: var(--accent); opacity: 1; }
.footer .downloads { color: var(--muted); margin-top: 22px; }
.footer .dl-why { max-width: 520px; margin: 0 auto 10px; line-height: 1.6; text-wrap: pretty; }
.footer .downloads a { color: var(--text); opacity: 0.85; text-decoration: none; border-bottom: 1px solid var(--border); }
.footer .downloads a:hover { color: var(--accent); border-bottom-color: var(--accent); opacity: 1; }
.footer .downloads .dl-meta { color: var(--muted); }
.footer .sep { margin: 0 6px; }
.footer::before {
  content: ""; display: block; width: 60px; height: 1px; margin: 0 auto 26px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

@media (max-width: 520px) {
  .game-row { grid-template-columns: 84px 1fr auto; font-size: 0.86rem; }
  .session-head { grid-template-columns: 84px 1fr auto auto; }
  .session-times { padding-left: 90px; }
  .hero { padding-top: 52px; }
}
