:root {
  color-scheme: light;
  --ink: #151922;
  --muted: #667085;
  --line: #d9e0e8;
  --paper: #ffffff;
  --soft: #f5f8fb;
  --mint: #dff7ed;
  --sun: #ffe7a8;
  --rose: #ffe2e9;
  --blue: #e0f0ff;
  --shadow: 0 18px 46px rgba(24, 39, 75, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

body[data-page="games"] {
  background: #fbf6dc;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.nav-wrap {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-weight: 900;
  background: linear-gradient(135deg, #1f8cff, #00a88f 52%, #ffb000);
  box-shadow: 0 10px 22px rgba(31, 140, 255, 0.22);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 0.76rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.main-nav a {
  border-radius: 8px;
  color: #344054;
  padding: 9px 12px;
  font-size: 0.94rem;
}

.main-nav a:hover,
.main-nav a.active {
  background: #eef6ff;
  color: #0b5cab;
}

.menu-button {
  display: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
}

.hero {
  width: min(1180px, calc(100% - 32px));
  min-height: calc(100vh - 120px);
  margin: 0 auto;
  padding: 52px 0 28px;
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(360px, 1.14fr);
  gap: 36px;
  align-items: center;
}

.hero-copy h1,
.page-title h1,
.text-panel h1,
.article-detail h1,
.game-info h1 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-copy h1 {
  max-width: 680px;
  font-size: clamp(3.25rem, 7vw, 6.8rem);
}

.hero-text {
  max-width: 600px;
  color: #344054;
  font-size: 1.18rem;
}

.eyebrow {
  margin: 0 0 10px;
  color: #0b7a75;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-actions,
.toolbar,
.game-facts,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  font-weight: 800;
}

.button.primary {
  border-color: #111827;
  background: #111827;
  color: #ffffff;
}

.button.ghost {
  background: #ffffff;
  color: #111827;
}

.hero-play {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: var(--shadow);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
}

.section,
.page-shell,
.content-page,
.article-page,
.game-page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.section {
  padding: 54px 0;
}

.section.compact {
  padding-top: 22px;
}

.section.split {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 32px;
  align-items: start;
}

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

.section-heading h2,
.page-title h1,
.text-panel h1,
.article-detail h1,
.game-info h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
}

.section-heading h2,
.category-card h2,
.search-results h2,
.instruction-panel h2,
.text-panel h2,
.article-detail h2 {
  margin: 0;
  line-height: 1.15;
}

.section-heading a {
  color: #0b5cab;
  font-weight: 800;
}

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

.game-card,
.article-card,
.category-card,
.text-panel,
.play-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 10px 30px rgba(24, 39, 75, 0.06);
}

.game-card {
  overflow: hidden;
}

.portal-card {
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.game-card a,
.article-card a {
  display: block;
  height: 100%;
}

.thumb {
  position: relative;
  min-height: 148px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent), white 72%), #ffffff),
    repeating-linear-gradient(45deg, rgba(17, 24, 39, 0.08) 0 2px, transparent 2px 16px);
}

.real-thumb {
  background: #111827;
}

.real-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 260ms ease, filter 260ms ease;
}

.hover-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #111827;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.01);
  transition: opacity 180ms ease;
}

.play-badge {
  position: absolute;
  right: 9px;
  bottom: 9px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.82);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 4px 8px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.game-card:hover .hover-frame,
.game-card:focus-within .hover-frame {
  opacity: 1;
}

.game-card:hover .play-badge,
.game-card:focus-within .play-badge {
  opacity: 1;
  transform: translateY(0);
}

.thumb span {
  position: absolute;
  display: block;
  border-radius: 999px;
  background: var(--accent);
}

.thumb span:nth-child(1) {
  width: 56px;
  height: 56px;
  left: 26px;
  top: 28px;
}

.thumb span:nth-child(2) {
  width: 34px;
  height: 34px;
  right: 36px;
  top: 32px;
  background: #111827;
}

.thumb span:nth-child(3) {
  width: 96px;
  height: 18px;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: #ffffff;
  border: 2px solid rgba(17, 24, 39, 0.22);
}

.thumb.memory span {
  border-radius: 8px;
}

.thumb.slide span {
  border-radius: 4px;
}

.card-body,
.article-card,
.category-card {
  padding: 18px;
}

.compact-body {
  padding: 8px 0 0;
}

.compact-body h3 {
  margin: 0;
  color: #514f46;
  font-size: 0.98rem;
  font-weight: 750;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.game-card h3,
.article-card h3 {
  margin: 8px 0;
  line-height: 1.2;
  font-size: 1.15rem;
}

.game-card p,
.article-card p,
.category-card p,
.text-panel p,
.article-detail p,
.instruction-panel p {
  color: #475467;
}

.tag-row small,
.game-facts span,
.chip span {
  border-radius: 999px;
  background: #f0f4f8;
  color: #475467;
  padding: 4px 8px;
  font-size: 0.78rem;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 12px;
  font-weight: 800;
}

.pagination {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.pagination span {
  color: #475467;
  font-weight: 800;
}

.page-btn {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  font-weight: 800;
  padding: 9px 14px;
}

.page-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.article-stack {
  display: grid;
  gap: 12px;
}

.page-shell {
  padding: 48px 0 72px;
}

.games-portal {
  width: min(1800px, 100%);
  min-height: calc(100vh - 74px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
}

.game-rail {
  position: sticky;
  top: 74px;
  height: calc(100vh - 74px);
  overflow-y: auto;
  border-right: 1px solid rgba(119, 107, 66, 0.2);
  background: #fbf9ed;
  padding: 18px 14px;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  color: #4b4637;
}

.rail-brand .brand-mark {
  width: 34px;
  height: 34px;
  font-size: 0.78rem;
}

.rail-nav {
  display: grid;
  gap: 5px;
}

.rail-link {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 9px;
  align-items: center;
  background: transparent;
  color: #716a5b;
  cursor: pointer;
  padding: 9px 8px;
  text-align: left;
}

.rail-link:hover,
.rail-link.active {
  background: #fff0a8;
  color: #4b3f12;
  font-weight: 850;
}

.rail-dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: #ffbf2f;
}

.rail-link small {
  color: #9b8d65;
  font-weight: 800;
}

.portal-content {
  min-width: 0;
  padding: 22px 28px 58px;
}

.portal-toolbar {
  min-height: 52px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: minmax(260px, 560px) 190px;
  gap: 12px;
  align-items: end;
  justify-content: center;
}

.portal-search,
.portal-select {
  display: grid;
  gap: 5px;
  color: #514f46;
  font-size: 0.78rem;
  font-weight: 850;
}

.portal-search input,
.portal-select select {
  min-height: 42px;
  border: 1px solid rgba(119, 107, 66, 0.18);
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 5px 14px rgba(101, 87, 35, 0.08);
}

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

.portal-heading h1 {
  margin: 0;
  color: #514f46;
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.1;
}

.portal-heading p {
  margin: 6px 0 0;
  color: #837b6b;
  font-size: 0.95rem;
}

.count-pill {
  border-radius: 999px;
  background: #fff0a8;
  color: #5c4a02;
  font-size: 0.88rem;
  font-weight: 900;
  padding: 8px 12px;
  white-space: nowrap;
}

.portal-grid {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 32px 26px;
}

.portal-card .thumb {
  min-height: 0;
  border-radius: 8px;
  background: #111827;
  box-shadow: 0 8px 18px rgba(69, 56, 22, 0.11);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.portal-card:hover .thumb,
.portal-card:focus-within .thumb {
  transform: translateY(-3px);
  box-shadow: 0 14px 26px rgba(69, 56, 22, 0.18);
}

.portal-card:hover .real-thumb img,
.portal-card:focus-within .real-thumb img {
  filter: saturate(1.08) contrast(1.04);
  transform: scale(1.08);
}

.popular-intro {
  margin: 28px 0 0;
  color: #d0a40d;
  font-size: 1.04rem;
  font-weight: 900;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #ffffff;
  padding: 38px 0 24px;
}

.footer-grid {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 28px;
}

.footer-grid strong,
.footer-grid span {
  display: block;
  color: #111827;
  font-weight: 900;
  margin-bottom: 10px;
}

.footer-grid p,
.footer-grid a {
  color: #667085;
  font-size: 0.95rem;
}

.footer-grid a {
  display: block;
  margin: 7px 0;
}

.footer-grid a:hover {
  color: #0b5cab;
}

.copyright {
  width: min(1180px, calc(100% - 32px));
  margin: 26px auto 0;
  color: #98a2b3;
  font-size: 0.86rem;
}

.category-preview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin: -4px -4px 12px;
}

.category-preview img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
}

.guide-grid {
  display: grid;
  gap: 16px;
}

.guide-feature {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  padding: 18px;
  align-items: center;
}

.guide-feature span {
  color: #0b7a75;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.guide-feature h2 {
  margin: 6px 0;
  line-height: 1.15;
}

.guide-feature p {
  color: #667085;
}

.guide-feature a {
  color: #0b5cab;
  font-weight: 900;
}

.guide-covers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.guide-covers img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 7px;
  object-fit: cover;
}

.page-title {
  max-width: 760px;
  margin-bottom: 28px;
}

.page-title p {
  color: #475467;
  font-size: 1.08rem;
}

.toolbar {
  align-items: end;
  margin-bottom: 22px;
}

.search-box,
.select-box,
.wide-search,
.contact-form label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-weight: 800;
}

.search-box {
  flex: 1 1 320px;
}

.select-box {
  flex: 0 0 220px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 12px 13px;
}

.category-card {
  display: grid;
  gap: 10px;
  align-content: start;
}

.category-card strong {
  color: #0b7a75;
}

.content-page,
.article-page {
  padding: 48px 0 80px;
}

.text-panel,
.article-detail {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 46px);
}

.text-panel h2,
.article-detail h2 {
  margin-top: 30px;
}

.legal p {
  font-size: 0.98rem;
}

.contact-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.form-note,
.empty {
  color: var(--muted);
}

.article-meta {
  margin: 12px 0 28px;
  color: var(--muted);
}

.read-next {
  margin-top: 42px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.read-next .article-card {
  margin-top: 12px;
}

.wide-search {
  max-width: 720px;
  margin-bottom: 28px;
}

.search-results {
  display: grid;
  gap: 34px;
}

.game-page {
  padding: 34px 0 78px;
}

.game-layout,
.play-panel {
  display: block;
}

.play-panel {
  padding: clamp(18px, 3vw, 30px);
}

.game-info {
  max-width: 860px;
  margin-bottom: 24px;
}

.arcade-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.iframe-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #101828;
}

.embed-toolbar {
  min-height: 58px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.embed-toolbar .button.ghost {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.game-frame {
  display: block;
  width: 100%;
  height: min(74vh, 720px);
  min-height: 520px;
  border: 0;
  background: #ffffff;
}

.scorebar {
  min-height: 58px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: #f9fbfd;
}

.scorebar strong,
.scorebar span {
  white-space: nowrap;
}

#gameCanvas {
  max-height: 62vh;
  object-fit: contain;
}

.html-game {
  min-height: 420px;
  padding: 22px;
  display: grid;
  place-items: center;
}

.typing-box {
  width: min(520px, 100%);
  display: grid;
  gap: 18px;
}

.typing-word {
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent), white 82%);
  color: #111827;
  padding: 32px 20px;
  text-align: center;
  font-size: clamp(2.4rem, 8vw, 4.5rem);
  font-weight: 900;
}

.memory-grid,
.slide-grid {
  width: min(440px, 100%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.memory-grid button,
.slide-grid button,
.slide-grid span {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  font-size: 1.7rem;
  font-weight: 900;
}

.memory-grid button.open,
.memory-grid button.matched {
  background: color-mix(in srgb, var(--accent), white 72%);
}

.slide-grid {
  grid-template-columns: repeat(3, 1fr);
}

.slide-grid button {
  background: color-mix(in srgb, var(--accent), white 78%);
}

.slide-grid span {
  background: #eef2f7;
}

.instruction-panel {
  margin-top: 20px;
  border-left: 4px solid var(--accent);
  padding: 10px 0 10px 16px;
}

.source-note {
  font-size: 0.92rem;
}

@media (max-width: 900px) {
  .nav-wrap {
    flex-wrap: wrap;
    padding: 12px 0;
  }

  .menu-button {
    display: inline-flex;
  }

  .main-nav {
    display: none;
    width: 100%;
    flex-wrap: wrap;
    padding-bottom: 6px;
  }

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

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

  .hero {
    min-height: auto;
  }

  .hero-play {
    min-height: 260px;
  }

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

  .games-portal {
    display: block;
  }

  .game-rail {
    position: static;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid rgba(119, 107, 66, 0.2);
    padding: 12px;
  }

  .rail-brand {
    display: none;
  }

  .rail-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .rail-link {
    width: auto;
    min-width: max-content;
    grid-template-columns: 10px 1fr auto;
  }

  .portal-content {
    padding: 18px 14px 48px;
  }

  .portal-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .footer-grid,
  .guide-feature {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .nav-wrap,
  .hero,
  .section,
  .page-shell,
  .content-page,
  .article-page,
  .game-page {
    width: min(100% - 22px, 1180px);
  }

  .brand {
    min-width: 0;
  }

  .brand small {
    display: none;
  }

  .hero-copy h1 {
    font-size: 3.1rem;
  }

  .hero {
    padding-top: 34px;
  }

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

  .portal-toolbar {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .portal-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .portal-grid {
    grid-template-columns: 1fr;
    gap: 18px 12px;
  }

  .compact-body h3 {
    font-size: 0.9rem;
  }

  .section-heading,
  .scorebar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    display: grid;
  }

  .select-box {
    flex-basis: auto;
  }

  .html-game {
    min-height: 360px;
    padding: 14px;
  }

  .game-frame {
    height: 620px;
    min-height: 620px;
  }

  .memory-grid,
  .slide-grid {
    gap: 7px;
  }

  .memory-grid button,
  .slide-grid button {
    font-size: 1.35rem;
  }
}
