:root {
  --bg: #0b0b1a;
  --bg-2: #12122a;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f1f1fb;
  --muted: #9a9ac0;
  --accent: #8b5cf6;
  --accent-2: #06b6d4;
  --good: #22c55e;
  --bad: #f43f5e;
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(139, 92, 246, 0.22), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(6, 182, 212, 0.16), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg { fill: currentColor; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: rgba(11, 11, 26, 0.72);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; flex-shrink: 0; }
.brand b { font-weight: 800; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.search {
  flex: 1; min-width: 0; max-width: 460px; margin-inline-start: auto;
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px; height: 42px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  transition: border-color .2s, background .2s;
}
.search:focus-within { border-color: var(--accent); background: var(--surface-2); }
.search svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.search input { all: unset; flex: 1; min-width: 0; font-size: 0.95rem; }
.net { width: 10px; height: 10px; border-radius: 50%; background: var(--good); box-shadow: 0 0 10px var(--good); flex-shrink: 0; }
.net.off { background: var(--bad); box-shadow: 0 0 10px var(--bad); }

/* ---------- main ---------- */
#view { padding: 18px 16px calc(96px + var(--safe-b)); max-width: 1280px; margin: 0 auto; outline: none; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 2px 14px; }
.section-title h1, .section-title h2 { margin: 0; font-size: 1.3rem; letter-spacing: -0.01em; }
.section-title span { color: var(--muted); font-size: 0.9rem; white-space: nowrap; flex-shrink: 0; }

/* hero */
.hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: 20px;
  min-height: 260px; padding: 30px; border-radius: 26px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 30px 80px -30px var(--c1);
  isolation: isolate;
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 80% 30%, rgba(255,255,255,.35), transparent 40%),
    repeating-linear-gradient(115deg, rgba(255,255,255,.06) 0 2px, transparent 2px 22px);
}
.hero .eyebrow { display: inline-flex; gap: 6px; align-items: center; font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; background: rgba(0,0,0,.25); padding: 6px 12px; border-radius: 999px; }
.hero h1, .hero .hero-title { font-size: clamp(1.9rem, 5vw, 3.2rem); line-height: 1.02; margin: 14px 0 10px; letter-spacing: -0.03em; }
.hero p { margin: 0 0 20px; max-width: 46ch; opacity: .92; line-height: 1.5; }
.hero-art { font-size: clamp(6rem, 18vw, 11rem); text-align: center; filter: drop-shadow(0 20px 30px rgba(0,0,0,.35)); animation: float 4s ease-in-out infinite; }
.hero-dots { position: absolute; bottom: 14px; inset-inline-end: 20px; display: flex; gap: 6px; }
.hero-dots button { width: 8px; height: 8px; border-radius: 99px; border: 0; padding: 0; background: rgba(255,255,255,.4); cursor: pointer; transition: width .3s; }
.hero-dots button.on { width: 22px; background: #fff; }
@keyframes float { 50% { transform: translateY(-12px) rotate(-3deg); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 22px; border-radius: 14px; border: 0; cursor: pointer;
  font-weight: 700; font-size: 1rem;
  background: #fff; color: #111;
  transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -10px rgba(0,0,0,.5); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.small { height: 36px; padding: 0 14px; font-size: .9rem; border-radius: 11px; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }

/* chips */
/* One swipeable row on every screen size; the edges fade to hint that it scrolls. */
.chips {
  display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; overflow-y: hidden; padding: 2px 16px; margin: 22px -16px 0;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scroll-padding-inline: 16px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 24px), transparent);
          mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 24px), transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; height: 38px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; line-height: 1;
  scroll-snap-align: start;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  font-weight: 600; font-size: .92rem; transition: all .2s;
}
.chip:hover { color: var(--text); }
.chip.on { background: var(--text); color: var(--bg); border-color: transparent; }

/* grid of game cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), border-color .2s, box-shadow .25s;
  animation: rise .5s both; animation-delay: calc(var(--i, 0) * 40ms);
}
.card:hover { transform: translateY(-4px); border-color: rgba(255,255,255,.22); box-shadow: 0 24px 50px -24px var(--c1); }
.card:active { transform: scale(.98); }
.thumb {
  position: relative; aspect-ratio: 16 / 10; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--c1), var(--c2)); overflow: hidden;
}
.thumb::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 75% 20%, rgba(255,255,255,.35), transparent 45%),
              repeating-linear-gradient(-45deg, rgba(255,255,255,.05) 0 2px, transparent 2px 16px);
}
.thumb .ico { font-size: 4.2rem; filter: drop-shadow(0 10px 18px rgba(0,0,0,.35)); transition: transform .35s cubic-bezier(.2,.8,.2,1); z-index: 1; }
.card:hover .thumb .ico { transform: scale(1.12) rotate(-6deg); }
.badges { position: absolute; top: 10px; inset-inline-start: 10px; inset-inline-end: 52px; display: flex; flex-wrap: wrap; gap: 5px; z-index: 2; }
.badge { font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 4px 8px; border-radius: 7px; background: rgba(0,0,0,.45); backdrop-filter: blur(6px); }
.badge.online { background: rgba(16, 185, 129, .85); }
.badge.d3 { background: rgba(139, 92, 246, .9); }
.badge.party { background: rgba(236, 72, 153, .9); }
.fav {
  position: absolute; top: 8px; inset-inline-end: 8px; z-index: 3; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; border: 0; cursor: pointer; background: rgba(0,0,0,.35); backdrop-filter: blur(6px);
  color: #fff; transition: transform .2s;
}
.fav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.fav.on svg { fill: #f43f5e; stroke: #f43f5e; }
.fav:active { transform: scale(.85); }
.card .info { padding: 12px 14px 14px; }
.card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.card .meta { display: flex; justify-content: space-between; gap: 6px; color: var(--muted); font-size: .84rem; }
.card .meta span:last-child { white-space: nowrap; flex-shrink: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty .big { font-size: 3rem; margin-bottom: 10px; }

/* ---------- panels / lists ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-list li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.lb-list li:last-child { border-bottom: 0; }
.lb-list .rank { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--surface-2); }
.lb-list li:nth-child(1) .rank { background: linear-gradient(135deg, #fde047, #f59e0b); color: #111; }
.lb-list li:nth-child(2) .rank { background: linear-gradient(135deg, #e5e7eb, #9ca3af); color: #111; }
.lb-list li:nth-child(3) .rank { background: linear-gradient(135deg, #fdba74, #c2410c); color: #111; }
.lb-list .who { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-list .pts { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent-2); }
.lb-list li.me .who { color: var(--accent-2); }
.lb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.lb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.lb-head .ico { font-size: 1.6rem; }
.lb-head h3 { margin: 0; font-size: 1.05rem; }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field label { font-weight: 600; color: var(--muted); font-size: .9rem; }
.input {
  height: 48px; padding: 0 14px; border-radius: 12px; font: inherit; font-size: 1rem;
  background: rgba(0,0,0,.25); border: 1px solid var(--border); color: var(--text); outline: none;
}
.input:focus { border-color: var(--accent); }
.switch { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--border); }
.switch input { width: 46px; height: 26px; appearance: none; background: var(--surface-2); border-radius: 99px; position: relative; cursor: pointer; transition: background .2s; }
.switch input::after { content: ""; position: absolute; width: 20px; height: 20px; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(20px); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.stat { background: rgba(0,0,0,.2); border-radius: 14px; padding: 14px; text-align: center; }
.stat b { display: block; font-size: 1.5rem; }
.stat span { color: var(--muted); font-size: .8rem; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); z-index: 30;
  display: flex; gap: 4px; padding: 6px; border-radius: 22px;
  background: rgba(20, 20, 42, 0.78); border: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 20px 50px -20px rgba(0,0,0,.8);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 72px; padding: 8px 10px 6px; border-radius: 16px; color: var(--muted); font-size: .72rem; font-weight: 600; transition: all .2s; }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a.on { color: #fff; background: linear-gradient(135deg, rgba(139,92,246,.5), rgba(6,182,212,.4)); }

/* ---------- player ---------- */
body.playing .topbar, body.playing .tabbar { display: none; }
body.playing #view { padding: 0; max-width: none; height: 100dvh; }
.player { position: fixed; inset: 0; display: flex; flex-direction: column; background: #05050d; z-index: 40; }
.player-bar {
  display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-t)) 12px 8px;
  background: rgba(10,10,24,.9); border-bottom: 1px solid var(--border); z-index: 2;
}
.icon-btn { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:active { transform: scale(.92); }
.player-title { flex: 1; min-width: 0; }
.player-title h1 { font-size: 1rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-title small { display: block; color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud { display: flex; gap: 8px; flex-shrink: 0; }
.hud-item { display: flex; flex-direction: column; align-items: flex-end; padding: 2px 10px; border-radius: 10px; background: var(--surface); min-width: 64px; }
.hud-item span { white-space: nowrap; max-width: 72px; overflow: hidden; text-overflow: ellipsis; font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hud-item b { font-variant-numeric: tabular-nums; font-size: 1.05rem; line-height: 1.1; }
.hud-item.bump b { animation: bump .25s; }
@keyframes bump { 50% { transform: scale(1.25); color: var(--accent-2); } }
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.stage canvas { display: block; }
.game-canvas { position: absolute; inset: 0; }
.player-side { display: none; }

/* overlays shown inside a game stage */
.overlay {
  position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px;
  background: rgba(5,5,15,.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade .25s;
}
.overlay-card {
  width: min(380px, 100%); text-align: center; padding: 26px 22px; border-radius: 24px;
  background: linear-gradient(160deg, rgba(40,40,80,.92), rgba(18,18,40,.95)); border: 1px solid var(--border);
  box-shadow: 0 30px 80px -30px #000; animation: pop .35s cubic-bezier(.2,1.4,.4,1);
}
.overlay-card .big { font-size: 3rem; line-height: 1; }
.overlay-card h2 { margin: 12px 0 6px; font-size: 1.6rem; }
.overlay-card p { margin: 0 0 18px; color: var(--muted); line-height: 1.5; white-space: pre-line; }
.overlay-card .actions { display: flex; flex-direction: column; gap: 10px; }
.overlay-card .score-big { font-size: 3rem; font-weight: 800; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } }

/* ---------- toasts ---------- */
#toasts { position: fixed; top: calc(14px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; width: min(92vw, 420px); }
.toast { padding: 12px 16px; border-radius: 14px; background: rgba(30,30,60,.95); border: 1px solid var(--border); box-shadow: 0 14px 40px -12px #000; animation: toast 3.2s forwards; font-weight: 600; text-align: center; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-10px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-10px); } }

/* ---------- shared in-game UI ---------- */
.touch-pad { position: absolute; left: 0; right: 0; bottom: calc(12px + var(--safe-b)); display: flex; justify-content: center; gap: 10px; z-index: 5; padding: 0 12px; }
.touch-pad button {
  width: 62px; height: 62px; border-radius: 18px; border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.1); backdrop-filter: blur(8px); font-size: 1.4rem; font-weight: 800;
  touch-action: none;
}
.touch-pad button:active, .touch-pad button.down { background: rgba(139,92,246,.55); }
@media (hover: hover) and (pointer: fine) { .touch-only { display: none !important; } }

/* desktop: leaderboard side panel while playing */
@media (min-width: 1100px) {
  .player-body { display: flex; flex: 1; min-height: 0; }
  .player-side { display: block; width: 300px; padding: 16px; border-inline-start: 1px solid var(--border); overflow-y: auto; background: rgba(10,10,24,.85); }
  .player-side h2 { margin: 0 0 8px; font-size: 1.05rem; }
  .player-side .controls { color: var(--muted); font-size: .88rem; line-height: 1.5; margin: 0 0 18px; }
}
.player-body { display: flex; flex: 1; min-height: 0; flex-direction: column; }
@media (min-width: 1100px) { .player-body { flex-direction: row; } }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; padding: 22px; min-height: 0; }
  .hero-art { position: absolute; inset-inline-end: -10px; top: 6px; }
  .hero h1, .hero .hero-title { margin-top: 10px; max-width: 70%; }
  .hero > div:first-child { position: relative; z-index: 1; }
  .hero-art { font-size: 5rem; opacity: .45; z-index: 0; }
  .hero p { font-size: .95rem; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .thumb .ico { font-size: 3rem; }
  .card .info { padding: 10px 12px 12px; }
  .card h3 { font-size: .95rem; }
  .brand span { display: none; }
  .hud-item { min-width: 52px; padding: 2px 8px; }
  .tabbar a { min-width: 64px; }
}
@media (max-width: 360px) { .grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* zenitab Ads slots (rendered by the SDK inside a Shadow DOM) */
.ad-slot { margin: 22px 2px 4px; max-width: 560px; }
.ad-slot[hidden] { display: none; }
.player-side .ad-slot { margin: 20px 0 0; }

/* ---------- languages, server-rendered content, footer ---------- */
/* Language picker in the top bar: a compact "🌐 TR" pill with the native select stretched invisibly over it,
   so phones still get their own picker and the bar never grows. */
.lang-pick {
  position: relative; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 12px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-weight: 700; font-size: .85rem; letter-spacing: .04em; cursor: pointer; transition: border-color .2s, background .2s;
}
.lang-pick:hover { background: var(--surface-2); }
.lang-pick:focus-within { border-color: var(--accent); }
.lang-pick svg { width: 18px; height: 18px; color: var(--muted); }
.lang-pick select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; border: 0; }
@media (max-width: 420px) { .lang-pick { padding: 0 10px; gap: 4px; } .topbar { gap: 10px; } }
/* Dark dropdown lists everywhere (some browsers ignore color-scheme for the open list). */
select { color-scheme: dark; }
select option, select optgroup { background-color: #16162e; color: #f1f1fb; }
select.input { appearance: none; -webkit-appearance: none; background-color: #16162e; padding-inline-end: 40px;
  background-image: linear-gradient(45deg, transparent 50%, #9a9ac0 50%), linear-gradient(135deg, #9a9ac0 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; cursor: pointer; }
[dir="rtl"] select.input { background-position: 14px 50%, 20px 50%; }
.page-h1 { margin: 2px 2px 14px; font-size: 1rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.lead { color: var(--muted); line-height: 1.55; max-width: 70ch; margin: 0 2px 16px; }
.lang-hint { position: fixed; z-index: 90; inset-inline: 12px; bottom: calc(92px + var(--safe-b)); margin: 0 auto; max-width: 520px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: rgba(30,30,60,.97); border: 1px solid var(--border); box-shadow: 0 14px 40px -12px #000; }
.lang-hint span { flex: 1; font-size: .92rem; }
.ssr h1 { font-size: clamp(1.5rem, 4vw, 2.3rem); margin: 8px 2px 10px; letter-spacing: -0.02em; }
.ssr h2 { font-size: 1.2rem; margin: 26px 2px 12px; }
.ssr .muted { color: var(--muted); }
.ssr-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ssr-card { display: flex; gap: 12px; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); height: 100%; }
.ssr-card .ico { font-size: 2.2rem; line-height: 1; }
.ssr-card b { display: block; }
.ssr-card small { display: block; color: var(--accent-2); font-size: .78rem; margin: 2px 0 4px; }
.ssr-card span span { color: var(--muted); font-size: .86rem; line-height: 1.45; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 2px; padding: 0; color: var(--muted); font-size: .85rem; }
.crumbs li + li::before { content: "›"; margin-inline-end: 6px; }
.site-foot { max-width: 1280px; margin: 0 auto; padding: 8px 18px calc(110px + var(--safe-b)); color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.site-foot a { color: var(--muted); }
.site-foot a:hover, .site-foot a[aria-current] { color: var(--text); }
body.playing .site-foot, body.playing .lang-hint { display: none; }
#view:has(> *:not(.ssr)) + .site-foot { padding-top: 16px; }
[dir="rtl"] .switch input::after { left: auto; right: 3px; }
[dir="rtl"] .switch input:checked::after { transform: translateX(-20px); }

#app { overflow-x: clip; }

/* Bottom tab bar: labels stay on one line in every language. */
.tabbar a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (max-width: 420px) { .tabbar a { min-width: 0; padding: 8px 9px 6px; } .tabbar a span { font-size: .68rem; } }

/* Narrow phones: the game title gives way to the score boxes, which never overlap it. */
@media (max-width: 400px) {
  .player-bar { gap: 6px; }
  .player-title small { display: none; }
  .hud { gap: 4px; }
  .hud-item { min-width: 0; padding: 2px 6px; }
  .hud-item b { font-size: .95rem; }
  .player-bar .icon-btn { width: 38px; height: 38px; flex-shrink: 0; }
}
[dir="rtl"] .player-bar > a.icon-btn svg { transform: scaleX(-1); }

/* ---------- game detail page ---------- */
.crumbs { margin: 4px 0 14px; }
.crumbs a:hover, .crumbs a[aria-current] { color: var(--text); }
.gd-hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 28px;
  padding: 28px; border-radius: 26px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 30px 80px -34px var(--c1);
}
.gd-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(circle at 85% 15%, rgba(255,255,255,.3), transparent 42%),
              linear-gradient(90deg, rgba(5,5,15,.45), rgba(5,5,15,.1) 70%),
              repeating-linear-gradient(115deg, rgba(255,255,255,.05) 0 2px, transparent 2px 22px);
}
.gd-art {
  width: 180px; aspect-ratio: 1; border-radius: 32px; display: grid; place-items: center;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 24px 50px -20px rgba(0,0,0,.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.gd-art span { font-size: 6.2rem; line-height: 1; filter: drop-shadow(0 14px 22px rgba(0,0,0,.4)); animation: float 4s ease-in-out infinite; }
.gd-head { min-width: 0; }
.gd-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.gd-hero h1 { margin: 0; font-size: clamp(1.8rem, 4.6vw, 3rem); line-height: 1.05; letter-spacing: -0.03em; text-shadow: 0 2px 18px rgba(0,0,0,.25); }
.gd-sub { margin: 8px 0 0; font-weight: 600; opacity: .9; font-size: .95rem; }
.gd-desc { margin: 12px 0 20px; max-width: 60ch; line-height: 1.55; opacity: .95; }
.gd-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.gd-play { height: 52px; padding: 0 30px; font-size: 1.08rem; box-shadow: 0 14px 30px -12px rgba(0,0,0,.55); }
.gd-actions .btn.ghost { height: 52px; background: rgba(0,0,0,.28); border-color: rgba(255,255,255,.22); color: #fff; backdrop-filter: blur(6px); }
.gd-actions .btn.ghost svg { width: 18px; height: 18px; }
.gd-actions .fav.gd-fav { position: static; width: 52px; height: 52px; border-radius: 14px; background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.22); }
.gd-actions .fav.gd-fav svg { width: 22px; height: 22px; }

.gd-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; margin-top: 22px; align-items: start; }
.gd-main > section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; }
.gd h2 { font-size: 1.2rem; margin: 0 0 10px; letter-spacing: -0.01em; }
.gd h3 { font-size: 1rem; margin: 18px 0 6px; color: var(--accent-2); }
.gd-main p { margin: 0; line-height: 1.65; color: #d6d6ee; }
.gd-controls { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; background: rgba(0,0,0,.25); padding: 10px 12px; border-radius: 12px; }
.gd-tips { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.gd-tips li { position: relative; padding-inline-start: 28px; line-height: 1.55; color: #d6d6ee; }
.gd-tips li::before { content: "★"; position: absolute; inset-inline-start: 0; top: 0; color: #fbbf24; }
.gd-faq details { border-top: 1px solid var(--border); }
.gd-faq details:first-of-type { border-top: 0; }
.gd-faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; font-weight: 600; }
.gd-faq summary::-webkit-details-marker { display: none; }
.gd-faq summary::after { content: "+"; flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent-2); font-weight: 800; transition: transform .2s; }
.gd-faq details[open] summary::after { transform: rotate(45deg); }
.gd-faq details p { padding: 0 0 14px; }

.gd-side { display: grid; gap: 16px; position: sticky; top: calc(76px + var(--safe-t)); }
.gd-side h2 { font-size: 1.05rem; }
.gd-facts { margin: 0; }
.gd-facts div { display: grid; grid-template-columns: 42% 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); font-size: .9rem; }
.gd-facts div:first-child { border-top: 0; padding-top: 2px; }
.gd-facts dt { color: var(--muted); }
.gd-facts dd { margin: 0; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.gd-facts dd a { color: var(--accent-2); }
.gd-facts dd a:hover { text-decoration: underline; }
.gd-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.gd-tags .chip { height: 32px; padding: 0 12px; font-size: .84rem; cursor: default; }
.gd-tags a.chip { cursor: pointer; color: var(--text); }
.gd-tags a.chip:hover { border-color: var(--accent); }
.gd-side .muted { color: var(--muted); margin: 0; }
.gd-related { margin-top: 10px; }
.gd-related h2 { margin: 18px 2px 14px; }
.gd .ad-slot { margin: 0 0 16px; }

@media (max-width: 960px) {
  .gd-layout { grid-template-columns: 1fr; }
  .gd-side { position: static; }
}
@media (max-width: 640px) {
  .gd-hero { grid-template-columns: 1fr; gap: 16px; padding: 20px 18px; border-radius: 22px; }
  .gd-art { width: 92px; border-radius: 22px; position: absolute; top: 16px; inset-inline-end: 16px; }
  .gd-art span { font-size: 3.2rem; }
  .gd-head { padding-inline-end: 0; }
  .gd-badges, .gd-hero h1 { padding-inline-end: 104px; }
  .gd-hero h1 { font-size: 1.75rem; }
  .gd-desc { margin-bottom: 16px; font-size: .95rem; }
  .gd-actions { display: grid; grid-template-columns: 1fr auto auto; }
  .gd-play { padding: 0 16px; }
  .gd-actions .btn.ghost { padding: 0 14px; }
  .gd-main > section { padding: 16px; }
  .gd-facts div { grid-template-columns: 40% 1fr; }
}
@media (max-width: 380px) {
  .gd-actions .btn.ghost { font-size: 0; gap: 0; width: 52px; padding: 0; }
  .gd-actions .btn.ghost svg { width: 20px; height: 20px; }
}
