/* =========================================
   全局重置与日式无障碍风格
   ========================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

:root {
  /* 配色方案：和风/博物馆 */
  --bg-color: #f4f1ea; /* 和纸色 */
  --text-color: #3e3e3e; /* 墨色，非纯黑 */
  --primary-color: #8a3b00; /* 柿渋色 (红褐色)，醒目且沉稳 */
  --secondary-color: #2f4f4f; /* 铁御纳户色 (深蓝灰) */
  --accent-color: #d4ac0d; /* 金茶色 (点缀) */
  --border-color: #c9c5b9;
  --success-color: #2e7d32;
  /* 字体栈：优先日文 */
  --font-stack: 'Hiragino Sans', 'Yu Gothic', 'Meiryo', sans-serif;

  /* 尺寸常量 */
  --header-height: 60px;
  --board-max-width: 95vw; /* 适配手机 */
}

body {
  font-family: var(--font-stack);
  background-color: var(--bg-color);
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, 0.03) 1px, transparent 1px), linear-gradient(to bottom, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 20px 20px; /* 方格纸底纹 */
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  align-items: center;
  overflow-x: hidden;
  /* 防止下拉刷新干扰拖拽 */
  overscroll-behavior: none;
}

.hero-play-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--primary-color) 0%, #b34d00 100%);
  color: #fff;
  padding: 20px 30px;
  border-radius: 16px;
  text-decoration: none;
  box-shadow: 0 10px 25px rgba(138, 59, 0, 0.4);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  animation: pulse-glow 2s infinite;
}

.hero-play-btn:hover,
.hero-play-btn:active {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 15px 35px rgba(138, 59, 0, 0.5);
}

.hero-play-content {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hero-play-title {
  font-size: 1.8rem;
  font-weight: bold;
  font-family: 'Cormorant Garamond', serif;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.hero-play-subtitle {
  font-size: 0.9rem;
  opacity: 0.9;
}

.hero-play-icon {
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.2);
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding-left: 5px;
}

@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(138, 59, 0, 0.6);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(138, 59, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(138, 59, 0, 0);
  }
}

/* =========================================
   通用组件
   ========================================= */

/* 按钮：大尺寸、高对比、易点击 */
.btn-primary,
.btn-secondary,
.btn-line {
  display: inline-block;
  padding: 15px 30px;
  font-size: 1.2rem; /* 19px+ */
  font-weight: bold;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 0.1s,
    opacity 0.2s;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
  min-width: 200px;
}

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

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

.btn-line {
  background-color: #06c755; /* LINE Green */
  color: white;
}

.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.98);
}

.small-btn {
  padding: 10px 20px;
  font-size: 1rem;
  min-width: auto;
}

/* 标题 */
h1,
h2,
h3 {
  font-weight: 700;
  line-height: 1.4;
}

/* =========================================
   首页 (Portal) 样式
   ========================================= */
.portal-container {
  width: 100%;
  max-width: 600px;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 30px;
}

.portal-title {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 10px;
  border-bottom: 4px solid var(--accent-color);
  padding-bottom: 15px;
  width: 100%;
}

.portal-subtitle {
  font-size: 1.1rem;
  color: #666;
  margin-top: -20px;
}

/* 新增：指南板块 */
.guide-section {
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  width: 100%;
  border: 1px dashed var(--border-color);
}
.guide-title {
  font-size: 1.1rem;
  color: var(--secondary-color);
  margin-bottom: 10px;
  text-align: center;
}
.guide-steps {
  display: flex;
  justify-content: space-around;
}
.guide-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.9rem;
  color: #555;
}
.guide-icon {
  font-size: 1.8rem;
  margin-bottom: 5px;
}

.menu-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.menu-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 25px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.menu-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.menu-card h2 {
  font-size: 1.5rem;
  color: var(--secondary-color);
}

.menu-card p {
  font-size: 1rem;
  color: #666;
}

/* =========================================
   游戏页布局 (Level)
   ========================================= */
.game-container {
  width: 100%;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  gap: 15px;
}

body#page-level-sangoku .game-container {
  max-width: 100%;
}

.game-header {
  margin: 0 auto;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 15px 20px;
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.home-btn {
  text-decoration: none;
  font-size: 1.5rem;
  padding: 5px;
  border-radius: 5px;
  background: #f0f0f0;
  line-height: 1;
}

/* 音乐开关按钮 */
.music-btn {
  font-size: 1.3rem;
  padding: 5px 10px;
  border-radius: 5px;
  background: #f0f0f0;
  border: none;
  cursor: pointer;
  line-height: 1;
  color: var(--secondary-color);
  opacity: 0.6;
  transition: all 0.2s;
}

.music-btn.active {
  background: #e8f5e9;
  color: var(--success-color);
  opacity: 1;
}

.level-info {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--primary-color);
}

.timer-box {
  font-size: 1.5rem;
  font-family: monospace; /* 等宽字体防止跳动 */
  font-weight: bold;
  color: var(--secondary-color);
  background: #eef;
  padding: 5px 15px;
  border-radius: 6px;
  transition:
    color 0.3s,
    background-color 0.3s;
}

/* 倒计时紧急状态 (最后10秒) */
.timer-urgent {
  color: #d32f2f !important;
  background-color: #ffebee !important;
  animation: pulse-timer 1s infinite;
}

@keyframes pulse-timer {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* 响应式调整：移动端 Header 优化 */
@media (max-width: 480px) {
  .game-header {
    padding: 10px;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .level-info {
    font-size: 1.1rem;
    order: 1;
    width: 100%;
    text-align: center;
    margin-bottom: 5px;
  }
  .timer-box {
    font-size: 1.2rem;
    padding: 4px 10px;
    order: 3;
  }
  .game-header > div:first-child {
    order: 2;
  }
}

/* 棋盘容器 */
.game-board-wrapper {
  position: relative;
  /* 宽高由 JS 动态设置 */
  margin: 0 auto;
  border: 6px solid #fff;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  background: #ccc; /* 占位色 */
  touch-action: none;
}

.puzzle-grid {
  display: grid;
  /* grid-template由JS动态生成 */
  width: 100%;
  height: 100%;
  background-color: #c08756;
  position: relative;
}

/* 拼块样式 */
.tile {
  background-repeat: no-repeat;
  /* background-size 由 JS 动态设置 */
  box-sizing: border-box;
  border: none;
  background-clip: padding-box;
  position: relative;
  transition:
    transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    filter 0.1s;
  z-index: 1;
  border-radius: 10px;
}

.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 0.5px solid #fff;
  border-radius: inherit;
  box-sizing: border-box;
  pointer-events: none;
}

@media (max-width: 480px) {
  .tile {
    border-radius: 5px;
  }
}

/* 圆角处理：仅在组的边缘应用 (如果需要动态圆角可以保留，但用户要求固定圆角) */
/* 这里我们保留用户要求的固定圆角，或者根据连接状态取消圆角以实现完美融合 */
.tile.connect-top {
  border-top: none;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.tile.connect-top::after {
  border-top-color: transparent;
}
.tile.connect-bottom {
  border-bottom: none;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.tile.connect-bottom::after {
  border-bottom-color: transparent;
}
.tile.connect-left {
  border-left: none;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.tile.connect-left::after {
  border-left-color: transparent;
}
.tile.connect-right {
  border-right: none;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.tile.connect-right::after {
  border-right-color: transparent;
}

/* 拖拽时的源拼块（变淡） */
.tile.drag-source {
  opacity: 0.3;
  filter: grayscale(0.8);
}

/* 拖拽经过的目标拼块（高亮） */
.tile.drag-over {
  filter: brightness(1.2);
  box-shadow: inset 0 0 0 3px rgba(255, 235, 59, 0.8);
  z-index: 5;
}

/* 拖拽组容器 (悬浮层) */
.drag-group-container {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  transform: scale(1.02); /* 稍微放大一点 */
  transform-origin: center;
}

/* 克隆体样式 */
.drag-clone {
  position: absolute; /* 相对于 group-container 定位 */
  opacity: 0.95;
  border: none;
  box-sizing: border-box;
  background-repeat: no-repeat;
}

/* 焊接特效 */
.tile.just-merged {
  animation: snap-pop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 10;
}
@keyframes snap-pop {
  0% {
    filter: brightness(1);
  }
  30% {
    filter: brightness(1.5);
  }
  100% {
    filter: brightness(1);
  }
}

/* 交叉推荐板块 */
.cross-promo {
  margin-top: 10px;
  padding-top: 15px;
  border-top: 1px dashed #ccc;
  text-align: center;
  width: 100%;
}
.cross-promo p {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 8px;
}

/* 文章模块 (AdSense SEO Friendly) */
.content-article {
  width: 100%;
  max-width: 700px;
  margin: 30px auto;
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.content-article h3 {
  font-size: 1.2rem;
  color: var(--primary-color);
  margin-bottom: 10px;
  border-left: 4px solid var(--accent-color);
  padding-left: 10px;
}

.content-article p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #555;
  margin-bottom: 15px;
}

/* 关卡故事卡片样式 */
.story-card {
  background-color: #fffaf0; /* 略带暖色背景 */
  border: 2px solid #e0d0b0;
  margin-top: 15px;
  margin-bottom: 10px;
}

/* =========================================
   关卡胜利内联区域 (Level Complete Inline)
   ========================================= */
.level-complete-container {
  width: 100%;
  text-align: center;
  padding: 20px;
  background: #fff;
  border-radius: 12px;
  border: 2px solid var(--primary-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 10;
  animation: slide-up 0.5s ease-out;
}

.level-complete-container.hidden {
  display: none;
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.complete-title {
  color: var(--primary-color);
  font-size: 1.8rem;
  margin-bottom: 15px;
}

.complete-actions {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
}

/* =========================================
   新：关卡介绍页 (Intro Page)
   ========================================= */
.intro-page {
  width: 100%;
  max-width: 600px;
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  margin: 20px 0;
  display: flex;
  flex-direction: column;
}

.intro-header {
  background: var(--primary-color);
  color: white;
  padding: 40px 20px;
  text-align: center;
  position: relative;
}

.intro-title-main {
  font-size: 2.2rem;
  margin-bottom: 5px;
}

.intro-subtitle {
  font-size: 1rem;
  opacity: 0.9;
}

.intro-body {
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  gap: 25px;
  align-items: center;
}

.level-card {
  width: 100%;
  background: #fdfbf7;
  border: 2px solid #e0d0b0;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.level-display-title {
  font-size: 1.8rem;
  color: var(--primary-color);
  margin-bottom: 5px;
}

.difficulty-badge {
  display: inline-block;
  background: var(--accent-color);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
  margin-bottom: 15px;
}

.story-preview {
  text-align: left;
  border-top: 1px solid #eee;
  padding-top: 15px;
}

.story-preview h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--secondary-color);
}

.story-preview p {
  font-size: 0.95rem;
  color: #666;
  line-height: 1.5;
}

.how-to-play {
  width: 100%;
  background: #f0f4f4;
  padding: 15px;
  border-radius: 8px;
}

.how-to-play h3 {
  font-size: 1rem;
  margin-bottom: 10px;
  color: var(--secondary-color);
}

.how-to-play ul {
  padding-left: 20px;
  font-size: 0.9rem;
  color: #555;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.start-large-btn {
  width: 100%;
  font-size: 1.4rem;
  padding: 18px;
}

.back-link-simple {
  color: #999;
  text-decoration: none;
  font-size: 0.9rem;
}

.game-play-area.hidden,
.intro-page.hidden {
  display: none;
}

/* =========================================
   新：加载页 (Loading Screen)
   ========================================= */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.loading-logo {
  font-size: 3rem;
  color: var(--primary-color);
  margin-bottom: 20px;
  animation: pulse 1.5s infinite;
}

.loading-bar-container {
  width: 200px;
  height: 6px;
  background: #ddd;
  border-radius: 3px;
  overflow: hidden;
}

.loading-bar {
  width: 0%;
  height: 100%;
  background: var(--primary-color);
  animation: loading-progress 1.5s forwards;
}

@keyframes loading-progress {
  to {
    width: 100%;
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* =========================================
   新：关卡开始飘窗 (Level Start Toast)
   ========================================= */
#level-toast {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 15px 30px;
  border-radius: 30px;
  z-index: 3000;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.3s,
    transform 0.3s;
}

#level-toast.show {
  opacity: 1;
  transform: translate(-50%, -40%);
}

.toast-title {
  font-size: 1.4rem;
  font-weight: bold;
  display: block;
}

.toast-diff {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* =========================================
   新：设置模态框 (Settings Modal)
   ========================================= */
.settings-modal .modal-content {
  max-width: 350px;
}

.settings-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid #eee;
}

.settings-option:last-child {
  border-bottom: none;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: '';
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--success-color);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* =========================================
   新：新手引导 (Tutorial)
   ========================================= */
.tutorial-hint {
  position: absolute;
  z-index: 100;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: float 2s infinite ease-in-out;
}

.tutorial-hand {
  font-size: 2.5rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.tutorial-text {
  background: var(--primary-color);
  color: white;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  margin-top: 5px;
  white-space: nowrap;
}

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

.tile.tutorial-highlight {
  box-shadow: 0 0 0 4px var(--accent-color);
  z-index: 10;
}

/* =========================================
   美人画廊 (Gallery System)
   ========================================= */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  padding: 10px;
}

.gallery-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.3s ease;
}

.gallery-card.unlocked {
  border-color: var(--accent-color);
  box-shadow: 0 0 15px rgba(212, 172, 13, 0.3);
  animation: unlock-glow 2s infinite alternate;
}

@keyframes unlock-glow {
  from {
    box-shadow: 0 0 5px rgba(212, 172, 13, 0.2);
  }
  to {
    box-shadow: 0 0 20px rgba(212, 172, 13, 0.5);
  }
}

.gallery-fragments-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  aspect-ratio: 4/5;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}

.gallery-fragment {
  width: 100%;
  height: 100%;
  background-color: #ccc;
  background-repeat: no-repeat;
}

.gallery-fragment.locked {
  filter: grayscale(1) brightness(0.5) blur(5px) !important;
  opacity: 0.3;
}

.gallery-fragment.owned {
  opacity: 1;
}
.gallery-fragment.owned:not(.blurred) {
  filter: none;
}

.blurred {
  filter: blur(5px);
}

.gallery-info h3 {
  font-size: 1rem;
  margin-bottom: 2px;
  color: var(--secondary-color);
}

.gallery-status {
  font-size: 0.75rem;
  color: #888;
  font-weight: bold;
}

.gallery-desc {
  font-size: 0.8rem;
  color: #555;
  margin-top: 5px;
  line-height: 1.4;
  text-align: left;
  border-top: 1px solid #eee;
  padding-top: 5px;
}

/* 奖励弹窗与飘窗 */
.reward-card {
  animation: pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.unlocked-special {
  border-top-color: var(--accent-color);
  background: linear-gradient(to bottom, #fffaf0, #fff);
}

.reward-char-preview {
  width: 150px;
  height: 187.5px; /* 4:5 ratio */
  margin: 0 auto;
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  border: 3px solid #fff;
  filter: blur(5px);
}

@keyframes pop-in {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 欠片获得飘窗 */
.fragment-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translate(-50%, 100px);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  z-index: 5000;
  transition:
    transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    opacity 0.5s;
  opacity: 0;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.fragment-toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.toast-content {
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.toast-icon {
  font-size: 1.8rem;
}

.toast-text p {
  margin: 0;
  font-size: 1rem;
}

.toast-text small {
  opacity: 0.7;
  font-size: 0.8rem;
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================
   模态框 (结算/排行榜/Intro)
   ========================================= */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 20px;
}

.overlay.hidden {
  display: none;
}

.modal-content {
  background: #fff;
  width: 100%;
  max-width: 450px;
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  border-top: 8px solid var(--primary-color);
}

.intro-card {
  border-top-color: var(--accent-color);
  padding-top: 40px;
  position: relative;
}

.intro-badge {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-color);
  color: white;
  padding: 5px 15px;
  border-radius: 20px;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.intro-text-box {
  background: #f9f9f9;
  padding: 15px;
  border-radius: 8px;
  margin: 10px 0;
  text-align: left;
  border-left: 4px solid #ddd;
}

.modal-title {
  font-size: 1.8rem;
  color: var(--primary-color);
  margin-bottom: 15px;
}

.modal-desc {
  font-size: 1.2rem;
  margin-bottom: 25px;
  color: #444;
}

.leaderboard {
  margin: 20px 0;
  text-align: left;
  background: #f9f9f9;
  padding: 15px;
  border-radius: 8px;
}

.leaderboard h3 {
  font-size: 1.1rem;
  color: var(--secondary-color);
  border-bottom: 1px solid #ddd;
  padding-bottom: 5px;
  margin-bottom: 10px;
}

.lb-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 1rem;
  border-bottom: 1px dashed #eee;
}

.lb-item:last-child {
  border-bottom: none;
}
.lb-rank {
  font-weight: bold;
  width: 30px;
}
.lb-name {
  flex: 1;
}
.lb-score {
  font-weight: bold;
  color: var(--primary-color);
}

/* =========================================
   底部导航
   ========================================= */
.back-link {
  margin-top: 20px;
  color: #666;
  text-decoration: underline;
  font-size: 1rem;
  cursor: pointer;
}

/* Confetti */
.confetti-particle {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  border-radius: 2px;
}

/* PWA Install Modal */
.pwa-install-modal {
  background: linear-gradient(135deg, #8a3b00 0%, #5a2600 100%);
  color: #f4f1ea;
  border: 3px solid #d4af37;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 86c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zm66-3c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zm-46-43c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zm20-46c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23ffffff' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
}

.pwa-silhouette {
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 200px;
  height: 300px;
  background-image: url('https://picsum.photos/seed/beauty/400/600');
  background-size: cover;
  opacity: 0.2;
  mask-image: linear-gradient(to left, black, transparent);
  -webkit-mask-image: linear-gradient(to left, black, transparent);
  pointer-events: none;
  filter: grayscale(1) contrast(1.5);
}

.pwa-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 20px;
}

.pwa-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
  margin-bottom: 15px;
  color: #ffd700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.pwa-desc {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 25px;
  color: #f4f1ea;
}

/* iOS Hint */
.ios-pwa-hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #8a3b00;
  color: white;
  padding: 15px 20px;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  width: 90%;
  max-width: 350px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 2px solid #d4af37;
}

.ios-pwa-hint::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid #8a3b00;
}

.ios-pwa-icon {
  font-size: 1.5rem;
  margin: 10px 0;
}

@media screen and (max-width: 640px) {
  .hide-on-mob {
    display: none !important;
  }
}
@media screen and (min-width: calc(640px + 1px)) {
  .hide-on-pc {
    display: none !important;
  }
}

.game-wrap {
  display: flex;
  align-items: flex-start;
}
