*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 110px;
}

body {
  margin: 0;
  min-width: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 3%, rgba(243, 190, 53, 0.14) 0 82px, transparent 83px),
    radial-gradient(circle at 93% 20%, rgba(13, 156, 138, 0.09) 0 130px, transparent 131px),
    var(--sp-bg);
  color: var(--sp-ink);
  font-family: var(--sp-font-body);
  font-size: 16px;
  line-height: 1.65;
  word-break: keep-all;
}

button,
input {
  font: inherit;
}

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

a {
  color: inherit;
}

img,
svg {
  display: block;
}

.shell {
  width: min(100% - 32px, 1440px);
  margin-inline: auto;
}

.visually-hidden {
  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 {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 12px;
  padding: 12px 18px;
  border-radius: var(--sp-radius-s);
  background: var(--sp-ink);
  color: #fff;
  font-weight: 700;
  transform: translateY(-150%);
  transition: transform 160ms ease-out;
}

.skip-link:focus {
  transform: translateY(0);
}

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

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  border-bottom: 1px solid rgba(221, 230, 222, 0.9);
  background: rgba(255, 248, 233, 0.96);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 92px;
  padding-block: 12px;
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 11px;
  min-height: 56px;
  text-decoration: none;
}

.brand-mark {
  width: 58px;
  height: 58px;
  filter: drop-shadow(0 5px 8px rgba(47, 79, 69, 0.12));
}

.brand-copy {
  display: grid;
  line-height: 1.15;
}

.brand-copy strong {
  color: var(--sp-ink);
  font-family: var(--sp-font-display);
  font-size: 1.68rem;
  letter-spacing: -0.06em;
}

.brand-copy small {
  margin-top: 6px;
  color: var(--sp-ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.search-box {
  display: flex;
  flex: 0 1 560px;
  align-items: center;
  gap: 11px;
  min-width: 0;
  min-height: 54px;
  padding: 0 18px;
  border: 2px solid var(--sp-line);
  border-radius: var(--sp-radius-m);
  background: var(--sp-surface);
  color: var(--sp-ink-soft);
  box-shadow: 0 5px 16px rgba(47, 79, 69, 0.06);
  transition: border-color 180ms ease-out, box-shadow 180ms ease-out;
}

.search-box:focus-within {
  border-color: var(--sp-accent);
  box-shadow: 0 0 0 4px rgba(13, 156, 138, 0.13);
}

.search-box svg {
  flex: 0 0 25px;
  width: 25px;
  height: 25px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  height: 48px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--sp-ink);
  font-size: 1rem;
  font-weight: 600;
}

.search-box input::placeholder {
  color: #87918d;
  opacity: 1;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 54px 0 62px;
}

.hero::after {
  content: '';
  position: absolute;
  right: -55px;
  bottom: -135px;
  width: 300px;
  height: 300px;
  border: 42px solid rgba(240, 100, 74, 0.07);
  border-radius: 50%;
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  align-items: center;
  gap: clamp(32px, 6vw, 90px);
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--sp-accent);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.eyebrow span {
  display: inline-block;
  margin-right: 5px;
  color: var(--sp-warn);
  font-size: 0.7em;
  vertical-align: 0.12em;
}

.hero h1 {
  margin: 0;
  font-family: var(--sp-font-display);
  font-size: clamp(2.65rem, 6vw, 5.2rem);
  font-weight: 400;
  line-height: 1.16;
  letter-spacing: -0.065em;
}

.hero h1 em {
  color: var(--sp-primary);
  font-style: normal;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 560px;
  margin: 22px 0 28px;
  color: var(--sp-ink-soft);
  font-size: clamp(1.03rem, 2vw, 1.2rem);
  font-weight: 500;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 22px;
  border: 0;
  border-radius: var(--sp-radius-m);
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.primary-button {
  background: var(--sp-primary);
  color: var(--sp-primary-ink);
  box-shadow: var(--sp-shadow-press);
  transition: transform 100ms ease-out, box-shadow 100ms ease-out;
}

.primary-button:hover {
  transform: translateY(-2px);
}

.primary-button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--sp-primary-press);
}

.primary-button svg {
  width: 21px;
  height: 21px;
}

.secondary-button {
  border: 2px solid var(--sp-line);
  background: var(--sp-surface);
  color: var(--sp-ink);
}

.challenge-panel {
  position: relative;
  min-width: 0;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--sp-line);
  border-radius: var(--sp-radius-l);
  background: var(--sp-surface);
  box-shadow: var(--sp-shadow);
}

.challenge-panel::before,
.challenge-panel::after {
  content: '';
  position: absolute;
  z-index: -1;
  border-radius: 50%;
}

.challenge-panel::before {
  top: -19px;
  right: 32px;
  width: 48px;
  height: 48px;
  background: var(--sp-warn);
}

.challenge-panel::after {
  right: -18px;
  bottom: 35px;
  width: 36px;
  height: 36px;
  background: var(--sp-accent);
}

.challenge-panel h2 {
  margin: 0 0 15px;
  font-family: var(--sp-font-display);
  font-size: clamp(1.55rem, 3vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.04em;
}

.mini-loading {
  display: grid;
  min-height: 220px;
  place-items: center;
  border-radius: var(--sp-radius-m);
  background: var(--sp-bg-2);
  color: var(--sp-ink-soft);
  font-weight: 700;
}

.filters {
  padding-block: 28px 30px;
}

.filter-panel {
  display: grid;
  gap: 19px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--sp-line);
  border-radius: var(--sp-radius-l);
  background: var(--sp-bg-2);
}

.filter-group {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.filter-label {
  padding-top: 11px;
  color: var(--sp-ink-soft);
  font-size: 0.92rem;
  font-weight: 800;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.filter-chip {
  position: relative;
  min-width: 54px;
  min-height: 48px;
  padding: 9px 16px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--sp-surface);
  color: var(--sp-ink-soft);
  cursor: pointer;
  font-size: 0.94rem;
  font-weight: 700;
  transition: border-color 160ms ease-out, background 160ms ease-out, color 160ms ease-out, transform 160ms ease-out;
}

.filter-chip:hover {
  transform: translateY(-1px);
  border-color: #bdcdc3;
  color: var(--sp-ink);
}

.filter-chip.is-active {
  border-color: var(--sp-accent);
  background: #e2f5ef;
  color: #087665;
}

.filter-chip.is-active::before {
  content: '✓';
  margin-right: 5px;
  font-weight: 900;
}

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

.section-heading h2 {
  margin: 0;
  font-family: var(--sp-font-display);
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  font-weight: 400;
  letter-spacing: -0.045em;
}

.section-heading > p {
  margin: 0 0 5px;
  color: var(--sp-ink-soft);
  font-size: 0.94rem;
}

.compact-heading {
  align-items: center;
  margin-bottom: 16px;
}

.text-button {
  min-height: 48px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--sp-radius-s);
  background: transparent;
  color: var(--sp-accent);
  cursor: pointer;
  font-weight: 800;
}

.text-button:hover {
  background: rgba(13, 156, 138, 0.08);
}

.load-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  min-height: 110px;
  margin-block: 12px 28px;
  border: 1px solid var(--sp-line);
  border-radius: var(--sp-radius-l);
  background: var(--sp-surface);
  color: var(--sp-ink-soft);
  font-weight: 700;
}

.load-status[hidden] {
  display: none;
}

.load-status.is-error {
  flex-direction: column;
  padding: 24px;
  color: var(--sp-bad);
  text-align: center;
}

.loading-dots {
  display: flex;
  gap: 4px;
}

.loading-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sp-accent);
  animation: dot-bounce 900ms ease-in-out infinite alternate;
}

.loading-dots i:nth-child(2) {
  animation-delay: 150ms;
}

.loading-dots i:nth-child(3) {
  animation-delay: 300ms;
}

.game-section {
  padding-block: 38px;
}

.all-games {
  padding-bottom: 84px;
}

.result-count {
  min-width: 92px;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--sp-surface-2);
  color: #79561a !important;
  font-weight: 800;
  text-align: center;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.game-card {
  --card-subject: var(--sub-mix);
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--sp-line);
  border-top: 6px solid var(--card-subject);
  border-radius: var(--sp-radius-l);
  background: var(--sp-surface);
  box-shadow: 0 7px 22px rgba(47, 79, 69, 0.09);
  transition: transform 180ms ease-out, box-shadow 180ms ease-out;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 31px rgba(47, 79, 69, 0.14);
}

.card-link {
  display: block;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.card-link:focus-visible {
  outline: 3px solid var(--sp-accent);
  outline-offset: -4px;
  border-radius: calc(var(--sp-radius-l) - 4px);
}

.card-media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 8 / 5;
  background: color-mix(in srgb, var(--card-subject) 14%, #fff);
}

.card-media img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 260ms ease-out;
}

.game-card:hover .card-media img {
  transform: scale(1.025);
}

.thumb-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.83), rgba(255, 255, 255, 0.34)),
    var(--card-subject);
  color: var(--sp-ink);
  text-align: center;
}

.thumb-fallback::before,
.thumb-fallback::after {
  content: '';
  position: absolute;
  border: 3px solid var(--card-subject);
  border-radius: 50%;
  opacity: 0.28;
}

.thumb-fallback::before {
  top: 16px;
  left: 17px;
  width: 38px;
  height: 38px;
}

.thumb-fallback::after {
  right: 22px;
  bottom: 18px;
  width: 55px;
  height: 55px;
}

.thumb-fallback span {
  position: relative;
  z-index: 1;
  max-width: 90%;
  font-family: var(--sp-font-display);
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  line-height: 1.35;
  letter-spacing: -0.04em;
}

.media-badges {
  position: absolute;
  z-index: 3;
  top: 11px;
  left: 11px;
  display: flex;
  gap: 6px;
}

.new-badge,
.feature-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #fff;
  font-family: var(--sp-font-num);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 3px 8px rgba(38, 51, 47, 0.14);
}

.new-badge {
  background: var(--sp-primary);
}

.feature-badge {
  background: var(--sp-accent);
}

.favorite-button {
  position: absolute;
  z-index: 5;
  top: 14px;
  right: 13px;
  display: grid;
  width: 48px;
  height: 48px;
  padding: 0;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: #7b8581;
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 1.55rem;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(38, 51, 47, 0.14);
  transition: color 150ms ease-out, transform 150ms ease-out;
}

.favorite-button:hover {
  transform: scale(1.06);
}

.favorite-button.is-favorite {
  color: #e49c0d;
}

.card-body {
  padding: 18px 18px 20px;
}

.subject-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--card-subject) 12%, #fff);
  color: var(--card-subject);
  font-size: 0.78rem;
  font-weight: 800;
}

.subject-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
}

.card-title {
  margin: 10px 0 7px;
  overflow-wrap: anywhere;
  font-family: var(--sp-font-display);
  font-size: 1.28rem;
  font-weight: 400;
  line-height: 1.38;
  letter-spacing: -0.045em;
}

.card-desc {
  display: -webkit-box;
  min-height: 3.1em;
  margin: 0;
  overflow: hidden;
  color: var(--sp-ink-soft);
  font-size: 0.9rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 15px 0 0;
  padding: 0;
  list-style: none;
}

.card-meta li {
  min-height: 29px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #f3f6f3;
  color: #59655f;
  font-size: 0.76rem;
  font-weight: 700;
}

.challenge-card {
  border-top-width: 5px;
  border-radius: var(--sp-radius-m);
  box-shadow: none;
}

.challenge-card .card-media {
  aspect-ratio: 16 / 7;
}

.challenge-card .card-body {
  padding: 15px 17px 18px;
}

.challenge-card .card-desc {
  min-height: auto;
}

.challenge-card .card-title {
  font-size: 1.18rem;
}

.challenge-card .favorite-button {
  top: 10px;
  right: 10px;
}

.empty-state {
  padding: 52px 20px;
  border: 1px dashed #bdcbc2;
  border-radius: var(--sp-radius-l);
  background: var(--sp-bg-2);
  text-align: center;
}

.empty-state h3 {
  margin: 16px 0 4px;
  font-family: var(--sp-font-display);
  font-size: 1.45rem;
  font-weight: 400;
}

.empty-state p {
  margin: 0 0 18px;
  color: var(--sp-ink-soft);
}

.empty-shapes {
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 7px;
  height: 46px;
}

.empty-shapes span {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--sp-primary);
  transform: rotate(9deg);
}

.empty-shapes span:nth-child(2) {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--sp-warn);
  transform: none;
}

.empty-shapes span:nth-child(3) {
  background: var(--sp-accent);
  transform: rotate(-9deg);
}

.site-footer {
  border-top: 1px solid var(--sp-line);
  background: #edf5ec;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 120px;
  padding-block: 26px;
  color: var(--sp-ink-soft);
  font-size: 0.9rem;
}

.footer-inner strong {
  color: var(--sp-ink);
  font-family: var(--sp-font-display);
  font-size: 1.13rem;
  font-weight: 400;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  align-items: center;
  gap: 12px 18px;
}

.footer-links a {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
}

.admin-link {
  color: #8a9690;
  font-size: 0.78rem;
  text-decoration: none;
}

@keyframes dot-bounce {
  from { transform: translateY(3px); opacity: 0.45; }
  to { transform: translateY(-3px); opacity: 1; }
}

@media (max-width: 1199px) {
  .game-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 899px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-copy {
    text-align: center;
  }

  .hero-copy > p:not(.eyebrow) {
    margin-inline: auto;
  }

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

  .filter-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 19px;
  }
}

@media (max-width: 639px) {
  .shell {
    width: min(100% - 24px, 1440px);
  }

  .site-header {
    position: relative;
  }

  .header-inner {
    display: grid;
    gap: 10px;
    padding-block: 10px 14px;
  }

  .brand {
    justify-self: center;
  }

  .brand-mark {
    width: 51px;
    height: 51px;
  }

  .brand-copy strong {
    font-size: 1.48rem;
  }

  .search-box {
    width: 100%;
    min-height: 52px;
  }

  .hero {
    padding: 42px 0 43px;
  }

  .hero h1 {
    font-size: clamp(2.5rem, 13vw, 3.55rem);
  }

  .challenge-panel::after {
    right: -8px;
  }

  .filter-panel {
    gap: 21px;
  }

  .filter-group {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .filter-label {
    padding-top: 0;
  }

  .filter-chip {
    flex: 1 1 auto;
    padding-inline: 13px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  .compact-heading {
    flex-direction: row;
    align-items: center;
  }

  .game-section {
    padding-block: 30px;
  }

  .game-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 19px;
  }

  .spotlight-grid .game-card:nth-child(n + 4) {
    display: none;
  }

  .footer-inner {
    align-items: start;
    flex-direction: column;
  }

  .footer-links {
    justify-content: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

[hidden] { display: none !important; }
