:root {
  --ink: #0E1116;
  --shelf: #151920;
  --panel: #1A1F29;
  --panel-2: #212836;
  --edge: #2B3342;
  --paper: #EDEAE3;
  --muted: #9199A6;
  --muted-2: #6B7482;
  --brass: #E3B23C;
  --display: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Menlo, monospace;
}

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

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--display);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

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

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

.replay-wrap {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

/* ---------- HERO ---------- */
.replay-hero {
  background: linear-gradient(180deg, var(--shelf) 0%, var(--ink) 100%);
}

.replay-hero-inner {
  padding: 34px 0 26px;
}

.replay-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.brand-mark {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 26px;
  height: 26px;
  padding: 5px;
  background: var(--panel);
}

.brand-mark span {
  position: relative;
  width: 3px;
  height: 100%;
  background: #222836;
}

.brand-mark i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--brass);
}

.brand-mark span:nth-child(1) i { height: 100%; }
.brand-mark span:nth-child(2) i { height: 66%; }
.brand-mark span:nth-child(3) i { height: 34%; }

.brand-name {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.replay-title {
  margin: 0;
  font-size: clamp(44px, 7.5vw, 72px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.94;
}

.replay-title-muted {
  color: var(--muted-2);
}

/* ---------- MAIN SECTIONS ---------- */
.replay-main {
  padding: 20px 0 36px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.replay-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.replay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.replay-head-end {
  justify-content: flex-end;
}

.replay-head-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.replay-heading {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.replay-scope {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.replay-clear {
  padding: 6px 12px;
  background: var(--panel-2);
  color: var(--brass);
  font-size: 12px;
  font-weight: 700;
  transition: background 150ms ease;
}

.replay-clear:hover {
  background: var(--edge);
}

.replay-clear[hidden] {
  display: none;
}

/* ---------- MAIN-SITE SEGMENTED CONTROL ---------- */
.seg {
  display: inline-flex;
  background: var(--shelf);
  padding: 3px;
  gap: 2px;
}

.seg button {
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-2);
  transition: background 140ms ease, color 140ms ease;
}

.seg button:hover {
  color: var(--paper);
}

.seg button.on {
  background: var(--panel-2);
  color: var(--brass);
}

/* ---------- SHARP COVER TILE (NO BORDER, NO GLOSS, NO TITLE BELOW) ---------- */
.cover-tile {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--panel);
  cursor: pointer;
  padding: 0;
  width: 100%;
  text-align: left;
  display: block;
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1), filter 180ms ease, box-shadow 180ms ease;
}

.cover-tile:hover {
  transform: translateY(-4px);
  filter: brightness(1.12);
  box-shadow: 0 14px 28px -14px rgba(0, 0, 0, 0.92);
  z-index: 6;
}

.cover-tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-tile img[hidden] {
  display: none;
}

.cover-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: var(--shelf);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-align: center;
  color: rgba(237, 234, 227, 0.72);
  overflow-wrap: anywhere;
}

.cover-tile img:not([hidden]) + .cover-fallback {
  display: none;
}

/* ---------- EXACT MAIN-SITE MODAL & COVER RATING RING ---------- */
.rating-ring {
  position: relative;
  flex: 0 0 auto;
  width: 100px;
  height: 100px;
}

.rating-ring svg {
  width: 100%;
  height: 100%;
  display: block;
  transform: rotate(-90deg);
}

.rating-ring .ring-track {
  fill: none;
  stroke: var(--edge);
  stroke-width: 12;
}

.rating-ring .ring-fill {
  fill: none;
  stroke-width: 12;
  stroke-linecap: butt;
}

.rating-ring .ring-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 38px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.rating-ring.sm {
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 4;
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

.rating-ring.sm::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: 0;
  border-radius: 50%;
  background: rgba(10, 12, 16, 0.86);
  backdrop-filter: blur(4px);
}

.rating-ring.sm svg,
.rating-ring.sm .ring-num {
  position: relative;
  z-index: 1;
}

.rating-ring.sm .ring-num {
  position: absolute;
  font-size: 11px;
}

.rating-ring.md {
  width: 64px;
  height: 64px;
  margin-top: 4px;
}

.rating-ring.md .ring-num {
  font-size: 24px;
}

.score-num {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

/* ---------- TOP 5 SHOWCASE (NO STRIPES) ---------- */
.replay-top5 {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 14px;
  align-items: start;
}

.top5-hero {
  background: var(--shelf);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 180ms ease, transform 180ms ease;
}

.top5-hero:hover {
  background: var(--panel);
  transform: translateY(-2px);
}

.top5-hero-cover {
  width: 144px;
  flex: none;
}

.top5-hero-cover .cover-tile {
  pointer-events: none;
}

.top5-hero-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.top5-title {
  margin: 0;
  font-size: clamp(22px, 2.5vw, 30px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.top5-meta {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}

.top5-rest {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

/* ---------- 6 BENTO CATEGORY CARDS (NO STRIPES, NO ARCADE LINK) ---------- */
.replay-bento {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.bento-tile {
  position: relative;
  overflow: hidden;
  background: var(--shelf);
  padding: 20px 22px;
  min-height: 124px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
  transition: background 180ms ease, transform 180ms ease, opacity 180ms ease;
}

.bento-tile:hover {
  background: var(--panel);
  transform: translateY(-2px);
}

.bento-tile.is-active {
  background: var(--panel-2);
}

.bento-tile.is-dimmed {
  opacity: 0.42;
}

.bento-tile.is-dimmed:hover {
  opacity: 0.85;
}

.bento-peeks {
  position: absolute;
  right: 8px;
  bottom: -16px;
  display: flex;
  pointer-events: none;
  user-select: none;
  opacity: 0.82;
}

.bento-peek {
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.72);
  transition: transform 220ms ease;
}

.bento-peek img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bento-peek-1 {
  width: 66px;
  margin-right: -24px;
  transform: rotate(-4deg);
}

.bento-peek-2 {
  width: 82px;
  transform: rotate(3deg);
}

.bento-tile:hover .bento-peek-1 {
  transform: translate(-4px, -3px) rotate(-6deg);
}

.bento-tile:hover .bento-peek-2 {
  transform: translate(3px, -5px) rotate(5deg);
}

.bento-top {
  position: relative;
  z-index: 2;
}

.bento-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.bento-count {
  font-size: clamp(36px, 4.4vw, 48px);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* ---------- TIMELINE (BLOCKS WHEN ALL, CLEAN GRID WHEN SINGLE) ---------- */
.replay-timeline {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.month-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.month-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.month-blocks {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.cat-block {
  background: var(--shelf);
  padding: 16px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cat-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cat-block-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.cat-block-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted-2);
}

.cat-block-covers {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.cat-block-cover {
  width: 122px;
  flex: none;
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.replay-empty {
  padding: 44px 20px;
  text-align: center;
  background: var(--shelf);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

/* ---------- SKELETON ---------- */
.replay-skel {
  background: linear-gradient(90deg, var(--shelf) 25%, var(--panel-2) 50%, var(--shelf) 75%);
  background-size: 200% 100%;
  animation: replayShimmer 1.4s ease-in-out infinite;
}

@keyframes replayShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- FOOTER (CENTERED YEAR PILLS + HOME LINK BELOW, NO ARROW) ---------- */
.replay-footer {
  padding: 28px 0 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.replay-years {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.replay-year-pill {
  padding: 8px 18px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  background: var(--shelf);
  color: var(--muted);
  transition: background 150ms ease, color 150ms ease;
}

.replay-year-pill:hover {
  background: var(--panel-2);
  color: var(--paper);
}

.replay-year-pill.active {
  background: var(--brass);
  color: var(--ink);
}

.replay-home {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: color 150ms ease;
}

.replay-home:hover {
  color: var(--brass);
}

/* ---------- LIGHTBOX ---------- */
.replay-lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(6, 8, 11, 0.82);
  backdrop-filter: blur(8px);
}

.replay-lightbox[hidden] {
  display: none;
}

.replay-lightbox-card {
  position: relative;
  width: min(520px, 100%);
  padding: 26px;
  background: var(--shelf);
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.92);
}

.lb-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  width: 34px;
  height: 34px;
  background: var(--panel-2);
  color: var(--paper);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms ease;
}

.lb-close:hover {
  background: var(--edge);
}

.lb-body {
  display: flex;
  align-items: center;
  gap: 22px;
}

.lb-cover {
  width: 160px;
  flex: none;
}

.lb-cover .cover-tile {
  pointer-events: none;
}

.lb-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lb-cat {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.lb-title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.lb-sub {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}

.lb-ring-wrap {
  padding-top: 4px;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 960px) {
  .replay-top5 {
    grid-template-columns: 1fr;
  }
  .replay-bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .poster-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .replay-hero-inner {
    padding: 26px 0 20px;
  }
  .replay-main {
    gap: 36px;
  }
  .top5-hero {
    padding: 16px;
    gap: 14px;
  }
  .top5-hero-cover {
    width: 112px;
  }
  .top5-rest {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .replay-bento {
    gap: 10px;
  }
  .bento-tile {
    padding: 15px 16px;
    min-height: 126px;
  }
  .bento-peek-1 {
    width: 52px;
    margin-right: -20px;
  }
  .bento-peek-2 {
    width: 66px;
  }
  .cat-block-cover {
    width: calc((100% - 24px) / 3);
    min-width: 84px;
  }
  .poster-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }
  .lb-body {
    flex-direction: column;
    text-align: center;
  }
  .lb-info {
    align-items: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
