/* 三国志探险 - Q版卡通主题样式 */

/* ===== CSS变量 ===== */
:root {
  --bg: #fef9ef;
  --bg-card: #ffffff;
  --text: #2c2c2c;
  --text-light: #666;
  --wei: #4a90d9;
  --wei-light: #d4e4f7;
  --shu: #4caf50;
  --shu-light: #d4efd5;
  --wu: #ef5350;
  --wu-light: #fdd;
  --gold: #f5a623;
  --gold-light: #fff3d4;
  --rare-blue: #5c6bc0;
  --rare-blue-light: #e0e3f8;
  --common-green: #66bb6a;
  --common-green-light: #e0f2e1;
  --legend-gold: #f5a623;
  --shadow: 0 4px 15px rgba(0,0,0,0.08);
  --shadow-hover: 0 8px 25px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --font-title: 'ZCOOL XiaoWei', serif;
  --font-body: 'Noto Sans SC', sans-serif;
  --tab-height: 64px;
  --header-height: 56px;
}

/* ===== 粒子系统 ===== */
#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: particleFall var(--duration, 8s) linear forwards;
}

.particle-petal {
  border-radius: 50% 0 50% 0;
  transform: rotate(45deg);
}

.particle-sparkle {
  border-radius: 50%;
  box-shadow: 0 0 4px currentColor;
}

@keyframes particleFall {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 0.8; }
  90% { opacity: 0.6; }
  100% {
    transform: translateY(105vh) translateX(var(--drift, 50px)) rotate(var(--rotate, 360deg));
    opacity: 0;
  }
}

/* ===== 全局动效 ===== */
.flash-pulse {
  position: fixed;
  inset: 0;
  z-index: 250;
  pointer-events: none;
  animation: flashPulseAnim 0.6s ease-out forwards;
}

@keyframes flashPulseAnim {
  0% { opacity: 0.8; transform: scale(0.5); }
  100% { opacity: 0; transform: scale(2); }
}

/* 屏幕震动 */
#app.shaking {
  animation: shakeAnim 0.1s ease-in-out 3;
}

@keyframes shakeAnim {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(calc(var(--shake-intensity, 5px) * -1)); }
  75% { transform: translateX(var(--shake-intensity, 5px)); }
}

/* 入场动画 - 交错出现 */
.stagger-ready {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  animation: staggerIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(var(--stagger, 0) * 0.08s);
}

@keyframes staggerIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 滚动出现 */
.animate-on-enter {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.animated-in {
  opacity: 1;
  transform: translateY(0);
}

/* 呼吸/漂浮效果 */
.float {
  animation: floatAnim 3s ease-in-out infinite;
}

@keyframes floatAnim {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* 闪烁光效 */
.shimmer-text {
  background: linear-gradient(90deg, var(--text) 40%, var(--gold) 50%, var(--text) 60%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmerText 3s ease-in-out infinite;
}

@keyframes shimmerText {
  0%, 100% { background-position: 200% 0; }
  50% { background-position: -200% 0; }
}

/* ===== 全局重置 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  height: 100dvh;
}

body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  /* 微信/iOS 安全区 */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  box-sizing: border-box;
}

/* 微信浏览器：底部功能栏约50px，增加额外留白防止遮挡 */
html.wechat body {
  padding-bottom: calc(env(safe-area-inset-bottom) + 50px);
}

html.wechat .tab-bar {
  bottom: 50px;
}

html.wechat .screen {
  padding-bottom: calc(var(--tab-height) + 50px + 16px);
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ===== 应用容器 ===== */
#app {
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

@media (min-width: 768px) {
  #app {
    max-width: 100%;
  }
}

/* ===== Screen 通用 ===== */
.screen {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(var(--tab-height) + 16px);
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  display: flex;
  flex-direction: column;
  animation: screenFadeIn 0.35s ease;
}

@keyframes screenFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(254,249,239,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: var(--header-height);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.screen-header h2 {
  font-family: var(--font-title);
  font-size: 22px;
}

.points-display {
  font-size: 16px;
  font-weight: 700;
  background: var(--gold-light);
  padding: 4px 12px;
  border-radius: 20px;
  color: var(--gold);
}

.back-btn {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text);
  cursor: pointer;
  padding: 4px 8px;
}

/* ===== 底部Tab导航 ===== */
.tab-bar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: var(--tab-height);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 -2px 20px rgba(0,0,0,0.08);
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  z-index: 100;
  border-top: 1px solid rgba(0,0,0,0.05);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  color: var(--text-light);
  transition: all 0.2s;
  flex: 1;
}

.tab.active {
  color: var(--wu);
  transform: translateY(-2px);
}

.tab.active .tab-icon {
  animation: tabBounce 0.4s ease;
}

@keyframes tabBounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.3); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.tab-icon {
  font-size: 18px;
}

.tab-label {
  font-size: 9px;
  font-weight: 500;
}

/* ===== 通用按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, var(--wu), #ff7043);
  color: white;
  box-shadow: 0 4px 12px rgba(239,83,80,0.3);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary:not(:disabled):active {
  transform: scale(0.95);
  box-shadow: 0 2px 6px rgba(239,83,80,0.2);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 2px solid #ddd;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.hidden {
  display: none !important;
}

/* ===== 首页 ===== */

/* 英雄区 - 大图轮播 */
.home-hero {
  position: relative;
  height: 240px;
  min-height: 180px;
  flex-shrink: 0;
  overflow: hidden;
}

.home-hero-bg {
  position: absolute;
  inset: 0;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.2s ease, transform 8s ease;
  transform: scale(1.05);
}

.hero-img.active {
  opacity: 1;
  transform: scale(1);
}

.home-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0,0,0,0.1) 0%,
    rgba(0,0,0,0.3) 50%,
    rgba(254,249,239,1) 100%
  );
}

.home-hero-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  text-align: center;
}

.game-title {
  font-family: var(--font-title);
  font-size: 44px;
  color: white;
  text-shadow: 0 2px 20px rgba(0,0,0,0.5), 0 0 40px rgba(245,166,35,0.3);
  -webkit-text-fill-color: initial;
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
}

.game-subtitle {
  font-size: 14px;
  color: rgba(255,255,255,0.85);
  margin-top: 4px;
  letter-spacing: 4px;
  text-shadow: 0 1px 8px rgba(0,0,0,0.5);
}

.hero-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}

.hero-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  transition: all 0.3s;
}

.hero-dots .dot.active {
  background: white;
  width: 20px;
  border-radius: 4px;
}

/* 统计条 */
.home-stats-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
  margin-top: -8px;
  position: relative;
  z-index: 2;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  padding: 10px 18px;
  border-radius: 20px;
  box-shadow: var(--shadow);
  font-weight: 700;
  font-size: 17px;
}

.stat-pill-icon {
  font-size: 22px;
}

.stat-pill-value {
  color: var(--text);
}

/* ===== 首页头像卡片 ===== */
#auth-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.home-avatar-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 24px;
  padding: 5px 12px 5px 5px;
  cursor: pointer;
  transition: background 0.2s;
}

.home-avatar-card:hover {
  background: rgba(0,0,0,0.6);
}

.home-avatar-ring {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 2px;
  flex-shrink: 0;
}

.home-avatar-ring.legend { background: linear-gradient(135deg, #ffd700, #ff9800); }
.home-avatar-ring.rare   { background: linear-gradient(135deg, #7c4dff, #448aff); }
.home-avatar-ring.common { background: linear-gradient(135deg, #66bb6a, #43a047); }
.home-avatar-ring.guest  { background: linear-gradient(135deg, #aaa, #888); }

.home-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,0.1);
  display: block;
}

.home-avatar-name {
  font-size: 12px;
  font-weight: 700;
  color: white;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== 头像选择弹窗 ===== */
.avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
}

.avatar-picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg-page);
}

.avatar-picker-item.selected {
  border-color: #4caf50;
  background: #4caf5012;
}

.avatar-picker-item.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.avatar-picker-item:not(.locked):hover {
  transform: scale(1.06);
}

.avatar-picker-name {
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.avatar-picker-rarity {
  font-size: 9px;
  color: var(--text-light);
}

.home-entries {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  padding: 6px 12px 16px;
}

.entry-card {
  position: relative;
  aspect-ratio: 2/3;
  border-radius: 14px;
  overflow: hidden;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  transition: transform 0.18s, box-shadow 0.18s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.entry-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  border: 1.5px solid rgba(255,255,255,0.18);
  pointer-events: none;
  z-index: 3;
}

.entry-card:active { transform: scale(0.93); box-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.entry-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.35); }

.entry-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  transition: transform 0.35s ease;
}

.entry-card:hover .entry-bg { transform: scale(1.06); }

.entry-info {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 4px 10px;
  background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,0.55) 70%, rgba(0,0,0,0.8) 100%);
  color: white;
}


.entry-icon {
  font-size: 26px;
  margin-bottom: 3px;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.7));
}

.entry-title {
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px 6px rgba(0,0,0,0.8), 0 0 12px rgba(0,0,0,0.5);
  white-space: nowrap;
  letter-spacing: 0.5px;
}

/* 旧 action-card 保留给不需要的地方 */
.action-card {
  position: relative;
  min-width: 140px;
  height: 160px;
  flex-shrink: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  transition: transform 0.2s;
}

.action-card:active {
  transform: scale(0.96);
}

.action-card-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 0.4s;
}

.action-card:hover .action-card-bg {
  transform: scale(1.08);
}

.action-card-content {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 14px;
  background: linear-gradient(180deg, rgba(0,0,0,0) 30%, rgba(0,0,0,0.65) 100%);
  color: white;
}

.action-card-icon {
  font-size: 24px;
  position: absolute;
  top: 12px;
  right: 12px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.action-card-title {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-title);
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}

.action-card-desc {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 2px;
}

/* ===== 排行榜/擂台 Tab ===== */
.lb-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.lb-tab.active {
  color: var(--text);
  border-bottom-color: #667eea;
}

/* ===== 首页5入口（竖向卡片一排）===== */

/* ===== 关卡地图 ===== */
#map-container {
  flex: 1;
  padding: 0 16px 16px;
  overflow-y: auto;
}

.stage-header {
  padding: 8px 0 12px;
}

.stage-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 6px;
}

.stage-stars-total {
  font-weight: 700;
  color: var(--gold);
}

.stage-progress-bar {
  height: 6px;
  background: #e8e8e8;
  border-radius: 3px;
  overflow: hidden;
}

.stage-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--shu), var(--gold));
  border-radius: 3px;
  transition: width 0.6s ease;
}

.stage-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stage-card {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 4px solid var(--kingdom-color, #999);
}

.stage-card:active { transform: scale(0.98); }

.stage-card.locked {
  opacity: 0.5;
  filter: grayscale(0.5);
  cursor: not-allowed;
}

.stage-card.current {
  box-shadow: 0 0 0 2px var(--kingdom-color), var(--shadow);
}

.stage-card-img {
  width: 120px;
  min-height: 100px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.stage-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stage-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 60%, var(--bg-card) 100%);
  pointer-events: none;
}

.stage-lock {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 24px;
}

.stage-lock span { font-size: 11px; margin-top: 4px; }

.stage-number {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage-card-body {
  flex: 1;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stage-name {
  font-size: 15px;
  font-weight: 700;
}

.stage-desc {
  font-size: 12px;
  color: var(--text-light);
}

.stage-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.stage-npc-row {
  display: flex;
  gap: -4px;
}

.stage-npc-row .avatar-img {
  margin-left: -6px;
  border: 2px solid var(--bg-card);
}

.stage-npc-row .avatar-img:first-child { margin-left: 0; }

.stage-stars-row { font-size: 14px; }
.stage-star.earned { filter: none; }
.stage-star:not(.earned) { opacity: 0.3; }

.stage-difficulty { font-size: 12px; }

.stage-reward {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
  margin-top: 2px;
}

/* ===== 对战关卡信息 ===== */
.battle-stage-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  height: 140px;
}

.battle-stage-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.battle-stage-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 30%, rgba(0,0,0,0.7) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px;
  color: white;
}

.battle-stage-overlay p { font-size: 14px; margin-bottom: 6px; }
.battle-stage-npc { display: flex; gap: 8px; margin-bottom: 4px; }
.stage-npc-preview { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.battle-stage-diff { font-size: 12px; opacity: 0.8; }

/* ===== 答题列表 ===== */
.quiz-coins-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--gold-light);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 15px;
}

.quiz-coins-bar strong {
  color: var(--gold);
  font-size: 20px;
}

.quiz-coins-hint { font-size: 12px; color: var(--text-light); }

.quiz-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-list-card {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.2s;
}

.quiz-list-card:active { transform: scale(0.98); }
.quiz-list-card.disabled { opacity: 0.4; cursor: not-allowed; }

.quiz-list-img {
  width: 100px;
  min-height: 80px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.quiz-list-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.quiz-list-img-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 50%, var(--bg-card) 100%);
}

.quiz-list-info {
  flex: 1;
  padding: 10px 12px;
}

.quiz-list-info h4 { font-size: 15px; margin-bottom: 2px; }
.quiz-list-info p { font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
.quiz-list-best { font-size: 12px; color: var(--shu); font-weight: 600; }
.quiz-list-new { font-size: 12px; color: var(--gold); font-weight: 600; }
.quiz-no-coins {
  text-align: center;
  color: var(--wu);
  font-size: 14px;
  padding: 16px;
  font-weight: 600;
}

#map-container svg {
  width: 100%;
  height: auto;
  max-height: calc(100vh - 200px);
}

.map-region {
  opacity: 0.3;
  transition: opacity 0.3s;
}

.map-city {
  cursor: pointer;
  transition: all 0.2s;
}

.map-city:hover circle,
.map-city.active circle {
  r: 14;
}

.map-city.locked {
  opacity: 0.3;
  cursor: not-allowed;
}

.map-city-label {
  font-size: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  pointer-events: none;
}

.city-panel {
  position: fixed;
  bottom: var(--tab-height);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 560px;
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  padding: 20px;
  z-index: 50;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(100%); }
  to { transform: translateX(-50%) translateY(0); }
}

.panel-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
}

.city-kingdom {
  font-size: 13px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  display: inline-block;
  margin: 6px 0;
}

.city-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.city-actions .btn {
  flex: 1;
}

.btn-quiz {
  background: var(--shu);
  color: white;
}

.btn-battle {
  background: var(--wu);
  color: white;
}

/* ===== 问答 ===== */
.quiz-list-view, .quiz-play-view {
  padding: 16px;
  flex: 1;
}

#quiz-container {
  padding: 16px;
  flex: 1;
}

.quiz-intro {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow);
  font-size: 15px;
  line-height: 1.8;
  margin-bottom: 16px;
  overflow: hidden;
}

.quiz-scene-img {
  width: 100%;
  aspect-ratio: 3/2;
  overflow: hidden;
  position: relative;
}

.quiz-scene-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: sceneZoom 20s ease-in-out infinite alternate;
}

@keyframes sceneZoom {
  0% { transform: scale(1); }
  100% { transform: scale(1.1); }
}

.quiz-scene-img::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(transparent, var(--bg-card));
}

.quiz-intro p {
  padding: 16px 24px 8px;
}

.quiz-intro .btn {
  margin: 8px 24px 24px;
  width: calc(100% - 48px);
}

.quiz-progress {
  margin-bottom: 16px;
  text-align: center;
}

.quiz-progress span {
  font-size: 14px;
  color: var(--text-light);
}

.progress-bar {
  height: 6px;
  background: #eee;
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--shu), var(--gold));
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 0%;
}

.quiz-question {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 20px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-option {
  display: block;
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 2px solid #e8e8e8;
  border-radius: var(--radius-sm);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
  line-height: 1.5;
}

.quiz-option:active {
  transform: scale(0.98);
}

.quiz-option.correct {
  background: var(--shu-light);
  border-color: var(--shu);
  color: #1b5e20;
}

.quiz-option.wrong {
  background: var(--wu-light);
  border-color: var(--wu);
  color: #b71c1c;
}

.quiz-option.disabled {
  pointer-events: none;
  opacity: 0.6;
}

.quiz-feedback {
  margin-top: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.6;
  animation: fadeIn 0.3s ease;
}

.quiz-feedback.correct {
  background: var(--shu-light);
  border-left: 4px solid var(--shu);
}

.quiz-feedback.wrong {
  background: var(--wu-light);
  border-left: 4px solid var(--wu);
}

.quiz-result {
  text-align: center;
  padding: 32px 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.quiz-result h3 {
  font-family: var(--font-title);
  font-size: 28px;
  margin-bottom: 12px;
}

.quiz-result p {
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--text-light);
}

.quiz-result .btn {
  margin-top: 16px;
  margin-right: 8px;
}

/* ===== 抽卡 ===== */
#gacha-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ===== Banner ===== */
.gacha-banner {
  background: url('../images/gacha_bg.webp') center/cover no-repeat, linear-gradient(160deg, #0d0628 0%, #1a0a3e 50%, #0a1628 100%);
  padding: 36px 24px 28px;
  color: white;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gacha-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10,6,40,0.3) 0%, rgba(10,6,40,0.65) 100%);
}

.gacha-banner-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.gacha-banner-text {
  position: relative;
  z-index: 2;
}

.gacha-banner-label {
  font-size: 10px;
  letter-spacing: 4px;
  color: rgba(255,215,0,0.8);
  font-weight: 700;
  margin-bottom: 6px;
}

.gacha-banner h3 {
  font-family: var(--font-title);
  font-size: 36px;
  margin: 0 0 4px;
  text-shadow: 0 0 20px rgba(200,150,255,0.6), 0 2px 8px rgba(0,0,0,0.5);
  background: linear-gradient(135deg, #fff 30%, #d4b0ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gacha-banner p {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  margin: 0;
}

.gacha-banner-coins {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 3;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,215,0,0.3);
  color: #ffd700;
  font-weight: 700;
  font-size: 14px;
  padding: 4px 10px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

/* ===== 保底进度条 ===== */
.gacha-pity-wrap {
  background: var(--bg-card);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.gacha-pity-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.gacha-pity-label {
  width: 72px;
  color: var(--text-light);
  flex-shrink: 0;
}

.gacha-pity-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.gacha-pity-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.16,1,0.3,1);
}

.gacha-pity-bar.rare {
  background: linear-gradient(90deg, #5c6bc0, #7c4dff);
  box-shadow: 0 0 6px rgba(124,77,255,0.5);
}

.gacha-pity-bar.legend {
  background: linear-gradient(90deg, #f5a623, #ffd700);
  box-shadow: 0 0 6px rgba(255,215,0,0.4);
}

.gacha-pity-num {
  font-weight: 700;
  font-size: 14px;
  min-width: 20px;
  text-align: right;
}

.gacha-pity-unit {
  color: var(--text-light);
  font-size: 11px;
}

/* ===== 按钮 ===== */
.gacha-buttons {
  display: flex;
  gap: 12px;
  padding: 16px 16px 0;
}

.btn-gacha-single, .btn-gacha-ten {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 16px 8px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}

.btn-gacha-single:active, .btn-gacha-ten:active { transform: scale(0.96); }

.btn-gacha-single {
  background: linear-gradient(145deg, #4a3aaa, #7c4dff, #5c6bc0);
  color: white;
  box-shadow: 0 6px 20px rgba(124,77,255,0.4);
  border: 1px solid rgba(255,255,255,0.15);
}

.btn-gacha-ten {
  background: linear-gradient(145deg, #b07800, #f5a623, #ffd700);
  color: #1a0a00;
  box-shadow: 0 6px 20px rgba(245,166,35,0.45);
  border: 1px solid rgba(255,255,255,0.25);
}

.gacha-btn-shine {
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: btnShine 2.5s ease-in-out infinite;
  pointer-events: none;
}

.btn-gacha-ten .gacha-btn-shine { animation-delay: 1.2s; }

@keyframes btnShine {
  0% { left: -100%; }
  40%, 100% { left: 160%; }
}

.gacha-btn-icon {
  font-size: 18px;
  opacity: 0.85;
}

.gacha-btn-title {
  font-size: 18px;
  font-weight: 800;
}

.gacha-btn-cost {
  font-size: 12px;
  opacity: 0.8;
  font-weight: 600;
}

.btn-gacha-single:disabled, .btn-gacha-ten:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ===== 概率说明 ===== */
.gacha-rates {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  font-size: 11px;
  color: var(--text-light);
}

.gacha-rates b { color: var(--text-primary); }
.gacha-rates .rare-rate b { color: #7c4dff; }
.gacha-rates .legend-rate b { color: var(--gold); }

.gacha-result {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding: 16px;
}

/* (旧 gacha-card 已移至新的单抽/十连系统) */

/* ===== 图鉴 ===== */
.cards-filter {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
}

.filter-btn {
  padding: 6px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 20px;
  background: var(--bg-card);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn.active {
  background: var(--text);
  color: white;
  border-color: var(--text);
}

.cards-count {
  font-weight: 700;
  color: var(--gold);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 12px 16px;
}

.card-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.card-item:active {
  transform: scale(0.96);
}

.card-item.locked {
  opacity: 0.4;
  filter: grayscale(1);
}

.card-item.legend { border-top: 3px solid var(--legend-gold); }
.card-item.rare { border-top: 3px solid var(--rare-blue); }
.card-item.common { border-top: 3px solid var(--common-green); }

.card-item .avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  font-size: 26px;
  color: white;
  font-weight: 700;
  position: relative;
}

.card-item .deco {
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 14px;
}

.card-item .card-name {
  font-size: 14px;
  font-weight: 700;
}

.card-item .card-kingdom {
  font-size: 11px;
  color: var(--text-light);
}

.card-item .card-level {
  font-size: 11px;
  color: var(--gold);
  margin-top: 2px;
}

/* 卡牌详情弹窗 */
.card-detail {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.card-detail-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 0;
  max-width: 400px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  animation: detailSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-detail-content > .panel-close {
  position: sticky;
  top: 8px;
  float: right;
  margin-right: 8px;
  z-index: 10;
  background: rgba(0,0,0,0.5);
  color: white;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-card-art {
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
  position: relative;
}

.detail-card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-card-art::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(transparent, var(--bg-card));
}

#card-detail-inner > *:not(.detail-card-art) {
  padding-left: 24px;
  padding-right: 24px;
}

#card-detail-inner > *:last-child {
  padding-bottom: 24px;
}

@keyframes detailSlideUp {
  from { opacity: 0; transform: translateY(40px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.detail-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 40px;
  color: white;
  font-weight: 700;
  position: relative;
}

.detail-avatar .deco {
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 24px;
}

.detail-name {
  text-align: center;
  font-family: var(--font-title);
  font-size: 24px;
  margin-bottom: 2px;
}

.detail-title {
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 12px;
}

.detail-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.detail-stat {
  flex: 1;
  text-align: center;
  padding: 8px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.detail-stat-value {
  font-size: 22px;
  font-weight: 700;
}

.detail-stat-label {
  font-size: 11px;
  color: var(--text-light);
}

.detail-section {
  margin-bottom: 12px;
}

.detail-section h4 {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 6px;
}

.detail-section p {
  font-size: 14px;
  line-height: 1.7;
}

.detail-quote {
  font-style: italic;
  padding: 10px 14px;
  background: var(--gold-light);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--gold);
  font-size: 14px;
  line-height: 1.6;
}

.detail-upgrade {
  margin-top: 16px;
  text-align: center;
}

.detail-upgrade .btn {
  width: 100%;
}

/* ===== 对战 ===== */
#battle-container {
  padding: 16px;
  flex: 1;
}

.battle-select h3 {
  text-align: center;
  font-size: 18px;
  margin-bottom: 16px;
}

.battle-team-slots {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.team-slot {
  width: 80px;
  height: 100px;
  border: 3px dashed #ddd;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #ccc;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-card);
}

.team-slot.filled {
  border-style: solid;
  border-color: var(--shu);
}

.team-slot .slot-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  font-weight: 700;
}

.team-slot .slot-name {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}

.battle-available-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
}

.battle-card-pick {
  padding: 10px 4px;
  background: var(--bg-card);
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}

.battle-card-pick:active {
  transform: scale(0.95);
}

.battle-card-pick.selected {
  border-color: var(--shu);
  background: var(--shu-light);
}

.battle-card-pick .mini-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  font-weight: 700;
  margin: 0 auto 4px;
}

.battle-card-pick .mini-name {
  font-size: 11px;
  font-weight: 600;
}

/* 对战场 */
.battle-arena {
  animation: fadeIn 0.3s ease;
  background: url('../images/battle_bg.webp') center/cover no-repeat;
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
}

.battle-arena::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(254,249,239,0.7);
  border-radius: var(--radius);
  pointer-events: none;
}

.battle-arena > * {
  position: relative;
  z-index: 1;
}

.battle-teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.battle-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.battle-vs {
  font-family: var(--font-title);
  font-size: 32px;
  color: var(--wu);
  font-weight: 700;
}

.battle-card-show {
  width: 80px;
  text-align: center;
  padding: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  transition: all 0.3s;
}

.battle-card-show.fighting {
  box-shadow: 0 0 20px rgba(245,166,35,0.4);
  transform: scale(1.05);
}

.battle-card-show.win {
  box-shadow: 0 0 20px rgba(76,175,80,0.4);
}

.battle-card-show.lose {
  opacity: 0.5;
}

.battle-card-show .b-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  font-weight: 700;
  margin: 0 auto 4px;
}

.battle-card-show .b-name {
  font-size: 12px;
  font-weight: 600;
}

.battle-card-show .b-stat {
  font-size: 11px;
  color: var(--text-light);
}

.battle-log {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  max-height: 200px;
  overflow-y: auto;
}

.battle-log-entry {
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  line-height: 1.5;
  animation: fadeIn 0.3s ease;
}

.battle-log-entry:last-child {
  border-bottom: none;
}

.battle-log-entry .win-text { color: var(--shu); font-weight: 600; }
.battle-log-entry .lose-text { color: var(--wu); font-weight: 600; }

.battle-result {
  text-align: center;
  padding: 24px;
  margin-top: 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: fadeIn 0.3s ease;
}

.battle-result h3 {
  font-family: var(--font-title);
  font-size: 28px;
  margin-bottom: 8px;
}

.battle-result p {
  color: var(--text-light);
  margin-bottom: 4px;
}

.battle-result .btn {
  margin-top: 16px;
}

/* ===== 头像（AI图片 + SVG回退） ===== */
.avatar-img {
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  border: 2px solid white;
}

.avatar-img img {
  display: block;
}

.avatar-svg, .avatar-svg-fallback {
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-svg svg, .avatar-svg-fallback svg {
  display: block;
}

/* 传说卡牌光效 */
.card-item.legend .avatar-svg,
.gacha-card.legend .avatar-svg {
  animation: legendGlow 2s ease-in-out infinite;
}

@keyframes legendGlow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(245,166,35,0.4)); }
  50% { filter: drop-shadow(0 0 12px rgba(245,166,35,0.8)); }
}

/* 稀有卡光效 */
.card-item.rare .avatar-svg,
.gacha-card.rare .avatar-svg {
  animation: rareGlow 2.5s ease-in-out infinite;
}

@keyframes rareGlow {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(92,107,192,0.3)); }
  50% { filter: drop-shadow(0 0 8px rgba(92,107,192,0.6)); }
}

/* ===== 抽卡仪式增强 ===== */
.gacha-ceremony {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.gacha-flash {
  position: fixed;
  inset: 0;
  z-index: 249;
  pointer-events: none;
  animation: gachaFlash 0.6s ease-out forwards;
}

.gacha-flash.legend { background: radial-gradient(circle, rgba(245,166,35,0.6) 0%, transparent 70%); }
.gacha-flash.rare { background: radial-gradient(circle, rgba(92,107,192,0.4) 0%, transparent 70%); }
.gacha-flash.common { background: radial-gradient(circle, rgba(102,187,106,0.3) 0%, transparent 70%); }

@keyframes gachaFlash {
  0% { opacity: 1; transform: scale(0.5); }
  50% { opacity: 0.8; transform: scale(1.5); }
  100% { opacity: 0; transform: scale(2); }
}

/* 单抽全屏揭示 */
.gacha-single-reveal {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-hover);
  animation: singleRevealIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.gacha-single-reveal.legend {
  box-shadow: 0 0 30px rgba(245,166,35,0.4);
}

.gacha-single-reveal.rare {
  box-shadow: 0 0 20px rgba(92,107,192,0.3);
}

.gacha-single-art {
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
}

.gacha-single-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: slowZoom 10s ease-in-out infinite alternate;
}

@keyframes slowZoom {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

.gacha-single-info {
  padding: 16px;
  text-align: center;
}

.gacha-single-rarity {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.gacha-single-name {
  font-family: var(--font-title);
  font-size: 28px;
  margin: 4px 0;
}

.gacha-single-title {
  color: var(--text-light);
  font-size: 14px;
}

.gacha-single-dup {
  margin-top: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--gold);
}

@keyframes singleRevealIn {
  0% { opacity: 0; transform: scale(0.7) rotateY(90deg); }
  50% { transform: scale(1.02) rotateY(0deg); }
  100% { opacity: 1; transform: scale(1) rotateY(0deg); }
}

/* 十连网格 */
.gacha-multi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.gacha-multi-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
  text-align: center;
  padding-bottom: 6px;
  cursor: pointer;
  animation: multiCardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards;
  transition: transform 0.2s;
}

.gacha-multi-card:active { transform: scale(0.95); }

.gacha-multi-card.legend {
  box-shadow: 0 0 12px rgba(245,166,35,0.4);
}

.gacha-multi-card.rare {
  border: 1px solid var(--rare-blue);
}

.gacha-multi-art {
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
}

.gacha-multi-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gacha-multi-name {
  font-size: 12px;
  font-weight: 700;
  margin-top: 4px;
  padding: 0 2px;
}

.gacha-multi-rarity {
  font-size: 10px;
  font-weight: 600;
}

.gacha-multi-dup {
  font-size: 10px;
  color: var(--text-light);
}

@keyframes multiCardIn {
  0% { opacity: 0; transform: scale(0) rotateY(180deg); }
  60% { transform: scale(1.05) rotateY(20deg); }
  100% { opacity: 1; transform: scale(1) rotateY(0); }
}

@keyframes cardShine {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

/* 抽卡大图预览 */
.gacha-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
  cursor: pointer;
}

.gacha-preview-card {
  max-width: 320px;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0,0,0,0.5);
  animation: detailSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.gacha-preview-card.legend {
  box-shadow: 0 0 60px rgba(245,166,35,0.5);
}

.gacha-preview-card.rare {
  box-shadow: 0 0 40px rgba(92,107,192,0.4);
}

.gacha-preview-card img {
  width: 100%;
  display: block;
}

.gacha-preview-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 20px 20px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: white;
}

.gacha-preview-info h3 {
  font-family: var(--font-title);
  font-size: 28px;
  margin-bottom: 2px;
}

.gacha-preview-info p {
  font-size: 14px;
  opacity: 0.8;
}

/* 抽卡结果中的星星粒子 */
.gacha-star {
  position: fixed;
  pointer-events: none;
  z-index: 300;
  font-size: 16px;
  animation: starFloat 1.5s ease-out forwards;
}

@keyframes starFloat {
  0% { opacity: 1; transform: scale(0) rotate(0deg); }
  30% { opacity: 1; transform: scale(1.2) rotate(180deg); }
  100% { opacity: 0; transform: scale(0.5) rotate(360deg) translateY(-80px); }
}

/* ===== 地图增强 ===== */
.map-river {
  fill: none;
  stroke: #87CEEB;
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0.6;
}

.map-mountain {
  fill: #a8d5a2;
  opacity: 0.4;
}

.map-cloud {
  fill: white;
  opacity: 0.3;
  animation: cloudFloat 20s linear infinite;
}

@keyframes cloudFloat {
  0% { transform: translateX(0); }
  100% { transform: translateX(60px); }
}

.map-city circle {
  transition: all 0.3s ease;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.map-city:not(.locked):hover circle {
  filter: drop-shadow(0 0 8px currentColor);
}

.map-city-pulse {
  animation: cityPulse 2s ease-in-out infinite;
}

@keyframes cityPulse {
  0%, 100% { r: 10; opacity: 1; }
  50% { r: 13; opacity: 0.8; }
}

/* ===== 对战动画增强 ===== */
.battle-card-show.fighting {
  box-shadow: 0 0 20px rgba(245,166,35,0.4);
  transform: scale(1.05);
  animation: battlePulse 0.6s ease-in-out infinite;
}

@keyframes battlePulse {
  0%, 100% { box-shadow: 0 0 20px rgba(245,166,35,0.4); }
  50% { box-shadow: 0 0 35px rgba(245,166,35,0.7); }
}

.battle-clash {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  animation: clashAppear 0.5s ease-out forwards;
  pointer-events: none;
  z-index: 10;
}

@keyframes clashAppear {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(3); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
}

/* 对战属性飞出数字 */
.battle-stat-fly {
  position: absolute;
  font-size: 20px;
  font-weight: 700;
  pointer-events: none;
  animation: statFly 1s ease-out forwards;
  z-index: 10;
}

.battle-stat-fly.win { color: var(--shu); }
.battle-stat-fly.lose { color: var(--wu); }

@keyframes statFly {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-40px) scale(1.3); }
}

/* ===== 动画 ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  z-index: 300;
  pointer-events: none;
  animation: confettiFall 1.5s ease-out forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

@keyframes dmgFloat {
  0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(0.5); }
  20% { transform: translateX(-50%) translateY(-10px) scale(1.2); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-40px) scale(0.8); }
}

/* ===== 大富翁 ===== */
#monopoly-container {
  flex: 1;
  padding: 0;
  overflow-y: auto;
}

.mono-start {
  padding: 16px;
}

.mono-start-banner {
  text-align: center;
  padding: 32px 20px;
  background: linear-gradient(135deg, #2c3e50, #4a6741);
  border-radius: var(--radius);
  color: white;
  margin-bottom: 16px;
}

.mono-start-banner h3 {
  font-family: var(--font-title);
  font-size: 28px;
  margin-bottom: 4px;
}

.mono-start-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mono-rule {
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 14px;
}

/* 游戏中 */
.mono-game {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.mono-status {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
}

.mono-player-info {
  flex: 1;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  opacity: 0.5;
  transition: all 0.3s;
}

.mono-player-info.active {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--gold);
}

/* 地图 */
.mono-map {
  flex: 1;
  min-height: 250px;
  padding: 4px 8px;
}

.mono-map svg {
  display: block;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

#screen-monopoly {
  overflow-y: scroll;
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE/Edge */
}
#screen-monopoly::-webkit-scrollbar {
  display: none;                /* Chrome/Safari */
}

.mono-piece {
  transition: left 0.15s ease, top 0.15s ease;
}

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

@keyframes pieceMoving {
  0%   { transform: translate(-50%, -100%) translateY(0)    scale(1); }
  30%  { transform: translate(-50%, -100%) translateY(-10px) scale(1.1); }
  65%  { transform: translate(-50%, -100%) translateY(-4px) scale(1.05); }
  100% { transform: translate(-50%, -100%) translateY(0)    scale(1); }
}

@keyframes pieceRing {
  0%, 100% { opacity: 0.3;  transform: scale(1); }
  50%       { opacity: 0.75; transform: scale(1.18); }
}

/* 控制区 */
.mono-controls {
  padding: 12px;
  text-align: center;
}

.mono-dice-btn {
  font-size: 20px;
  padding: 14px 48px;
  animation: bounce 1.5s ease-in-out infinite;
}

.mono-dice-rolling {
  font-size: 48px;
  animation: bounce 0.15s ease infinite;
}

.mono-dice-result {
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mono-dice-result span {
  font-size: 18px;
  color: var(--text-light);
}

.mono-waiting {
  color: var(--text-light);
  font-size: 14px;
  padding: 8px;
}

/* 日志 */
.mono-log {
  padding: 8px 12px;
  max-height: 100px;
  overflow-y: auto;
}

.mono-log-entry {
  font-size: 12px;
  color: var(--text-light);
  padding: 3px 0;
  border-bottom: 1px solid #f0f0f0;
  animation: fadeIn 0.3s ease;
}

/* 弹窗 */
.mono-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.mono-popup-overlay.hidden { display: none; }

.mono-popup-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  animation: detailSlideUp 0.3s ease;
  text-align: center;
}

.mono-popup-content h4 {
  font-family: var(--font-title);
  font-size: 20px;
  margin-bottom: 8px;
}

.mono-city-desc {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 12px;
  text-align: left;
  line-height: 1.6;
}

.mono-quiz-q {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.5;
  text-align: left;
}

.mono-quiz-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mono-quiz-opt {
  padding: 11px 14px;
  background: linear-gradient(135deg, #fafafa, #f5f5f5);
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.2s;
  line-height: 1.4;
}

.mono-quiz-opt:active {
  transform: scale(0.97);
  border-color: #667eea;
  background: linear-gradient(135deg, #667eea11, #764ba211);
}

/* 大富翁结果星 */
.mono-result-stars { font-size: 28px; margin: 8px 0; }

/* ===== 全局 UI 增强 ===== */

/* 按钮涟漪效果 */
.btn, .action-card, .quiz-option, .filter-btn, .battle-card-pick, .tab {
  position: relative;
  overflow: hidden;
}

.btn::after, .action-card::after, .quiz-option::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255,255,255,0.3) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.btn:active::after, .action-card:active::after, .quiz-option:active::after {
  opacity: 1;
  transition: opacity 0s;
}

/* 卡片悬浮阴影动画 */
.card-item, .gacha-card, .battle-card-show {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}

.card-item:active {
  transform: scale(0.95);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 进度条动画增强 */
.progress-fill {
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* 问答选项交互增强 */
.quiz-option {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.quiz-option:not(.disabled):active {
  transform: scale(0.97);
}

.quiz-option.correct {
  animation: correctPulse 0.5s ease;
}

.quiz-option.wrong {
  animation: wrongShake 0.4s ease;
}

@keyframes correctPulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* 对战属性值弹出动画 */
.battle-card-show .b-stat {
  transition: all 0.3s ease;
}

.battle-card-show.fighting .b-stat {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
}

/* 图鉴筛选按钮动画 */
.filter-btn {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.filter-btn.active {
  transform: scale(1.05);
}

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

/* ── 手机（< 768px）：竖屏全高，内容单列 ── */
@media (max-width: 767px) {
  #app {
    max-width: 100%;
  }
  .tab-bar {
    max-width: 100%;
  }
}

/* ── 平板 / 桌面（≥ 768px）：全宽全屏，内容区居中 ── */
@media (min-width: 768px) {
  #app {
    max-width: 100%;
  }

  /* tab-bar 全宽，图标和文字略微放大 */
  .tab-bar {
    max-width: 100%;
    height: 64px;
    padding: 0 24px;
  }

  .tab-icon {
    font-size: 22px;
  }

  .tab-label {
    font-size: 10px;
  }

  .tab {
    padding: 8px 6px;
  }

  /* hero 全宽 */
  .home-hero {
    max-width: 100% !important;
    height: 300px;
  }

  .home-stats-bar {
    max-width: 100% !important;
  }

  /* 入口卡片：8列，固定高度不随宽度拉伸 */
  .home-entries {
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
    padding: 8px 24px 20px;
    max-width: 100% !important;
  }

  .entry-card {
    aspect-ratio: unset;
    height: 160px;
  }

  /* 武将卡片：5列 */
  .cards-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .battle-available-cards {
    grid-template-columns: repeat(7, 1fr);
  }

  /* hover 效果 */
  .quiz-option:hover {
    border-color: var(--wei);
    background: var(--wei-light);
    transform: translateX(4px);
  }
  .action-card:hover .action-card-bg { transform: scale(1.12); }
  .action-card:hover { box-shadow: var(--shadow-hover); }
  .card-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
  .entry-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.35); }

  /* ── 各板块内容区：居中约束宽度，避免在大屏拉得过宽 ── */
  .screen {
    padding-bottom: calc(64px + 24px);
  }

  /* 内容居中容器通用模式 */
  #map-container,
  .quiz-list-view,
  .quiz-play-view,
  #quiz-container,
  #gacha-container,
  #dungeon-container,
  #leaderboard-container,
  #achievements-container,
  #monopoly-container,
  .battle-select,
  .battle-arena,
  .cards-filter,
  #cards-grid {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }

  /* 问答题目区在宽屏居中 */
  .quiz-question,
  .quiz-options,
  .quiz-progress,
  .quiz-result,
  .quiz-intro {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
  }

  /* 对战可用武将区 */
  #battle-container {
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
  }

  /* 地图 SVG 居中 */
  #map-container svg {
    max-width: 100%;
  }

  /* 城市面板在宽屏不超过 600px */
  .city-panel {
    max-width: 600px;
  }
}

/* ── 大屏（≥ 1200px）：更大图标，更高 hero ── */
@media (min-width: 1200px) {
  .home-hero {
    height: 360px;
  }

  .tab-bar {
    height: 68px;
  }

  .tab-icon {
    font-size: 24px;
  }

  .tab-label {
    font-size: 11px;
  }

  .home-entries {
    gap: 16px;
    padding: 8px 40px 24px;
  }

  .entry-card {
    height: 180px;
  }

  .cards-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .battle-available-cards {
    grid-template-columns: repeat(8, 1fr);
  }
}
