:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --panel: #ffffff;
  --ink: #151515;
  --muted: #64615c;
  --line: #ded8cc;
  --accent: #d33d2e;
  --accent-dark: #9d261d;
  --green: #0d7a5f;
  --blue: #2364aa;
  --shadow: 0 14px 34px rgba(20, 20, 20, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

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

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(246, 244, 239, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.catalog-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 28px;
  align-items: end;
  padding: 46px 0 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(34px, 6vw, 68px);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.catalog-tools {
  display: flex;
  justify-content: flex-end;
}

.search-box {
  display: grid;
  width: 100%;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-box input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(35, 100, 170, 0.16);
}

.ad-band,
.ad-box {
  display: grid;
  place-items: center;
  min-height: 86px;
  color: #7c756a;
  background: #ebe5da;
  border: 1px dashed #c6bcad;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px 0 20px;
}

.filter-button {
  min-height: 38px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.filter-button[aria-pressed="true"] {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(218px, 1fr));
  gap: 14px;
  padding-bottom: 48px;
}

.game-card {
  display: grid;
  min-height: 190px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.game-card h2 {
  align-self: start;
  margin: 10px 0 8px;
  font-size: 24px;
  line-height: 1.02;
}

.game-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.tag {
  justify-self: start;
  padding: 5px 8px;
  color: var(--blue);
  background: #e9f1fa;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 18px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.button.secondary {
  color: var(--ink);
  background: transparent;
  border-color: var(--line);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  padding: 24px 0 42px;
}

.play-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.play-header h1 {
  font-size: clamp(28px, 5vw, 48px);
}

.play-header p:last-child {
  max-width: 660px;
  margin: 10px 0 0;
  color: var(--muted);
}

.play-actions {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  justify-content: flex-end;
  gap: 8px;
}

.game-shell {
  width: min(100%, 500px);
  height: min(78vh, 760px);
  min-height: 620px;
  margin-inline: auto;
  overflow: hidden;
  background: #111;
  border: 1px solid #0f1720;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.play-side {
  display: grid;
  align-content: start;
  gap: 18px;
}

.side-list {
  display: grid;
  gap: 8px;
}

.side-link {
  display: grid;
  gap: 4px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.side-link span {
  color: var(--muted);
  font-size: 12px;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  padding: 28px 16px 36px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.legal-page {
  max-width: 820px;
  padding: 42px 0 58px;
}

.legal-page h1 {
  font-size: clamp(30px, 6vw, 52px);
}

.legal-page p,
.legal-page li {
  color: var(--muted);
}

@media (max-width: 860px) {
  .catalog-head,
  .play-layout {
    grid-template-columns: 1fr;
  }

  .catalog-tools {
    justify-content: stretch;
  }

  .play-header {
    display: grid;
  }

  .play-actions {
    justify-content: start;
  }

  .game-shell {
    width: min(100%, 500px);
    height: min(76vh, 720px);
    min-height: 520px;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  main {
    width: min(100% - 24px, 1180px);
  }

  .catalog-head {
    padding-top: 30px;
  }

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

  .game-shell {
    width: 100%;
    height: min(74vh, 640px);
    min-height: 560px;
  }
}
