/* ================================================================
   宁波小游戏乐园 — 游戏导航页
   延续地铁拼音游戏的绘本背景、糖果色和积木卡片视觉。
   ================================================================ */

:root {
  --color-bg: #E8F4FD;
  --color-bg-gradient:
    radial-gradient(1200px 600px at 20% -10%, #FFF7C2 0%, transparent 60%),
    radial-gradient(900px 500px at 90% 0%, #FFD8EC 0%, transparent 55%),
    linear-gradient(180deg, #BEE7FF 0%, #DAF3FF 45%, #CFF2D8 78%, #B7ECC4 100%);
  --color-text: #2C3E50;
  --color-shadow: rgba(46, 62, 96, 0.18);
  --candy-yellow: #FFD93D;
  --candy-pink: #FF7EB9;
  --candy-mint: #6BE7C1;
  --candy-sky: #7FD8FF;
  --candy-coral: #FF8C6B;
  --font-main: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", "Comic Sans MS", Arial, sans-serif;
  --radius-lg: 32px;
  --radius-pill: 999px;
  --transition-bounce: 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  background: var(--color-bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
  color: var(--color-text);
  background: var(--color-bg-gradient);
  background-attachment: fixed;
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.clouds {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.cloud {
  position: absolute;
  opacity: 0.72;
  filter: drop-shadow(0 4px 8px rgba(90, 130, 170, 0.15));
}

.cloud-1 {
  width: 240px;
  top: 4%;
  animation: float-cloud 40s linear infinite;
}

.cloud-2 {
  width: 200px;
  top: 33%;
  animation: float-cloud 55s linear -15s infinite;
}

.cloud-3 {
  width: 220px;
  top: 70%;
  animation: float-cloud 50s linear -30s infinite;
}

@keyframes float-cloud {
  from { transform: translateX(-260px); }
  to { transform: translateX(calc(100vw + 260px)); }
}

.lobby {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding:
    max(36px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(56px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
}

.lobby-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 16px auto clamp(30px, 5vw, 52px);
  text-align: center;
}

.lobby-kicker {
  padding: 7px 20px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 4px 14px rgba(90, 130, 170, 0.16);
  color: #4A6572;
  font-size: clamp(15px, 2vw, 20px);
  font-weight: 800;
  letter-spacing: 0.15em;
}

.lobby-hero h1 {
  background: linear-gradient(135deg,
    #FF6B6B 0%, #FFA94D 22%, #FFD93D 44%,
    #6BE7C1 65%, #4DA6FF 84%, #C084FC 100%);
  background-clip: text;
  filter: drop-shadow(0 3px 0 rgba(255, 255, 255, 0.95))
          drop-shadow(0 7px 15px rgba(0, 0, 0, 0.12));
  color: transparent;
  font-size: clamp(44px, 8vw, 76px);
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1.18;
  animation: title-wiggle 4s ease-in-out infinite;
}

.lobby-hero h1::before,
.lobby-hero h1::after {
  display: inline-block;
  color: initial;
  font-size: 0.45em;
  vertical-align: middle;
  animation: star-spin 3.5s linear infinite;
  content: "⭐";
}

.lobby-hero h1::after {
  animation-direction: reverse;
}

@keyframes title-wiggle {
  0%, 100% { transform: rotate(-1deg); }
  50% { transform: rotate(1deg); }
}

@keyframes star-spin {
  to { transform: rotate(360deg); }
}

.lobby-hero p {
  padding: 9px 24px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 14px rgba(90, 130, 170, 0.18);
  color: #3B5566;
  font-size: clamp(18px, 2.5vw, 24px);
  font-weight: 700;
}

.games h2 {
  margin-bottom: 22px;
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 900;
  text-align: center;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
  gap: clamp(24px, 4vw, 38px);
  align-items: stretch;
  max-width: 1040px;
  margin: 0 auto;
  list-style: none;
}

.game-grid:has(> li:only-child) {
  max-width: 520px;
}

.game-card {
  position: relative;
  display: flex;
  min-height: 440px;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px;
  overflow: hidden;
  border: 4px solid rgba(255, 255, 255, 0.52);
  border-radius: var(--radius-lg);
  color: #FFFFFF;
  text-align: center;
  text-decoration: none;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.18);
  box-shadow:
    0 12px 0 rgba(0, 93, 144, 0.24),
    0 20px 36px var(--color-shadow),
    inset 0 4px 0 rgba(255, 255, 255, 0.4),
    inset 0 -8px 0 rgba(0, 0, 0, 0.08);
  transition: transform var(--transition-bounce), box-shadow var(--transition-bounce);
}

.game-card::before {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 15%, rgba(255,255,255,0.4) 0 4px, transparent 5px),
    radial-gradient(circle at 86% 28%, rgba(255,255,255,0.3) 0 6px, transparent 7px),
    linear-gradient(180deg, rgba(255,255,255,0.28), transparent 45%);
  pointer-events: none;
  content: "";
}

.subway-card {
  background: linear-gradient(145deg, #5CC8FF 0%, #168DD2 55%, #0876B9 100%);
}

.game-card:focus-visible {
  outline: 5px solid var(--candy-yellow);
  outline-offset: 6px;
}

.game-number {
  position: relative;
  align-self: flex-start;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.95);
  color: #0876B9;
  font-size: 16px;
  font-weight: 900;
  text-shadow: none;
}

.train-art {
  position: relative;
  display: block;
  width: min(100%, 360px);
  margin: -4px auto -10px;
  filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.18));
  animation: train-bob 2.4s ease-in-out infinite;
}

.train-art svg {
  display: block;
  width: 100%;
  height: auto;
}

.train-body { fill: #FFFFFF; }
.train-window { fill: #BCEAFF; stroke: #075E98; stroke-width: 7; }
.train-divider { stroke: #075E98; stroke-width: 6; }
.train-light { fill: var(--candy-yellow); stroke: #F2A900; stroke-width: 4; }
.train-wheel { fill: #34495E; stroke: #FFFFFF; stroke-width: 7; }
.train-rail { fill: none; stroke: rgba(255, 255, 255, 0.82); stroke-linecap: round; stroke-width: 9; }

@keyframes train-bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-9px) rotate(1deg); }
}

.game-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.game-eyebrow {
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 800;
  letter-spacing: 0.2em;
}

.game-content strong {
  font-size: clamp(34px, 5vw, 48px);
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.15;
}

.game-description {
  max-width: 320px;
  font-size: clamp(16px, 2vw, 19px);
  font-weight: 700;
  line-height: 1.6;
}

.game-start {
  position: relative;
  display: inline-flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: auto;
  padding: 12px 28px;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, #FFE66D, var(--candy-yellow));
  color: #754C00;
  font-size: 20px;
  font-weight: 900;
  text-shadow: none;
  box-shadow: 0 6px 0 #E8A814, 0 10px 18px rgba(0, 0, 0, 0.16);
}

@media (hover: hover) {
  .game-card:hover {
    transform: translateY(-8px) rotate(-0.6deg) scale(1.015);
    box-shadow:
      0 16px 0 rgba(0, 93, 144, 0.24),
      0 28px 44px rgba(46, 62, 96, 0.24),
      inset 0 4px 0 rgba(255, 255, 255, 0.4),
      inset 0 -8px 0 rgba(0, 0, 0, 0.08);
  }
}

.game-card:active {
  transform: translateY(7px);
  box-shadow:
    0 5px 0 rgba(0, 93, 144, 0.24),
    0 10px 20px var(--color-shadow),
    inset 0 4px 0 rgba(255, 255, 255, 0.4),
    inset 0 -5px 0 rgba(0, 0, 0, 0.08);
}

@media (max-width: 640px) {
  .lobby {
    padding-top: max(24px, env(safe-area-inset-top));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-left: max(16px, env(safe-area-inset-left));
  }

  .lobby-hero {
    margin-top: 8px;
  }

  .lobby-hero h1 {
    font-size: clamp(38px, 12vw, 56px);
  }

  .lobby-hero h1::before,
  .lobby-hero h1::after {
    display: none;
  }

  .game-card {
    min-height: 410px;
    padding: 24px 20px;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  .lobby-hero {
    margin: 0 auto 22px;
  }

  .lobby-hero h1 {
    font-size: 42px;
  }

  .lobby-hero p {
    padding-block: 6px;
    font-size: 17px;
  }

  .game-card {
    min-height: 350px;
  }

  .train-art {
    width: 260px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
