:root {
  --primary: #0040c0;
  --primary-light: #5b8def;
  --primary-bg: #e8efff;
  --play: #8b3dff;
  --play-bg: #f3ebff;
  --accent: #ff6b35;
  --accent-bg: #fff1eb;
  --ink: #0a0e1a;
  --ink-2: #1f2a3d;
  --ink-3: #4a5468;
  --ink-4: #7c8599;
  --line: #e4e8f0;
  --line-2: #f0f3f8;
  --bg: #ffffff;
  --bg-soft: #fafbfd;
  --bg-mid: #f4f6fa;
  --green: #00b377;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, .04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .08);
  --shadow-lg: 0 20px 60px rgba(15, 23, 42, .12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

/* MOTION */
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(22px, -20px) scale(1.14); }
}
@keyframes drift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-18px, 18px) scale(1.1); }
}
@keyframes ctaGlow {
  0%, 100% { box-shadow: 0 10px 30px rgba(139,61,255,.28); }
  50% { box-shadow: 0 10px 40px rgba(139,61,255,.5); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", sans-serif;
  color: var(--ink);
  background: var(--bg-soft);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }

/* NAV */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(140%) blur(20px);
  -webkit-backdrop-filter: saturate(140%) blur(20px);
  border-bottom: 1px solid rgba(228, 232, 240, 0.7);
}
.nav-inner {
  max-width: 1180px; margin: 0 auto;
  padding: 16px 32px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--play) 100%);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 14px;
  box-shadow: 0 4px 12px rgba(139, 61, 255, 0.3);
}
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; color: var(--ink); }
.brand-name .zh { color: var(--ink-4); font-weight: 600; font-size: 13px; margin-left: 6px; }
.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { color: var(--ink-3); font-size: 13.5px; font-weight: 500; }
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  background: var(--ink); color: #fff !important;
  padding: 8px 16px; border-radius: 8px;
  font-weight: 600; font-size: 13px;
}

/* HERO / PAGE HEAD */
.pagehead {
  padding: 56px 32px 40px;
  text-align: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(139, 61, 255, .14), transparent 60%),
    var(--bg-soft);
}
.pagehead .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--play-bg); color: var(--play);
  padding: 6px 14px; border-radius: 100px;
  font-size: 12px; font-weight: 700; margin-bottom: 16px;
}
.pagehead h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 12px; }
.pagehead p { color: var(--ink-3); font-size: 15px; max-width: 560px; margin: 0 auto; }
.breadcrumb { font-size: 13px; color: var(--ink-4); margin-bottom: 18px; }
.breadcrumb a { color: var(--ink-3); font-weight: 600; }

/* CATEGORY GRID (hub) */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 32px 80px; }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 12px; }
@media (max-width: 920px) { .cat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .cat-grid { grid-template-columns: 1fr; } }
.cat-card {
  display: block; background: #fff; border: 1px solid var(--line); border-radius: 18px;
  padding: 28px; transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  position: relative; overflow: hidden;
  opacity: 0; animation: fadeSlideUp .55s ease both;
}
.cat-grid a:nth-child(1) { animation-delay: .05s; }
.cat-grid a:nth-child(2) { animation-delay: .12s; }
.cat-grid a:nth-child(3) { animation-delay: .19s; }
.cat-grid a:nth-child(4) { animation-delay: .26s; }
.cat-grid a:nth-child(5) { animation-delay: .33s; }
.cat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-5px); border-color: var(--line-2); }
.cat-card:hover .cat-icon { transform: scale(1.12) rotate(-4deg); }
.cat-icon {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  font-size: 26px; margin-bottom: 18px; transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.cat-card h2 { font-size: 18px; font-weight: 800; color: var(--ink); margin-bottom: 8px; letter-spacing: -0.01em; }
.cat-card p { font-size: 13.5px; color: var(--ink-3); line-height: 1.65; margin-bottom: 16px; }
.cat-count { font-size: 12px; font-weight: 700; color: var(--ink-4); }
.cat-count b { color: var(--play); }
.tone-1 .cat-icon { background: var(--play-bg); color: var(--play); }
.tone-2 .cat-icon { background: var(--primary-bg); color: var(--primary); }
.tone-3 .cat-icon { background: var(--accent-bg); color: var(--accent); }

/* GAME GRID (category page) */
.game-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 1000px) { .game-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px) { .game-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .game-grid { grid-template-columns: 1fr; } }
.game-tile {
  display: block; background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 22px; transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  text-align: center; opacity: 0; animation: fadeSlideUp .5s ease both;
}
.game-grid a:nth-child(1) { animation-delay: .04s; }
.game-grid a:nth-child(2) { animation-delay: .09s; }
.game-grid a:nth-child(3) { animation-delay: .14s; }
.game-grid a:nth-child(4) { animation-delay: .19s; }
.game-grid a:nth-child(5) { animation-delay: .24s; }
.game-grid a:nth-child(6) { animation-delay: .29s; }
.game-grid a:nth-child(7) { animation-delay: .34s; }
.game-grid a:nth-child(8) { animation-delay: .39s; }
.game-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-4px); border-color: var(--line-2); }
.game-tile:hover .g-icon { transform: scale(1.15) rotate(6deg); background: var(--play-bg); }
.game-tile:hover .play-badge { background: var(--play); color: #fff; }
.game-tile .g-icon {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  font-size: 26px; margin: 0 auto 14px; background: var(--bg-mid);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), background .25s ease;
}
.game-tile h3 { font-size: 14.5px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.game-tile p { font-size: 12px; color: var(--ink-4); line-height: 1.55; }
.play-badge {
  display: inline-block; margin-top: 12px; font-size: 11.5px; font-weight: 700;
  color: var(--play); background: var(--play-bg); padding: 4px 12px; border-radius: 100px;
  transition: all .2s ease;
}

footer { background: var(--ink); color: var(--ink-4); padding: 32px; text-align: center; font-size: 12px; margin-top: 40px; }
footer a { color: var(--ink-4); }

/* GAME DETAIL PAGE */
.detail-hero {
  padding: 48px 32px 36px; text-align: center; position: relative; overflow: hidden;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(139, 61, 255, .14), transparent 60%), var(--bg-soft);
}
.detail-hero::before, .detail-hero::after {
  content: ''; position: absolute; border-radius: 50%; filter: blur(46px); pointer-events: none; z-index: 0;
}
.detail-hero::before { width: 200px; height: 200px; background: rgba(139,61,255,.22); top: -60px; left: 6%; animation: drift 13s ease-in-out infinite; }
.detail-hero::after { width: 240px; height: 240px; background: rgba(0,64,192,.16); top: 10px; right: 4%; animation: drift2 16s ease-in-out infinite; }
.detail-hero > * { position: relative; z-index: 1; }
.detail-hero .breadcrumb { opacity: 0; animation: fadeSlideUp .5s ease .02s both; }
.detail-hero .tagline { opacity: 0; animation: fadeSlideUp .5s ease .22s both; }
.detail-hero .detail-cta { opacity: 0; animation: fadeSlideUp .5s ease .3s both; }
.detail-icon {
  width: 76px; height: 76px; border-radius: 20px; margin: 0 auto 18px;
  display: grid; place-items: center; font-size: 36px;
  background: linear-gradient(135deg, var(--play-bg), var(--primary-bg));
  box-shadow: var(--shadow-md); cursor: default;
  opacity: 0; animation: fadeSlideUp .5s ease .08s both, floatY 3.2s ease-in-out .6s infinite;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.detail-icon:hover { transform: scale(1.14) rotate(-6deg); }
.detail-hero h1 {
  font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px;
  opacity: 0; animation: fadeSlideUp .5s ease .15s both;
}
.detail-hero .tagline { color: var(--ink-3); font-size: 15px; max-width: 560px; margin: 0 auto 24px; }
.detail-wrap { max-width: 840px; margin: 0 auto; padding: 0 32px 70px; }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 32px; }
@media (max-width: 760px) { .info-grid { grid-template-columns: 1fr; } }
.info-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 24px;
  opacity: 0; animation: fadeSlideUp .5s ease both;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.info-grid .info-card:nth-child(1) { animation-delay: .38s; }
.info-grid .info-card:nth-child(2) { animation-delay: .46s; }
.info-grid .info-card:nth-child(3) { animation-delay: .54s; }
.info-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }
.info-card:hover .i-icon { transform: scale(1.15) rotate(-8deg); }
.info-card .i-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.info-card .i-icon {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  font-size: 17px; background: var(--play-bg); color: var(--play); flex-shrink: 0;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.info-card.tone-b .i-icon { background: var(--primary-bg); color: var(--primary); }
.info-card.tone-c .i-icon { background: var(--accent-bg); color: var(--accent); }
.info-card h2 { font-size: 14.5px; font-weight: 800; color: var(--ink); }
.info-card p { font-size: 13.3px; color: var(--ink-3); line-height: 1.75; }
.detail-cta { text-align: center; }
.detail-cta .btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--play); color: #fff; padding: 15px 34px; border-radius: 10px;
  font-weight: 700; font-size: 15.5px; box-shadow: 0 10px 30px rgba(139,61,255,.28);
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s ease, background .18s ease;
  animation: ctaGlow 2.6s ease-in-out infinite;
}
.detail-cta .btn:hover { transform: translateY(-2px) scale(1.045); background: #7527e6; animation-play-state: paused; }
.detail-cta .btn:active { transform: translateY(0) scale(.98); }
.detail-wrap .info-grid + .detail-cta .btn { animation-delay: .6s; }
.detail-back {
  display: block; text-align: center; margin-top: 22px; font-size: 13px; color: var(--ink-4);
  opacity: 0; animation: fadeSlideUp .5s ease .62s both;
}
.detail-back a { color: var(--ink-3); font-weight: 600; }
