/* ============================================================
 * PixelGame 样式 —— 全英文 / 白色主题 / 手机适配
 * ============================================================ */
@font-face {
  font-family: 'Kenney Pixel Square';
  src: url('../fonts/Kenney Pixel Square.ttf') format('truetype');
}
@font-face {
  font-family: 'Kenney Mini Square';
  src: url('../fonts/Kenney Mini Square.ttf') format('truetype');
}

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

html, body {
  height: 100%;
  /* 锁定页面:禁止滚动/缩放/下拉 */
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Kenney Mini Square', 'Segoe UI', sans-serif;
  background: #f2f3f5; /* 与地图地面色调相近,手机端视觉上延伸为整屏游戏画面 */
  color: #1c1f2b;
}

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-wrap {
  position: relative;
}

#game {
  display: block;
  background: #ffffff;
  border-radius: 4px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.12);
  touch-action: none;
}

/* ---------------- Loading ---------------- */
#loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
#loading.show { opacity: 1; pointer-events: auto; }
#loading .msg {
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: 22px;
  letter-spacing: 3px;
  color: #8a8f9e;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* ---------------- Title (Begin.png 开始页) ---------------- */
#title {
  position: fixed;
  inset: 0;
  z-index: 20;
  cursor: pointer;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}
#title.show { opacity: 1; pointer-events: auto; }

/* 与 Begin.png 同宽高比的居中卡片,文字按卡片百分比定位。
   卡片加高并把背景图贴顶,让中部图案上移,给底部按钮让位 */
.title-card {
  position: relative;
  width: min(100vw, calc(100vh * 0.685));
  aspect-ratio: 534 / 780;
  background: url('../images/sprites/Begin/Begin.png') no-repeat center top / 100% auto;
}

.title-name {
  position: absolute;
  top: 15%;
  left: 0;
  width: 100%;
  text-align: center;
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: clamp(28px, 5.5vh, 68px);
  letter-spacing: 3px;
  color: #e04060;
  pointer-events: none;
}

.title-actions {
  position: absolute;
  bottom: 3%;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  /* 不单独设 pointer-events:auto,避免标题隐藏后按钮仍可点(拦截手机游戏内点击) */
}

.title-start {
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: clamp(22px, 4vh, 46px);
  letter-spacing: 8px;
  color: #20c080;
  cursor: pointer;
  animation: pulse 1.3s ease-in-out infinite;
}

.title-continue {
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: clamp(16px, 2.8vh, 28px);
  letter-spacing: 4px;
  color: #e04060;
  cursor: pointer;
}

.title-set {
  font-family: 'Kenney Mini Square', 'Segoe UI', sans-serif;
  font-size: clamp(14px, 2.4vh, 22px);
  letter-spacing: 6px;
  color: #1c1f2b;
  border: 2px solid #1c1f2b;
  border-radius: 4px;
  padding: 6px 26px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.title-set:hover { background: #1c1f2b; color: #ffffff; }

.title-new {
  font-family: 'Kenney Mini Square', 'Segoe UI', sans-serif;
  font-size: clamp(14px, 2.4vh, 22px);
  letter-spacing: 5px;
  color: #e04060;
  border: 2px solid #e04060;
  border-radius: 4px;
  padding: 6px 22px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.title-new:hover { background: #e04060; color: #ffffff; }

.title-collect {
  font-family: 'Kenney Mini Square', 'Segoe UI', sans-serif;
  font-size: clamp(14px, 2.4vh, 22px);
  letter-spacing: 5px;
  color: #a060c0;
  border: 2px solid #a060c0;
  border-radius: 4px;
  padding: 6px 22px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.title-collect:hover { background: #a060c0; color: #ffffff; }

/* ---------------- 游戏内 SET 按钮(画面内右上角) ---------------- */
#set-btn-game {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 15;
  font-family: 'Kenney Mini Square', 'Segoe UI', sans-serif;
  font-size: 13px;
  letter-spacing: 3px;
  color: #1c1f2b;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #1c1f2b;
  border-radius: 4px;
  padding: 5px 14px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
#set-btn-game:hover { background: #1c1f2b; color: #ffffff; }

/* ---------------- 操作提示 ---------------- */
#hint {
  position: fixed;
  inset: 0;
  z-index: 34;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
#hint.show { opacity: 1; pointer-events: auto; }
.hint-panel {
  background: #ffffff;
  border: 2px solid #1c1f2b;
  border-radius: 6px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.2);
  padding: 26px 34px;
  width: min(84vw, 320px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  cursor: pointer;
}
.hint-title {
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: 24px;
  letter-spacing: 5px;
  color: #e04060;
}
.hint-row {
  font-family: 'Kenney Mini Square', 'Segoe UI', sans-serif;
  font-size: 15px;
  letter-spacing: 1px;
  color: #1c1f2b;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hint-key {
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: 15px;
  color: #20c080;
  border: 2px solid #20c080;
  border-radius: 4px;
  padding: 2px 8px;
}
.hint-go {
  margin-top: 8px;
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: 16px;
  letter-spacing: 4px;
  color: #1c1f2b;
  animation: pulse 1.2s ease-in-out infinite;
}

/* ---------------- 设置面板 ---------------- */
#settings {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
#settings.show { opacity: 1; pointer-events: auto; }

.set-panel {
  background: #ffffff;
  border: 2px solid #1c1f2b;
  border-radius: 6px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.22);
  padding: 28px 36px;
  width: min(86vw, 360px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}
.set-title {
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: 26px;
  letter-spacing: 6px;
  text-align: center;
  color: #1c1f2b;
}
.set-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.set-label {
  font-family: 'Kenney Mini Square', 'Segoe UI', sans-serif;
  font-size: 14px;
  letter-spacing: 2px;
  color: #5a6072;
  width: 74px;
}
#volume {
  flex: 1;
  accent-color: #20c080;
}
.set-val {
  font-family: 'Kenney Mini Square', 'Segoe UI', sans-serif;
  font-size: 14px;
  color: #1c1f2b;
  width: 44px;
  text-align: right;
}
.set-btn {
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: 17px;
  letter-spacing: 4px;
  color: #1c1f2b;
  background: #ffffff;
  border: 2px solid #1c1f2b;
  border-radius: 4px;
  padding: 11px 0;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.set-btn:hover {
  background: #1c1f2b;
  color: #ffffff;
  transform: translateY(-1px);
}

/* ---------------- 抽卡(每关通关后) ---------------- */
#card-draw {
  position: fixed;
  inset: 0;
  z-index: 36;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.94);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
#card-draw.show { opacity: 1; pointer-events: auto; }
.draw-panel {
  background: #ffffff;
  border: 2px solid #1c1f2b;
  border-radius: 6px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.2);
  padding: 26px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.draw-title {
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: 28px;
  letter-spacing: 5px;
  color: #20c080;
}
.draw-sub {
  font-family: 'Kenney Mini Square', 'Segoe UI', sans-serif;
  font-size: 15px;
  color: #5a6072;
  letter-spacing: 2px;
}
.draw-cards {
  display: flex;
  gap: 22px;
  justify-content: center;
}
.draw-slot {
  position: relative;
  width: 32px;
  height: 32px;
  cursor: pointer;
}
.draw-slot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* 阴影贴合素材边缘(不拉伸、不加白底) */
  filter: drop-shadow(4px 4px 6px rgba(0, 0, 0, 0.32));
  transition: opacity 0.9s ease, transform 0.3s ease;
}
.draw-slot:hover img { transform: translateY(-3px); }
.draw-slot .draw-front { opacity: 0; }
.draw-slot.revealed { cursor: default; }
.draw-slot.revealed .draw-back { opacity: 0; }
.draw-slot.revealed .draw-front { opacity: 1; }
.draw-slot.revealed:hover img { transform: none; }
.draw-go {
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: 18px;
  letter-spacing: 4px;
  color: #1c1f2b;
  background: #ffffff;
  border: 2px solid #1c1f2b;
  border-radius: 4px;
  padding: 10px 34px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.draw-go:hover { background: #1c1f2b; color: #ffffff; }
.draw-strong {
  font-family: 'Kenney Mini Square', 'Segoe UI', sans-serif;
  font-size: 13px;
  letter-spacing: 2px;
  color: #8a8f9e;
}

/* ---------------- 收藏图鉴 ---------------- */
#collection {
  position: fixed;
  inset: 0;
  z-index: 38;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
#collection.show { opacity: 1; pointer-events: auto; }
.collect-panel {
  background: #ffffff;
  border: 2px solid #1c1f2b;
  border-radius: 6px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.2);
  padding: 20px 26px 26px;
  width: min(94vw, 620px);
  position: relative;
}
.collect-back {
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: 14px;
  letter-spacing: 3px;
  color: #1c1f2b;
  background: #ffffff;
  border: 2px solid #1c1f2b;
  border-radius: 4px;
  padding: 6px 14px;
  cursor: pointer;
}
.collect-back:hover { background: #1c1f2b; color: #ffffff; }
.collect-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.collect-navs {
  display: flex;
  align-items: center;
  gap: 10px;
}
.collect-title {
  display: none; /* 花色英文标题已按要求删去 */
}
.collect-nav {
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: 15px;
  letter-spacing: 3px;
  color: #1c1f2b;
  background: #ffffff;
  border: 2px solid #1c1f2b;
  border-radius: 4px;
  padding: 7px 18px;
  cursor: pointer;
}
.collect-nav:hover { background: #1c1f2b; color: #ffffff; }
.collect-grid {
  display: grid;
  grid-template-columns: repeat(7, 32px);
  gap: 14px;
  justify-content: center;
}
.collect-card {
  width: 32px;
  height: 32px;
  object-fit: contain;
  /* 阴影贴合素材边缘,无白底 */
  filter: drop-shadow(4px 4px 6px rgba(0, 0, 0, 0.32));
}

/* ---------------- 集齐卡片作者感谢页 ---------------- */
#thanks {
  position: fixed;
  inset: 0;
  z-index: 39;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
#thanks.show { opacity: 1; pointer-events: auto; }
.thanks-panel {
  background: #ffffff;
  border: 2px solid #1c1f2b;
  border-radius: 6px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.22);
  padding: 34px 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.thanks-title {
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: 26px;
  letter-spacing: 4px;
  color: #20c080;
}
.thanks-author {
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: 40px;
  letter-spacing: 6px;
  color: #e04060;
}
.thanks-btn {
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: 17px;
  letter-spacing: 4px;
  color: #1c1f2b;
  background: #ffffff;
  border: 2px solid #1c1f2b;
  border-radius: 4px;
  padding: 11px 34px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.thanks-btn:hover { background: #1c1f2b; color: #ffffff; }

/* ---------------- Toast(顶部小字提示) ---------------- */
#toast {
  position: fixed;
  left: 50%;
  top: 2%;
  transform: translateX(-50%);
  z-index: 12;
  padding: 8px 22px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid #20c080;
  color: #177a52;
  font-family: 'Kenney Mini Square', 'Segoe UI', sans-serif;
  font-size: 16px;
  letter-spacing: 1px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(4px); }

/* ---------------- End screen ---------------- */
#end-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  text-align: center;
  z-index: 25;
  background: rgba(255, 255, 255, 0.88);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
#end-screen.show { opacity: 1; pointer-events: auto; }
#end-title {
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: clamp(36px, 7vw, 64px);
  letter-spacing: 6px;
}
#end-screen.win #end-title { color: #20c080; }
#end-screen.lose #end-title { color: #e04060; }
#end-text {
  font-family: 'Kenney Mini Square', 'Segoe UI', sans-serif;
  font-size: 18px;
  color: #5a6072;
}
#end-btn {
  margin-top: 8px;
  padding: 14px 44px;
  font-family: 'Kenney Pixel Square', 'Segoe UI', sans-serif;
  font-size: 22px;
  letter-spacing: 4px;
  border-radius: 4px;
  border: 2px solid #1c1f2b;
  background: #ffffff;
  color: #1c1f2b;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.3s, background 0.2s, color 0.2s;
}
#end-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
  background: #1c1f2b;
  color: #ffffff;
}

/* ---------------- Fade ---------------- */
#fade {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
}
#fade.on { opacity: 1; pointer-events: auto; }
