/* 猫猫纸箱 Web 落地页样式（配色见 PRD §7） */
:root {
  /* 交接包 tokens/design-tokens.css 的 Web 别名 */
  --bg-page: #EDE3D4;
  --panel-cream: #F7EBDD;
  --panel-cream-2: #FFF6E9;
  --wood-dark: #6E4529;
  --wood-mid: #A76B3E;
  --wood-light: #D9A065;
  --text-primary: #4A2F1F;
  --text-secondary: #8B6A50;
  --accent-gold: #F3A72D;
  --accent-glow: #FFC94C;
  --success: #6F9B72;
  --danger: #D75B55;
  --grid-base: #E8D5B8;
  --grid-alt: #F2E4CF;
  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --shadow-soft: 0 10px 30px rgba(72,46,28,.12);
  --shadow-raised: 0 8px 0 rgba(92,54,27,.18), 0 18px 34px rgba(74,44,24,.18);

  /* 兼容当前落地页的旧变量名 */
  --page-bg: var(--bg-page);
  --panel: var(--panel-cream);
  --cream: var(--panel-cream-2);
  --frame: var(--wood-dark);
  --board: var(--grid-base);
  --groove: #C5A57F;
  --box: var(--wood-mid);
  --ink: var(--text-primary);
  --ink-soft: var(--text-secondary);
  --done: var(--success);
  --error: var(--danger);
  --hint: var(--accent-gold);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: "Noto Sans SC", "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.playing { overflow: hidden; }

a { color: inherit; text-decoration: none; }

.wrap { width: min(1080px, 92vw); margin: 0 auto; }

/* 顶部导航 */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 22px; }
.brand .mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(160deg, var(--box), var(--frame));
  position: relative;
}
.brand .mark::after {
  content: ""; position: absolute; inset: 12px 8px auto 8px; height: 5px;
  background: var(--page-bg); border-radius: 3px;
}

.btn {
  display: inline-block; border: none; cursor: pointer;
  padding: 14px 30px; border-radius: 999px;
  font-size: 17px; font-weight: 700; font-family: inherit;
  background: var(--box); color: #FFF9F0;
  box-shadow: 0 6px 0 rgba(91, 62, 43, 0.35);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(91, 62, 43, 0.35); }
.btn.ghost { background: var(--panel); color: var(--ink); box-shadow: 0 6px 0 rgba(91,62,43,0.18); }

/* 首屏 */
.hero {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center;
  padding: 56px 0 72px;
}
.hero h1 { font-size: clamp(38px, 6vw, 64px); line-height: 1.12; margin: 0 0 18px; letter-spacing: -1px; }
.hero p.lead { font-size: 19px; line-height: 1.7; color: var(--ink-soft); margin: 0 0 30px; }
.hero .cta { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.hero .meta { margin-top: 22px; font-size: 14px; color: var(--ink-soft); }
.hero-art {
  background: linear-gradient(160deg, #F4EEE4, var(--page-bg));
  border: 2px solid rgba(91,62,43,0.18); border-radius: 28px;
  padding: 24px; display: flex; justify-content: center; align-items: center;
}
.hero-art canvas { border-radius: 18px; }

/* 通用区块 */
section { padding: 56px 0; border-top: 2px dashed rgba(91,62,43,0.18); }
h2 { font-size: clamp(26px, 3.6vw, 34px); margin: 0 0 10px; }
.sub { color: var(--ink-soft); margin: 0 0 32px; font-size: 16px; line-height: 1.7; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.card {
  background: var(--panel); border: 2px solid rgba(91,62,43,0.18); border-radius: 22px; padding: 24px;
}
.card .tag {
  display: inline-block; font-size: 13px; font-weight: 700; padding: 6px 12px;
  border-radius: 999px; background: var(--cream); color: var(--ink); margin-bottom: 14px;
}
.card h3 { margin: 0 0 10px; font-size: 20px; }
.card p { margin: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.7; }

.chapters { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.chapter { border-radius: 22px; padding: 26px; border: 2px solid transparent; }
.chapter:nth-child(1) { background: #E7DCC8; }
.chapter:nth-child(2) { background: #DCE6EC; }
.chapter:nth-child(3) { background: #DCE6D8; }
.chapter span { font-size: 13px; font-weight: 700; opacity: .7; }
.chapter h3 { margin: 6px 0 8px; font-size: 22px; }
.chapter p { margin: 0; font-size: 15px; line-height: 1.7; color: #6b563f; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 18px; }
.fact { background: var(--panel); border: 2px solid rgba(91,62,43,0.18); border-radius: 20px; padding: 22px; text-align: center; }
.fact strong { display: block; font-size: 30px; margin-bottom: 6px; }
.fact span { font-size: 14px; color: var(--ink-soft); }

footer { padding: 40px 0 60px; color: var(--ink-soft); font-size: 14px; line-height: 1.9; }

/* 游戏层 */
#game-layer {
  position: fixed; inset: 0; display: none; z-index: 50;
  background: rgba(58, 44, 30, 0.72);
  backdrop-filter: blur(6px);
  align-items: center; justify-content: center;
}
#game-layer.open { display: flex; }
#game-stage {
  position: relative;
  width: min(100vw, 390px);
  height: min(100vh, 844px);
  background: var(--page-bg);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
}
#game-canvas { position: absolute; inset: 0; display: block; touch-action: none; }
#game-dom { display: none; position: absolute; inset: 0; z-index: 3; overflow: hidden; }
#game-dom.is-active { display: block; }
#game-dom, #game-dom button { font-family: "Noto Sans SC", "Noto Sans", "PingFang SC", sans-serif; }
.dom-screen { position: absolute; inset: 0; overflow: auto; color: var(--text-primary); background: var(--bg-page) url("assets/bg_room.png") center/cover; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.dom-play { overflow: hidden; background: transparent; pointer-events: none; }
.dom-play > * { pointer-events: auto; }
.dom-play-top { position: absolute; top: 16px; left: 8px; right: auto; width: calc(100% - 16px); display: grid; grid-template-columns: 40px 40px minmax(0,1fr) 58px 40px 40px; gap: 4px; align-items: start; overflow: hidden; }
.dom-play-top > * { min-width: 0; }
.dom-play-icon { min-height: 52px; padding: 4px 2px; border: 1.5px solid var(--wood-mid); border-radius: 14px; background: rgba(255,246,233,.95); color: var(--text-primary); font-size: 22px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 0 rgba(92,54,27,.16); }
.dom-play-icon img { display: block; width: 24px; height: 24px; margin: 0 auto 1px; object-fit: contain; }
.dom-play-icon:first-child { background: var(--accent-gold); }
.dom-play-icon small { display: block; font-size: 11px; font-weight: 700; line-height: 1.1; }
.dom-play-level { min-height: 52px; padding: 9px 4px 4px; border: 1.5px solid var(--wood-dark); border-radius: 14px; background: linear-gradient(#a76b3e,#6e4529); color: #fff6e9; text-align: center; font-size: 18px; font-weight: 700; text-shadow: 0 2px 0 rgba(60,31,16,.45); }
.dom-play-level small { display: block; margin-top: 3px; color: #f7ebdd; font-size: 9px; font-weight: 400; text-shadow: none; }
.dom-play-timer { min-height: 32px; padding: 10px 3px; border-radius: 16px; background: rgba(255,246,233,.95); color: var(--text-primary); text-align: center; font-size: 15px; font-weight: 700; }
.dom-play-tools { position: absolute; left: 8px; right: auto; width: calc(100% - 16px); bottom: 18px; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 5px; padding: 6px; border: 2px solid #6e3c1c; border-radius: 18px; background: linear-gradient(#a9642f,#7b4520); pointer-events: auto; overflow: hidden; }
.dom-play-tool { min-width: 0; min-height: 82px; padding: 6px 2px; border: 1.5px solid #cbae86; border-radius: 13px; background: var(--panel-cream-2); color: var(--text-primary); font-size: 10px; font-weight: 700; cursor: pointer; }
.dom-play-tool img { display: block; width: 34px; height: 34px; margin: 0 auto 4px; object-fit: contain; }
.dom-play-tool.is-active { background: var(--accent-gold); box-shadow: 0 0 0 2px var(--accent-glow); }
.dom-play-tool.is-disabled { opacity: .4; }
.dom-play-hint { position: absolute; left: 0; right: 0; bottom: 122px; color: var(--text-secondary); text-align: center; font-size: 12px; pointer-events: none; }
.dom-play-board { position: absolute; border: 4px solid var(--wood-mid); border-radius: 24px; background: linear-gradient(#d9a065,#a76b3e); box-shadow: 0 8px 0 rgba(92,54,27,.26); pointer-events: none; }
.dom-board-grid { position: absolute; display: grid; grid-template-columns: repeat(6,1fr); grid-template-rows: repeat(6,1fr); overflow: hidden; border-radius: 12px; background: var(--grid-base); }
.dom-board-cell { min-width: 0; min-height: 0; margin: 2px; border-radius: 8px; background: var(--grid-alt); box-shadow: inset 0 0 0 1px rgba(140,100,60,.15); }
.dom-board-cell.is-alt { background: var(--grid-alt); }
.dom-board-watermark { position: absolute; z-index: 1; left: 27.5%; top: 25%; width: 45%; height: 45%; object-fit: contain; opacity: .15; filter: blur(2px) saturate(.8); pointer-events: none; }
.dom-board-cat, .dom-board-box, .dom-board-mark { position: absolute; z-index: 2; pointer-events: none; }
.dom-board-cat { object-fit: contain; }
.dom-board-box { object-fit: contain; z-index: 3; }
.dom-board-mark { display: grid; place-items: center; width: 1em; height: 1em; color: var(--wood-dark); font-size: 42px; font-weight: 700; line-height: 1; }
.dom-board-clue { position: absolute; z-index: 4; display: flex; align-items: center; justify-content: center; gap: 2px; padding: 3px 5px; border-radius: 13px; background: rgba(74,44,24,.8); box-shadow: 0 3px 0 rgba(52,28,14,.28); pointer-events: none; }
.dom-board-clue img { width: var(--paw-size); height: var(--paw-size); object-fit: contain; }
.dom-board-clue-left { flex-direction: row; }
.dom-screen::before { content: ""; position: fixed; inset: 0; background: rgba(237,227,212,.38); pointer-events: none; }
.dom-body, .dom-header, .dom-actions, .dom-home-hero, .dom-home-board, .dom-chapters, .dom-level-grid, .dom-settings-list, .dom-help-list, .dom-result-hero, .dom-result-summary { position: relative; z-index: 1; }
.dom-header { height: 74px; display: flex; align-items: center; justify-content: center; padding: 12px 24px 0; }
.dom-header h1 { margin: 0; font-size: 30px; line-height: 1; font-weight: 700; }
.dom-icon-button { position: absolute; left: 14px; top: 22px; width: 42px; height: 42px; border: 1.5px solid var(--wood-mid); border-radius: 14px; background: var(--panel-cream-2); color: var(--text-primary); font-size: 32px; line-height: 30px; cursor: pointer; }
.dom-body { min-height: calc(100% - 74px); padding: 10px 20px 28px; }
.dom-home-hero { text-align: center; padding-top: 6px; }
.dom-home-hero .dom-top-cat { width: 210px; height: 124px; object-fit: cover; object-position: center top; display: block; margin: -18px auto -24px; }
.dom-home-hero h2 { display: inline-block; margin: 0; padding: 16px 34px; border: 1.5px solid var(--wood-dark); border-radius: 20px; background: linear-gradient(#a76b3e,#6e4529); color: #fff6e9; font-size: 34px; text-shadow: 0 3px 0 rgba(60,31,16,.55); }
.dom-home-hero p { margin: 10px auto 14px; width: fit-content; padding: 8px 18px; border-radius: 18px; background: var(--panel-cream-2); color: var(--text-secondary); font-size: 13px; }
.dom-home-board { width: 264px; height: 218px; margin: 0 auto 14px; padding: 18px; display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; border: 4px solid var(--wood-mid); border-radius: 22px; background: var(--grid-base); box-shadow: var(--shadow-raised); }
.dom-home-board img { width: 100%; height: 100%; object-fit: contain; background: rgba(255,246,233,.42); border-radius: 10px; }
.dom-home-board .dom-home-watermark { position: absolute; z-index: 1; left: 26%; top: 22%; width: 48%; height: 56%; object-fit: contain; background: transparent; opacity: .15; filter: blur(2px) saturate(.8); pointer-events: none; }
.dom-home-board > img:not(.dom-home-watermark) { position: relative; z-index: 2; }
.dom-actions { display: grid; gap: 10px; }
.dom-actions-large { width: min(274px, 100%); margin: 0 auto; }
.dom-actions button, .dom-help-finish { min-height: 58px; border: 1.5px solid var(--wood-mid); border-radius: 20px; background: var(--panel-cream-2); color: var(--text-primary); font-size: 17px; font-weight: 600; cursor: pointer; box-shadow: 0 5px 0 rgba(92,54,27,.18); }
.dom-actions button:active, .dom-setting-row:active, .dom-chapter:active, .dom-level:active { transform: translateY(2px); box-shadow: none; }
.dom-actions .dom-primary, .dom-primary { background: var(--accent-gold); border-color: #a76b3e; font-weight: 700; }
.dom-actions-small { width: 276px; margin: 18px auto 0; display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.dom-actions-small button { min-height: 70px; padding: 6px 2px; border-radius: 16px; border: 1.5px solid var(--wood-mid); background: var(--panel-cream-2); color: var(--text-primary); font-size: 11px; cursor: pointer; }
.dom-actions-small img { display: block; width: 28px; height: 28px; margin: 0 auto 4px; }
.dom-chapters { display: flex; gap: 10px; margin: 8px -20px 14px; padding: 0 20px 8px; overflow-x: auto; }
.dom-chapter { flex: 0 0 106px; min-height: 170px; padding: 8px; display: flex; flex-direction: column; align-items: center; justify-content: end; gap: 4px; border: 1.5px solid var(--wood-mid); border-radius: 18px; background: var(--panel-cream-2); color: var(--text-primary); cursor: pointer; box-shadow: 0 5px 0 rgba(92,54,27,.18); }
.dom-chapter.is-selected { background: #ffe7b2; border-color: var(--accent-gold); box-shadow: 0 0 0 2px rgba(243,167,45,.35), 0 5px 0 rgba(92,54,27,.18); }
.dom-chapter img { width: 84px; height: 84px; object-fit: contain; }
.dom-chapter strong { font-size: 14px; }
.dom-chapter span, .dom-chapter small { font-size: 11px; color: var(--text-secondary); }
.dom-level-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 10px; padding: 18px; border: 1.5px solid #b98b64; border-radius: 22px; background: rgba(247,235,221,.94); }
.dom-level { height: 62px; border: 1.5px solid var(--wood-mid); border-radius: 12px; background: #fff0ce; color: var(--text-primary); font-size: 16px; font-weight: 600; cursor: pointer; }
.dom-level.is-complete { background: #ffe0a1; }
.dom-level.is-locked { background: #b2a088; color: #6e5f4a; }
.dom-help-list { display: grid; gap: 14px; padding-bottom: 18px; }
.dom-help-card { padding: 14px 16px 18px; border: 1.5px solid #d0af8d; border-radius: 20px; background: rgba(255,246,233,.95); box-shadow: 0 5px 0 rgba(92,54,27,.14); }
.dom-help-title { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: linear-gradient(#a76b3e,#6e4529); color: #fff6e9; }
.dom-help-title b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-gold); color: var(--text-primary); }
.dom-help-title h2 { margin: 0; font-size: 17px; }
.dom-help-card p { margin: 14px 2px 0; font-size: 14px; line-height: 1.7; }
.dom-help-finish { display: block; width: 260px; margin: 0 auto; }
.dom-settings-list { display: grid; gap: 10px; }
.dom-setting-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 88px; padding: 12px 14px; text-align: left; border: 1.5px solid #d0af8d; border-radius: 20px; background: rgba(255,246,233,.96); color: var(--text-primary); cursor: pointer; box-shadow: 0 5px 0 rgba(92,54,27,.14); }
.dom-setting-row img { width: 42px; height: 42px; padding: 8px; border-radius: 12px; background: var(--wood-light); }
.dom-setting-row span { display: grid; gap: 4px; flex: 1; }
.dom-setting-row strong { font-size: 18px; }
.dom-setting-row small { font-size: 12px; color: var(--text-secondary); }
.dom-setting-row b { font-size: 30px; color: var(--text-secondary); font-weight: 400; }
.dom-toggle { font-style: normal; font-size: 26px; color: var(--text-secondary); }
.dom-toggle.is-on { color: var(--accent-gold); }
.dom-modal { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 22px; background: rgba(52,28,14,.5); }
.dom-modal-card { position: relative; width: min(320px,100%); padding: 28px 22px; border: 1.5px solid var(--wood-mid); border-radius: 24px; background: var(--panel-cream-2); text-align: center; box-shadow: var(--shadow-raised); }
.dom-modal-close { position: absolute; top: 10px; right: 10px; width: 34px !important; height: 34px; margin: 0 !important; border: 0; border-radius: 50%; background: rgba(247,241,232,.9); color: var(--text-primary); font-size: 25px; line-height: 1; cursor: pointer; }
.dom-modal-card h2 { margin: 0 0 16px; font-size: 24px; }
.dom-modal-card p { font-size: 14px; line-height: 1.7; }
.dom-feedback-copy { color: var(--text-primary); font-size: 13px !important; font-weight: 600; }
.dom-copy-link { width: auto !important; margin: 0 !important; padding: 0; border: 0; background: transparent; color: var(--text-primary); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.dom-site { color: var(--wood-dark); font-weight: 600; }
.dom-site-copy { width: auto !important; margin: 0 !important; padding: 0; border: 0; background: transparent; color: var(--wood-dark); font: inherit; font-weight: 600; cursor: pointer; }
.dom-modal-card button { width: 100%; margin-top: 14px; }
.dom-result-hero { text-align: center; padding-top: 8px; }
.dom-result-hero img { display: block; width: 160px; height: 160px; object-fit: contain; margin: 0 auto -4px; }
.dom-result-hero h2 { margin: 0; font-size: 32px; }
.dom-result-hero p { margin: 10px 0 22px; font-size: 15px; }
.dom-result-summary { width: min(302px,100%); margin: 0 auto 22px; padding: 28px 20px 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; border: 1.5px solid var(--wood-mid); border-radius: 24px; background: var(--panel-cream-2); box-shadow: 0 6px 0 rgba(92,54,27,.14); text-align: center; }
.dom-result-summary span { display: grid; gap: 8px; font-size: 12px; color: var(--text-secondary); }
.dom-result-summary strong { font-size: 28px; color: var(--text-primary); }
.dom-result-summary p { grid-column: 1 / -1; margin: 14px 0 0; font-size: 13px; }
#game-close {
  position: absolute; top: calc(10px + var(--safe-top)); right: 10px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(247, 241, 232, .9); color: var(--ink); font-size: 20px; line-height: 1;
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding: 32px 0 48px; }
  .hero-art { order: -1; padding: 16px; }
  section { padding: 40px 0; }
}
@media (max-width: 560px) {
  #game-stage { width: 100vw; height: 100vh; border-radius: 0; }
  #game-close { top: calc(8px + var(--safe-top)); right: 8px; }
}
