/* PLAY GRID design system — ported from doc/ui-demo (v0 design)
 * Light-first, auto dark. No framework; tokens + components. */

:root {
  color-scheme: light;
  --bg: #f4f5f8;
  --card: #ffffff;
  --fg: #1d2130;
  --muted: #62687a;
  --primary: #4f46e5;
  --primary-soft: rgba(79, 70, 229, 0.1);
  --primary-fg: #ffffff;
  --accent: #f0b429;
  --accent-soft: rgba(240, 180, 41, 0.18);
  --border: #e5e7ee;
  --secondary: #eef0f5;
  --danger: #dc2626;
  --ok: #059669;
  --shadow: 0 10px 30px rgba(29, 33, 48, 0.07);
  --r: 14px;
  --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: ui-monospace, 'Cascadia Code', Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121216;
    --card: #1c1d23;
    --fg: #f4f4f6;
    --muted: #a0a5b4;
    --primary: #818cf8;
    --primary-soft: rgba(129, 140, 248, 0.14);
    --primary-fg: #14142a;
    --accent: #fbbf24;
    --accent-soft: rgba(251, 191, 36, 0.15);
    --border: rgba(255, 255, 255, 0.09);
    --secondary: #282a33;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; }
.container { max-width: 80rem; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px) { .container { padding: 0 1.5rem; } }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.hdr-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 4rem; }
.brand { display: flex; align-items: center; gap: 2px; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand em { color: var(--primary); font-style: normal; }
.nav-desktop { display: none; align-items: center; gap: 4px; }
@media (min-width: 1024px) { .nav-desktop { display: flex; } }
.nav-pill {
  display: flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 8px 14px;
  font-size: 0.875rem; font-weight: 600; color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.nav-pill:hover { background: var(--secondary); color: var(--fg); }
.nav-pill.active { background: var(--primary-soft); color: var(--primary); }
.hdr-actions { display: flex; align-items: center; gap: 8px; }
.lang-btn {
  border: 1px solid var(--border); background: var(--card); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 0.8rem; font-weight: 700;
}
.lang-btn:hover { color: var(--fg); border-color: var(--primary); }
.avatar-chip {
  display: flex; align-items: center; gap: 8px; border-radius: 999px;
  padding: 4px 12px 4px 4px; border: 1px solid var(--border); background: var(--card);
  font-size: 0.85rem; font-weight: 700;
}
.avatar-chip:hover { border-color: var(--primary); }
.avatar-dot {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #d946ef, #7c3aed); color: #fff; font-size: 0.8rem; font-weight: 800;
}
.menu-btn {
  display: flex; width: 36px; height: 36px; align-items: center; justify-content: center;
  border: none; background: none; color: var(--fg); font-size: 1.3rem; border-radius: 50%;
}
.menu-btn:hover { background: var(--secondary); }
@media (min-width: 1024px) { .menu-btn { display: none; } }
@media (max-width: 560px) { #pg-auth-area .btn { display: none; } }
.nav-mobile .auth-row { display: flex; gap: 8px; margin-top: 8px; }
.nav-mobile .auth-row .btn { flex: 1; }
.nav-mobile { display: none; border-top: 1px solid var(--border); background: var(--bg); padding: 10px 1rem 14px; }
.nav-mobile.open { display: block; }
.nav-mobile .nav-pill { border-radius: 12px; margin: 2px 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 12px; padding: 10px 18px; font-size: 0.9rem; font-weight: 700;
  border: 1px solid transparent; transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-pri { background: var(--primary); color: var(--primary-fg); }
.btn-pri:hover { box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 40%, transparent); }
.btn-outline { background: var(--card); border-color: var(--border); color: var(--fg); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: none; color: var(--muted); }
.btn-ghost:hover { background: var(--secondary); color: var(--fg); }
.btn-lg { padding: 13px 26px; font-size: 1rem; border-radius: 14px; }
.btn-sm { padding: 7px 13px; font-size: 0.8rem; border-radius: 10px; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }

/* ---------- cards & sections ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 24px; }
.section-card { padding: 1.5rem; }
@media (min-width: 640px) { .section-card { padding: 2rem; } }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; font-weight: 700; color: var(--primary); }
.h1 { font-size: clamp(2.5rem, 6vw, 4.2rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; }
.h3 { font-size: 1.12rem; font-weight: 800; }
.sub { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ---------- game cards ---------- */
.games-grid { display: grid; gap: 1.25rem; }
@media (min-width: 640px) { .games-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .games-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .games-grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }
.game-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); border: 1px solid var(--border); border-radius: 24px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.game-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.gc-cover {
  position: relative; aspect-ratio: 16 / 10; display: flex; align-items: center; justify-content: center;
  font-size: 3.4rem; overflow: hidden;
}
.gc-cover::before {
  content: ''; position: absolute; inset: 0; opacity: 0.3;
  background-image: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.9) 1px, transparent 1px);
  background-size: 22px 22px;
}
.cover-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.gc-cover .play-hover {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.18s; background: rgba(0, 0, 0, 0.12);
}
.game-card:hover .play-hover { opacity: 1; }
.play-hover span {
  width: 56px; height: 56px; border-radius: 50%; background: rgba(255,255,255,0.95); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem; box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.gc-badge {
  position: absolute; left: 12px; top: 12px; border-radius: 999px; padding: 3px 10px;
  background: rgba(255,255,255,0.92); color: #059669; font-size: 0.72rem; font-weight: 800; z-index: 2;
}
.gc-body { display: flex; flex-direction: column; flex: 1; padding: 1.1rem 1.25rem 1.25rem; }
.gc-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gc-name { font-weight: 800; display: flex; align-items: center; gap: 8px; }
.cat-tag { border-radius: 7px; background: var(--primary-soft); color: var(--primary); padding: 2px 7px; font-size: 0.72rem; font-weight: 700; }
.gc-players { font-size: 0.76rem; color: var(--muted); white-space: nowrap; }
.gc-desc { margin-top: 8px; flex: 1; font-size: 0.87rem; color: var(--muted); }
.gc-rating { margin-top: 10px; font-size: 0.85rem; font-weight: 700; }
.gc-rating i { font-style: normal; color: var(--accent); }
.gc-actions { display: flex; gap: 8px; margin-top: 14px; }
.gc-actions .btn { flex: 1; }

/* cover gradients (per game / category) */
.gr-arc    { background: linear-gradient(135deg, #7e22ce, #c026d3 50%, #581c87); }
.gr-tower  { background: linear-gradient(135deg, #fcd34d, #fb923c 55%, #d97706); }
.gr-beacon { background: linear-gradient(135deg, #1e3a8a, #3730a3 55%, #0f172a); }
.gr-pet    { background: linear-gradient(135deg, #fbcfe8, #f472b6 55%, #ec4899); }
.gr-soon   { background: linear-gradient(135deg, #334155, #475569 55%, #1e293b); }
.gr-voxel  { background: linear-gradient(135deg, #4ade80, #16a34a 55%, #14532d); }

/* ---------- chips / filters ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border-radius: 999px; border: 1px solid var(--border); background: var(--card);
  color: var(--muted); padding: 8px 16px; font-size: 0.86rem; font-weight: 600; transition: all 0.15s;
}
.chip:hover { color: var(--fg); border-color: var(--primary); }
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.chip.soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.seg { display: inline-flex; gap: 4px; border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 4px; }
.seg button { border: none; background: none; border-radius: 999px; padding: 7px 14px; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--secondary); color: var(--fg); }
.seg button.on.pri { background: var(--primary); color: var(--primary-fg); }

/* ---------- inputs ---------- */
.input {
  width: 100%; border: 1px solid var(--border); background: var(--card); color: var(--fg);
  border-radius: 16px; padding: 13px 16px; font-size: 0.92rem; font-family: inherit; outline: none;
  transition: border 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input::placeholder { color: var(--muted); }
.search-wrap { position: relative; }
.search-wrap .input { padding-left: 46px; }
.search-wrap::before { content: '🔍'; position: absolute; left: 16px; top: 50%; transform: translateY(-50%); opacity: 0.5; font-size: 0.95rem; }
.field-label { display: block; font-size: 0.82rem; font-weight: 700; color: var(--muted); margin: 14px 0 6px; }

/* ---------- stats tiles ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (min-width: 768px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-tile { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 1.4rem; text-align: center; }
.stat-tile b { display: block; font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-tile span { font-size: 0.85rem; color: var(--muted); }
.stat-tile.left { text-align: left; }
.stat-tile .ico { font-size: 1.2rem; }

/* ---------- leaderboard ---------- */
.podium { display: grid; gap: 1rem; }
@media (min-width: 640px) { .podium { grid-template-columns: repeat(3, 1fr); align-items: end; } }
.podium-card { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 1.5rem; }
@media (min-width: 640px) {
  .podium-card:nth-child(1) { order: 2; margin-top: -1.5rem; }
  .podium-card:nth-child(2) { order: 1; }
  .podium-card:nth-child(3) { order: 3; }
}
.podium-avatar {
  width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; box-shadow: 0 0 0 4px var(--accent-soft);
}
.podium-card:nth-child(2) .podium-avatar { box-shadow: 0 0 0 4px var(--secondary); }
.podium-card:nth-child(3) .podium-avatar { box-shadow: 0 0 0 4px rgba(180, 83, 9, 0.25); }
.podium-rank {
  margin-top: 10px; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 0.9rem;
}
.podium-score { margin-top: 6px; font-family: var(--mono); font-weight: 800; font-size: 1.15rem; color: var(--primary); }
.lb-table { overflow: hidden; }
.lb-head, .lb-row {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center;
  padding: 13px 20px;
}
@media (min-width: 640px) { .lb-head, .lb-row { grid-template-columns: 44px 1fr 120px 110px; } }
.lb-head { display: none; border-bottom: 1px solid var(--border); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
@media (min-width: 640px) { .lb-head { display: grid; } }
.lb-row { border-bottom: 1px solid var(--border); }
.lb-row:last-child { border-bottom: none; }
.lb-row.me { background: var(--primary-soft); }
.rank-badge {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--secondary); font-weight: 800; font-size: 0.85rem;
}
.lb-player { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.lb-player .flag { font-size: 1.1rem; }
.lb-player .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you-tag { border-radius: 5px; background: var(--primary); color: var(--primary-fg); font-size: 0.62rem; font-weight: 800; padding: 2px 6px; }
.lb-game { display: none; font-size: 0.85rem; color: var(--muted); }
@media (min-width: 640px) { .lb-game { display: block; } }
.lb-score { text-align: right; font-family: var(--mono); font-weight: 800; }
.lb-empty { padding: 34px 20px; text-align: center; color: var(--muted); font-size: 0.9rem; }

/* ---------- detail page ---------- */
.detail-hero { display: flex; flex-direction: column; gap: 1.5rem; }
@media (min-width: 768px) { .detail-hero { flex-direction: row; align-items: center; } }
.detail-cover {
  position: relative; border-radius: 24px; min-height: 210px; flex: 1;
  display: flex; align-items: center; justify-content: center; font-size: 4.5rem; overflow: hidden;
}
.detail-cover::before {
  content: ''; position: absolute; inset: 0; opacity: 0.3;
  background-image: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.9) 1px, transparent 1px);
  background-size: 22px 22px;
}
.detail-info { flex: 1.2; }
.prose { font-size: 0.95rem; }
.prose p { margin: 0 0 1em; color: var(--fg); }
.prose h2 { font-size: 1.15rem; font-weight: 800; margin: 1.6em 0 0.6em; }
.prose ul { margin: 0 0 1em 1.2em; }
.prose li { margin: 0.35em 0; color: var(--muted); }
.prose li strong, .prose p strong { color: var(--fg); }
.detail-grid { display: grid; gap: 1.5rem; margin-top: 2rem; }
@media (min-width: 900px) { .detail-grid { grid-template-columns: 1fr 340px; align-items: start; } }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--card); margin-top: 3.5rem; }
.ftr-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; padding: 3rem 0 2rem; }
@media (min-width: 768px) { .ftr-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.ftr-grid h3 { font-size: 0.85rem; font-weight: 800; margin-bottom: 10px; }
.ftr-grid ul { list-style: none; }
.ftr-grid li { margin: 7px 0; }
.ftr-grid a { font-size: 0.86rem; color: var(--muted); }
.ftr-grid a:hover { color: var(--primary); }
.ftr-desc { font-size: 0.86rem; color: var(--muted); margin-top: 10px; max-width: 260px; }
.ftr-bottom {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--border); padding: 1.3rem 0 2rem; font-size: 0.83rem; color: var(--muted);
}

/* ---------- misc ---------- */
.hero-wrap { display: grid; gap: 2rem; padding: 2.5rem 0 3rem; align-items: center; }
@media (min-width: 1024px) { .hero-wrap { grid-template-columns: 1.1fr 1fr; padding: 4rem 0; } }
.hero-art { position: relative; display: flex; align-items: center; justify-content: center; min-height: 260px; }
.hero-glow { position: absolute; inset: 8%; border-radius: 50%; background: var(--primary-soft); filter: blur(60px); }
.hero-tiles { position: relative; display: grid; grid-template-columns: repeat(2, minmax(120px, 150px)); gap: 14px; }
.hero-tile {
  position: relative; overflow: hidden;
  aspect-ratio: 1; border-radius: 22px; display: flex; align-items: center; justify-content: center;
  font-size: 2.6rem; box-shadow: var(--shadow); transform: rotate(-3deg); transition: transform 0.25s;
}
.hero-tile:nth-child(2) { transform: rotate(4deg) translateY(14px); }
.hero-tile:nth-child(3) { transform: rotate(2deg) translateY(-6px); }
.hero-tile:nth-child(4) { transform: rotate(-5deg) translateY(10px); }
.hero-tile:hover { transform: scale(1.06) rotate(0deg); }
.avatar-stack { display: flex; }
.avatar-stack span {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--bg); margin-left: -8px;
}
.avatar-stack span:first-child { margin-left: 0; }
.banner {
  display: flex; flex-direction: column; gap: 1rem; border-radius: 20px; background: var(--primary-soft); padding: 1.5rem;
}
@media (min-width: 640px) { .banner { flex-direction: row; align-items: center; justify-content: space-between; } }
.banner-ico {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); color: var(--primary-fg); display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.subscribe-box { text-align: center; padding: 2.6rem 1.5rem; }
.sub-row { display: flex; gap: 10px; max-width: 430px; margin: 1.2rem auto 0; }
.sub-row .input { flex: 1; }
.status-line { min-height: 22px; margin-top: 8px; font-size: 0.84rem; color: var(--muted); }
.skeleton { position: relative; overflow: hidden; background: var(--secondary); border-radius: 8px; color: transparent !important; }
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--fg) 6%, transparent), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.notice { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.87rem; color: var(--muted); padding: 1rem; }
.fade-in { animation: fadeUp 0.4s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }
.hide { display: none !important; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; } .mt-6 { margin-top: 3rem; }
.row-between { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; }
.center { text-align: center; }

/* profile */
.profile-hero { overflow: hidden; }
.profile-cover { height: 108px; background: linear-gradient(90deg, var(--primary), #6366f1); }
.profile-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; padding: 0 1.5rem 1.5rem; }
.profile-ava {
  width: 88px; height: 88px; margin-top: -44px; border-radius: 24px; border: 4px solid var(--card);
  background: linear-gradient(135deg, #d946ef, #7c3aed); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 800;
  box-shadow: var(--shadow);
}
.game-row {
  display: flex; align-items: center; gap: 14px; border: 1px solid var(--border); border-radius: 16px; padding: 12px 14px;
}
.game-row .mini-cover {
  width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0;
}
.auth-tabs { display: flex; gap: 6px; margin-bottom: 1.2rem; }
