/* WebGames portal: dense arcade shelves, original media, and CSS-only previews. */
:root {
  --bg: #080b18;
  --bg-raised: #0d1225;
  --surface: #141a31;
  --surface-2: #1c2442;
  --border: #2a3458;
  --text: #f7f4ff;
  --text-dim: #b5bdd9;
  --primary: #8da2ff;
  --accent: #ffcc4d;
  --mint: #55e6b2;
  --pink: #ff7aa8;
  --focus: #fff2a8;
  --radius: 18px;
  --radius-sm: 11px;
  --maxw: 1440px;
  --sidebar: 220px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 0;
  min-height: 100dvh;
  color: var(--text);
  background:
    radial-gradient(circle at 78% -10%, rgba(141, 162, 255, 0.16), transparent 30rem),
    radial-gradient(circle at -10% 22%, rgba(255, 122, 168, 0.1), transparent 26rem),
    var(--bg);
  font: 500 16px/1.55 "Aptos", "Trebuchet MS", system-ui, sans-serif;
}

html.portal-pseudo-fullscreen,
body.portal-pseudo-fullscreen {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body.portal-pseudo-fullscreen {
  position: fixed;
  left: 0;
  right: 0;
}

h1, h2, h3 { margin: 0; font-family: "Trebuchet MS", system-ui, sans-serif; line-height: 1.08; }
h1 { font-size: clamp(2.15rem, 5vw, 4.6rem); letter-spacing: -0.055em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); letter-spacing: -0.035em; }
h3 { font-size: 1.08rem; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }
img { display: block; max-width: 100%; }
button, input { font: inherit; }
[hidden] { display: none !important; }

.container, .header-inner, .portal-layout { width: min(100% - 32px, var(--maxw)); margin-inline: auto; }
.sr-only { 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; left: 12px; top: -80px; z-index: 1000; padding: 10px 16px; color: #080b18; background: var(--focus); border-radius: var(--radius-sm); }
.skip-link:focus { top: 12px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(181, 189, 217, 0.16);
  background: rgba(8, 11, 24, 0.9);
  backdrop-filter: blur(18px);
}
.header-inner { min-height: 72px; display: grid; grid-template-columns: auto minmax(220px, 420px) auto; gap: 24px; align-items: center; }
.brand { min-height: 44px; display: inline-flex; align-items: center; gap: 10px; color: var(--text); font: 800 1.35rem/1 "Trebuchet MS", sans-serif; letter-spacing: -0.04em; }
.brand:hover { color: var(--text); }
.brand-mark { width: 26px; aspect-ratio: 1; border-radius: 9px 9px 13px 9px; background: conic-gradient(from 35deg, var(--accent), var(--pink), var(--primary), var(--mint), var(--accent)); box-shadow: 0 0 22px rgba(141, 162, 255, 0.38); transform: rotate(-7deg); }
.header-search input { width: 100%; min-height: 44px; padding: 10px 16px 10px 42px; color: var(--text); border: 1px solid var(--border); border-radius: 999px; background: var(--surface) radial-gradient(circle at 22px 50%, transparent 5px, var(--text-dim) 6px, transparent 7px); }
.header-search input::placeholder { color: #929bbd; }
.site-nav { display: flex; justify-content: flex-end; gap: 4px; }
.site-nav a { min-height: 44px; display: inline-flex; align-items: center; padding: 9px 12px; color: var(--text-dim); font-weight: 750; border-radius: 10px; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }

.portal-layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); gap: clamp(28px, 4vw, 64px); align-items: start; }
.portal-main { min-width: 0; padding-block: 26px 56px; }
.category-sidebar { min-width: 0; position: sticky; top: 98px; padding: 26px 0; }
.sidebar-label, .eyebrow, .card-kicker { color: var(--accent); font-size: 0.72rem; font-weight: 850; letter-spacing: 0.14em; text-transform: uppercase; }
.category-sidebar nav { display: grid; gap: 7px; margin-top: 12px; }
.category-sidebar a { min-height: 48px; display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: center; padding: 8px 12px; color: var(--text-dim); font-weight: 750; border: 1px solid transparent; border-radius: 13px; }
.category-sidebar a span { color: var(--primary); font-weight: 900; text-align: center; }
.category-sidebar a:hover, .category-sidebar a[aria-current="page"] { color: var(--text); background: var(--surface); border-color: var(--border); }

.home-intro { max-width: 780px; padding: clamp(12px, 3vw, 34px) 0 24px; }
.home-intro h1 { margin-top: 7px; font-size: clamp(2rem, 5vw, 4rem); }
.home-intro > p:last-child, .page-heading > p:last-child { max-width: 62ch; margin-top: 12px; color: var(--text-dim); font-size: 1.05rem; }
.featured-game { min-height: 390px; display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(340px, 1.25fr); overflow: hidden; border: 1px solid var(--border); border-radius: 28px; background: linear-gradient(135deg, #171f3a, #11162a); box-shadow: var(--shadow); }
.featured-copy { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: clamp(28px, 5vw, 58px); }
.featured-copy h2 { max-width: 10ch; margin: 10px 0 18px; font-size: clamp(2.2rem, 5vw, 4.2rem); }
.featured-copy p { max-width: 50ch; margin-bottom: 24px; color: var(--text-dim); }
.featured-media { min-width: 0; }
.featured-media img { width: 100%; height: 100%; object-fit: cover; }
.featured-placeholder { grid-template-columns: 1fr minmax(280px, 0.75fr); }
.featured-art { min-height: 300px; }

.block { padding-top: clamp(38px, 6vw, 68px); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-head .eyebrow { margin-bottom: 5px; }
.section-head > a { min-height: 44px; display: inline-flex; align-items: center; font-weight: 800; white-space: nowrap; }
.page-heading { padding: 24px 0 6px; }
.page-heading h1 { margin-top: 7px; }
.crumb { padding-top: 2px; color: var(--text-dim); font-size: 0.9rem; }
.crumb a { color: var(--text-dim); }

.game-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(12px, 2vw, 20px); }
.compact-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { min-width: 0; overflow: hidden; display: flex; flex-direction: column; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18); }
.card-link { height: 100%; display: flex; flex-direction: column; color: inherit; }
.card-link:hover { color: inherit; }
.game-card:has(.card-link) { transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease; }
.game-card:has(.card-link):hover, .game-card:has(.card-link):focus-within { transform: translateY(-4px); border-color: var(--primary); box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28); }
.thumb { position: relative; aspect-ratio: 16 / 10; display: grid; place-items: center; overflow: hidden; color: var(--primary); background: var(--surface-2); font-weight: 800; text-align: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.body { flex: 1; padding: 15px 16px 17px; }
.body h3 { margin: 4px 0 7px; }
.body p { min-height: 2.9em; margin-bottom: 13px; color: var(--text-dim); font-size: 0.9rem; }
.badge { width: max-content; display: inline-flex; align-items: center; min-height: 26px; padding: 3px 9px; color: var(--text-dim); border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: 0.68rem; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.badge.review { color: var(--accent); }
.badge.published { color: var(--mint); }
.badge.coming-soon { color: #d9deef; background: rgba(8, 11, 24, 0.35); }
.placeholder-card { box-shadow: none; }
.placeholder-art { position: relative; overflow: hidden; background: linear-gradient(135deg, #222d53, #121831); }
.placeholder-art::before, .placeholder-art::after, .placeholder-art span { content: ""; position: absolute; display: block; }
[data-art="rings"]::before { width: 45%; aspect-ratio: 1; border: 18px solid var(--pink); border-radius: 50%; box-shadow: 0 0 0 18px rgba(141, 162, 255, 0.45); }
[data-art="tiles"]::before { width: 42%; aspect-ratio: 1; border-radius: 18px; background: var(--accent); transform: rotate(16deg); box-shadow: 35px -28px 0 var(--primary), -35px 28px 0 var(--pink); }
[data-art="letters"]::before { content: "A"; inset: 0; display: grid; place-items: center; color: var(--text); font: 900 clamp(4rem, 10vw, 8rem)/1 "Trebuchet MS", sans-serif; transform: rotate(-8deg); text-shadow: 20px 18px 0 var(--pink); }
[data-art="steps"]::before { width: 55%; height: 18px; background: var(--mint); box-shadow: 28px 32px 0 var(--primary), 56px 64px 0 var(--pink), 84px 96px 0 var(--accent); transform: translate(-32px, -48px); }
[data-art="shapes"]::before { width: 36%; aspect-ratio: 1; background: var(--primary); clip-path: polygon(50% 0, 100% 100%, 0 100%); transform: translate(-25px, -6px) rotate(-10deg); }
[data-art="shapes"]::after { width: 28%; aspect-ratio: 1; right: 20%; bottom: 18%; border-radius: 50%; background: var(--accent); }
[data-art="maze"]::before { inset: 16%; border: 16px double var(--primary); border-right-color: transparent; border-radius: 18px; transform: rotate(8deg); }

.cat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cat-pill { min-height: 70px; display: flex; align-items: center; padding: 16px 18px; color: var(--text); border: 1px solid var(--border); border-radius: 15px; background: linear-gradient(145deg, var(--surface), var(--bg-raised)); font-weight: 800; }
.cat-pill:hover { color: var(--text); border-color: var(--primary); }

.btn { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 10px 18px; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-weight: 850; cursor: pointer; }
.btn:hover { color: var(--text); filter: brightness(1.08); }
.btn.primary { color: #090c18; border-color: transparent; background: var(--accent); }
.play-wrap { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(240px, 0.7fr); gap: 28px; padding-top: 24px; }
.embed-frame { width: 100%; aspect-ratio: 16 / 10; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: #000; box-shadow: var(--shadow); }
.embed-frame.portrait { max-width: 430px; aspect-ratio: 9 / 16; margin-inline: auto; }
.embed-frame iframe { width: 100%; height: 100%; display: block; border: 0; }
.play-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
[data-fullscreen] [data-fullscreen-icon] { display: inline-grid; place-items: center; min-width: 1.1em; }
body.portal-pseudo-fullscreen .embed-frame[data-pseudo-fullscreen="true"] {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  margin: 0;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #000;
}
body.portal-pseudo-fullscreen [data-fullscreen][data-fullscreen-active="pseudo"] {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 1002;
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  color: #fff;
  background: rgba(8, 11, 24, 0.72);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(12px);
}
body.portal-pseudo-fullscreen [data-fullscreen][data-fullscreen-active="pseudo"] [data-fullscreen-icon] {
  font-size: 1.2rem;
}
body.portal-pseudo-fullscreen [data-fullscreen][data-fullscreen-active="pseudo"] [data-fullscreen-label] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.play-section { margin-top: 26px; }
.play-section h2 { margin-bottom: 9px; font-size: 1.2rem; }
.play-section p, .play-section li { color: var(--text-dim); }
.related-grid { grid-template-columns: 1fr; }
.ad-slot { padding: 18px; color: var(--text-dim); border: 1px dashed var(--border); border-radius: var(--radius-sm); background: var(--surface); text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { display: inline-flex; padding: 5px 10px; color: var(--text-dim); border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 0.78rem; }

.search-box { max-width: 680px; display: block; margin-bottom: 24px; }
.search-box input { width: 100%; min-height: 52px; padding: 12px 16px; color: var(--text); border: 1px solid var(--border); border-radius: 14px; background: var(--surface); font-size: 1rem; }
.empty-state { grid-column: 1 / -1; padding: 34px 0; color: var(--text-dim); }

.site-footer { border-top: 1px solid var(--border); background: rgba(8, 11, 24, 0.5); }
.site-footer .container { min-height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--text-dim); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 16px; }
.site-footer a { color: var(--text-dim); font-weight: 700; }

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

@media (max-width: 1120px) {
  .header-inner { grid-template-columns: auto 1fr; gap: 10px 20px; padding-block: 12px; }
  .site-nav { grid-column: 1 / -1; justify-content: flex-start; }
  .portal-layout { grid-template-columns: 1fr; gap: 0; }
  .category-sidebar { position: static; padding: 22px 0 0; }
  .category-sidebar nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .featured-game, .featured-placeholder { min-height: 0; grid-template-columns: 1fr; }
  .featured-media, .featured-art { order: -1; }
  .featured-media { min-height: 0; background: var(--surface-2); }
  .featured-media img { width: 100%; height: auto; object-fit: contain; }
  .featured-art { min-height: 260px; }
}

@media (max-width: 760px) {
  .container, .header-inner, .portal-layout { width: min(100% - 24px, var(--maxw)); }
  .header-inner { grid-template-columns: 1fr auto; }
  .header-search { grid-column: 1 / -1; grid-row: 2; }
  .site-nav { grid-column: 2; grid-row: 1; }
  .site-nav a:first-child, .site-nav a:last-child { display: none; }
  .category-sidebar nav { width: 100%; max-width: 100%; display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: thin; }
  .category-sidebar a { min-width: 168px; }
  .cat-row { grid-template-columns: 1fr; }
  .featured-copy { padding: 28px 24px; }
  .featured-copy h2 { font-size: clamp(2.4rem, 12vw, 4rem); }
  .featured-art { min-height: 240px; }
  .game-grid, .compact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .play-wrap { grid-template-columns: 1fr; }
  .play-page .category-sidebar { display: none; }
  .play-page .portal-main { padding-top: 12px; }
  .play-page .play-wrap { padding-top: 12px; }
}

@media (max-width: 460px) {
  .brand { font-size: 1.15rem; }
  .site-nav a { padding-inline: 9px; }
  .game-grid, .compact-grid { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; }
  .section-head > a { display: none; }
  .site-footer .container { align-items: flex-start; flex-direction: column; justify-content: center; padding-block: 20px; }
}

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