/* Skipcade: site and shared game styles.
   Kept light on purpose: flat colours, no blur, and only transform/opacity
   animations, so scrolling and hover stay smooth on high-refresh screens. */

:root {
  --bg: #0c0d12;
  --surface: #15171f;
  --surface-2: #1c1f2a;
  --line: #262a36;
  --text: #f2f3f7;
  --muted: #a3a9bd;
  --accent: #ffcf3f;
  --accent-ink: #1b1400;
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
main.wrap { flex: 1; padding-top: 24px; padding-bottom: 56px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- header: name, search, language ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 12px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; letter-spacing: -0.2px; white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; }
.brand b { color: var(--accent); font-weight: 800; }

.search { position: relative; flex: 1 1 260px; max-width: 520px; margin: 0 auto; }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; margin-top: -9px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  outline-offset: 0;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--accent); }

.lang { display: flex; gap: 2px; margin-left: auto; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.lang a { min-width: 40px; padding: 7px 0; border-radius: 999px; font-size: 13px; font-weight: 700; line-height: 1.5; text-align: center; color: var(--muted); }
.lang a:hover { color: var(--text); }
.lang a[aria-current="true"] { background: var(--accent); color: var(--accent-ink); }

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  padding: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
.footer-link { text-decoration: underline; text-underline-offset: 3px; }
.footer-link:hover { color: var(--text); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 20;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

/* ---------- home: the game rectangles ---------- */

/* two across on a phone, four or more on a wide screen */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(150px, 22%), 1fr)); gap: 20px 16px; }

.tile { display: block; }
.tile-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface);
  transition: transform .12s ease-out;
}
.tile-img svg { display: block; width: 100%; height: 100%; }
.tile:hover .tile-img { transform: scale(1.03); }
.tile:active .tile-img { transform: scale(.98); }
.tile-name { display: block; margin-top: 8px; font-weight: 700; font-size: 15px; line-height: 1.3; }

.empty { margin: 40px 0; color: var(--muted); text-align: center; }

/* ---------- a game that takes the whole window ---------- */

/* the page still scrolls to the text below the game, but shows no scrollbar over it */
.full-game { scrollbar-width: none; }
.full-game::-webkit-scrollbar { display: none; }
.stage-full { width: 100%; height: 100vh; height: 100dvh; background: #000; }
.stage-full iframe { display: block; width: 100%; height: 100%; border: 0; }

.about { padding-top: 28px; padding-bottom: 48px; }
.about-top { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.about .back { margin-top: 20px; }
.about p { max-width: 720px; }

/* ---------- pages with a header (privacy, games drawn by the site) ---------- */

.play-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; padding: 0 0 16px; }
.back { display: inline-flex; align-items: center; padding: 7px 14px 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-weight: 600; font-size: 14px; }
.back:hover { color: var(--text); border-color: var(--muted); }
.play-title { margin: 0; font-size: 26px; font-weight: 800; line-height: 1.2; }
.play-lead { margin: 6px 0 16px; color: var(--muted); }
.notice { padding: 24px; text-align: center; color: var(--muted); }

.more { margin-top: 44px; }
.more-title { margin: 0 0 14px; font-size: 20px; font-weight: 800; }

.play { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.game-host { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-height: 320px; }
.game-mount { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.play-side { display: flex; flex-direction: column; gap: 16px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel-title { margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.panel p { margin: 0; color: var(--muted); font-size: 14.5px; }
.stat-value { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }

.prose { max-width: 640px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.prose p { font-size: 16px; color: var(--text); }

.skins { display: grid; gap: 8px; }
.skin { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.skin:hover:enabled { border-color: var(--muted); }
.skin.is-on, .skin.is-on:hover { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.skin:disabled { cursor: default; opacity: .62; }
.skin-swatch { flex: none; width: 34px; height: 34px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .18); }
.skin-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.skin-name { font-weight: 700; font-size: 14.5px; }
.skin-note { font-size: 12.5px; color: var(--muted); }
.skin-lock { flex: none; width: 16px; height: 16px; color: var(--muted); }
.skin-lock svg { display: block; width: 100%; height: 100%; }

/* ---------- shared game UI ---------- */

.g-hud { display: flex; justify-content: center; gap: 28px; }
.g-hud-item { display: flex; flex-direction: column; align-items: center; min-width: 72px; }
.g-hud-label { font-size: 11.5px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; color: var(--muted); }
.g-hud-value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; white-space: nowrap; }

.g-stage { position: relative; line-height: 0; border-radius: 12px; overflow: hidden; }
.g-canvas { display: block; touch-action: none; user-select: none; -webkit-user-select: none; }

.g-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  text-align: center;
  line-height: 1.4;
  background: rgba(10, 12, 24, .8);
}
.g-overlay-title { font-size: 28px; font-weight: 800; line-height: 1.2; }
.g-overlay-text { color: var(--muted); max-width: 320px; }

.g-btn { border: 1px solid var(--line); background: var(--surface-2); padding: 9px 18px; border-radius: 999px; font-weight: 700; font-size: 14.5px; }
.g-btn:hover { border-color: var(--muted); }
.g-btn-primary, .g-btn-primary:hover { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); padding: 11px 26px; font-size: 16px; }

.g-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.g-seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); }
.g-seg-btn { border: 0; background: transparent; padding: 6px 13px; border-radius: 999px; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.g-seg-btn[aria-pressed="true"] { background: var(--text); color: var(--bg); }

.g-status { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 24px; font-weight: 600; text-align: center; }
.g-status-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .55); }

/* ---------- front door and not-found pages ---------- */

.gateway { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 32px 20px; text-align: center; }
.gateway .brand { font-size: 30px; }
.gateway .brand-mark { width: 48px; height: 48px; }
.gateway-title { margin: 0; font-size: 22px; font-weight: 800; }
.gateway p { margin: 0; color: var(--muted); }
.gateway-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.gateway-links a { border: 1px solid var(--line); background: var(--surface-2); padding: 10px 22px; border-radius: 999px; font-weight: 700; }
.gateway-links a:hover { border-color: var(--accent); }

/* ---------- small screens ---------- */

@media (max-width: 880px) {
  .play { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .topbar { padding: 10px 14px; }
  /* name and language on the first line, the search across the second */
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .grid { gap: 16px 12px; }
  .game-host { padding: 10px; }
  .g-hud { gap: 16px; }
  .play-title { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .tile-img { transition: none; }
  .tile:hover .tile-img, .tile:active .tile-img { transform: none; }
}
