/* ================================================================
   宁波地铁 · 拼音之旅 — glm5.2 全局样式
   受众:3岁儿童 —— 大按钮、糖果色、圆胖形、强反馈、少文字。
   ================================================================ */

/* ---------- CSS 变量 ---------- */
: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-text-light: #7F8C8D;
  --color-white: #FFFFFF;
  --color-shadow: rgba(46, 62, 96, 0.18);

  /* 线路品牌色(保留) */
  --line1-color: #009FE3;
  --line2-color: #E3002B;
  --line3-color: #FFC72C;
  --line4-color: #6B8E23;
  --line5-color: #6B3FA0;

  /* 三岁儿童专用:糖果色高亮 */
  --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;
  --font-pinyin: "Helvetica Neue", "PingFang SC", Arial, sans-serif;

  /* 圆角:统一"圆滚滚",儿童视觉喜好 */
  --radius-sm: 12px;
  --radius-md: 22px;
  --radius-lg: 32px;
  --radius-xl: 44px;
  --radius-pill: 999px;

  --transition-fast:   0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-normal: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-slow:   0.6s ease;

  /* 触达尺寸:3岁儿童指头触点 ≥ 64px */
  --touch-min: 64px;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  /* iOS 地址栏动态收放:优先 dvh,退化到 -webkit-fill-available,最兜底 100% */
  height: 100%;
  height: -webkit-fill-available;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;            /* 阻止 iOS 橡皮筋刷新 */
  font-family: var(--font-main);
  background: var(--color-bg-gradient);
  color: var(--color-text);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -webkit-touch-callout: none;          /* 长按不弹出图片/文字菜单 */
  touch-action: manipulation;           /* 双击不放大;单指手势由 JS 接管 */
  user-select: none;
  -webkit-user-select: none;
}

/* .screen 自身处理 safe-area 内边距,避免叠加,这里不再给 body 补 padding */

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  outline: none;
}

button:focus-visible {
  outline: 4px solid var(--candy-yellow);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

/* ---------- 云朵背景 ---------- */
.clouds {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.cloud {
  position: absolute;
  opacity: 0.75;                   /* 更明显,像绘本插画 */
  filter: drop-shadow(0 4px 8px rgba(90, 130, 170, 0.15));
}

.cloud-1 { width: 240px; height: 120px; top: 6%;  animation: float-cloud 40s linear infinite; }
.cloud-2 { width: 200px; height: 100px; top: 22%; animation: float-cloud 55s linear infinite; animation-delay: -15s; }
.cloud-3 { width: 220px; height: 110px; top: 55%; animation: float-cloud 50s linear infinite; animation-delay: -30s; }

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

/* ---------- 画面切换 ---------- */
.screen {
  position: fixed;
  inset: 0;
  /* 让开设备刘海/底部横条 */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
}

/* ================================================================
   开场画面:线路选择 —— 儿童首页
   ================================================================ */

#screen-line-select {
  gap: 18px;
  padding: 28px 20px;
  justify-content: center;
}

.lobby-link {
  position: absolute;
  top: max(18px, calc(env(safe-area-inset-top) + 10px));
  left: max(18px, calc(env(safe-area-inset-left) + 10px));
  z-index: 3;
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border: 2px solid rgba(90, 130, 170, 0.12);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #FFFFFF, #EDF6FF);
  box-shadow:
    0 4px 0 rgba(90, 130, 170, 0.22),
    0 6px 14px rgba(90, 130, 170, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  color: var(--color-text);
  font-size: clamp(14px, 1.8vw, 17px);
  font-weight: 800;
  text-decoration: none;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.lobby-link:focus-visible {
  outline: 4px solid var(--candy-yellow);
  outline-offset: 3px;
}

@media (hover: hover) {
  .lobby-link:hover {
    transform: translateY(-2px);
    background: linear-gradient(180deg, #FFFFFF, #E0F0FF);
  }
}

.lobby-link:active {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 rgba(90, 130, 170, 0.22),
    0 2px 6px rgba(90, 130, 170, 0.14);
}

.title {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

/* "宁波地铁"小标签 */
.title-sub {
  display: inline-block;
  align-self: center;
  padding: 4px 18px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-pill);
  font-size: clamp(15px, 2.4vw, 22px);
  font-weight: 700;
  color: #4A6572;
  letter-spacing: 0.15em;
  box-shadow: 0 3px 10px rgba(90, 130, 170, 0.15);
}

/* "拼音之旅"主标题:糖果彩虹字 + 描边 */
.title-main {
  font-size: clamp(42px, 8vw, 72px);
  font-weight: 900;
  background: linear-gradient(135deg,
    #FF6B6B 0%, #FFA94D 25%, #FFD93D 50%,
    #6BE7C1 72%, #4DA6FF 90%, #C084FC 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.08em;
  filter: drop-shadow(0 3px 0 rgba(255, 255, 255, 0.9))
          drop-shadow(0 6px 14px rgba(0, 0, 0, 0.12));
  animation: title-wiggle 4s ease-in-out infinite;
}

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

/* 主标题左右各贴一个装饰星星 */
.title-main::before,
.title-main::after {
  content: '⭐';
  -webkit-text-fill-color: initial;
  font-size: 0.5em;
  vertical-align: middle;
  margin: 0 0.15em;
  animation: star-spin 3s linear infinite;
  display: inline-block;
}
.title-main::after { animation-direction: reverse; }
@keyframes star-spin {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}

.hero-train {
  width: clamp(200px, 34vw, 320px);
  height: auto;
  margin: 6px 0;
  animation: train-bob 2.4s ease-in-out infinite;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.18));
}

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

.hint {
  font-size: clamp(18px, 3vw, 26px);
  color: #3B5566;
  font-weight: 700;
  padding: 8px 22px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 14px rgba(90, 130, 170, 0.18);
  animation: hint-bob 2s ease-in-out infinite;
}
.hint::before { content: '👉 '; }
.hint::after  { content: ' 🚇'; }

@keyframes hint-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

/* 线路按钮网格 —— 严格 6 列 × 2 行,方形等大 */
.line-buttons {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 1fr;
  gap: clamp(10px, 1.4vw, 18px);
  justify-content: center;
  margin-top: 8px;
  width: min(96vw, 1080px);
}

/* ---- 大糖果卡片式线路按钮(所有卡片同尺寸) ---- */
.line-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  aspect-ratio: 1 / 1;              /* 强制正方形 */
  min-width: 0;
  padding: clamp(10px, 1.6vw, 20px) clamp(8px, 1.4vw, 16px);
  border-radius: var(--radius-lg);
  color: var(--color-white);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  letter-spacing: 0.06em;
  background: var(--line-color, #4A90D9);
  box-shadow:
    0 10px 0 rgba(0, 0, 0, 0.12),          /* 底部厚阴影,像立体积木 */
    0 16px 30px var(--color-shadow),
    inset 0 3px 0 rgba(255, 255, 255, 0.45),
    inset 0 -6px 0 rgba(0, 0, 0, 0.08);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
}

/* 顶部光泽 */
.line-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, transparent 45%);
  pointer-events: none;
  border-radius: inherit;
}

/* 圆形大数字号牌 —— 由 JS 注入 data-code */
.line-btn-badge {
  width: clamp(52px, 6.5vw, 68px);
  height: clamp(52px, 6.5vw, 68px);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--line-color, #4A90D9);
  font-family: var(--font-pinyin);
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.15),
    inset 0 2px 0 rgba(255, 255, 255, 1);
  line-height: 1;
  text-shadow: none;
  margin-bottom: 2px;
}

.line-btn-name {
  font-size: clamp(20px, 2.8vw, 26px);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.line-btn-info {
  font-size: clamp(11px, 1.35vw, 13px);
  font-weight: 600;
  opacity: 0.9;
  letter-spacing: 0.02em;
  line-height: 1.3;
  text-align: center;
  padding: 3px 10px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-pill);
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* hover 效果只给真正有指针悬停能力的设备(避免触屏点一下卡住高亮) */
@media (hover: hover) {
  .line-btn:hover {
    transform: translateY(-6px) scale(1.05) rotate(-1deg);
    box-shadow:
      0 14px 0 rgba(0, 0, 0, 0.12),
      0 22px 40px var(--color-shadow),
      inset 0 3px 0 rgba(255, 255, 255, 0.45),
      inset 0 -6px 0 rgba(0, 0, 0, 0.08);
  }
}

.line-btn:active {
  transform: translateY(4px) scale(0.96);
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.12),
    0 6px 12px var(--color-shadow),
    inset 0 3px 0 rgba(255, 255, 255, 0.35),
    inset 0 -3px 0 rgba(0, 0, 0, 0.08);
}

/* 3号线是黄色,文字改用深色以保证可读性 */
.line-btn[data-line="line3"] {
  color: var(--color-text);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.6);
}
.line-btn[data-line="line3"] .line-btn-info {
  background: rgba(0, 0, 0, 0.1);
  color: var(--color-text);
}

/* 规划中线路:灰色,禁用 */
.line-btn-planned {
  background: linear-gradient(160deg, #C9CFD6, #A4ACB4) !important;
  color: rgba(255, 255, 255, 0.9);
  cursor: not-allowed !important;
  opacity: 0.75;
  filter: grayscale(0.5);
}
.line-btn-planned .line-btn-badge {
  color: #6B7480;
  background: rgba(255, 255, 255, 0.85);
}
@media (hover: hover) {
  .line-btn-planned:hover {
    transform: none;
  }
}
.line-btn-planned::before {
  content: '💤 规划中';
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.05em;
  z-index: 2;
}

/* ================================================================
   主游戏画面
   ================================================================ */

#screen-game {
  flex-direction: column;
  justify-content: flex-start;
}

/* 顶部 Header —— 儿童大按钮 */
#game-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(8px, 1.4vw, 14px) clamp(12px, 1.8vw, 22px);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10;
  border-bottom: 3px solid rgba(127, 216, 255, 0.4);
  box-shadow: 0 4px 14px rgba(90, 130, 170, 0.12);
  gap: 10px;
}

.header-btn {
  min-width: 52px;
  min-height: 52px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: clamp(14px, 1.8vw, 17px);
  font-weight: 800;
  background: linear-gradient(180deg, #FFFFFF, #EDF6FF);
  color: #2C3E50;
  box-shadow:
    0 4px 0 rgba(90, 130, 170, 0.22),
    0 6px 14px rgba(90, 130, 170, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  white-space: nowrap;
  border: 2px solid rgba(90, 130, 170, 0.12);
}

@media (hover: hover) {
  .header-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(180deg, #FFFFFF, #E0F0FF);
  }
}

.header-btn:active {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 rgba(90, 130, 170, 0.22),
    0 2px 6px rgba(90, 130, 170, 0.14);
}

/* 播放/暂停 融合按钮 —— 默认(暂停中)橙色糖果,提示"点我播放";播放中变绿色糖果 */
.btn-playpause {
  background: linear-gradient(180deg, #FFD97A, #FF9F1C);
  color: #4A2E00;
  border-color: rgba(255, 159, 28, 0.55);
  box-shadow:
    0 4px 0 rgba(180, 100, 0, 0.5),
    0 6px 14px rgba(255, 159, 28, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  min-width: 80px;
}
.btn-playpause:hover {
  background: linear-gradient(180deg, #FFE099, #FFB042);
}

.btn-playpause.is-playing {
  background: linear-gradient(180deg, #7DE884, #2ecc71);
  color: #fff;
  border-color: rgba(46, 204, 113, 0.5);
  box-shadow:
    0 4px 0 rgba(39, 174, 96, 0.55),
    0 6px 14px rgba(46, 204, 113, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn-playpause.is-playing:hover {
  background: linear-gradient(180deg, #8CF090, #27ae60);
}

.header-actions {
  display: flex;
  gap: 8px;
}

/* 进度条 —— 彩虹糖果 */
.progress-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 320px;
  min-width: 110px;
}

.progress-stars {
  font-size: clamp(14px, 1.8vw, 18px);
  font-weight: 900;
  color: #E67E22;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  animation: star-tickle 3s ease-in-out infinite;
}

@keyframes star-tickle {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

.progress-bar {
  flex: 1;
  height: 14px;
  background: rgba(90, 130, 170, 0.14);
  border-radius: var(--radius-pill);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.12);
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-pill);
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: linear-gradient(90deg,
    #FF6B6B 0%, #FFA94D 25%, #FFD93D 50%,
    #6BE7C1 75%, #4DA6FF 100%);
  background-size: 200% 100%;
  animation: progress-shimmer 3s linear infinite;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45);
}

@keyframes progress-shimmer {
  from { background-position: 0% 50%; }
  to   { background-position: 200% 50%; }
}

/* 地图容器 —— Canvas 无限画布 */
#map-container {
  flex: 1;
  width: 100%;
  overflow: hidden;
  padding: 0;
  position: relative;
  touch-action: none;
}

#subway-map {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  background:
    radial-gradient(600px 300px at 20% 20%, rgba(255, 236, 179, 0.5), transparent 60%),
    radial-gradient(500px 300px at 85% 85%, rgba(200, 240, 210, 0.5), transparent 60%),
    linear-gradient(135deg, #F4FBFF 0%, #EEF7F0 100%);
}
#subway-map:active {
  cursor: grabbing;
}

/* 悬浮控制按钮组 —— 大糖果 */
.map-controls {
  position: absolute;
  right: 18px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 5;
}
.map-ctrl-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(180deg, #FFFFFF, #F0F7FF);
  box-shadow:
    0 5px 0 rgba(90, 130, 170, 0.28),
    0 10px 22px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
  border: 2px solid rgba(127, 216, 255, 0.35);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
@media (hover: hover) {
  .map-ctrl-btn:hover {
    transform: translateY(-3px);
  }
}
.map-ctrl-btn:active {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 rgba(90, 130, 170, 0.28),
    0 3px 10px rgba(0, 0, 0, 0.14);
}

.map-hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(44, 62, 80, 0.72);
  color: #fff;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  z-index: 4;
  animation: mapHintFade 5s forwards;
}
@keyframes mapHintFade {
  0%, 70% { opacity: 0.9; }
  100% { opacity: 0; }
}

/* ---------- 线路图中的站点样式 ---------- */
.station-group {
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.station-group:hover {
  transform: scale(1.18);
}

.station-dot {
  transition: r var(--transition-fast), filter var(--transition-fast);
}

.station-group:hover .station-dot {
  filter: drop-shadow(0 0 10px currentColor);
}

.station-name {
  font-family: var(--font-main);
  font-weight: 700;
  fill: var(--color-text);
  pointer-events: none;
}

.station-pinyin {
  font-family: var(--font-pinyin);
  font-weight: 500;
  fill: var(--color-text-light);
  font-size: 11px;
  pointer-events: none;
}

/* 当前站呼吸动画 */
.station-group.active .station-dot {
  animation: station-breathe 1.3s ease-in-out infinite;
}

@keyframes station-breathe {
  0%, 100% { filter: drop-shadow(0 0 6px currentColor); }
  50%      { filter: drop-shadow(0 0 22px currentColor); }
}

/* 列车样式 */
.train-group {
  transition: transform 0.05s linear;
  filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.28));
}

/* ================================================================
   报站卡片 —— 儿童放大版
   ================================================================ */

.station-card {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 40, 70, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: overlay-enter 0.3s ease;
}

@keyframes overlay-enter {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.station-card-inner {
  width: clamp(300px, 70vw, 520px);
  padding: clamp(32px, 4.5vw, 54px) clamp(24px, 3.5vw, 40px);
  border-radius: var(--radius-xl);
  text-align: center;
  color: var(--color-white);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.35),
    inset 0 3px 0 rgba(255, 255, 255, 0.35),
    inset 0 -6px 0 rgba(0, 0, 0, 0.12);
  animation: card-enter 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  border: 4px solid rgba(255, 255, 255, 0.35);
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: scale(0.6) translateY(40px) rotate(-4deg);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0) rotate(0);
  }
}

.card-badge {
  display: inline-block;
  padding: 6px 22px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.35);
  font-size: clamp(14px, 1.8vw, 17px);
  font-weight: 800;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
}
.card-badge::before { content: '🎉 '; }

.card-close {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  color: white;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), transform var(--transition-fast);
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.card-close:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: scale(1.1) rotate(90deg);
}

.card-pinyin {
  font-size: clamp(38px, 8vw, 72px);
  font-weight: 800;
  font-family: var(--font-pinyin);
  letter-spacing: 0.06em;
  line-height: 1.3;
  margin-bottom: 10px;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.15),
    0 4px 12px rgba(0, 0, 0, 0.25);
  display: flex;
  justify-content: center;
  gap: clamp(8px, 1.4vw, 16px);
  flex-wrap: wrap;
}

.card-pinyin .syllable {
  display: inline-block;
  animation: syllable-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.card-pinyin .syllable:nth-child(1) { animation-delay: 0.10s; }
.card-pinyin .syllable:nth-child(2) { animation-delay: 0.22s; }
.card-pinyin .syllable:nth-child(3) { animation-delay: 0.34s; }
.card-pinyin .syllable:nth-child(4) { animation-delay: 0.46s; }

@keyframes syllable-pop {
  from {
    opacity: 0;
    transform: scale(0.4) translateY(14px) rotate(-10deg);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0) rotate(0);
  }
}

.card-name {
  font-size: clamp(30px, 6vw, 54px);
  font-weight: 900;
  letter-spacing: 0.14em;
  margin-bottom: 14px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.card-line-label {
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 700;
  opacity: 0.9;
  margin-bottom: 18px;
  padding: 4px 14px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-pill);
  display: inline-block;
}

.card-hint {
  font-size: clamp(12px, 1.5vw, 15px);
  font-weight: 600;
  opacity: 0.7;
  animation: hint-pulse 2s ease-in-out infinite;
}
.card-hint::before { content: '👆 '; }

@keyframes hint-pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%      { opacity: 0.85; transform: scale(1.05); }
}

/* ================================================================
   暂停遮罩
   ================================================================ */

.pause-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 40, 70, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: overlay-enter 0.3s ease;
}

.pause-content {
  text-align: center;
  color: white;
}

.pause-icon {
  font-size: 88px;
  margin-bottom: 14px;
  animation: pause-wiggle 1.2s ease-in-out infinite;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
}
@keyframes pause-wiggle {
  0%, 100% { transform: rotate(-6deg); }
  50%      { transform: rotate(6deg); }
}

.pause-text {
  font-size: 34px;
  font-weight: 900;
  margin-bottom: 28px;
  letter-spacing: 0.15em;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}

.pause-btn {
  padding: 18px 44px;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, #FFD93D, #FF9F1C);
  color: #4A2E00;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow:
    0 6px 0 rgba(180, 100, 0, 0.5),
    0 10px 22px rgba(0, 0, 0, 0.28),
    inset 0 2px 0 rgba(255, 255, 255, 0.55);
  transition: transform var(--transition-fast);
}

.pause-btn::before { content: '▶ '; }

.pause-btn:hover {
  transform: translateY(-3px);
}
.pause-btn:active {
  transform: translateY(4px);
  box-shadow:
    0 2px 0 rgba(180, 100, 0, 0.5),
    0 4px 8px rgba(0, 0, 0, 0.2);
}

/* ================================================================
   庆祝动画
   ================================================================ */

.celebrate-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(600px 400px at 50% 40%, rgba(255, 217, 61, 0.25), transparent 70%),
    rgba(20, 40, 70, 0.65);
  animation: overlay-enter 0.5s ease;
}

.celebrate-content {
  text-align: center;
  color: white;
  position: relative;
  padding: 0 20px;
}

.celebrate-stars {
  position: absolute;
  top: -90px; left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 90px;
  pointer-events: none;
}

.star-particle {
  position: absolute;
  font-size: 32px;
  animation: star-fall 2.2s ease-in forwards;
  filter: drop-shadow(0 4px 10px rgba(255, 217, 61, 0.6));
}

@keyframes star-fall {
  0%   { opacity: 0; transform: translateY(-70px) scale(0) rotate(0);   }
  30%  { opacity: 1; transform: translateY(0)     scale(1.3) rotate(180deg); }
  100% { opacity: 0; transform: translateY(90px)  scale(0.4) rotate(720deg); }
}

.celebrate-title {
  font-size: clamp(44px, 10vw, 82px);
  font-weight: 900;
  margin-bottom: 14px;
  animation: celebrate-bounce 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: linear-gradient(135deg, #FFD93D 0%, #FF7EB9 40%, #6BE7C1 80%, #4DA6FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 4px 0 rgba(255, 255, 255, 0.4))
          drop-shadow(0 8px 16px rgba(0, 0, 0, 0.35));
  letter-spacing: 0.06em;
}

@keyframes celebrate-bounce {
  from { opacity: 0; transform: scale(0.3) rotate(-10deg); }
  to   { opacity: 1; transform: scale(1)   rotate(0); }
}

.celebrate-subtitle {
  font-size: clamp(18px, 3.2vw, 26px);
  font-weight: 700;
  margin-bottom: 32px;
  opacity: 0.95;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

.celebrate-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.celebrate-btn {
  padding: 16px 32px;
  min-height: var(--touch-min);
  border-radius: var(--radius-pill);
  font-size: clamp(16px, 2.2vw, 20px);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: white;
  background: rgba(255, 255, 255, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow:
    0 5px 0 rgba(0, 0, 0, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.22);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.celebrate-btn:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: translateY(-3px);
}
.celebrate-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.celebrate-btn-primary {
  background: linear-gradient(180deg, #FFD93D, #FF6B6B);
  color: #4A1A1A;
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow:
    0 6px 0 rgba(180, 40, 40, 0.5),
    0 10px 22px rgba(255, 107, 107, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.5);
}

.celebrate-btn-primary:hover {
  background: linear-gradient(180deg, #FFE066, #FF8585);
}

/* ================================================================
   响应式
   ================================================================ */

/* ---------- 手机竖屏 (窄) ---------- */
@media (max-width: 600px) and (orientation: portrait) {
  #screen-line-select {
    gap: 12px;
    padding: 52px 12px 14px;
  }

  .lobby-link {
    top: max(10px, calc(env(safe-area-inset-top) + 6px));
    left: max(10px, calc(env(safe-area-inset-left) + 6px));
    min-height: 40px;
    padding: 6px 10px;
    font-size: 12px;
  }

  .title-main {
    font-size: 40px;
  }

  .hero-train {
    width: 200px;
    margin: 2px 0;
  }

  .hint {
    font-size: 16px;
    padding: 6px 16px;
  }

  /* 12 条线路,3 × 4 网格 */
  .line-buttons {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 96vw;
    padding: 4px;
  }

  .line-btn {
    padding: 8px 6px;
    gap: 4px;
    border-radius: var(--radius-md);
  }

  .line-btn-badge {
    width: clamp(38px, 12vw, 52px);
    height: clamp(38px, 12vw, 52px);
    font-size: clamp(20px, 6vw, 28px);
    flex-shrink: 0;
  }

  .line-btn-name {
    font-size: clamp(14px, 4vw, 18px);
  }

  .line-btn-info {
    font-size: 10px;
    padding: 2px 6px;
  }

  .line-btn-planned::before {
    font-size: 9px;
    padding: 2px 5px;
    top: 4px;
    right: 4px;
  }

  #map-container {
    align-items: flex-start;
    padding: 10px;
  }

  .station-card-inner {
    width: 92vw;
    padding: 24px 16px;
  }

  .card-pinyin {
    font-size: 40px;
    gap: 8px;
  }

  .card-name {
    font-size: 32px;
  }

  .progress-container {
    max-width: 130px;
  }

  .header-btn {
    padding: 6px 10px;
    font-size: 13px;
    min-width: 44px;
    min-height: 44px;
  }

  .header-actions {
    gap: 5px;
  }

  .map-controls {
    right: 12px;
    bottom: 16px;
  }
  .map-ctrl-btn {
    width: 50px;
    height: 50px;
    font-size: 22px;
  }
}

/* ---------- 手机横屏 (矮) ---------- */
@media (max-height: 500px) and (orientation: landscape) {
  #screen-line-select {
    gap: 8px;
    padding: 10px 14px 10px 104px;
  }

  .lobby-link {
    top: max(8px, calc(env(safe-area-inset-top) + 4px));
    left: max(8px, calc(env(safe-area-inset-left) + 4px));
    min-height: 38px;
    padding: 5px 9px;
    font-size: 11px;
  }

  .hero-train {
    width: 130px;
    margin: 0;
  }

  .title-main {
    font-size: 28px;
  }
  .title-sub {
    font-size: 13px;
    padding: 2px 12px;
  }
  .hint {
    font-size: 13px;
    padding: 4px 12px;
  }

  .line-buttons {
    gap: 8px;
    width: 98vw;
  }

  .line-btn {
    padding: 6px 4px;
    gap: 2px;
  }

  .line-btn-badge {
    width: 34px;
    height: 34px;
    font-size: 18px;
  }

  .line-btn-name {
    font-size: 13px;
  }

  .line-btn-info {
    font-size: 9px;
    padding: 1px 5px;
  }

  .header-btn {
    min-width: 40px;
    min-height: 40px;
    padding: 4px 10px;
    font-size: 12px;
  }

  .card-pinyin {
    font-size: 32px;
  }
  .card-name {
    font-size: 26px;
  }
}

/* ---------- iPad / 平板竖屏 ---------- */
@media (min-width: 601px) and (max-width: 1024px) and (orientation: portrait) {
  #screen-line-select {
    gap: 20px;
    padding: 40px 24px;
  }

  .title-main {
    font-size: 56px;
  }

  .hero-train {
    width: 280px;
  }

  .line-buttons {
    /* 12 条线路,竖屏 iPad 用 4 × 3 更方便手指点击 */
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    width: min(92vw, 720px);
  }

  .line-btn {
    padding: 16px 12px;
  }

  .line-btn-badge {
    width: 62px;
    height: 62px;
    font-size: 34px;
  }

  .line-btn-name {
    font-size: 22px;
  }

  .header-btn {
    min-width: 56px;
    min-height: 56px;
    font-size: 16px;
  }

  .map-ctrl-btn {
    width: 62px;
    height: 62px;
    font-size: 28px;
  }
}

/* ---------- iPad / 平板横屏 ---------- */
@media (min-width: 900px) and (max-width: 1366px) and (orientation: landscape) {
  #screen-line-select {
    gap: 20px;
    padding: 24px;
  }

  .title-main {
    font-size: 58px;
  }

  .hero-train {
    width: 260px;
  }

  .line-buttons {
    /* 保持 6 × 2,宽一点 */
    width: min(92vw, 1000px);
    gap: 16px;
  }

  .line-btn-badge {
    width: 60px;
    height: 60px;
    font-size: 32px;
  }

  .line-btn-name {
    font-size: 22px;
  }

  .header-btn {
    min-width: 56px;
    min-height: 56px;
    font-size: 16px;
  }
}

/* ---------- 大屏(桌面/大 iPad Pro) ---------- */
@media (min-width: 1400px) {
  .station-pinyin {
    font-size: 13px;
  }

  .line-buttons {
    width: min(94vw, 1200px);
  }
}

/* ================================================================
   工具类
   ================================================================ */

.no-select {
  user-select: none;
  -webkit-user-select: none;
}

/* 尊重减少动效设置 */
@media (prefers-reduced-motion: reduce) {
  .title-main,
  .hero-train,
  .hint,
  .progress-stars,
  .progress-fill,
  .pause-icon,
  .cloud {
    animation: none !important;
  }
  * { transition-duration: 0.01ms !important; }
}
