:root {
  --bg: #11131b;
  --shape-a: #0a0c12;
  --shape-b: #1a1e2b;
  --card: #1c202d;
  --card-2: #252a3a;
  --line: #2c3245;
  --text: #eef0f7;
  --muted: #8d93a8;
  --accent: #facc15;
  --accent-2: #2dd4bf;
  --pill-a: #1f8f6f;
  --pill-b: #23a985;
  --cell: 120px;
  --gap: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "League Spartan", system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; color: inherit; }
ul.grid { list-style: none; margin: 0; }

/* Big angular background shapes */
.bg-shapes { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.bg-shapes svg { width: 100%; height: 100%; }

/* ===== Mosaic grid: fixed 120px columns, 10px gap, centered, dense packing ===== */
.page { padding: 16px 16px 48px; }
.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;
  padding: 0;
}
.grid > * { min-width: 0; }
.tile {
  position: relative; display: block; overflow: hidden;
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,.35), 0 2px 4px -1px rgba(0,0,0,.25);
  transition: transform .2s ease, box-shadow .2s ease;
}
a.tile:hover { transform: scale(1.05); box-shadow: 0 12px 28px rgba(0,0,0,.6); z-index: 2; }
.span-3 { grid-column: span 3; grid-row: span 3; }
.span-2 { grid-column: span 2; grid-row: span 2; }
.tall-3 { grid-row: span 3; }
.wide-2 { grid-column: span 2; }

/* Game artwork (generated, no image files) */
.art {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: calc(var(--cell) * .46);
}
.art::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,.35), transparent 30%),
    radial-gradient(circle at 85% 90%, rgba(0,0,0,.35), transparent 45%),
    repeating-linear-gradient(135deg, rgba(255,255,255,.06) 0 10px, transparent 10px 20px);
}
.art .em { position: relative; filter: drop-shadow(0 6px 10px rgba(0,0,0,.35)); }
.span-2 .art { font-size: calc(var(--cell) * .9); align-content: center; gap: 2px; }
.span-3 .art { font-size: calc(var(--cell) * 1.3); align-content: center; gap: 4px; }
.art .wordmark {
  position: relative; text-align: center; padding: 0 8px; line-height: 1;
  font-weight: 900; letter-spacing: 1px; text-transform: uppercase;
  color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.35), 0 8px 18px rgba(0,0,0,.4);
}
.span-2 .art .wordmark { font-size: calc(var(--cell) * .22); }
.span-3 .art .wordmark { font-size: calc(var(--cell) * .34); }

/* Real thumbnails (GameDistribution games) */
.tile > img.thumb, .ico > img.thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: var(--card-2); }

/* Hover title overlay */
.overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 12px;
  background: linear-gradient(to top, rgba(0,0,0,.9), rgba(0,0,0,.6), rgba(0,0,0,.25) 30%, rgba(0,0,0,0) 40%, rgba(0,0,0,0));
  opacity: 0; transition: opacity .2s;
}
.overlay h3 { margin: 0; font-size: 14px; font-weight: 700; text-align: center; color: #fff; transform: translateY(6px); transition: transform .2s; }
.tile:hover .overlay { opacity: 1; }
.tile:hover .overlay h3 { transform: none; }
.span-2 .overlay h3, .span-3 .overlay h3 { font-size: 18px; }

/* ===== Logo "pill" tile: logo on top, two buttons below ===== */
.pill {
  height: 100%; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 16px; background: #f4f5fa; color: #11131b;
  border: 1px solid var(--pill-a);
  box-shadow: 0 10px 25px rgba(0,0,0,.45);
}
.pill .brand {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-weight: 800; font-size: 19px; letter-spacing: -.3px; padding-top: 4px;
}
.pill .brand .mark {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: #11131b; color: var(--accent); font-size: 18px; font-weight: 900;
}
.pill .btns { display: flex; height: 46px; flex: none; }
.pill .btns button { flex: 1; border: 0; display: grid; place-items: center; background: var(--pill-a); color: #fff; transition: filter .15s; }
.pill .btns button + button { background: var(--pill-b); }
.pill .btns button:hover { filter: brightness(1.15); }
.pill svg { width: 24px; height: 24px; }

.tile-wrap { display: block; }
.tile-wrap > .pill { height: 100%; }
/* Tall promo tile: pinned to column 1, rows 2–4 */
.tile-wrap.tall-3 { grid-column: 1; grid-row: 2 / span 3; }
.tile-wrap > .promo { height: 100%; }
.promo {
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 18px 8px; text-align: center; border: 0; width: 100%; height: 100%;
  background: linear-gradient(180deg, #050608, #17132b);
}
.promo .big { font-weight: 900; font-size: 28px; line-height: .95; letter-spacing: .5px; text-transform: uppercase; }
.promo .arrow { font-size: 110px; line-height: 1; color: #ef4444; font-weight: 300; animation: bob 1.4s ease-in-out infinite; }
.promo .cta { font-weight: 800; font-size: 24px; line-height: 1; text-transform: uppercase; }
.promo .cta small { display: block; font-size: 22px; margin-top: 6px; }
@keyframes bob { 50% { transform: translateY(8px); } }

/* Category cards (2×1) at the end of the grid */
.cat-card { border-radius: 12px; background: var(--card-2); box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.cat-card a { display: flex; align-items: center; gap: 12px; height: 100%; padding: 16px; transition: background .15s; border-radius: inherit; }
.cat-card a:hover { background: #2f3549; }
.cat-card .ce { font-size: 34px; }
.cat-card h3 { margin: 0; font-size: 14.4px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }

/* ===== Side menu drawer ===== */
.drawer-mask { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .25s; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 41;
  width: min(500px, 100vw); padding: 24px;
  background: var(--accent); color: #11131b;
  transform: translateX(-100%); transition: transform .28s ease;
  overflow-y: auto;
}
body.menu-open .drawer { transform: none; }
body.menu-open .drawer-mask { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.drawer-head h2 { margin: 0; font-size: 34px; font-weight: 800; }
.drawer-head button { width: 44px; height: 44px; border-radius: 12px; border: 2px solid #11131b; background: transparent; font-size: 20px; }
.drawer nav { display: grid; gap: 8px; }
.drawer nav a, .drawer nav button {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 14px 16px; border-radius: 14px; border: 0;
  background: rgba(17,19,27,.08); font-size: 19px; font-weight: 700; color: #11131b;
}
.drawer nav a:hover, .drawer nav button:hover { background: rgba(17,19,27,.16); }
.drawer h3 { margin: 22px 4px 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .8px; opacity: .65; }

/* ===== About card under the grid ===== */
.about-card {
  margin: 24px 0 0;
  background: #1a1a1a; border: 1px solid #333; border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,.5);
  padding: 32px; color: #e0e0e0; line-height: 1.65;
}
.about-card h5 { margin: 0 0 4px; font-size: 14px; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; }
.about-card h1 { margin: 0 0 12px; font-size: 40px; color: #fff; line-height: 1.1; }
.about-card h2 { margin: 28px 0 8px; font-size: 26px; color: #fff; }
.about-card h3 { margin: 24px 0 8px; font-size: 20px; color: #fff; }
.about-card p { margin: 0 0 12px; font-size: 16px; }
.about-card ul { margin: 0; padding-left: 22px; }
.about-card li { margin: 4px 0; }
.about-card a { color: var(--accent-2); }
.about-card a:hover { text-decoration: underline; }

/* ===== Footer ===== */
.site-footer { background: linear-gradient(180deg, #16213a, #0e1626); border-top: 3px solid; border-image: linear-gradient(90deg, #14b8a6, #3b82f6, #8b5cf6) 1; color: #c6cbe0; }
.footer-main { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; padding: 60px 40px 48px; }
.f-brand .row { display: flex; align-items: center; gap: 14px; }
.f-brand .logo { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: #11131b; flex: none; }
.f-brand .logo svg { width: 38px; height: 38px; }
.f-brand b { display: block; font-size: 28px; color: #fff; }
.f-brand small { color: #93a3c4; font-size: 15px; }
.f-brand p { max-width: 460px; margin: 18px 0 0; line-height: 1.6; color: #e2e8f0; }
.f-col h4 { margin: 24px 0 18px; color: #fff; font-size: 15px; }
.f-col a, .f-col button { display: flex; gap: 10px; align-items: center; margin: 0 0 14px; color: #93a3c4; background: none; border: 0; padding: 0; font-size: 16px; }
.f-col a:hover, .f-col button:hover { color: #fff; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 22px 40px; border-top: 1px solid rgba(255,255,255,.06); background: #0b1220; color: #64748b; font-size: 14px; }
.footer-bottom .chip { border: 1px solid #1f4d45; background: #0f2a2a; color: #d1fae5; padding: 10px 20px; border-radius: 10px; }

/* ===== Search / library modal ===== */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(5, 6, 10, .78); backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px 16px; overflow-y: auto;
}
.modal[hidden] { display: none; }
.modal-box { width: min(920px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px; }
.modal-head { display: flex; gap: 10px; align-items: center; }
.modal-head input {
  flex: 1; font: inherit; font-size: 18px; padding: 14px 18px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--text); outline: none;
}
.modal-head input:focus { border-color: var(--accent-2); }
.modal-head .x { width: 48px; height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--card-2); font-size: 20px; }
.modal h2 { font-size: 15px; color: var(--muted); font-weight: 600; margin: 18px 4px 10px; text-transform: uppercase; letter-spacing: .6px; }
.modal .grid { justify-content: start; --cell: 104px; }
.modal .empty { color: var(--muted); margin: 6px 4px; }

/* ===== Play page ===== */
.player {
  grid-column: 2 / span 7; grid-row: 1 / span 5;
  display: flex; flex-direction: column;
  border-radius: 12px; overflow: hidden;
  background: var(--card); box-shadow: 0 4px 14px rgba(0,0,0,.45);
}
.player iframe { flex: 1; width: 100%; border: 0; background: #000; display: block; min-height: 0; }
.player-bar { height: 112px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 20px; }
.player-bar .ico { width: 52px; height: 52px; border-radius: 12px; position: relative; overflow: hidden; flex: none; }
.player-bar .ico .art { font-size: 28px; }
.player-bar .meta { flex: 1; min-width: 0; }
.player-bar h1 { margin: 0; font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-bar .by { font-size: 14px; color: var(--muted); }
.act {
  border: 0; background: none; width: 62px; padding: 6px 0; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.act svg { width: 22px; height: 22px; fill: currentColor; }
.act:hover { background: var(--card-2); color: var(--text); }
.act.on { color: var(--accent); }
.about {
  grid-column: 1 / span 8; grid-row: span 2;
  background: var(--card); border-radius: 12px; padding: 22px 24px;
  box-shadow: 0 4px 14px rgba(0,0,0,.45); overflow: auto;
}
.about h2 { margin: 0 0 8px; font-size: 20px; }
.about p { margin: 0 0 10px; color: #c3c7d6; line-height: 1.6; }
.about .tags { display: flex; gap: 8px; flex-wrap: wrap; }
.about .tags span { background: var(--card-2); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--muted); }

.no-mobile { flex: 1; display: grid; place-items: center; text-align: center; padding: 24px; background: #0b0d14; min-height: 0; }
.no-mobile h2 { margin: 8px 0; font-size: 22px; }
.no-mobile p { margin: 0 auto 16px; max-width: 420px; color: #c3c7d6; line-height: 1.5; }
.no-mobile .btn-go { display: inline-block; background: var(--accent); color: #1a1400; font-weight: 800; padding: 12px 22px; border-radius: 12px; }
.act:disabled { opacity: .35; cursor: default; }

/* ===== Responsive ===== */
@media (max-width: 1340px) {
  .player { grid-column: 1 / -1; grid-row: auto / span 5; }
  .about { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .footer-main { grid-template-columns: 1fr 1fr; padding: 40px 24px; }
  .f-brand { grid-column: 1 / -1; }
  .footer-bottom { padding: 20px 24px; }
}
@media (max-width: 560px) {
  /* Phone: 3 columns, 3×3 features shrink to 2×2, tall promo hidden */
  .page { padding: 16px 8px 40px; }
  :root { --cell: min(120px, calc((100vw - 16px - 2 * var(--gap)) / 3)); }
  .span-3 { grid-column: span 2; grid-row: span 2; }
  .span-3 .art { font-size: calc(var(--cell) * .9); }
  .span-3 .art .wordmark { font-size: calc(var(--cell) * .22); }
  .tall-3.promo, .tile-wrap.tall-3 { display: none; }
  .about-card { padding: 22px; }
  .about-card h1 { font-size: 30px; }
  .footer-main { grid-template-columns: 1fr; }
  .player { grid-row: auto / span 4; }
  .player-bar { height: auto; padding: 12px; flex-wrap: wrap; gap: 8px; }
  .player-bar .meta { flex-basis: calc(100% - 70px); }
  .act { width: auto; flex: 1; }
  .about { grid-row: span 3; }
  .modal .grid { --cell: calc((100vw - 32px - 36px - 2 * var(--gap)) / 3); }
}
