:root {
  color-scheme: dark;
  --bg: #151618;
  --surface: #202225;
  --line: #393b3f;
  --ink: #f2f2ee;
  --muted: #b7b9bf;
  --focus: #d9ee9a;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); font: 1rem/1.5 "Segoe UI", system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
.frame { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
header { border-bottom: 1px solid var(--line); }
.header { min-height: 64px; display: flex; align-items: center; }
.brand { font-weight: 600; }
.brand span, .label, .card-copy p, .game-head p, nav { color: var(--muted); }
.library, .game-page { padding-block: 32px 48px; }
h1 { font-size: clamp(2rem, 5vw, 4rem); font-weight: 500; letter-spacing: -.05em; line-height: 1.1; }
.feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.feature-copy { align-self: center; padding: clamp(24px, 5vw, 64px); }
.feature-copy h1 { margin: 12px 0; font-size: clamp(4rem, 10vw, 7rem); font-variant-numeric: tabular-nums; }
.feature-copy > p:not(.label) { max-width: 27ch; color: var(--muted); }
.play { display: inline-block; padding: 12px 20px; margin-top: 24px; border-radius: 8px; color: #202115; background: var(--focus); font-weight: 600; transition: background-color 150ms ease-out; }
.play:hover { background: #e9fac1; }
.feature-art { display: grid; place-items: center; overflow: hidden; min-height: 360px; background: #d8c3a2; padding: 24px; }
.board { width: min(100%, 320px); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 12px; border-radius: 12px; background: #75624e; box-shadow: 0 8px 0 #554737; font: 600 clamp(1rem, 2.8vw, 1.75rem)/1 ui-monospace, monospace; }
.tile { display: grid; aspect-ratio: 1; place-items: center; border-radius: 4px; background: #f0e4ce; color: #493727; }
.tile:empty { background: #99856a; }
.tone-2 { background: #f1cc93; }.tone-3 { background: #f5b876; }
.tone-4 { background: #ed975f; }.tone-5 { background: #e78557; }
.tone-6 { background: #f0cb6e; }.tone-7 { background: #f8da83; }
.collection { margin-top: 32px; }
.collection h2 { font-size: 1.75rem; font-weight: 500; }
.cards { margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 272px), 1fr)); gap: 20px; }
.card { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); transition: border-color 150ms ease-out; }
.card:hover { border-color: var(--muted); }
.cover { display: grid; place-items: center; aspect-ratio: 2/1; font: 600 1.15rem/1 ui-monospace, monospace; }
.sample-grid { display: grid; grid-template-columns: repeat(2, 40px); gap: 8px; }
.sample-grid span { display: grid; place-items: center; aspect-ratio: 1; border-radius: 4px; }
.numbers { background: #d6c5a7; color: #472e1d; }
.numbers span { background: #f2e4ce; }
.numbers span:nth-child(n+3) { background: #efa865; }
.squares { background: #263d4c; }
.squares span { background: #74afcf; }
.squares span:nth-child(3n+1) { background: #ef8a82; }
.circles { background: #3c344b; color: #252438; }
.circles span { border-radius: 50%; background: #c8b8ec; }
.circles span:nth-child(2) { background: #e89d98; }
.card-copy { padding: 16px; }
.label { font-size: .875rem; }
h3 { font-size: 1.4rem; font-weight: 600; margin: 4px 0; }
.game-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 16px 0; }
.external { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; text-align: center; }
.external:hover { background: var(--surface); }
iframe { display: block; width: 100%; height: max(580px, calc(100dvh - 228px)); border: 1px solid var(--line); border-radius: 12px; background: #fff; }
@media (max-width: 560px) {
  .frame { width: calc(100% - 32px); }
  .library, .game-page { padding-block: 24px 32px; }
  .feature { grid-template-columns: 1fr; }
  .feature-art { min-height: 0; }
  .board { max-width: 248px; }
}
@media (prefers-reduced-motion: reduce) { .card, .play { transition: none; } }

/* Warm arcade catalog */
.portal {
  --ink: #3a221d;
  --muted: #633b31;
  --focus: #692e1a;
  --light: #fff8ec;
  color-scheme: light;
  min-height: 100dvh;
  background: linear-gradient(118deg, #ffdc9f, #ffb674 52%, #fa8a68);
}
.portal-header {
  width: min(1220px, calc(100% - 64px));
  margin: auto; padding: 32px 0 12px; border: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.portal-header .brand {
  padding: 14px 22px; border-radius: 16px; background: var(--light);
  font-size: clamp(1.25rem, 3vw, 2rem); font-weight: 700; letter-spacing: -.035em;
  box-shadow: 0 4px 0 #6a322330;
}
.portal-header .brand span { color: #9b3a28; }
.search { position: relative; width: min(100%, 320px); }
.search input {
  display: block; width: 100%; min-height: 48px; padding: 8px 12px 8px 36px;
  border: 1px solid #8a44295c; border-radius: 12px; color: var(--ink);
  background: #fff4e3; font: inherit;
}
.search input::placeholder { color: var(--muted); }
.search input:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.magnifier {
  position: absolute; left: 13px; top: 16px; width: 12px; height: 12px;
  border: 1.5px solid var(--muted); border-radius: 50%; pointer-events: none;
}
.magnifier::after {
  content: ""; position: absolute; width: 5px; height: 1.5px; background: var(--muted);
  right: -4px; bottom: -2px; transform: rotate(45deg);
}
.portal-layout { width: min(1220px, calc(100% - 64px)); margin-inline: auto; }
.rail { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0 0; color: var(--ink); }
.rail a { padding: 6px 12px; border-radius: 8px; }
.rail a[aria-current], .rail a:hover { background: #fff4e3; }
.portal-main { padding: 24px 0 48px; }
.collection-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.collection-head h1 { font-size: clamp(1.5rem, 4vw, 2.4rem); font-weight: 600; letter-spacing: -.035em; }
.collection-head p, #no-games { color: var(--muted); }
.recent { margin-bottom: 24px; }
.recent h2 { margin-bottom: 8px; font-size: 1.1rem; font-weight: 600; }
#recent-games { display: flex; flex-wrap: wrap; gap: 8px; }
#recent-games a { padding: 8px 12px; border-radius: 8px; background: #fff4e3; }
.mosaic { display: grid; grid-template-columns: 1.3fr 1fr 1fr; align-items: start; gap: 16px; }
.mosaic .card {
  display: grid; grid-template-rows: minmax(0, 1fr) auto;
  aspect-ratio: 1; border: 3px solid #fff2da; border-radius: 24px;
  background: var(--light); box-shadow: 0 8px 18px #6a322323;
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}
.mosaic .card:hover { border-color: var(--focus); box-shadow: 0 8px 18px #6a322343; }
.mosaic .spotlight { aspect-ratio: 1.3; }
.mosaic .cover, .mosaic .feature-art { aspect-ratio: auto; min-height: 0; height: 100%; }
.mosaic .feature-art { padding: 12px; background: #c89b68; }
.mosaic .board { width: min(65%, 184px); gap: 4px; padding: 8px; font-size: clamp(.7rem, 2vw, 1rem); }
.mosaic .squares { background: #426c7b; }
.mosaic .circles { background: #755b85; }
.mosaic .snow {
  background:
    linear-gradient(143deg, transparent 45%, #edf7ff 45% 59%, transparent 59%) 46% 70% / 78% 84% no-repeat,
    linear-gradient(34deg, #5b9abe 28%, #86c1df 29% 56%, #d3eafa 57%);
}
.mosaic .supercar {
  background:
    linear-gradient(90deg, transparent 48%, #ffe49b 48% 52%, transparent 52%) center / 100% 100% no-repeat,
    linear-gradient(111deg, #85433d 22%, #354150 23% 78%, #85433d 79%);
}
.mosaic .sample-grid { grid-template-columns: repeat(2, clamp(28px, 6vw, 76px)); gap: 8px; transform: rotate(-10deg); }
.mosaic .sample-grid span { box-shadow: 0 4px 0 #33203060; }
.mosaic .card-copy { padding: 10px 14px 12px; }
.mosaic .card-copy h3 { margin: 2px 0; line-height: 1.2; }
.mosaic .card-copy p { color: var(--muted); font-size: .875rem; line-height: 1.35; }
[hidden] { display: none !important; }
@media (max-width: 760px) {
  .portal-header, .portal-layout { width: calc(100% - 32px); }
  .portal-header { padding-top: 16px; gap: 12px; }
  .mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .mosaic .spotlight { grid-column: 1 / -1; aspect-ratio: 1.8; }
  .mosaic .card { min-height: 224px; }
}
@media (max-width: 450px) {
  .portal-header { flex-direction: column; align-items: stretch; }
  .portal-header .brand { align-self: start; padding: 10px 16px; }
  .search { width: 100%; }
  .mosaic .board { max-width: 120px; }
  .mosaic .card { border-radius: 16px; }
  .mosaic .card-copy { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) { .mosaic .card { transition: none; } }
