/* ===============================================
   RESET
   =============================================== */

/* Padding and borders should not change an element's declared size. */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Browser margin/padding defaults vary wildly across elements and vendors.
   Start from zero - handle spacing intentionally via the design system. */
* {
  margin: 0;
  padding: 0;
}

/* Prevents flex/grid children from overflowing their container.
   The default min-width: auto on flex and grid children causes overflow bugs
   that are notoriously confusing to debug. */
* {
  min-width: 0;
}

/* Hidden means hidden: !important is warranted here. */
[hidden] {
  display: none !important;
}

/* Allows CSS transitions to/from intrinsic keyword sizes (auto, min-content, etc.).
   Only meaningful for users who haven't requested reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  html {
    interpolate-size: allow-keywords;
  }
}

/* Prevent adjustments of font size after orientation changes in iOS. */
html {
  -webkit-text-size-adjust: 100%; /* Safari, iOS Safari */
  text-size-adjust: 100%;         /* Chrome, Edge, Firefox Android */
}

/* Ensures the page occupies at least the full viewport.
   dvh accounts for mobile browser UI (address bar, navigation)
   and overrides the vh fallback in browsers that support it. */
body {
  font-family: 'JetBrains Mono', monospace;
  min-height: 100vh;
  min-height: 100svh;
}

/* Scroll events captured by the scrolling area you're pointing at, by default. */
html {
  overscroll-behavior: contain;
}

/* Antialiased rendering looks better on high-DPI (retina) screens.
   On lower-DPI displays, subpixel antialiasing (the default) can be
   sharper, so this is slightly lossy on older monitors.
   Enable kerning and ligatures at small font-sizes by default. */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-smooth: always;
  text-rendering: optimizeLegibility;
}

/* A unitless line-height avoids inheritance math issues.
   The smaller default line-height for h-elements avoids excessive
   line-height when your design system (likely) applies larger fonts.
   WCAG recommends at least 1.5 for body copy. */
body {
  line-height: 1.5;
}
h1, h2, h3, h4, h5, h6 {
  line-height: 1.1;
}

/* Prevents long URLs or unbreakable strings from blowing out their container. */
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

/* Smarter line-breaking:
   'pretty' avoids widows (lone words on the last line of a paragraph).
   'balance' distributes heading text more evenly across lines.
   Harmless in browsers that don't support them. */
p {
  text-wrap: pretty;
}
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
}

/* Headings carry semantic meaning, not visual weight.
   h1–h6 sizing and boldness should come from your design system. */
h1, h2, h3, h4, h5, h6 {
  font-size: inherit;
  font-weight: inherit;
}

/* Inline embedded content has a gap at the bottom caused by baseline alignment.
   Block display removes it; max-width prevents overflow.
   height: auto preserves aspect ratio when max-width constrains the width. */
img, picture, video, canvas, svg, embed, iframe, object, audio {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Exemption for SVG icons (Heroicons/Lucide/Phosphor, etc.) with explicit sizes:
   these should not be constrained. */
svg[width][height] {
  max-width: revert;
}

/* Strips visual chrome from buttons so they can be styled from scratch. */
button {
  background: none;
  border: none;
}

/* Form elements use OS-level fonts and ignore font inheritance by default. */
input, button, textarea, select {
  font: inherit;
}

/* Strips OS-level native styling from interactive elements.
   Leaves border and background intact, providing accessibility by default.
   Visual styling should be handled by the design system. */
input, button, textarea, select {
  -webkit-appearance: none;
  appearance: none;
}

/* Anything interactive should signal clickability.
   'button' attribute targets [type="button"], [type="submit"], etc. */
button,
[role="button"],
label,
summary,
select {
  cursor: pointer;
}

/* Inherit color by default so links don't always appear in browser-default blue.
   Text-decoration is intentionally left as underlined for accessibility. */
a {
  color: inherit;
}

/* Removes bullets/numbers.
   list markers should be an explicit choice, not a default. */
ul, ol {
  list-style: none;
}

/* Tables default to separated borders with spacing between cells.
   For any custom table design, you'll want to collapse the borders. */
table {
  border-collapse: collapse;
}

/* Browsers apply bold to <th> elements.
   Boldness in tables should be controlled by your design system. */
th {
  font-weight: inherit;
}

/* Fieldsets have a surprise border and padding that most UIs don't want. */
fieldset {
  border: none;
  padding: 0;
}

/* More of a normalization, but these are inconsistently styled in some browsers. */
sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}
sub { bottom: -0.25em; }
sup { top: -0.5em; }

/* Ensures monospace elements render at the same size as surrounding text. */
pre, code, kbd, samp {
  font-family: monospace;
  font-size: inherit;
}

/* Browser-generated quotation marks are rarely wanted in a design system. */
blockquote,
q {
  quotes: none;
}
blockquote::before,
blockquote::after,
q::before,
q::after {
  content: none;
}

/* Creates an explicit stacking context on the app root.
   Prevents z-index bleed from portals, modals, or tooltips
   from leaking out unexpectedly. */
#root {
  isolation: isolate;
}

/* ===============================================
   FONTS
   =============================================== */

@font-face {
  font-family: 'JetBrains Mono';
  src: url('../Source/Font/JetBrainsMono-2.304/fonts/webfonts/JetBrainsMono-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ===============================================
   HEADER / FOOTER BREAKPOINT SWITCH
   =============================================== */

.header-d-wrap,
.header-p-wrap,
.footer-d-wrap,
.footer-p-wrap {
  width: 100%;
  flex-shrink: 0;
}

/* The reset's `img { max-width: 100% }` fights the header logo's own
   fill-and-crop sizing (width/height: 148% inside an overflow:hidden circle).
   Exempt it so the component renders exactly as it does standalone. */
.headerc-d-logo img,
.headerc-p-logo img {
  max-width: none;
  height: 148%;
}

.header-p-wrap,
.footer-p-wrap {
  display: none;
}

/* ===============================================
   LAYOUT
   =============================================== */

html, body {
  height: 100%;
}

body {
  background: #090909;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
  height: 100svh;
}

.play-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  width: 100%;
  padding: 36px 150px;
  overflow: hidden;
}

.play-title {
  width: 100%;
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 40px;
  line-height: normal;
  color: #3d0018;
  text-shadow: 0px 1px 1px rgba(0, 255, 146, 0.5);
}

/* Scroll wrappers: invisible on desktop, a custom scrollbar on the phone. */
.play-scroll-outer,
.play-scroll-inner,
.play-scroll-wrap {
  display: contents;
}

.play-scrollbar-track {
  display: none;
}

.play-content {
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  /* Four posters in one line; more posters go to the next line. The box scrolls up and down when they do not all fit. */
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-content: start;
  justify-items: center;
  gap: 40px 24px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #00ff92 rgba(205, 205, 205, 0.06);
  /* Safe zone: room around the posters so the glow is never cut off. */
  padding: 28px 28px 40px;
  box-sizing: border-box;
}

.play-content::-webkit-scrollbar { width: 6px; }
.play-content::-webkit-scrollbar-track { background: rgba(205, 205, 205, 0.06); border-radius: 3px; }
.play-content::-webkit-scrollbar-thumb { background: #00ff92; border-radius: 3px; }

/* The posters are square (4500 x 4500): four in one line on desktop (more go to the next line), two on phone. */
.play-card {
  /* So the glow can be sized from the card width (cqw) on every screen. */
  container-type: inline-size;
  flex-shrink: 0;
  width: min(100%, 230px);
  aspect-ratio: 1 / 1;
  display: block;
  position: relative;
  transition: transform 0.3s ease;
}

.play-card:hover {
  transform: scale(1.25);
  z-index: 1;
}

.play-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  /* The glow is 3 times as wide as the green border of the poster (the border is
     about 0.6% of the poster width), so it grows and shrinks with the button. */
  --play-glow-blur: 1.8cqw;
  filter: drop-shadow(3px 3px 0px #000) drop-shadow(0 0 var(--play-glow-blur) rgba(205, 205, 205, 0.5));
}

/* A soft #cdcdcd glow that slowly turns on and off between 20% and 70%, like
   a star. Each poster has its own speed and start, so they never blink together. */
@keyframes play-card-twinkle {
  0%, 100% {
    filter: drop-shadow(3px 3px 0px #000) drop-shadow(0 0 var(--play-glow-blur) rgba(205, 205, 205, 0.2));
  }
  50% {
    filter: drop-shadow(3px 3px 0px #000) drop-shadow(0 0 var(--play-glow-blur) rgba(205, 205, 205, 0.7));
  }
}

@media (prefers-reduced-motion: no-preference) {
  .play-card img {
    animation: play-card-twinkle 3.5s ease-in-out infinite;
  }

  .play-card:nth-child(1) img { animation-duration: 3s; animation-delay: -0.8s; }
  .play-card:nth-child(2) img { animation-duration: 3.6s; animation-delay: -2.2s; }
  .play-card:nth-child(3) img { animation-duration: 3.3s; animation-delay: -1.4s; }
  .play-card:nth-child(4) img { animation-duration: 4s; animation-delay: -3s; }
  .play-card:nth-child(5) img { animation-duration: 3.4s; animation-delay: -1.9s; }
  .play-card:nth-child(6) img { animation-duration: 3.8s; animation-delay: -2.7s; }
}

/* Narrow desktop windows: less side padding so all four posters of a line still fit. */
@media (min-width: 769px) and (max-width: 1279px) {
  .play-body {
    padding: 36px 40px;
  }
}

/* ===============================================
   RESPONSIVE - PHONE (max-width: 768px)
   =============================================== */
@media (max-width: 768px) {

  /* The page keeps the height of the screen: header and footer stay in place, only the posters scroll. */
  .header-d-wrap,
  .footer-d-wrap {
    display: none;
  }

  .header-p-wrap,
  .footer-p-wrap {
    display: block;
  }

  .play-body {
    flex: 1 1 auto;
    justify-content: flex-start;
    gap: 14px;
    padding: 16px 40px 12px;
    overflow: hidden;
  }

  .play-title {
    font-size: 30px;
  }

  /* ===== SCROLL WRAPPERS: real scroll container + custom scrollbar (same as the game pages) ===== */

  .play-scroll-outer {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    position: relative;
  }

  .play-scroll-inner {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 6px;
    width: 100%;
    height: 100%;
  }

  .play-scroll-wrap {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    overflow-x: hidden;
    overflow-y: scroll;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .play-scroll-wrap::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .play-scrollbar-track {
    display: block;
    flex-shrink: 0;
    align-self: stretch;
    width: 4px;
    padding: 4px 1px;
    background: #000000;
    position: relative;
  }

  .play-scrollbar-thumb {
    position: absolute;
    left: 50%;
    width: 1px;
    transform: translateX(-50%);
    background: #00ff92;
    filter: blur(0.5px);
    cursor: pointer;
  }

  .play-content {
    flex: none;
    /* One poster in each row (the desktop grid has four columns, which made them tiny here). */
    grid-template-columns: minmax(0, 1fr);
    justify-items: stretch;
    gap: 28px;
    height: auto;
    padding: 7px;
  }

  .play-card {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }

}
