:root {
  color-scheme: light;
  --bg: #f6f8f4;
  --surface: #ffffff;
  --surface-soft: #eef3eb;
  --ink: #16201c;
  --muted: #66756c;
  --line: #dbe3da;
  --green: #2f704f;
  --green-deep: #1f4e3a;
  --sky: #b8dff0;
  --gold: #e7af45;
  --coral: #db765f;
  --blue: #426e9f;
  --shadow: 0 18px 44px rgba(32, 48, 39, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(180deg, #fbfcfa 0%, var(--bg) 42%, #eef4f1 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

.site-header,
main,
.site-footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--green-deep);
  font-size: 1rem;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--green);
  color: #fff;
  box-shadow: 0 10px 24px rgba(47, 112, 79, 0.22);
}

.brand-mark svg {
  width: 25px;
  height: 25px;
  fill: currentColor;
}

.brand-mark path + path {
  fill: #f4c86a;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.header-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--green-deep);
  font-size: 0.92rem;
  font-weight: 700;
}

.header-actions a:hover,
.header-actions a:focus-visible {
  border-color: var(--line);
  background: #fff;
  outline: none;
}

.header-actions .primary-link {
  background: var(--green);
  color: #fff;
  box-shadow: 0 10px 24px rgba(47, 112, 79, 0.2);
}

.header-actions .primary-link:hover,
.header-actions .primary-link:focus-visible {
  border-color: var(--green);
  background: var(--green-deep);
}

main {
  padding-bottom: 34px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px;
  padding: 30px 0 18px;
}

.intro h1 {
  max-width: 720px;
  margin: 0;
  color: #14251d;
  font-size: clamp(2.3rem, 4.4vw, 4.35rem);
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
}

.intro p {
  max-width: 610px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.22rem);
  line-height: 1.6;
}

.quick-panel {
  display: grid;
  min-width: 220px;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 30px rgba(52, 72, 61, 0.08);
}

.quick-panel span {
  display: flex;
  align-items: center;
  min-height: 28px;
  color: var(--green-deep);
  font-size: 0.86rem;
  font-weight: 800;
}

.quick-panel span::before {
  content: "";
  width: 9px;
  height: 9px;
  margin-right: 10px;
  border-radius: 999px;
  background: var(--gold);
}

.quick-panel span:nth-child(2)::before {
  background: var(--blue);
}

.quick-panel span:nth-child(3)::before {
  background: var(--coral);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 18px;
}

.filter {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
}

.filter:hover,
.filter:focus-visible,
.filter.is-active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  outline: none;
}

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

.game-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 9px 28px rgba(37, 52, 44, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.game-card:hover,
.game-card:focus-visible {
  border-color: rgba(47, 112, 79, 0.65);
  box-shadow: var(--shadow);
  outline: none;
  transform: translateY(-3px);
}

.game-card.is-featured {
  border-color: rgba(47, 112, 79, 0.72);
  box-shadow: 0 16px 36px rgba(47, 112, 79, 0.16);
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--surface-soft);
}

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

.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.36);
  pointer-events: none;
}

.game-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.game-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.game-title-row h2 {
  margin: 0;
  font-size: clamp(1.05rem, 1.8vw, 1.36rem);
  line-height: 1.14;
  font-weight: 900;
  letter-spacing: 0;
}

.tag {
  flex: 0 0 auto;
  max-width: 42%;
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf4ef;
  color: var(--green-deep);
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.game-card[data-category="timing"] .tag {
  background: #edf4ff;
  color: #234f82;
}

.game-card[data-category="puzzle"] .tag {
  background: #fff4db;
  color: #7a5517;
}

.game-card[data-category="creative"] .tag {
  background: #fff0eb;
  color: #8b3f2f;
}

.game-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.play-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  margin-top: auto;
  padding-top: 4px;
}

.play-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--green-deep);
  font-size: 0.94rem;
  font-weight: 900;
}

.play-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--green);
  color: #fff;
}

.play-icon svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.player-note {
  color: #809086;
  font-size: 0.78rem;
  font-weight: 800;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 0 36px;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--green-deep);
  font-weight: 900;
}

@media (max-width: 920px) {
  .intro {
    grid-template-columns: 1fr;
    padding-top: 28px;
  }

  .quick-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 0;
  }

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

@media (max-width: 640px) {
  .site-header,
  main,
  .site-footer {
    width: min(100% - 28px, 1180px);
  }

  .site-header {
    align-items: flex-start;
    min-height: 76px;
    padding-top: 18px;
  }

  .brand {
    max-width: 190px;
    align-items: flex-start;
  }

  .brand-mark {
    flex: 0 0 auto;
  }

  .header-actions {
    gap: 6px;
  }

  .header-actions a {
    min-height: 36px;
    padding: 0 10px;
    font-size: 0.8rem;
  }

  .intro h1 {
    font-size: clamp(2.35rem, 13vw, 3.6rem);
  }

  .quick-panel {
    grid-template-columns: 1fr;
  }

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

  .game-title-row {
    display: grid;
  }

  .tag {
    max-width: 100%;
    justify-self: start;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
