:root {
  --navy: #131d47;
  --white: #f1f1f1;
  --black: #000000;
  --blue: #0393cf;
  --blue-2: #01a2d8;
  --yellow: #f2eb26;
  --ink: #15203f;
  --muted: #5c6684;
  --surface: #ffffff;
  --line: #d9e0ef;
  --shadow: 0 18px 45px rgba(19, 29, 71, 0.14);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 720px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--white);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(135deg, rgba(3, 147, 207, 0.16), transparent 34%),
    linear-gradient(315deg, rgba(242, 235, 38, 0.2), transparent 30%);
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 4px solid rgba(242, 235, 38, 0.9);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

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

.skip-link:focus {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 20;
  width: auto;
  height: auto;
  padding: 12px 16px;
  clip: auto;
  background: var(--yellow);
  color: var(--black);
  font-weight: 800;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--navy);
  color: var(--white);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.header-inner {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  max-width: 1240px;
  min-height: 82px;
  margin: 0 auto;
  padding: 12px 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 190px;
  text-decoration: none;
}

.brand img {
  display: block;
  width: 164px;
  height: auto;
  max-height: 56px;
  object-fit: contain;
  object-position: left center;
}

.site-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.site-nav a {
  min-height: 44px;
  padding: 12px 14px;
  border-radius: var(--radius);
  color: rgba(241, 241, 241, 0.82);
  font-weight: 800;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a.active {
  background: rgba(255, 255, 255, 0.11);
  color: var(--white);
}

.profile-pill,
.primary-btn,
.secondary-btn,
.play-btn,
.filter-btn,
.nav-toggle {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 900;
}

.profile-pill {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 10px;
  max-width: 220px;
  padding: 10px 14px;
  background: var(--white);
  color: var(--navy);
}

.profile-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--yellow);
  box-shadow: 0 0 0 3px rgba(242, 235, 38, 0.25);
}

.nav-toggle {
  display: none;
  width: 48px;
  background: rgba(255, 255, 255, 0.12);
}

.nav-toggle span:not(.sr-only) {
  display: block;
  width: 22px;
  height: 3px;
  margin: 4px auto;
  background: var(--white);
  border-radius: 999px;
}

.page {
  min-height: calc(100vh - 82px);
}

.hero,
.page-shell,
.browse-panel {
  width: min(1180px, calc(100% - 64px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 32px;
  align-items: end;
  padding: 56px 0 30px;
}

.hero-copy h1,
.page-shell h1 {
  max-width: 780px;
  margin: 0;
  color: var(--navy);
  font-size: clamp(3rem, 5vw, 5.8rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy .welcome,
.about-layout p {
  max-width: 680px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-panel,
.about-stat {
  min-height: 190px;
  padding: 26px;
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  background: var(--navy);
  color: var(--white);
  box-shadow: var(--shadow);
}

.hero-panel strong,
.about-stat strong {
  display: block;
  margin: 14px 0 8px;
  color: var(--yellow);
  font-size: 2.4rem;
  line-height: 1;
}

.panel-kicker {
  display: inline-block;
  padding: 7px 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.13);
  font-weight: 900;
}

.browse-panel,
.page-shell {
  padding: 30px 0 56px;
}

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

.section-heading h1,
.section-heading h2 {
  margin: 0;
  color: var(--navy);
  font-size: 2.1rem;
  line-height: 1.1;
}

.text-link {
  color: var(--blue);
  font-weight: 900;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}

.search-field input {
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 750;
  box-shadow: 0 10px 24px rgba(19, 29, 71, 0.08);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.filter-btn {
  padding: 10px 14px;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--navy);
}

.filter-btn.active,
.filter-btn:hover {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.game-card {
  display: grid;
  grid-template-rows: 170px 1fr auto;
  min-height: 430px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 16px 34px rgba(19, 29, 71, 0.1);
}

.game-thumb {
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, var(--navy), var(--blue) 65%, var(--yellow));
}

.game-thumb.muted {
  background:
    linear-gradient(135deg, #5d6688, #98a3ba 65%, #d6d0a0);
}

.game-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-placeholder {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border: 4px solid rgba(255, 255, 255, 0.84);
  border-radius: 24px;
  color: #ffffff;
  font-size: 2.1rem;
  font-weight: 950;
}

.game-content {
  padding: 20px 20px 8px;
}

.game-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.game-meta span,
.leaderboard-flag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: var(--radius);
  background: rgba(1, 162, 216, 0.12);
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 900;
}

.game-card h3 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 1.45rem;
  line-height: 1.15;
}

.game-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.game-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 20px;
}

.play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  padding: 0 18px;
  background: var(--yellow);
  color: var(--black);
  text-decoration: none;
}

.play-btn:hover {
  transform: translateY(-1px);
}

.play-btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.primary-btn,
.secondary-btn {
  padding: 0 16px;
}

.primary-btn {
  background: var(--blue);
  color: #ffffff;
}

.secondary-btn {
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--navy);
}

.danger {
  border-color: #d53a3a;
  color: #a71515;
}

.empty-state {
  margin: 22px 0 0;
  padding: 18px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.leaderboard-card,
.settings-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  background: var(--navy);
  color: var(--white);
  font-size: 0.9rem;
}

.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 34px;
  align-items: start;
}

.settings-layout {
  max-width: 920px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row h2,
.setting-row p {
  margin: 0;
}

.setting-row h2,
.switch-row strong {
  display: block;
  color: var(--navy);
  font-size: 1.05rem;
}

.setting-row p,
.switch-row small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.switch-row input {
  width: 56px;
  height: 32px;
  accent-color: var(--blue);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(19, 29, 71, 0.68);
}

.modal {
  width: min(460px, 100%);
  padding: 28px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal h2 {
  margin: 0 0 10px;
  color: var(--navy);
}

.modal p {
  color: var(--muted);
}

.modal label span {
  display: block;
  margin-bottom: 8px;
  color: var(--navy);
  font-weight: 900;
}

.modal input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
}

.form-error {
  min-height: 24px;
  margin: 8px 0 0;
  color: #a71515;
  font-weight: 800;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.play-body {
  min-width: 720px;
  overflow: hidden;
  background: #080d24;
}

.play-body::before {
  display: none;
}

.play-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: 58px;
  padding: 8px 16px;
  background: var(--navy);
  color: var(--white);
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: var(--yellow);
  color: var(--black);
  font-weight: 950;
  text-decoration: none;
}

.play-bar strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-shell {
  height: calc(100vh - 58px);
}

.play-shell iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.play-error {
  padding: 28px;
  color: var(--white);
}

@media (max-width: 1060px) {
  .header-inner {
    grid-template-columns: auto auto;
  }

  .nav-toggle {
    display: inline-block;
  }

  .site-nav {
    position: absolute;
    top: 82px;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    padding: 12px 32px 22px;
    background: var(--navy);
  }

  .site-nav.open {
    display: flex;
  }

  .profile-pill {
    justify-self: end;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    min-height: 140px;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .filters {
    justify-content: flex-start;
  }

  .games-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .about-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  html,
  body,
  .play-body {
    min-width: 640px;
  }

  .header-inner {
    padding: 12px 24px;
  }

  .hero,
  .page-shell,
  .browse-panel {
    width: min(100% - 40px, 1180px);
  }

  .hero-copy h1,
  .page-shell h1 {
    font-size: 3.2rem;
  }

  .games-grid {
    grid-template-columns: 1fr;
  }

  .game-card {
    grid-template-columns: 230px 1fr;
    grid-template-rows: 1fr auto;
    min-height: 260px;
  }

  .game-thumb {
    grid-row: 1 / 3;
  }

  .game-actions {
    align-items: end;
  }
}
