:root {
  --bg-outer: #1a1510;
  --bg-shell: #251e17;
  --parchment-light: #fbf6e9;
  --parchment-mid: #f3e8cf;
  --parchment-dark: #e4d3b0;
  --gold-bright: #f2c86b;
  --gold-mid: #c5984b;
  --gold-deep: #8b6329;
  --ink-dark: #382312;
  --ink-mid: #6b4f34;
  --ink-soft: #967a5c;
  --btn-brown-top: #9d7b54;
  --btn-brown-bot: #6d4f32;
  --danger: #c63f2f;
  --jade: #3c8c68;
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "SimSun", Georgia, serif;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  background: radial-gradient(circle at 50% 25%, #34291d 0%, #17120d 72%);
  font-family: var(--font-sans);
  color: var(--ink-dark);
}

.hidden {
  display: none !important;
}

/* 手机竖屏外壳：移动端铺满，桌面端居中拟真小游戏屏 */
.app-shell {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  max-height: 920px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #2b2219 0%, #1e1812 100%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(212, 175, 106, 0.25);
  overflow: hidden;
}

@media (min-width: 460px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .app-shell {
    height: min(94dvh, 860px);
    border-radius: 26px;
  }
}

/* ============ 顶部 HUD & 微信胶囊 ============ */
.top-hud {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 8px;
  background: linear-gradient(180deg, rgba(24, 17, 11, 0.88) 0%, rgba(24, 17, 11, 0.35) 100%);
  gap: 8px;
  flex-shrink: 0;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px 0 7px;
  border-radius: 999px;
  background: rgba(34, 24, 15, 0.82);
  border: 1px solid rgba(216, 178, 107, 0.45);
  color: #f7e9cb;
  font-size: 13px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 232, 179, 0.16);
}

.hud-stamina-btn {
  cursor: pointer;
  padding-right: 5px;
  transition: transform 0.12s;
}
.hud-stamina-btn:active {
  transform: scale(0.96);
}

.hud-coin-icon, .hud-gourd-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.hud-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, #e7b55b, #b67d2a);
  color: #2e1a08;
  font-size: 13px;
  font-weight: 800;
  margin-left: 2px;
}

.hud-buff-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f3bd49, #d4881e);
  color: #2e1905;
  white-space: nowrap;
}
.hud-buff-tag.buff-jade {
  background: linear-gradient(90deg, #6fd6a7, #2f8b63);
  color: #0e2c1e;
}

.wx-capsule {
  display: inline-flex;
  align-items: center;
  height: 30px;
  border-radius: 999px;
  background: rgba(25, 20, 16, 0.72);
  border: 1px solid rgba(255, 240, 210, 0.25);
  overflow: hidden;
  flex-shrink: 0;
}

.wx-cap-btn {
  border: none;
  background: transparent;
  color: #f6ead4;
  font-size: 13px;
  font-weight: 700;
  padding: 0 11px;
  height: 100%;
  cursor: pointer;
}
.wx-cap-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.wx-cap-sep {
  width: 1px;
  height: 14px;
  background: rgba(255, 240, 210, 0.24);
}

/* ============ 主视口与页面切换 ============ */
.main-viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.view.active {
  display: flex;
}

/* ============ 1. 首页（最左按钮，大封面挑战大厅） ============ */
.view-home {
  position: relative;
  background: #1f1912;
}

.home-backdrop-art {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 20%;
  opacity: 0.34;
  filter: blur(2px) saturate(0.95);
  transform: scale(1.04);
}
.home-backdrop-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(28, 21, 14, 0.65) 0%, rgba(28, 21, 14, 0.45) 42%, rgba(24, 18, 12, 0.96) 86%);
}

.home-content {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 16px 14px;
  overflow-y: auto;
  gap: 12px;
}

.home-emblem-block {
  text-align: center;
  padding-top: 6px;
}

.home-subtitle-tag {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(212, 168, 86, 0.16);
  border: 1px solid rgba(235, 196, 118, 0.42);
  color: #f4d694;
  font-size: 11px;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}

.home-title {
  font-family: var(--font-serif);
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 6px;
  background: linear-gradient(180deg, #fff6db 0%, #eec26b 55%, #b87e2d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.65));
}

.home-tagline {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(244, 227, 194, 0.82);
  letter-spacing: 0.6px;
}

.home-showcase-card {
  display: flex;
  gap: 12px;
  padding: 11px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(249, 241, 222, 0.96), rgba(234, 218, 186, 0.94));
  border: 1.5px solid #cfa863;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.showcase-thumb-wrap {
  position: relative;
  width: 78px;
  height: 104px;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid #a87e3e;
  flex-shrink: 0;
  background: #3a2a1a;
}
.showcase-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.showcase-diff-badge {
  position: absolute;
  top: 5px;
  left: 5px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(45, 92, 68, 0.92);
  color: #fff6e0;
}
.showcase-diff-badge.hard {
  background: rgba(164, 42, 30, 0.92);
}

.showcase-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}
.showcase-lv {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 800;
  color: var(--ink-dark);
}
.showcase-meta {
  font-size: 12px;
  color: var(--ink-mid);
  font-weight: 600;
}
.showcase-progress-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--ink-soft);
}
.showcase-progress-bar {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: rgba(124, 91, 46, 0.22);
  overflow: hidden;
}
.showcase-progress-bar > div {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #d69838, #9c5819);
  transition: width 0.3s ease;
}

.home-buff-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.active-buff-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(242, 198, 92, 0.18);
  border: 1px solid rgba(242, 198, 92, 0.52);
  color: #fce29a;
}

.home-cta-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-imperial-lg {
  position: relative;
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid #f7d98e;
  border-radius: 16px;
  background: linear-gradient(180deg, #c63f2a 0%, #8f2214 100%);
  color: #fff6df;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: 0 8px 20px rgba(120, 24, 12, 0.5), inset 0 1px 0 rgba(255, 224, 152, 0.55);
  transition: transform 0.12s;
}
.btn-imperial-lg:active {
  transform: scale(0.98);
}
.btn-main-text {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 2px;
}
.btn-sub-cost {
  font-size: 11px;
  color: #ffe2a4;
  opacity: 0.92;
}

.btn-pouch-entry {
  position: relative;
  width: 100%;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1.5px solid #d7b16a;
  background: linear-gradient(180deg, #f8efd9 0%, #e9d5ae 100%);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.12s;
}
.btn-pouch-entry:active {
  transform: scale(0.98);
}
.pouch-entry-icon {
  font-size: 26px;
  line-height: 1;
}
.pouch-entry-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pouch-entry-label strong {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--ink-dark);
}
.pouch-entry-label small {
  font-size: 11px;
  color: var(--ink-mid);
}
.red-dot {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e23828;
  box-shadow: 0 0 0 2px #f8efd9;
}

.home-inventory-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.inv-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 4px;
  border-radius: 10px;
  background: rgba(248, 238, 214, 0.11);
  border: 1px solid rgba(226, 189, 122, 0.28);
  color: #efe0c1;
  font-size: 11px;
}
.inv-chip strong {
  color: #ffd97a;
  font-size: 12px;
}

/* ============ 2. 玩法（1-30关连续列表） & 3. 画卷档案 ============ */
.view-levels, .view-archive {
  background: linear-gradient(180deg, #f3e8cf 0%, #e7d6b3 100%);
}

.view-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid rgba(154, 118, 66, 0.25);
  background: rgba(251, 246, 233, 0.72);
  flex-shrink: 0;
}

.view-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 800;
  color: var(--ink-dark);
  letter-spacing: 1px;
}
.view-sub {
  font-size: 11px;
  color: var(--ink-mid);
  margin-top: 2px;
}

.btn-mini-pouch {
  position: relative;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #c59648;
  background: linear-gradient(180deg, #9d7b54, #6e5033);
  color: #fff6e0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.mini-pouch-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e23828;
  box-shadow: 0 0 0 2px #f6ecd5;
}

.levels-filter-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  flex-shrink: 0;
}
.filter-tab {
  flex: 1;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(158, 122, 68, 0.45);
  background: rgba(255, 250, 238, 0.7);
  color: var(--ink-mid);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.filter-tab.active {
  background: linear-gradient(180deg, #9b774f, #6e4f31);
  color: #fff7e3;
  border-color: #7b552c;
}

.levels-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 18px;
}

.chapter-block {
  margin-bottom: 16px;
}
.chapter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px;
}
.chapter-name {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-dark);
}
.chapter-desc {
  font-size: 11px;
  color: var(--ink-mid);
  margin: 0 4px 8px;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
.level-grid-flat {
  padding-top: 8px;
}

.level-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #fcf7eb;
  border: 1.5px solid #cfb07a;
  box-shadow: 0 4px 10px rgba(74, 48, 20, 0.12);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.12s;
}
.level-card:active {
  transform: scale(0.97);
}
.level-card.locked {
  opacity: 0.72;
  filter: grayscale(0.45);
}
.level-card.current {
  border-color: #c83e2b;
  box-shadow: 0 0 0 2px rgba(200, 62, 43, 0.25), 0 6px 14px rgba(130, 35, 20, 0.2);
}

.level-thumb-box {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #36291c;
  overflow: hidden;
}
.level-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.level-card.locked .level-thumb-box img {
  filter: blur(4px) brightness(0.55);
  transform: scale(1.06);
}

.level-num-tag {
  position: absolute;
  top: 5px;
  left: 5px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(34, 22, 12, 0.8);
  color: #fce9be;
  font-size: 10px;
  font-weight: 700;
}

.level-diff-tag {
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: #3c8c68;
}
.level-diff-tag.hard {
  background: #b93829;
}

.level-lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #f6e7c5;
  font-size: 20px;
  background: rgba(20, 14, 9, 0.35);
}

.level-stars-bar {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.level-card-foot {
  padding: 5px 6px 6px;
  text-align: center;
}
.level-card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.level-card-spec {
  font-size: 10px;
  color: var(--ink-mid);
  margin-top: 1px;
}

/* 档案图鉴（独立滚动容器 + 精致 3:4 古风装裱画卷卡，绝不压扁） */
.archive-count-pill {
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(140, 96, 44, 0.16);
  border: 1px solid #c5984b;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-dark);
}

.archive-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 12px 18px;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.archive-item {
  border-radius: 11px;
  overflow: hidden;
  background: linear-gradient(180deg, #fffdf7 0%, #f5ebd4 100%);
  border: 1.5px solid #cba86d;
  box-shadow: 0 4px 12px rgba(74, 48, 20, 0.14);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.12s;
}
.archive-item:active {
  transform: scale(0.97);
}
.archive-item.uncollected {
  border-color: #d8c39b;
  box-shadow: 0 2px 6px rgba(74, 48, 20, 0.08);
}

.archive-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: linear-gradient(160deg, #efe2c4 0%, #dfd0ab 100%);
  overflow: hidden;
}
.archive-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 已解锁画卷：精致朱红「珍藏」小印章 + 底部星级 */
.archive-collected-seal {
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(176, 38, 28, 0.9);
  border: 1px solid rgba(255, 224, 168, 0.7);
  color: #fff6e0;
  font-family: var(--font-serif);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
}

/* 未解锁画卷：古风宣纸卷轴封印卡片（替代黑灰模糊块） */
.archive-locked-art {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 250, 236, 0.65), transparent 65%),
    linear-gradient(180deg, #f2e6cb 0%, #e4d3b0 100%);
  position: relative;
}
.archive-locked-art::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(154, 118, 66, 0.42);
  border-radius: 6px;
  pointer-events: none;
}
.archive-wax-seal {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid #c9a25e;
  background: linear-gradient(180deg, #fbf4e3, #e8d5ae);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 900;
  color: #8c6634;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.8), 0 2px 6px rgba(102, 72, 30, 0.14);
}
.archive-lock-vol {
  font-family: var(--font-serif);
  font-size: 11px;
  font-weight: 700;
  color: #8b6c46;
  letter-spacing: 1.5px;
}

.archive-caption {
  padding: 6px 5px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-dark);
  border-top: 1px solid rgba(186, 152, 98, 0.28);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.archive-item.uncollected .archive-caption {
  color: #9b805d;
}

/* ============ 4. 拼图局内界面（复刻参考图「有巢筑屋」青绿祥云古风风格） ============ */
.view-game {
  background:
    radial-gradient(circle at 15% 6%, rgba(124, 178, 168, 0.42) 0%, transparent 40%),
    radial-gradient(circle at 86% 10%, rgba(219, 190, 126, 0.35) 0%, transparent 42%),
    linear-gradient(180deg, #cfe1d7 0%, #e4ebd9 32%, #d8e4d8 100%);
  padding: 6px 10px 8px;
  gap: 7px;
}

.game-scroll-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 2px;
  flex-shrink: 0;
}

.game-back-pill {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid #b59258;
  background: rgba(255, 250, 236, 0.85);
  color: #4b3117;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(56, 42, 20, 0.16);
  flex-shrink: 0;
}

.game-title-plaque {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.plaque-wing {
  width: 34px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(212, 166, 62, 0.15), #d8a638);
  flex-shrink: 0;
}
.plaque-wing.right {
  background: linear-gradient(270deg, rgba(212, 166, 62, 0.15), #d8a638);
}

.game-title-ink {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 900;
  color: #2c1e12;
  letter-spacing: 3px;
  text-shadow: 0 1px 0 rgba(255, 252, 240, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-stage-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(54, 42, 26, 0.82);
  color: #f9e3ad;
  border: 1px solid #c99d4e;
  white-space: nowrap;
  flex-shrink: 0;
}
.game-stage-tag.hard {
  background: rgba(152, 34, 24, 0.88);
  border-color: #f0b868;
}

/* 第二行工具栏：加时 / 提示 / 黑金倒计时牌 / 原图 / 锦囊设置 */
.game-action-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 2px;
  flex-shrink: 0;
}

.round-tool-btn {
  position: relative;
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 0;
  width: 48px;
  transition: transform 0.1s;
}
.round-tool-btn:active {
  transform: scale(0.93);
}

.round-tool-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  border: 2.5px solid #e6be6a;
  box-shadow: 0 3px 8px rgba(45, 34, 16, 0.25), inset 0 1px 2px rgba(255, 255, 255, 0.45);
  color: #fff;
}

.tool-red .round-tool-circle {
  background: radial-gradient(circle at 35% 30%, #e46445, #b43624);
}
.tool-jade .round-tool-circle {
  background: radial-gradient(circle at 35% 30%, #5cb588, #2d7a56);
}
.tool-teal .round-tool-circle {
  background: radial-gradient(circle at 35% 30%, #4e9e9c, #27696d);
}
.tool-gear .round-tool-circle {
  background: radial-gradient(circle at 35% 30%, #d45b4c, #993027);
  font-size: 21px;
}

.round-tool-label {
  font-size: 11px;
  font-weight: 800;
  color: #3d2b18;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  line-height: 1;
}

.round-ad-dot {
  position: absolute;
  top: -2px;
  right: 1px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #fff9e8;
  border: 1.5px solid #d59e3c;
  color: #c57a17;
  font-size: 9px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.round-ad-dot.has-prop {
  background: #2f855a;
  border-color: #d6f5e3;
  color: #ffffff;
  font-size: 10px;
}

/* 居中黑金倒计时匾额（复刻参考图 • 04:00 •） */
.timer-plaque {
  flex: 1;
  max-width: 136px;
  height: 40px;
  border-radius: 6px;
  background: linear-gradient(180deg, #322419 0%, #1e150e 100%);
  border: 2px solid #d9b05d;
  box-shadow: 0 3px 10px rgba(32, 22, 12, 0.35), inset 0 0 0 1.5px rgba(255, 232, 176, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #f3c86b;
  font-variant-numeric: tabular-nums;
}
.timer-plaque.urgent {
  border-color: #ff6b57;
  background: linear-gradient(180deg, #5a1c14 0%, #330d09 100%);
  color: #ffd5cd;
  animation: pulseUrgent 0.7s infinite alternate;
}
@keyframes pulseUrgent {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}

.timer-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d94a3d;
  box-shadow: 0 0 4px rgba(255, 110, 96, 0.6);
}

.timer-digits {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1px;
}

/* 全屏棋盘舞台 */
.game-board-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.board-frame-clean {
  position: relative;
  padding: 3px;
  border-radius: 8px;
  background: linear-gradient(145deg, #c29e62, #7a5c32 55%, #b18d52);
  box-shadow: 0 10px 26px rgba(32, 26, 14, 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
}

#boardCanvas {
  display: block;
  border-radius: 5px;
  touch-action: none;
  cursor: grab;
}
#boardCanvas:active {
  cursor: grabbing;
}

.game-bottom-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 6px 0;
  font-size: 11px;
  color: #4f5f53;
  flex-shrink: 0;
}
.game-bottom-hint strong {
  color: #8c4a16;
  font-size: 12px;
}

/* 查原图浮层 */
.peek-overlay {
  position: absolute;
  inset: 3px;
  border-radius: 5px;
  overflow: hidden;
  z-index: 15;
  background: #1c140c;
  transition: opacity 0.2s;
}
.peek-overlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s;
}
.peek-overlay.ghost-mode {
  background: transparent;
  pointer-events: none;
}
.peek-overlay.ghost-mode img {
  opacity: 0.45;
}
.peek-hud {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}
.peek-countdown {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(24, 16, 8, 0.85);
  border: 1px solid rgba(242, 200, 107, 0.55);
  color: #ffe39d;
  font-size: 12px;
  font-weight: 700;
}
.peek-mode-btn, .peek-close-btn {
  border: 1px solid rgba(255, 232, 180, 0.45);
  background: rgba(40, 27, 15, 0.86);
  color: #fff4d6;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
}
.peek-mode-btn {
  margin-left: auto;
}

.float-fx-layer {
  position: absolute;
  inset: 3px;
  pointer-events: none;
  z-index: 18;
  overflow: hidden;
}
.float-fx-text {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(34, 21, 10, 0.88);
  border: 1.5px solid #f0c970;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 900;
  color: #ffe285;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  animation: floatUpFade 1.25s ease-out forwards;
}
@keyframes floatUpFade {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.75); }
  22% { opacity: 1; transform: translate(-50%, -55%) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -130%) scale(1); }
}

/* 线性闯关卡片状态标签 */
.level-status-ribbon {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 3px 4px;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  color: #fff;
  background: rgba(186, 48, 32, 0.92);
}
.level-status-ribbon.cleared {
  background: rgba(44, 118, 82, 0.9);
}

/* ============ 底部导航栏（玩法 / 首页 / 档案） ============ */
.bottom-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: 64px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: linear-gradient(180deg, #33271c 0%, #221911 100%);
  border-top: 1px solid rgba(212, 174, 102, 0.35);
  flex-shrink: 0;
  z-index: 25;
}

.nav-item {
  border: none;
  background: transparent;
  color: #a99373;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: color 0.15s;
}
.nav-item.active {
  color: #f6d384;
}
.nav-svg {
  width: 26px;
  height: 26px;
  display: block;
}
.nav-label {
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* ============ 全屏拖拽画布层 ============ */
.drag-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
}

/* ============ 弹窗系统 & 国宝锦囊（1:1还原截图古风美学） ============ */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(14, 10, 6, 0.74);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.18s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.guofeng-modal {
  position: relative;
  width: 100%;
  max-width: 392px;
  max-height: 92dvh;
  background: linear-gradient(180deg, #faf4e6 0%, #f1e5ca 100%);
  border: 2.5px solid #c9a462;
  border-radius: 14px;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.62), inset 0 0 0 4px #f8f1df, inset 0 0 0 5.5px rgba(196, 158, 92, 0.45);
  padding: 24px 12px 12px;
  display: flex;
  flex-direction: column;
}

/* 顶部古风匾额标题 */
.modal-plaque {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 176px;
  padding: 7px 26px;
  background: linear-gradient(180deg, #fffcf2 0%, #f1e3c4 100%);
  border: 2px solid #c49b52;
  border-radius: 10px;
  box-shadow: 0 5px 14px rgba(45, 25, 8, 0.32), inset 0 0 0 2px rgba(255, 255, 255, 0.7);
  text-align: center;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 900;
  color: #3f2612;
  letter-spacing: 3px;
  white-space: nowrap;
}

.modal-close-circle {
  position: absolute;
  top: -12px;
  right: -10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #f7ebd2;
  background: linear-gradient(180deg, #7c4d2d, #563119);
  color: #fff5df;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.modal-subtitle {
  text-align: center;
  font-size: 12px;
  color: #826544;
  margin-bottom: 10px;
}

/* 国宝锦囊 2x2 卡片网格 */
.pouch-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  overflow-y: auto;
  padding: 2px;
}

.pouch-card {
  background: linear-gradient(180deg, #fffdf7 0%, #f4ead4 100%);
  border: 1.5px solid #dac399;
  border-radius: 12px;
  padding: 7px 7px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 3px 10px rgba(102, 74, 34, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.pouch-svg {
  width: 56px;
  height: 58px;
  display: block;
}

.pouch-name {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 900;
  margin-top: 1px;
  letter-spacing: 1px;
}
.pouch-bronze .pouch-name { color: #a75c28; }
.pouch-silver .pouch-name { color: #707e90; }
.pouch-gold .pouch-name   { color: #b9821a; }
.pouch-jade .pouch-name   { color: #2e7c59; }

.pouch-ad-req {
  width: 100%;
  text-align: center;
  font-size: 11px;
  color: #7c6244;
  padding: 4px 0;
  margin: 4px 0;
  border-top: 1px solid rgba(182, 150, 96, 0.25);
  border-bottom: 1px solid rgba(182, 150, 96, 0.25);
  background: rgba(215, 191, 146, 0.16);
}

.pouch-reward-heading {
  font-size: 11px;
  font-weight: 700;
  color: #b48332;
  margin-bottom: 4px;
}

.pouch-rewards-list {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 5px;
  min-height: 38px;
  align-content: flex-start;
  margin-bottom: 5px;
}

.pouch-reward-chip {
  font-size: 11px;
  font-weight: 700;
  color: #462f1a;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.pouch-reward-chip.full-row {
  width: 100%;
  justify-content: center;
  color: #b67617;
}
.pouch-jade .pouch-reward-chip.full-row {
  color: #c28019;
}

.pouch-progress-wrap {
  width: 100%;
  margin-bottom: 7px;
}
.pouch-progress-meta {
  display: flex;
  justify-content: flex-end;
  font-size: 10px;
  color: #8c7050;
  margin-bottom: 2px;
}
.pouch-progress-bar {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 118, 72, 0.2);
  overflow: hidden;
}
.pouch-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #d69c3c, #9b6423);
  transition: width 0.25s;
}

.pouch-claim-btn {
  width: 100%;
  margin-top: auto;
  padding: 8px 6px;
  border-radius: 999px;
  border: 1px solid #5e4124;
  background: linear-gradient(180deg, var(--btn-brown-top) 0%, var(--btn-brown-bot) 100%);
  color: #fff6e2;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 7px rgba(64, 40, 16, 0.3), inset 0 1px 0 rgba(255, 232, 188, 0.32);
  transition: transform 0.1s;
}
.pouch-claim-btn:active:not(:disabled) {
  transform: scale(0.96);
}
.pouch-claim-btn.claimed {
  background: linear-gradient(180deg, #bfb29a, #9e9078);
  border-color: #8d806a;
  color: #f8f2e4;
  cursor: default;
  box-shadow: none;
}

.pouch-footer-note {
  text-align: center;
  font-size: 11px;
  color: #8f7454;
  margin-top: 10px;
}

/* 通用古风对话框内容 */
.dialog-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 6px 4px 2px;
}
.dialog-hero-icon {
  font-size: 44px;
  line-height: 1;
}
.dialog-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-mid);
}
.dialog-stat-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.dialog-stat-box {
  padding: 8px 6px;
  border-radius: 10px;
  background: rgba(255, 252, 244, 0.78);
  border: 1px solid #d9c093;
}
.dialog-stat-val {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink-dark);
}
.dialog-stat-lbl {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.dialog-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.dialog-actions.row {
  flex-direction: row;
}

.btn-primary {
  width: 100%;
  padding: 11px 14px;
  border-radius: 999px;
  border: 1.5px solid #f0cb78;
  background: linear-gradient(180deg, #c6412b 0%, #8f2314 100%);
  color: #fff6e0;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(124, 28, 16, 0.35);
}
.btn-brown {
  width: 100%;
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid #5d3f22;
  background: linear-gradient(180deg, #9d7b54, #6d4f32);
  color: #fff6e2;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.btn-secondary {
  width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid #c9ab78;
  background: rgba(255, 250, 238, 0.78);
  color: var(--ink-mid);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* 设置列表 */
.settings-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 252, 245, 0.85);
  border: 1px solid #d9c094;
  gap: 8px;
}
.setting-row-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-dark);
}
.setting-row-sub {
  font-size: 11px;
  color: var(--ink-soft);
}
.toggle-pill {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #b6945d;
  background: #e9d9ba;
  color: var(--ink-mid);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-pill.on {
  background: linear-gradient(180deg, #4b9c76, #2f7051);
  border-color: #24573e;
  color: #fff;
}

/* 画卷大图预览 */
.archive-preview-img {
  width: 100%;
  max-height: 55dvh;
  object-fit: contain;
  border-radius: 10px;
  border: 2px solid #b88e47;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* ============ 模拟激励视频广告全屏浮层 ============ */
.ad-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 7, 6, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  padding: 14px;
}
.ad-overlay.show {
  opacity: 1;
}
.ad-stage {
  width: 100%;
  max-width: 410px;
  height: min(92dvh, 760px);
  border-radius: 20px;
  background: linear-gradient(180deg, #211a14 0%, #120e0b 100%);
  border: 1px solid rgba(235, 192, 108, 0.35);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  color: #f9edd4;
  overflow: hidden;
  position: relative;
}
.ad-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ad-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #e4cfa3;
}
.ad-timer-box {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ad-countdown {
  font-size: 12px;
  font-weight: 700;
  color: #ffd778;
}
.ad-countdown.ready {
  color: #7ee4ad;
}
.ad-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}
.ad-creative {
  position: relative;
  text-align: center;
  padding: 28px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.ad-glow {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 184, 72, 0.28), transparent 70%);
  pointer-events: none;
}
.ad-emblem {
  font-size: 56px;
}
.ad-creative-title {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 800;
  color: #ffe29a;
}
.ad-creative-sub {
  font-size: 14px;
  color: #e7d9bf;
  line-height: 1.5;
}
.ad-progress-track {
  width: 82%;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-top: 6px;
}
.ad-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #f3be53, #ffdf8c);
}
.ad-tip {
  font-size: 11px;
  color: rgba(232, 212, 178, 0.56);
  margin-top: 8px;
}
.ad-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.ad-scene-tag {
  font-size: 12px;
  color: #e5c686;
}
.ad-claim-btn {
  width: 100%;
  padding: 13px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.55);
  font-size: 15px;
  font-weight: 800;
  cursor: not-allowed;
}
.ad-claim-btn.ready {
  background: linear-gradient(180deg, #56b385, #327e59);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(56, 156, 108, 0.45);
}

.ad-abandon-confirm {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ad-abandon-card {
  width: 100%;
  max-width: 310px;
  border-radius: 14px;
  background: #fbf5e6;
  color: var(--ink-dark);
  padding: 18px;
  text-align: center;
}
.ad-abandon-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 6px;
}
.ad-abandon-desc {
  font-size: 13px;
  color: var(--ink-mid);
  margin-bottom: 14px;
  line-height: 1.5;
}
.ad-abandon-actions {
  display: flex;
  gap: 8px;
}

/* Toast */
.toast-root {
  position: fixed;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 250;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
.toast-pill {
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(34, 23, 13, 0.92);
  border: 1px solid rgba(235, 193, 110, 0.6);
  color: #fff3d4;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  animation: toastPop 0.2s ease-out;
}
@keyframes toastPop {
  from { opacity: 0; transform: translateY(-8px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
