/* Qwen Games — shared styles (hub + game chrome). Dark, neon, mobile-first. */
:root {
  --bg: #0b1020;
  --bg2: #101733;
  --panel: rgba(22, 30, 58, 0.92);
  --ink: #e8ecff;
  --dim: #8b93b8;
  --accent: #7c5cff;
  --accent2: #00e5c3;
  --danger: #ff4d6d;
  --gold: #ffd166;
  --radius: 16px;
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-user-select: none; user-select: none;
  overscroll-behavior: none;
}
body.game {
  height: 100dvh; display: flex; flex-direction: column;
  background: radial-gradient(120% 90% at 50% 0%, var(--bg2) 0%, var(--bg) 70%);
  overflow: hidden;
}
body.game canvas { display: block; width: 100vw; height: 100dvh; }

/* ---------- game chrome ---------- */
.qg-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 12px 8px;
  pointer-events: none;
}
.qg-topbar a, .qg-topbar button {
  pointer-events: auto;
  background: var(--panel); color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px; padding: 7px 12px;
  font: 600 13px var(--font); text-decoration: none;
  backdrop-filter: blur(8px);
}
.qg-topbar .qg-title {
  flex: 1; text-align: center; font-weight: 800; letter-spacing: 0.4px;
  text-shadow: 0 2px 12px rgba(124, 92, 255, 0.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qg-hud {
  position: fixed; z-index: 4; right: 12px; top: max(52px, calc(env(safe-area-inset-top) + 52px));
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.qg-hud .hud-score {
  font-size: 34px; font-weight: 900; line-height: 1;
  text-shadow: 0 0 18px rgba(0, 229, 195, 0.6);
}
.qg-hud .hud-hi { font-size: 13px; color: var(--dim); font-weight: 700; }

.qg-toast {
  position: fixed; left: 50%; top: 18%; transform: translateX(-50%);
  z-index: 6; background: var(--panel); border: 1px solid rgba(124, 92, 255, 0.5);
  padding: 8px 16px; border-radius: 999px; font-weight: 800; font-size: 15px;
  opacity: 0; transition: opacity 0.25s; pointer-events: none; white-space: nowrap;
}
.qg-toast.show { opacity: 1; }

/* ---------- overlays (start / game over) ---------- */
.qg-overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center; padding: 24px;
  background: rgba(8, 11, 24, 0.78); backdrop-filter: blur(6px);
}
.qg-overlay.hidden { display: none; }
.qg-overlay h1 {
  margin: 0; font-size: clamp(34px, 9vw, 54px); font-weight: 900; letter-spacing: 1px;
  text-shadow: 0 0 30px currentColor;
}
.qg-overlay .tagline { margin: 0; color: var(--dim); font-size: 15px; max-width: 34ch; }
.qg-overlay .big-btn {
  margin-top: 10px; background: linear-gradient(135deg, var(--accent), #4d8cff);
  color: #fff; border: 0; border-radius: 999px; padding: 16px 42px;
  font: 800 19px var(--font); cursor: pointer;
  box-shadow: 0 10px 30px rgba(124, 92, 255, 0.45);
}
.qg-overlay .stats { display: flex; gap: 26px; font-variant-numeric: tabular-nums; }
.qg-overlay .stats .n { font-size: 40px; font-weight: 900; color: var(--gold); }
.qg-overlay .stats .l { font-size: 12px; color: var(--dim); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.qg-overlay .hint { color: var(--dim); font-size: 13px; }
.qg-overlay .record { color: var(--accent2); font-weight: 900; font-size: 16px; }

/* ---------- hub ---------- */
#hub { max-width: 560px; margin: 0 auto; padding: 0 16px calc(30px + env(safe-area-inset-bottom)); }
.hub-hero { padding: 30px 0 8px; text-align: center; }
.hub-hero h1 {
  margin: 0; font-size: clamp(30px, 8vw, 44px); font-weight: 900;
  background: linear-gradient(120deg, #7c5cff, #00e5c3 60%, #ffd166);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hub-hero p { margin: 8px 0 0; color: var(--dim); font-size: 14px; }
.install-btn {
  margin-top: 14px; display: none;
  background: linear-gradient(135deg, var(--accent), #4d8cff); color: #fff;
  border: 0; border-radius: 999px; padding: 12px 30px;
  font: 800 16px var(--font); cursor: pointer;
  box-shadow: 0 8px 26px rgba(124, 92, 255, 0.4);
}
.install-btn.show { display: inline-block; }
.game-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 18px;
}
.game-card {
  position: relative; display: block; text-decoration: none; color: var(--ink);
  background: linear-gradient(160deg, rgba(35, 46, 92, 0.8), rgba(19, 26, 52, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius); overflow: hidden;
  transition: transform 0.15s;
}
.game-card:active { transform: scale(0.97); }
.game-card .thumb {
  height: 96px; display: flex; align-items: center; justify-content: center;
  font-size: 46px; position: relative;
}
.game-card .thumb::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(60% 60% at 50% 120%, rgba(124, 92, 255, 0.35), transparent 70%);
}
.game-card .meta { padding: 10px 12px 12px; }
.game-card .name { font-weight: 800; font-size: 15px; }
.game-card .desc { color: var(--dim); font-size: 12px; margin-top: 3px; line-height: 1.35; }
.game-card .hi { margin-top: 8px; font-size: 11px; font-weight: 700; color: var(--accent2); font-variant-numeric: tabular-nums; }
.hub-foot { text-align: center; color: var(--dim); font-size: 12px; padding-top: 26px; }
