:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #eef3f8;
  --surface-raised: #ffffff;
  --text: #111827;
  --muted: #64748b;
  --line: #d9e2ec;
  --accent: #1c7ed6;
  --accent-strong: #145ea8;
  --accent-soft: #dff1ff;
  --sidebar-bg: rgba(255, 255, 255, 0.88);
  --topbar-bg: rgba(244, 247, 251, 0.92);
  --input-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --yellow: #ffd84d;
  --green: #42d392;
  --pink: #ff6b9a;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
  --shadow-hover: 0 24px 60px rgba(15, 23, 42, 0.2);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c111d;
  --surface: #151c2c;
  --surface-soft: #1e293b;
  --surface-raised: #172033;
  --text: #eef4ff;
  --muted: #9aa9bd;
  --line: #2a3548;
  --accent: #57b7ff;
  --accent-strong: #92d0ff;
  --accent-soft: rgba(87, 183, 255, 0.16);
  --sidebar-bg: rgba(14, 20, 32, 0.9);
  --topbar-bg: rgba(12, 17, 29, 0.9);
  --input-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  --shadow-hover: 0 26px 70px rgba(0, 0, 0, 0.46);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  transition:
    background-color 180ms ease,
    color 180ms ease;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.app-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  padding: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 900;
}

.brand__mark {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border-radius: 8px;
  background: var(--yellow);
  color: #16130a;
  box-shadow: inset -7px 0 0 rgba(0, 0, 0, 0.12);
}

.side-nav {
  display: grid;
  gap: 0.35rem;
  margin-top: 2rem;
}

.side-nav__item {
  border-radius: 8px;
  padding: 0.72rem 0.8rem;
  color: var(--muted);
  font-weight: 750;
  transition:
    background-color 160ms ease,
    color 160ms ease;
}

.side-nav__item:hover,
.side-nav__item--active {
  background: var(--surface-soft);
  color: var(--text);
}

.page {
  min-width: 0;
  padding: 1rem clamp(1rem, 3vw, 2.5rem) 2rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0 1rem;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
}

.search {
  flex: 1;
}

.search input {
  width: 100%;
  min-height: 3rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--input-shadow);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  outline: none;
  padding: 0 1rem;
}

.search input:focus {
  border-color: var(--accent);
}

.theme-toggle {
  position: relative;
  display: inline-grid;
  width: 3rem;
  height: 3rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--input-shadow);
  color: var(--text);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.theme-toggle:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.theme-toggle__icon {
  position: relative;
  display: block;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 4px rgba(255, 216, 77, 0.22);
}

:root[data-theme="dark"] .theme-toggle__icon {
  background: transparent;
  box-shadow: inset -0.36rem -0.2rem 0 0 var(--accent-strong);
}

.topbar__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 850;
  padding: 0 1rem;
  white-space: nowrap;
}

.topbar__link:hover {
  background: var(--accent-strong);
}

.intro {
  max-width: 760px;
  padding: 1.5rem 0 1rem;
}

.intro__kicker {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.65rem;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0;
}

.intro p,
.section-heading p,
.info-strip p {
  color: var(--muted);
  line-height: 1.65;
}

.quick-picks {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.75rem 0 1.35rem;
}

.quick-pick {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
  padding: 0 0.9rem;
  white-space: nowrap;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.quick-pick:hover,
.quick-pick--active {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.quick-pick:hover {
  transform: translateY(-1px);
}

.games-section {
  padding: 0.25rem 0 2rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading h2 {
  margin-bottom: 0.2rem;
  font-size: 1.6rem;
}

.section-heading p {
  max-width: 34rem;
  margin-bottom: 0;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 1rem;
}

.game-tile {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
  border-radius: 8px;
  outline-offset: 6px;
  transition:
    opacity 160ms ease,
    transform 180ms ease;
}

.game-tile:hover {
  transform: translateY(-5px);
}

.game-tile:focus-visible {
  outline: 3px solid var(--accent);
}

.game-tile--featured {
  grid-column: span 2;
}

.game-thumb {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  transition:
    box-shadow 180ms ease,
    transform 180ms ease,
    filter 180ms ease;
}

.game-tile:hover .game-thumb,
.game-tile:focus-visible .game-thumb {
  box-shadow: var(--shadow-hover);
  filter: saturate(1.08);
}

.game-tile--featured .game-thumb {
  aspect-ratio: 2 / 1;
}

.game-title {
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-meta {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 650;
}

.game-tile--locked {
  opacity: 0.72;
}

.game-tile--locked:hover {
  opacity: 0.86;
}

.game-thumb--pacman {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    #101828;
  background-size: 28px 28px;
}

.game-thumb--pacman img {
  position: absolute;
  left: 14%;
  top: 50%;
  width: clamp(76px, 22vw, 132px);
  transform: translateY(-50%);
  transition: transform 240ms ease;
}

.maze-line {
  position: absolute;
  right: 10%;
  left: 38%;
  height: 10px;
  border-radius: 999px;
  background: #3767ff;
}

.maze-line--top {
  top: 24%;
}

.maze-line--mid {
  top: 48%;
}

.maze-line--bottom {
  top: 72%;
}

.dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
}

.dot--one {
  right: 46%;
  top: 32%;
}

.dot--two {
  right: 30%;
  top: 56%;
}

.dot--three {
  right: 14%;
  top: 80%;
}

.game-tile:hover .game-thumb--pacman img,
.game-tile:focus-visible .game-thumb--pacman img {
  transform: translate(18px, -50%);
}

.game-tile:hover .game-thumb--pacman .dot,
.game-tile:focus-visible .game-thumb--pacman .dot {
  animation: pellet-pulse 740ms ease-in-out infinite alternate;
}

.game-thumb--flappy {
  background: linear-gradient(180deg, #54c6eb 0%, #bdf7dd 100%);
}

.game-thumb--flappy img {
  position: absolute;
  left: 18%;
  top: 43%;
  width: 70px;
  transform: translateY(-50%);
  transition: transform 220ms ease;
}

.game-tile--featured .game-thumb--flappy img {
  width: clamp(84px, 16vw, 126px);
}

.flappy-cloud {
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
}

.flappy-cloud::before,
.flappy-cloud::after {
  position: absolute;
  content: "";
  border-radius: 50%;
  background: inherit;
}

.flappy-cloud--one {
  left: 14%;
  top: 18%;
  width: 72px;
  height: 24px;
}

.flappy-cloud--two {
  right: 18%;
  top: 28%;
  width: 58px;
  height: 20px;
}

.flappy-cloud::before {
  left: 10px;
  top: -12px;
  width: 28px;
  height: 28px;
}

.flappy-cloud::after {
  right: 8px;
  top: -9px;
  width: 24px;
  height: 24px;
}

.flappy-gate {
  position: absolute;
  right: 18%;
  width: 48px;
  border-radius: 8px;
  background: linear-gradient(90deg, #2f9e44, #69db7c, #2b8a3e);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.16);
}

.flappy-gate--top {
  top: 0;
  height: 34%;
}

.flappy-gate--bottom {
  bottom: 0;
  height: 28%;
}

.game-tile:hover .game-thumb--flappy img,
.game-tile:focus-visible .game-thumb--flappy img {
  transform: translate(12px, -58%) rotate(-5deg);
}

.game-tile:hover .flappy-cloud,
.game-tile:focus-visible .flappy-cloud {
  animation: cloud-drift 1.8s ease-in-out infinite alternate;
}

.game-thumb--snake {
  background: linear-gradient(145deg, #fef3c7, #fb7185);
}

.snake-body {
  position: absolute;
  inset: 28% 18% 30%;
  border: 18px solid #166534;
  border-left-color: transparent;
  border-radius: 999px;
}

.snake-food {
  position: absolute;
  right: 22%;
  top: 25%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
}

.game-tile:hover .snake-body,
.game-tile:focus-visible .snake-body {
  animation: snake-wiggle 780ms ease-in-out infinite alternate;
}

.game-thumb--pong {
  background: #172554;
}

.pong-paddle,
.pong-ball {
  position: absolute;
  background: #ffffff;
}

.pong-paddle {
  top: 32%;
  width: 12px;
  height: 52px;
  border-radius: 999px;
}

.pong-paddle--left {
  left: 18%;
}

.pong-paddle--right {
  right: 18%;
}

.pong-ball {
  left: 50%;
  top: 44%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.game-tile:hover .pong-ball,
.game-tile:focus-visible .pong-ball {
  animation: pong-preview 900ms ease-in-out infinite alternate;
}

.info-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0 2rem;
}

.info-strip > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 1.25rem;
}

@keyframes pellet-pulse {
  from {
    opacity: 0.45;
    transform: scale(0.86);
  }

  to {
    opacity: 1;
    transform: scale(1.08);
  }
}

@keyframes cloud-drift {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-12px);
  }
}

@keyframes snake-wiggle {
  from {
    transform: translateX(0) rotate(0deg);
  }

  to {
    transform: translateX(8px) rotate(3deg);
  }
}

@keyframes pong-preview {
  from {
    transform: translate(-90%, -80%);
  }

  to {
    transform: translate(45%, 20%);
  }
}

.info-strip h2 {
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.info-strip p {
  margin-bottom: 0;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.25rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 900px) {
  .app-layout {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    margin-top: 1rem;
  }

  .side-nav__item {
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  .page {
    padding-inline: 0.9rem;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .topbar__link {
    grid-column: 1 / -1;
    width: 100%;
  }

  .intro {
    padding-top: 0.75rem;
  }

  .section-heading,
  .info-strip {
    display: block;
  }

  .section-heading p {
    margin-top: 0.4rem;
  }

  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
  }

  .game-tile--featured {
    grid-column: 1 / -1;
  }

  .info-strip > div + div {
    margin-top: 0.85rem;
  }
}

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

  .game-tile:hover,
  .quick-pick:hover,
  .theme-toggle:hover {
    transform: none;
  }
}
