/* games.tabcade.net: only the Tabcade Originals, as a wall of chunky square tiles in three sizes
   (Randoms 3x3, sports 2x2, the rest 1x1) under a top bar with search and category chips. */
:root {
  --bg: #ffd23a;      /* sunny yellow page */
  --ink: #1d1a17;     /* Tabcade's ink (the favicon face) */
  --paper: #ffffff;
  --orange: #ff6a13;  /* Tabcade orange */
  --soft: #fff4c9;
  --cell: 112px;
  --gap: 12px;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 700 16px/1.45 "Nunito", system-ui, sans-serif; overflow-x: hidden; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 12px; }
.skip:focus { top: 12px; }
:focus-visible { outline: 4px solid var(--ink); outline-offset: 3px; }

/* ---------- top bar: logo, search, back to the full site; then the category chips ---------- */
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 12px 16px 10px; border-bottom: 3px solid var(--ink); }
.top-row { display: flex; align-items: center; gap: 14px; max-width: 1400px; margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 400 28px/1 "Lilita One", "Nunito", sans-serif; white-space: nowrap; }
.logo img { border-radius: 12px; }
.logo b { font-weight: 400; color: var(--paper); background: var(--orange); padding: 3px 9px 4px; border-radius: 10px; border: 3px solid var(--ink); }
.search { flex: 1; min-width: 0; max-width: 560px; margin: 0 auto; }
.search input { width: 100%; height: 48px; border: 3px solid var(--ink); border-radius: 999px; background: var(--paper); color: var(--ink);
  padding: 0 20px; font: 800 17px "Nunito", sans-serif; }
.search input::placeholder { color: #6b6257; }
.full { flex: none; text-decoration: none; background: var(--ink); color: var(--paper); padding: 11px 16px; border-radius: 999px; font-weight: 900; font-size: 15px; white-space: nowrap; }
.full:hover { background: #3a332c; }
.chips { display: flex; gap: 8px; max-width: 1400px; margin: 10px auto 0; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 40px; padding: 0 16px; border: 3px solid var(--ink); border-radius: 999px; background: var(--paper); color: var(--ink);
  font: 900 15px "Nunito", sans-serif; cursor: pointer; }
.chip .n { margin-left: 6px; opacity: .6; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.chip:hover { background: var(--soft); }
.chip[aria-pressed="true"]:hover { background: #3a332c; }

main { max-width: 1400px; margin: 0 auto; padding: 14px 16px 30px; }
.count { margin: 0 0 12px; font-weight: 900; text-align: center; }

/* ---------- the tile wall ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, var(--cell)); grid-auto-rows: var(--cell); grid-auto-flow: dense;
  gap: var(--gap); justify-content: center; }
.t { position: relative; display: block; overflow: hidden; border-radius: 18px; background: var(--paper); text-decoration: none;
  grid-column: span 1; grid-row: span 1; transition: transform .15s ease-out; }
.t.s2 { grid-column: span 2; grid-row: span 2; border-radius: 24px; }
.t.s3 { grid-column: span 3; grid-row: span 3; border-radius: 30px; }
.t img { display: block; width: 100%; height: 100%; object-fit: cover; }
.t .name { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 7px; color: #fff; text-align: center;
  font: 900 13px/1.15 "Nunito", sans-serif; background: linear-gradient(transparent, rgba(29, 26, 23, .9) 55%);
  opacity: 0; transform: translateY(8px); transition: opacity .15s, transform .15s; }
.t.s2 .name { font: 400 22px/1.1 "Lilita One", sans-serif; padding: 34px 12px 12px; }
.t.s3 .name { font: 400 34px/1.1 "Lilita One", sans-serif; padding: 50px 16px 18px; }
.t:hover, .t:focus-visible { transform: scale(1.04); z-index: 2; }
.t:hover .name, .t:focus-visible .name { opacity: 1; transform: none; }
.t:focus-visible { outline: 4px solid var(--ink); outline-offset: 3px; }
/* the hero always says what it is */
.t.s3 .name { opacity: 1; transform: none; }
/* touch screens have no hover: names always show */
@media (hover: none) { .t .name { opacity: 1; transform: none; } .t:hover { transform: none; } }
.empty { grid-column: 1 / -1; text-align: center; font-weight: 900; padding: 30px 0; }

/* ---------- a game ---------- */
.play-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.play-head h1 { margin: 0; flex: 1; min-width: 0; font: 400 clamp(32px, 5vw, 52px)/1.05 "Lilita One", sans-serif; }
.play-btns { display: flex; gap: 10px; }
.btn { display: inline-flex; align-items: center; height: 46px; padding: 0 20px; border: 3px solid var(--ink); border-radius: 999px; background: var(--orange); color: #fff;
  font: 900 16px "Nunito", sans-serif; cursor: pointer; text-decoration: none; }
.btn:hover { background: #e85a06; }
.btn.ghost { background: var(--paper); color: var(--ink); }
.btn.ghost:hover { background: var(--soft); }
.tc-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 78vh; margin: 0 auto; border: 4px solid var(--ink); border-radius: 22px; overflow: hidden; background: var(--ink); }
.tc-stage iframe { display: block; width: 100%; height: 100%; border: 0; }
.tc-stage:fullscreen { max-height: none; border: 0; border-radius: 0; }
.about { max-width: 820px; margin: 18px auto 0; background: var(--paper); border: 3px solid var(--ink); border-radius: 20px; padding: 16px 20px; }
.about p { margin: 0; }
.about h2 { margin: 12px 0 4px; font: 400 22px "Lilita One", sans-serif; }
.more-h { margin: 26px 0 12px; text-align: center; font: 400 30px "Lilita One", sans-serif; }

.foot { text-align: center; padding: 10px 16px 30px; font-size: 14px; }
.foot p { margin: 4px 0; }

@media (max-width: 760px) {
  .top { padding: 10px 12px 8px; }
  .top-row { flex-wrap: wrap; gap: 10px; }
  .logo { font-size: 24px; }
  .logo img { width: 34px; height: 34px; }
  .full { margin-left: auto; padding: 9px 13px; font-size: 14px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .search input { height: 44px; }
  main { padding: 12px 12px 24px; }
  :root { --cell: 96px; --gap: 10px; }
}
/* phones: always three columns that fill the width, so the hero is the whole row */
@media (max-width: 420px) {
  :root { --gap: 8px; --cell: calc((100vw - 24px - 2 * var(--gap)) / 3); }
  .logo span { font-size: 21px; }
  .t.s2 .name { font-size: 18px; }
  .t.s3 .name { font-size: 28px; }
  .play-head h1 { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) { .t, .t .name { transition: none; } .t:hover, .t:focus-visible { transform: none; } }

/* ---------- background: a light scatter of game doodles (balls, a pad, a joystick, a puck) over the page colour ---------- */
body { background-color: var(--bg); background-image: var(--doodles); background-size: 220px 220px; background-attachment: fixed; }
.top { background: var(--bg); }
:root {
  --doodles: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' fill='none' stroke='%231d1a17' stroke-opacity='.09' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='40' cy='42' r='22'/%3E%3Cpath d='M18 42h44M40 20v44M24 26c10 10 10 22 0 32M56 26c-10 10-10 22 0 32'/%3E%3Crect x='128' y='26' width='62' height='36' rx='18'/%3E%3Cpath d='M146 36v16M138 44h16M172 40h.01M180 48h.01'/%3E%3Cpath d='M60 150v-30M60 120a9 9 0 1 0 .01 0M38 168h44v12H38z'/%3E%3Ccircle cx='168' cy='160' r='24'/%3E%3Cpath d='M168 146l12 9-5 14h-14l-5-14z'/%3E%3Cpath d='M112 96l8 8 8-8 8 8 8-8'/%3E%3Cellipse cx='122' cy='200' rx='16' ry='6'/%3E%3C/svg%3E");
}
.mode { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border: 3px solid var(--ink); border-radius: 999px; background: var(--paper); color: var(--ink); cursor: pointer; }
.mode:hover { background: var(--soft); }

/* ---------- dark mode ---------- */
:root[data-theme="dark"] {
  --bg: #121820; --ink: #f4efe6; --paper: #1f2833; --soft: #2b3644;
  color-scheme: dark;
  --doodles: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' fill='none' stroke='%23ffd23a' stroke-opacity='.07' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='40' cy='42' r='22'/%3E%3Cpath d='M18 42h44M40 20v44M24 26c10 10 10 22 0 32M56 26c-10 10-10 22 0 32'/%3E%3Crect x='128' y='26' width='62' height='36' rx='18'/%3E%3Cpath d='M146 36v16M138 44h16M172 40h.01M180 48h.01'/%3E%3Cpath d='M60 150v-30M60 120a9 9 0 1 0 .01 0M38 168h44v12H38z'/%3E%3Ccircle cx='168' cy='160' r='24'/%3E%3Cpath d='M168 146l12 9-5 14h-14l-5-14z'/%3E%3Cpath d='M112 96l8 8 8-8 8 8 8-8'/%3E%3Cellipse cx='122' cy='200' rx='16' ry='6'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] .top { border-bottom-color: #2b3644; }
:root[data-theme="dark"] .search input::placeholder { color: #9aa6b4; }
:root[data-theme="dark"] .full:hover, :root[data-theme="dark"] .chip[aria-pressed="true"]:hover { background: #d9d2c5; }
:root[data-theme="dark"] .chip[aria-pressed="true"] { background: #ffd23a; color: #1d1a17; border-color: #ffd23a; }
:root[data-theme="dark"] .t { box-shadow: 0 0 0 2px #2b3644; }
:root[data-theme="dark"] .tc-stage { background: #000; border-color: #2b3644; }
:root[data-theme="dark"] .about, :root[data-theme="dark"] .btn.ghost { border-color: #3a4757; }
:root[data-theme="dark"] .logo b { border-color: #121820; }
