/* World of games: shared look for the hub (index.html) and the player (play.html).
   Layout: a centred column with a brand header, a sticky filter + search bar, then a card grid.
   To restyle the whole site, change the tokens in :root. */
:root {
  --bg: #0E1224;
  --surface: #151A33;
  --raised: #1D2447;
  --line: #333C73;
  --line-soft: #252C57;
  --text: #EEF0FB;
  --mute: #9AA2CB;
  --accent: #8696FF;
  --t2d: #FFC857;
  --t3d: #6EE7D8;
  --display: 'Bricolage Grotesque', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  --body: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  --r: 14px;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--body);
  padding-block: 0 56px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  -webkit-text-size-adjust: 100%;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1200px; margin: 0 auto; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 14px; padding-top: 28px; }
.mark { width: 42px; height: 42px; flex: none; color: var(--accent); }
.wordmark { margin: 0; font: 800 clamp(28px, 5vw, 44px)/1 var(--display); letter-spacing: -0.02em; text-wrap: balance; }
.wordmark span { font-weight: 500; color: var(--mute); }
.lede { margin: 12px 0 0; max-width: 56ch; color: var(--mute); font-size: 16px; text-wrap: pretty; }

/* ---------- Arcade zone entrance (the zone itself has its own look in arcade/arcade.css) ---------- */
.zone-link {
  margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; text-decoration: none;
  background: linear-gradient(135deg, #2a0f4d, #12082a); border: 1.5px solid #FF3DDC; color: #ffd6f6; font-weight: 700; font-size: 14px; letter-spacing: .02em;
  box-shadow: 0 0 0 0 rgba(255, 61, 220, .0), inset 0 0 12px rgba(255, 61, 220, .18); transition: box-shadow .18s ease, transform .18s ease;
}
.zone-link:hover { transform: translateY(-2px); box-shadow: 0 0 18px rgba(255, 61, 220, .45), inset 0 0 12px rgba(255, 61, 220, .25); }
.zone-link svg { width: 20px; height: 20px; color: #29F0FF; flex: none; }
@media (max-width: 520px) { .brand { flex-wrap: wrap; row-gap: 12px; } .zone-link { margin-left: 0; } }

/* ---------- toolbar ---------- */
.toolbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 20px; padding-block: 14px; background: var(--bg);
}
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 999px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 0; border-radius: 999px;
  background: transparent; color: var(--mute); font-weight: 700; font-size: 14px; cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.tab:hover { color: var(--text); }
.tab .n { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--raised); color: var(--mute); font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.tab[aria-selected="true"] { background: var(--text); color: var(--bg); }
.tab[aria-selected="true"] .n { background: rgba(14, 18, 36, .14); color: var(--bg); }
.search { position: relative; flex: 1 1 220px; max-width: 340px; min-width: 0; }
.search svg { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--mute); pointer-events: none; }
.search input {
  width: 100%; min-width: 0; padding: 10px 14px 10px 40px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-soft); color: var(--text); font-size: 15px;
}
.search input::placeholder { color: var(--mute); opacity: 1; }
.search input:hover { border-color: var(--line); }
.status { margin: 6px 0 16px; color: var(--mute); font-size: 14px; min-height: 21px; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 18px; list-style: none; margin: 0; padding: 0; }
.grid > li { min-width: 0; display: flex; }
.card {
  display: flex; flex-direction: column; width: 100%; overflow: hidden; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r);
  transition: transform .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--line); }
.thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--raised); }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.card:hover .thumb img { transform: scale(1.04); }
.art {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(135deg, hsl(var(--h) 45% 27%), hsl(calc(var(--h) + 40) 50% 14%));
}
.art b { font: 800 88px/1 var(--display); color: hsl(var(--h) 65% 82% / .32); user-select: none; }
.pill {
  display: inline-flex; align-items: center; padding: 5px 8px; border: 1px solid currentColor; border-radius: 6px;
  background: rgba(14, 18, 36, .82); font: 700 11px/1 var(--body); letter-spacing: .09em;
}
.pill[data-t="2D"] { color: var(--t2d); }
.pill[data-t="3D"] { color: var(--t3d); }
.thumb .pill { position: absolute; left: 10px; top: 10px; }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 14px 16px 16px; }
.card h2 { margin: 0; font: 700 19px/1.2 var(--display); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.card p { margin: 6px 0 0; color: var(--mute); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 16px; font-weight: 700; font-size: 14px; }
.play-cta { display: inline-flex; align-items: center; gap: 6px; }
.play-cta svg { width: 16px; height: 16px; color: var(--accent); transition: transform .18s ease; }
.card:hover .play-cta svg { transform: translateX(3px); }
.new { color: var(--bg); background: var(--accent); border-radius: 6px; padding: 3px 7px; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }

/* ---------- empty states ---------- */
.empty { border: 1.5px dashed var(--line); border-radius: var(--r); padding: 40px 20px 44px; text-align: center; }
.empty h2 { margin: 0 0 8px; font: 700 22px/1.2 var(--display); text-wrap: balance; }
.empty p { margin: 0 auto; max-width: 46ch; color: var(--mute); text-wrap: pretty; }
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 520px; margin: 0 auto 28px; }
.slot { aspect-ratio: 16 / 10; border: 1.5px dashed var(--line); border-radius: 10px; display: grid; place-items: center; color: var(--line); font: 800 15px/1 var(--display); letter-spacing: .06em; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; border: 0; border-radius: 10px;
  background: var(--raised); color: var(--text); font-weight: 700; font-size: 14px; text-decoration: none; cursor: pointer;
  transition: background-color .15s ease;
}
.btn:hover { background: var(--line-soft); }
.btn svg { width: 18px; height: 18px; flex: none; }
.empty .btn { margin-top: 18px; }

.foot-note { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-top: 44px; padding-top: 16px; border-top: 1px solid var(--line-soft); color: var(--mute); font-size: 13px; }

/* ---------- player page ---------- */
body.player { height: 100%; display: flex; flex-direction: column; padding: 0; background: #000; }
body.player::before { display: none; }
html.player-root { height: 100%; }
.bar {
  flex: none; display: flex; align-items: center; gap: 12px; background: var(--surface); border-bottom: 1px solid var(--line-soft);
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 10px max(12px, env(safe-area-inset-left, 0px));
}
.bar .ttl { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.bar h1 { margin: 0; font: 700 18px/1.2 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .acts { display: flex; gap: 8px; flex: none; }
.btn.icon { padding: 9px; }
.hint { flex: none; margin: 0; padding: 7px max(16px, env(safe-area-inset-right, 0px)) 7px max(16px, env(safe-area-inset-left, 0px)); background: var(--bg); color: var(--mute); font-size: 13px; border-bottom: 1px solid var(--line-soft); }
.stage { position: relative; flex: 1; min-height: 0; background: #000; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--mute); pointer-events: none; }
.spin { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: wog-spin .8s linear infinite; }
@keyframes wog-spin { to { transform: rotate(360deg); } }
.notfound { margin: auto; padding: 24px; text-align: center; max-width: 420px; }
.notfound h1 { margin: 0 0 8px; font: 700 24px/1.2 var(--display); }
.notfound p { margin: 0 0 18px; color: var(--mute); }
@media (max-width: 560px) {
  .back-label { display: none; }
  .bar h1 { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- "Savol va takliflar" (feedback.js) ---------- */
.fb-open { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 700; font-size: 13px; cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.fb-open:hover { border-color: var(--accent); background: var(--raised); }
dialog.fb { width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: 0 24px 70px rgba(0, 0, 0, .55); }
dialog.fb::backdrop { background: rgba(6, 8, 20, .72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.fb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fb h2 { margin: 0; font: 800 22px/1.2 var(--display); letter-spacing: -0.01em; text-wrap: balance; }
.fb h3 { margin: 6px 0 8px; font: 800 24px/1.2 var(--display); }
.fb-lang { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line-soft); border-radius: 999px; background: var(--bg); flex: none; }
.fb-lang button { padding: 5px 9px; border: 0; border-radius: 999px; background: transparent; color: var(--mute); font-weight: 700; font-size: 12px; cursor: pointer; }
.fb-lang button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.fb-intro { margin: 10px 0 16px; color: var(--mute); font-size: 14px; text-wrap: pretty; }
.fb-field { margin-bottom: 14px; position: relative; }
.fb label { display: block; margin-bottom: 6px; font-weight: 700; font-size: 14px; }
.fb-opt { color: var(--mute); font-weight: 500; }
.fb input[type="text"], .fb textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--bg); color: var(--text); font: 400 16px/1.4 var(--body); }
.fb textarea { min-height: 120px; resize: vertical; }
.fb input::placeholder, .fb textarea::placeholder { color: var(--mute); opacity: .8; }
.fb input:hover, .fb textarea:hover { border-color: var(--line); }
.fb-count { position: absolute; right: 10px; bottom: 8px; font-size: 12px; color: var(--mute); background: var(--bg); padding: 0 4px; border-radius: 4px; }
.fb-trap { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.fb-status { min-height: 20px; margin: 0 0 10px; font-size: 14px; color: var(--t3d); }
.fb-status.bad { color: #ff8fa3; }
.fb-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.fb-send, .fb-cancel { padding: 11px 18px; border-radius: 12px; font-weight: 700; font-size: 15px; cursor: pointer; border: 1px solid var(--line); }
.fb-send { background: var(--accent); border-color: var(--accent); color: #0E1224; }
.fb-send:hover:not([disabled]) { filter: brightness(1.1); }
.fb-send[disabled] { opacity: .6; cursor: default; }
.fb-cancel { background: transparent; color: var(--text); }
.fb-cancel:hover { background: var(--raised); }
.fb-note { margin: 14px 0 0; color: var(--mute); font-size: 12.5px; }
.fb-done { padding: 12px 0 4px; text-align: center; }
.fb-done p { margin: 0 0 18px; color: var(--mute); }
.fb-done .fb-actions { justify-content: center; }
@media (max-width: 420px) { dialog.fb { padding: 16px; } .fb h2 { font-size: 19px; } .fb-actions > * { flex: 1; } }
