:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1f2430;
  --muted: #667085;
  --accent: #5b6ee1;
  --accent-2: #7c5cff;
  --border: #e6e8f0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 20px rgba(16, 24, 40, 0.06);
  --shadow-hover: 0 8px 30px rgba(16, 24, 40, 0.12);
  --puzzle: #5b6ee1;
  --arcade: #f59e0b;
  --action: #ef4444;
  --classic: #10b981;
  --strategy: #8b5cf6;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand:hover { text-decoration: none; }
.brand .logo { color: var(--accent); }
.site-nav { display: flex; gap: 18px; font-size: 0.95rem; }
.site-nav a { color: var(--muted); font-weight: 500; }
.site-nav a:hover { color: var(--text); text-decoration: none; }

/* ---------- Layout ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.hero { padding: 40px 0 8px; }
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 10px;
  letter-spacing: -0.03em;
}
.hero p { color: var(--muted); font-size: 1.05rem; max-width: 640px; margin: 0 0 6px; }
.section { padding: 28px 0; }
.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}

/* ---------- Game grid / cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  color: var(--text);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); text-decoration: none; }
.card-thumb {
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.2rem;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), color-mix(in srgb, var(--accent-2) 12%, var(--surface)));
}
.card-body { padding: 12px 14px 14px; }
.card-title { font-weight: 700; font-size: 1.05rem; margin: 0 0 4px; }
.card-desc { color: var(--muted); font-size: 0.85rem; margin: 0 0 10px; }
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
}
.badge-puzzle { background: var(--puzzle); }
.badge-arcade { background: var(--arcade); }
.badge-action { background: var(--action); }
.badge-classic { background: var(--classic); }
.badge-strategy { background: var(--strategy); }

/* ---------- Game page ---------- */
.game-page { padding: 24px 0 48px; }
.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--muted); }
.game-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.game-head h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 0; letter-spacing: -0.02em; }
.game-desc { color: var(--muted); max-width: 720px; font-size: 1.02rem; margin: 12px 0 0; }

/* ---------- Ad slot placeholder ---------- */
.ad-slot {
  margin: 20px 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: #98a2b3;
  font-size: 0.82rem;
  padding: 16px;
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
}

/* ---------- Game area ---------- */
.game-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
canvas {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  background: #0f1420;
  touch-action: none;
}
.hud { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.hud .stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 16px;
  font-size: 0.9rem;
  font-weight: 600;
}
.hud .stat span { color: var(--accent); font-weight: 800; }
.controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 4px;
}
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  touch-action: manipulation;
}
.btn:hover { background: var(--bg); border-color: #c9cfe0; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-2); }
.game-msg { font-weight: 700; min-height: 1.4em; color: var(--accent); text-align: center; }
.hint { color: var(--muted); font-size: 0.85rem; text-align: center; }

/* ---------- How to play / related ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-top: 22px;
}
.panel h2 { margin: 0 0 10px; font-size: 1.2rem; }
.panel ul { margin: 0; padding-left: 20px; }
.panel li { margin: 5px 0; }
.related-row { display: flex; gap: 12px; flex-wrap: wrap; }
.related-row a {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}
.related-row a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------- Static pages ---------- */
.prose { max-width: 720px; }
.prose h2 { margin-top: 28px; }
.prose p, .prose li { color: var(--muted); }
.prose a { color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 40px;
}
.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.85rem;
}
.footer-inner nav { display: flex; gap: 16px; }
.footer-inner a { color: var(--muted); }

@media (max-width: 560px) {
  .header-inner { flex-wrap: wrap; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card-thumb { font-size: 2.4rem; }
  .game-area { padding: 12px; }
}

/* ---------- Language toggle ---------- */
.lang-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.lang-toggle:hover { background: var(--bg); border-color: var(--accent); }

/* ---------- Win/lose animation effects ---------- */
.game-msg.msg-pop { animation: msgPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes msgPop {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); }
}
.game-msg.msg-shake { animation: msgShake 0.5s; }
@keyframes msgShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.fx-particle {
  position: fixed;
  z-index: 99999;
  top: -30px;
  pointer-events: none;
  animation-name: fxFall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}
@keyframes fxFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(360deg); opacity: 0; }
}

/* ---------- Themes ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1420;
  --surface: #1a2233;
  --text: #e6e9f2;
  --muted: #9aa4b8;
  --accent: #7c8cf8;
  --accent-2: #9d8cff;
  --border: #2a3448;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.5);
}
:root[data-theme="neon"] {
  color-scheme: dark;
  --bg: #0a0f1e;
  --surface: #121a2e;
  --text: #e8fbff;
  --muted: #8fa8c8;
  --accent: #00e5ff;
  --accent-2: #ff4dd8;
  --border: #1f2f4d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 0 18px rgba(0, 229, 255, 0.15);
  --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.5);
}
:root[data-theme="forest"] {
  color-scheme: light;
  --bg: #f2f7f0;
  --surface: #ffffff;
  --text: #1e2a1e;
  --muted: #5f6f5a;
  --accent: #2f9e44;
  --accent-2: #66bb6a;
  --border: #dde8da;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 6px 20px rgba(16, 24, 40, 0.07);
  --shadow-hover: 0 8px 30px rgba(16, 24, 40, 0.14);
}

/* ---------- Beautify ---------- */
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.card:hover .card-title { color: var(--accent); }
.card-title { transition: color 0.15s ease; }
.hero h1 { position: relative; padding-bottom: 10px; }
.hero h1::after {
  content: '';
  position: absolute;
  left: 2px;
  bottom: 0;
  width: 60px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.btn { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }

/* ---------- Acrylic glass (毛玻璃) ---------- */
body {
  background:
    radial-gradient(1200px 620px at 8% -12%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 62%),
    radial-gradient(1100px 540px at 102% -4%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 58%),
    var(--bg);
}
.site-header {
  background: color-mix(in srgb, var(--surface) 66%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
}
.card, .panel, .game-area, .hud .stat, .related-row a, .site-footer {
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
}
.card, .panel, .game-area, .hud .stat {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), var(--shadow);
}
.card:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), var(--shadow-hover); }

/* ---------- Responsive / UX polish ---------- */
html { -webkit-tap-highlight-color: transparent; }
body { overflow-x: hidden; }
img, canvas { display: block; }
@media (max-width: 640px) {
  .header-inner { gap: 10px; padding: 10px 14px; }
  .site-nav { gap: 10px; font-size: 0.85rem; flex-wrap: wrap; }
  .brand { font-size: 1.1rem; }
  .btn, .lang-toggle { min-height: 42px; }
  .lang-toggle { padding: 6px 12px; }
  .game-area { padding: 12px; }
  .hud .stat { padding: 6px 12px; font-size: 0.85rem; }
  .panel { padding: 16px 16px; }
  .section { padding: 20px 0; }
  .hero { padding: 28px 0 4px; }
  .game-head h1 { font-size: 1.5rem; }
  .related-row a { padding: 10px 13px; }
}
@media (min-width: 641px) and (max-width: 1024px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}
@media (min-width: 1280px) {
  .container, .header-inner, .footer-inner { max-width: 1200px; }
}

/* ---------- Footer (standard 3-column) ---------- */
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 44px 20px 28px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  align-items: start;
  justify-content: initial;
  flex-wrap: initial;
}
.footer-brand-col { padding-right: 12px; }
.footer-brand {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
}
.footer-brand:hover { text-decoration: none; color: var(--text); }
.footer-tagline { color: var(--muted); font-size: 0.88rem; margin: 10px 0 0; max-width: 320px; }
.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 4px;
}
.footer-col a { color: var(--muted); font-size: 0.9rem; text-decoration: none; width: fit-content; }
.footer-col a:hover { color: var(--accent); text-decoration: none; }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---------- Beautify v2 ---------- */
.site-nav a { position: relative; }
.site-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.2s ease;
}
.site-nav a:hover::after { width: 100%; }
.section-title { display: flex; align-items: center; gap: 10px; }
.section-title::before {
  content: '';
  width: 4px;
  height: 22px;
  border-radius: 2px;
  background: linear-gradient(var(--accent), var(--accent-2));
  flex-shrink: 0;
}
.card-thumb { transition: transform 0.2s ease; }
.card:hover .card-thumb { transform: scale(1.06); }
.card-thumb { overflow: hidden; }

@media (max-width: 640px) {
  .footer-inner { grid-template-columns: 1fr; gap: 24px; padding: 32px 20px 20px; }
}
