:root {
  --bg: #05070c;
  --bg-panel: rgba(6, 10, 17, 0.8);
  --bg-panel-strong: rgba(8, 12, 20, 0.94);
  --line: rgba(170, 180, 192, 0.18);
  --text: #f4ead8;
  --cool: #cfd6df;
  --shadow: rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #05070c 0%, #020306 100%);
  color: var(--text);
  font-family: "Chakra Petch", "Avenir Next Condensed", "Trebuchet MS", sans-serif;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
}

code {
  font-family: "SFMono-Regular", "Consolas", monospace;
  font-size: 0.92em;
  color: var(--cool);
}

button {
  font: inherit;
}

.backdrop,
.backdrop__grid,
.backdrop__glow,
.backdrop__noise {
  inset: 0;
  pointer-events: none;
  position: fixed;
}

.backdrop__grid {
  background:
    linear-gradient(rgba(205, 212, 222, 0.28) 1.5px, transparent 1.5px),
    linear-gradient(90deg, rgba(205, 212, 222, 0.28) 1.5px, transparent 1.5px);
  background-size: 3rem 3rem, 3rem 3rem;
  opacity: 0.68;
}

.backdrop__glow {
  background:
    radial-gradient(circle at 24% 22%, rgba(66, 142, 230, 0.14), transparent 18%),
    radial-gradient(circle at 74% 18%, rgba(186, 54, 70, 0.09), transparent 18%),
    radial-gradient(circle at 50% 32%, rgba(112, 122, 140, 0.07), transparent 34%);
}

.backdrop__noise {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 50%, transparent 50%),
    radial-gradient(circle at center, transparent 0, rgba(0, 0, 0, 0.24) 100%);
  background-size: 100% 4px, 100% 100%;
  mix-blend-mode: screen;
  opacity: 0.08;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1220px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.2rem 0 3rem;
}

.page-header {
  display: grid;
  gap: 0.7rem;
  justify-items: center;
  text-align: center;
  margin-bottom: 1.6rem;
}

h1 {
  margin: 0;
  font-family: "Bungee", "Impact", sans-serif;
  font-size: clamp(3.4rem, 9vw, 6.6rem);
  line-height: 0.88;
  color: #f6f7f8;
  -webkit-text-stroke: 1px rgba(222, 232, 242, 0.55);
  text-shadow:
    0.03em 0.03em 0 rgba(86, 140, 210, 0.92),
    0.07em 0.07em 0 rgba(8, 17, 31, 0.46),
    0.12em 0.12em 0 rgba(0, 0, 0, 0.68);
}

.page-header p {
  margin: 0;
  max-width: 36rem;
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(244, 245, 247, 0.82);
}

.panel {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 24%),
    linear-gradient(180deg, var(--bg-panel-strong), var(--bg-panel));
  box-shadow:
    0 18px 44px var(--shadow),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(8px);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  align-items: start;
}

.game-grid__error {
  grid-column: 1 / -1;
  margin: 0;
  padding: 1rem 1.2rem;
  border: 1px solid rgba(205, 212, 222, 0.24);
  background: rgba(12, 18, 29, 0.92);
}

.game-card {
  display: grid;
  gap: 0.85rem;
  padding: 0.7rem;
  cursor: pointer;
  text-align: left;
  color: inherit;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: rgba(205, 212, 222, 0.34);
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.48),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.game-card__cover-wrap {
  position: relative;
  border: 1px solid rgba(168, 174, 182, 0.16);
  padding: 0.55rem;
  background:
    linear-gradient(180deg, rgba(158, 166, 178, 0.05), rgba(27, 31, 39, 0.1)),
    rgba(0, 0, 0, 0.24);
}

.game-card__cover {
  width: 100%;
  aspect-ratio: 0.72;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.32);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.42);
}

.game-card__qr {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  width: 2.55rem;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.5));
}

.game-card__meta {
  display: grid;
  gap: 0.25rem;
  padding: 0 0.1rem 0.15rem;
}

.game-card__title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f6f7f8;
}

.scan-modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: 1rem;
}

.scan-modal[hidden] {
  display: none;
}

.scan-modal__scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(8px);
}

.scan-modal__card {
  position: relative;
  z-index: 1;
  width: min(92vw, 72rem);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 1.1rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.scan-modal--playing .scan-modal__card {
  width: min(94vw, 36rem);
  padding: 1.25rem 1.25rem 1.5rem;
}

.scan-modal__close {
  position: absolute;
  top: 0.95rem;
  right: 0.95rem;
  z-index: 1;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid rgba(205, 212, 222, 0.26);
  background: rgba(20, 28, 43, 0.82);
  color: #f6f7f8;
  cursor: pointer;
}

.scan-sheet {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(280px, 1fr);
  gap: 1.2rem;
  align-items: center;
}

.scan-sheet__info {
  display: grid;
  gap: 1rem;
}

.scan-sheet__cover {
  width: min(100%, 20rem);
  justify-self: center;
  border: 1px solid rgba(168, 174, 182, 0.16);
  background: rgba(0, 0, 0, 0.24);
}

.scan-sheet__copy {
  display: grid;
  gap: 0.55rem;
  text-align: center;
  justify-items: center;
}

.scan-sheet__kicker {
  margin: 0;
  color: rgba(205, 212, 222, 0.72);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.scan-sheet h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.scan-sheet__note {
  margin: 0;
  color: rgba(244, 245, 247, 0.82);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.82rem;
}

.scan-sheet__qr-wrap {
  display: grid;
  gap: 0.8rem;
  justify-items: center;
}

.scan-sheet__qr {
  width: min(100%, 42rem);
  justify-self: center;
  background: #fff;
}

.scan-sheet__play {
  display: inline-block;
  min-width: min(100%, 18rem);
  padding: 1rem 1.35rem;
  border: 1px solid rgba(177, 214, 255, 0.52);
  background: #2e7cff;
  color: #f8fbff;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-decoration: none;
  text-transform: uppercase;
  text-align: center;
  cursor: pointer;
  transition: background-color 120ms ease;
}

.scan-sheet__play:hover {
  background: #3b88ff;
}

.play-sheet {
  display: grid;
  gap: 1.2rem;
  justify-items: center;
  width: 100%;
}

.play-sheet__copy {
  display: grid;
  gap: 0.55rem;
  text-align: center;
}

.play-sheet__copy h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.phone-frame {
  position: relative;
  width: min(100%, 26rem);
  aspect-ratio: 430 / 932;
  padding: 0.9rem;
  border: 1px solid rgba(205, 212, 222, 0.24);
  border-radius: 2.8rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 12%),
    linear-gradient(180deg, rgba(25, 36, 58, 0.94), rgba(3, 5, 9, 0.98));
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.phone-frame__notch {
  position: absolute;
  top: 0.5rem;
  left: 50%;
  width: 34%;
  height: 1.35rem;
  border-radius: 0 0 1rem 1rem;
  background: #010203;
  transform: translateX(-50%);
  z-index: 1;
}

.phone-frame__screen {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 2rem;
  background: #000;
}

@media (max-width: 900px) {
  .page-shell {
    width: min(100% - 1rem, 1220px);
  }

  .game-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }

  .scan-sheet {
    grid-template-columns: 1fr;
  }

  .scan-sheet__cover {
    width: min(100%, 11.5rem);
  }

  .phone-frame {
    width: min(100%, 22rem);
  }
}

@media (max-width: 680px) {
  .page-shell {
    padding-top: 0.9rem;
  }

  h1 {
    font-size: clamp(3rem, 17vw, 4.8rem);
  }

  .game-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
  }

  .game-card {
    padding: 0.55rem;
  }

  .game-card__qr {
    width: 2.2rem;
    right: 0.7rem;
    bottom: 0.7rem;
  }

  .scan-modal__card {
    width: min(96vw, 72rem);
    padding: 0.9rem;
  }

  .scan-sheet {
    gap: 0.9rem;
  }

  .scan-sheet__copy {
    gap: 0.4rem;
  }

  .scan-sheet__qr {
    width: min(100%, 22rem);
  }

  .scan-modal--playing .scan-modal__card {
    width: min(96vw, 22rem);
    padding: 0.95rem 0.95rem 1.1rem;
  }

  .scan-sheet__play {
    width: 100%;
  }

  .phone-frame {
    width: min(100%, 19rem);
    border-radius: 2.2rem;
    padding: 0.75rem;
  }

  .phone-frame__screen {
    border-radius: 1.6rem;
  }
}
