/* DZ 小游戏公共样式：暖色、圆润、大字大按钮（给 40–80 岁的玩家）。
   兼容旧手机（iOS 13 / 安卓 8）：不用 inset、不用 flex 的 gap；
   用到 min() / max() / clamp() 的地方，前面都先写一行固定值垫底。 */
:root {
  --bg: #FFF3DC;
  --bg-deep: #FFE4B8;
  --card: #FFFFFF;
  --ink: #4A3426;
  --ink-soft: #7A604E;
  --green: #23804A;       /* 白字配这个绿，对比度 4.9:1，老人看得清 */
  --green-dark: #17603A;
  --orange: #FF8A3D;
  --orange-dark: #DE671C;
  --gold: #FFC83D;
  --pink: #FF9EAA;
  --line: #EBD3A8;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  /* ui-rounded：苹果手机上英文和数字用圆头字，看着更可爱；别的手机没有这个字体，自动用后面的 */
  font-family: ui-rounded, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 18px;
  line-height: 1.4;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* 整页的底：奶油色到暖橙的渐变，上面撒一层很淡的白色小圆点和小星星（自己画的） */
body {
  background-color: var(--bg-deep);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cg fill='%23fff' fill-opacity='.42'%3E%3Ccircle cx='24' cy='30' r='5'/%3E%3Ccircle cx='112' cy='18' r='3'/%3E%3Ccircle cx='138' cy='98' r='6'/%3E%3Ccircle cx='62' cy='124' r='4'/%3E%3Cpath d='M84 62l3 7 7 3-7 3-3 7-3-7-7-3 7-3z'/%3E%3Cpath d='M20 104l2 5 5 2-5 2-2 5-2-5-5-2 5-2z'/%3E%3Cpath d='M132 44l2 5 5 2-5 2-2 5-2-5-5-2 5-2z'/%3E%3C/g%3E%3C/svg%3E"), linear-gradient(180deg, #FFF3DC 0%, #FFE6BD 50%, #FFD59B 100%);
  background-attachment: fixed;
}

/* 每 30 关换一个场景（shell.js 的 sceneOf 给整页挂 scene-N）：只换底色，小圆点和小星星那一层不变。scene-0 早市就是上面原来的暖橙 */
/* 花园：嫩绿 */
html.scene-1 { background: #F4FBE6; }
body.scene-1 {
  --bg: #F4FBE6; --bg-deep: #D6EDBB;
  background-color: #D6EDBB;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cg fill='%23fff' fill-opacity='.42'%3E%3Ccircle cx='24' cy='30' r='5'/%3E%3Ccircle cx='112' cy='18' r='3'/%3E%3Ccircle cx='138' cy='98' r='6'/%3E%3Ccircle cx='62' cy='124' r='4'/%3E%3Cpath d='M84 62l3 7 7 3-7 3-3 7-3-7-7-3 7-3z'/%3E%3Cpath d='M20 104l2 5 5 2-5 2-2 5-2-5-5-2 5-2z'/%3E%3Cpath d='M132 44l2 5 5 2-5 2-2 5-2-5-5-2 5-2z'/%3E%3C/g%3E%3C/svg%3E"), linear-gradient(180deg, #F4FBE6 0%, #DDF2C4 50%, #BCE39C 100%);
}
/* 海边：浅蓝 */
html.scene-2 { background: #EAF7FF; }
body.scene-2 {
  --bg: #EAF7FF; --bg-deep: #C6E6F8;
  background-color: #C6E6F8;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cg fill='%23fff' fill-opacity='.42'%3E%3Ccircle cx='24' cy='30' r='5'/%3E%3Ccircle cx='112' cy='18' r='3'/%3E%3Ccircle cx='138' cy='98' r='6'/%3E%3Ccircle cx='62' cy='124' r='4'/%3E%3Cpath d='M84 62l3 7 7 3-7 3-3 7-3-7-7-3 7-3z'/%3E%3Cpath d='M20 104l2 5 5 2-5 2-2 5-2-5-5-2 5-2z'/%3E%3Cpath d='M132 44l2 5 5 2-5 2-2 5-2-5-5-2 5-2z'/%3E%3C/g%3E%3C/svg%3E"), linear-gradient(180deg, #EAF7FF 0%, #CDEBFB 50%, #A6D8F4 100%);
}
/* 夜市：晚霞的淡紫（底色还是浅的，字才看得清） */
html.scene-3 { background: #FCEEF8; }
body.scene-3 {
  --bg: #FCEEF8; --bg-deep: #E6CFF3;
  background-color: #E6CFF3;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cg fill='%23fff' fill-opacity='.42'%3E%3Ccircle cx='24' cy='30' r='5'/%3E%3Ccircle cx='112' cy='18' r='3'/%3E%3Ccircle cx='138' cy='98' r='6'/%3E%3Ccircle cx='62' cy='124' r='4'/%3E%3Cpath d='M84 62l3 7 7 3-7 3-3 7-3-7-7-3 7-3z'/%3E%3Cpath d='M20 104l2 5 5 2-5 2-2 5-2-5-5-2 5-2z'/%3E%3Cpath d='M132 44l2 5 5 2-5 2-2 5-2-5-5-2 5-2z'/%3E%3C/g%3E%3C/svg%3E"), linear-gradient(180deg, #FCEEF8 0%, #EDD7F6 50%, #D5BBEF 100%);
}

button { font-family: inherit; color: inherit; }

/* 慢慢转的光芒（小猫后面用）：自己画的 12 条白光，越往外越淡 */
.dz-rays {
  position: absolute; left: 50%; top: 50%;
  width: 420px; height: 420px; margin: -210px 0 0 -210px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cdefs%3E%3CradialGradient id='g'%3E%3Cstop offset='.2' stop-color='%23fff' stop-opacity='.85'/%3E%3Cstop offset='1' stop-color='%23fff' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Cpath fill='url(%23g)' d='M100 100L238.8 81.7L238.8 118.3ZM100 100L229.3 153.6L211.1 185.2ZM100 100L185.2 211.1L153.6 229.3ZM100 100L118.3 238.8L81.7 238.8ZM100 100L46.4 229.3L14.8 211.1ZM100 100L-11.1 185.2L-29.3 153.6ZM100 100L-38.8 118.3L-38.8 81.7ZM100 100L-29.3 46.4L-11.1 14.8ZM100 100L14.8 -11.1L46.4 -29.3ZM100 100L81.7 -38.8L118.3 -38.8ZM100 100L153.6 -29.3L185.2 -11.1ZM100 100L211.1 14.8L229.3 46.4Z'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: dz-spin 26s linear infinite;
  pointer-events: none;
}
@keyframes dz-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* 小猫眨眼：睁眼 / 闭眼两组换着显示（只换透明度，旧手机也不会画歪） */
.cat-shut { opacity: 0; animation: dz-blink-shut 4.2s infinite; }
.cat-open { animation: dz-blink-open 4.2s infinite; }
@keyframes dz-blink-open { 0%, 93% { opacity: 1; } 94%, 98% { opacity: 0; } 99%, 100% { opacity: 1; } }
@keyframes dz-blink-shut { 0%, 93% { opacity: 0; } 94%, 98% { opacity: 1; } 99%, 100% { opacity: 0; } }

/* ---------- 按钮 ---------- */
.dz-btn {
  display: block;
  position: relative;
  width: 100%;
  min-height: 60px;
  padding: 12px 18px;
  border: 0;
  border-radius: 22px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  cursor: pointer;
  transition: transform .08s, box-shadow .08s;
}
.dz-btn:active { transform: translateY(4px); box-shadow: none !important; }
.dz-btn:disabled { opacity: .55; cursor: default; }
/* 按钮做成鼓起来的糖果样：上浅下深、底下一条厚边、顶上一道高光 */
.dz-btn.primary {
  background: var(--green); background: linear-gradient(180deg, #2E9B58 0%, #1E7642 100%);
  color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .22);
  box-shadow: 0 6px 0 var(--green-dark), 0 12px 16px rgba(23, 96, 58, .25), inset 0 2px 0 rgba(255, 255, 255, .35);
}
.dz-btn.secondary { /* 橙底配深棕字，对比度 4.9:1 */
  background: var(--orange); background: linear-gradient(180deg, #FFA552 0%, #FF8128 100%);
  color: var(--ink);
  box-shadow: 0 6px 0 var(--orange-dark), 0 12px 16px rgba(222, 103, 28, .22), inset 0 2px 0 rgba(255, 255, 255, .45);
}
.dz-btn.ghost {
  background: #FFF8EA; background: linear-gradient(180deg, #FFFFFF 0%, #FFF1D6 100%);
  color: var(--ink); box-shadow: 0 5px 0 #E3C48E; border: 2px solid #EBCF9C;
}
.dz-btn.primary::before, .dz-btn.secondary::before {
  content: ''; position: absolute; left: 10px; right: 10px; top: 5px; height: 36%;
  border-radius: 16px 16px 30px 30px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, 0));
  pointer-events: none;
}
/* 最要紧的那个大按钮（开始玩 / 下一关）：隔几秒扫过一道光 */
.dz-btn.primary.big { overflow: hidden; }
.dz-btn.primary.big::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 28%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .42), rgba(255, 255, 255, 0));
  transform: skewX(-18deg);
  animation: dz-shine 3.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes dz-shine { 0%, 62% { left: -40%; } 100% { left: 130%; } }
/* 小一号的按钮：可选的、不想让它抢眼的（过关后的「看广告多拿金币」） */
.dz-btn.small { min-height: 52px; padding: 8px 14px; font-size: 19px; }
/* 按钮里的小图标（「看广告」前面的播放标记） */
.dz-btn-ico { display: inline-block; width: 28px; height: 28px; margin-right: 8px; vertical-align: -7px; color: #E5562B; }
.dz-btn-ico svg { display: block; width: 100%; height: 100%; }
.dz-btn.secondary .dz-btn-ico { color: #7A2E0B; }
.dz-btn:focus-visible { outline: 4px solid #2D6CDF; outline-offset: 2px; }

/* ---------- 金币图标（自己画的，不用表情符号，旧手机也显示得出来） ---------- */
.dz-coin {
  display: inline-block; flex: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFF2B0, #FFC83D 58%, #E9A915);
  border: 2px solid #D99A0B;
  box-shadow: inset 0 -2px 0 rgba(160, 100, 0, .35), 0 2px 0 rgba(255, 255, 255, .7);
  vertical-align: middle;
}

/* ---------- 弹窗 ---------- */
.dz-mask {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(74, 52, 38, .55);
  animation: dz-fade .18s ease-out;
}
.dz-modal {
  width: 100%; max-width: 400px; max-height: 100%;
  overflow-y: auto;
  padding: 22px 20px 20px;
  background: var(--card);
  border-radius: 30px;
  box-shadow: 0 10px 0 rgba(74, 52, 38, .22), 0 0 0 4px rgba(255, 255, 255, .55);
  text-align: center;
  animation: dz-pop .26s cubic-bezier(.2, 1.4, .5, 1);
}
/* 弹窗顶上的头图：一块有颜色的弧形底 + 转动的光芒，小猫站在中间。颜色跟着小猫的心情换 */
.dz-modal-hero {
  position: relative; overflow: hidden;
  margin: -22px -20px 12px; padding: 14px 0 8px;
  border-radius: 30px 30px 50% 50% / 30px 30px 26px 26px;
  background: linear-gradient(180deg, #FFEFC6 0%, #FFD68A 100%);
}
.dz-modal.m-cheer .dz-modal-hero { background: linear-gradient(180deg, #FFE680 0%, #FFB347 100%); }
.dz-modal.m-sad .dz-modal-hero { background: linear-gradient(180deg, #EAF1F9 0%, #C9DAEE 100%); }
.dz-modal.m-sad .dz-rays { display: none; }
.dz-modal-mascot { position: relative; width: 104px; height: 104px; margin: 0 auto; }
.dz-modal.m-cheer .dz-modal-mascot { animation: dz-hop .7s cubic-bezier(.3, 1.6, .5, 1) both; }
.dz-modal-mascot svg { width: 100%; height: 100%; display: block; }
.dz-modal-title { margin: 0 0 10px; font-size: 28px; font-weight: 900; }
/* 过关的标题：一条红丝带，压在头图下沿 */
.dz-modal.m-cheer .dz-modal-title {
  display: inline-block; position: relative; z-index: 1;
  margin: -30px 0 12px; padding: 6px 26px 8px;
  background: linear-gradient(180deg, #FF7B5A 0%, #E6463E 100%);
  color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .2);
  border: 3px solid #fff; border-radius: 18px;
  box-shadow: 0 5px 0 #B7302B;
  transform: rotate(-2deg);
}
.dz-modal-body { margin-bottom: 16px; font-size: 20px; color: var(--ink); }
/* 按钮一直贴在弹窗底部：内容太长要滚动时，「下一关 / 关闭」也不会跑到屏幕外面 */
.dz-modal-btns {
  position: -webkit-sticky; position: sticky; bottom: -20px;
  margin-bottom: -20px; padding: 10px 0 20px;
  background: var(--card);
}
.dz-modal-btns > * + * { margin-top: 14px; }

@keyframes dz-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dz-pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes dz-hop { 0% { transform: translateY(30px) scale(.6); opacity: 0; } 100% { transform: translateY(0) scale(1); opacity: 1; } }
/* 东西「蹦」出来（金币、星星、贴纸）：从小到大，冲过头再弹回来 */
@keyframes dz-bounce-in { 0% { transform: scale(0); opacity: 0; } 60% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }

/* ---------- 提示条 ---------- */
.dz-toast {
  position: fixed; left: 4%; right: 4%; top: 12px; z-index: 1500; /* 放在最上面，不挡牌和底部的按钮 */
  max-width: 520px; margin: 0 auto;
  padding: 12px 20px;
  background: rgba(74, 52, 38, .94);
  color: #fff;
  border-radius: 18px;
  font-size: 20px; font-weight: 700; text-align: center;
  pointer-events: none;
  animation: dz-fade .18s ease-out;
}

/* ---------- 撒花 ---------- */
.dz-confetti { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 900; pointer-events: none; overflow: hidden; }
.dz-confetti i {
  position: absolute; top: -20px;
  width: 12px; height: 18px; border-radius: 3px;
  animation: dz-fall linear forwards;
}
.dz-confetti i.dot { width: 14px; height: 14px; border-radius: 50%; }
.dz-confetti i.strip { width: 8px; height: 24px; border-radius: 4px; }
@keyframes dz-fall {
  from { transform: translateY(0) rotate(0deg); opacity: 1; }
  to { transform: translateY(105vh) rotate(540deg); opacity: .9; }
}

/* ---------- 设置 ---------- */
.dz-settings > * + * { margin-top: 14px; }
.dz-version { font-size: 16px; color: var(--ink-soft); }

/* ---------- 贴纸本 ---------- */
.dz-album-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 6px 4px 8px; font-size: 20px; font-weight: 800; text-align: left;
}
.dz-album-count { font-size: 18px; color: var(--ink-soft); }
.dz-album-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: 8px; gap: 8px; margin-bottom: 14px; }
.dz-sticker {
  padding: 8px 2px 6px; min-height: 86px;
  background: #F3EADB; border-radius: 16px; border: 2px dashed #D8C7A8;
}
.dz-sticker.has { background: #FFF8EA; border: 2px solid var(--gold); }
.dz-sticker-pic { font-size: 34px; line-height: 1.2; color: #BBA98C; font-weight: 900; }
.dz-sticker-name { font-size: 16px; font-weight: 700; line-height: 1.2; min-height: 19px; }

/* ---------- 每天领奖 ---------- */
.dz-daily { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 8px; gap: 8px; }
.dz-day {
  padding: 8px 2px; border-radius: 16px;
  background: #FFF8EA; border: 2px solid var(--line);
}
.dz-day.big { grid-column: span 3; background: #FFF1C9; }
.dz-day.done { opacity: .55; }
.dz-day.today { border-color: var(--orange); background: #FFE9D2; box-shadow: 0 0 0 3px rgba(255, 138, 61, .25); }
.dz-day-n { font-size: 16px; font-weight: 700; color: var(--ink-soft); }
.dz-day-coin { display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 900; }
.dz-day-coin > * + * { margin-left: 5px; }
.dz-day-coin .dz-coin { width: 20px; height: 20px; }
.dz-daily-note { grid-column: span 3; margin-top: 6px; font-size: 18px; color: var(--ink-soft); }

/* ---------- 挑战月历：一格一天，做完当天挑战的那一格盖上红章 ---------- */
.dz-cal-month { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.dz-cal-grid { display: flex; flex-wrap: wrap; margin: 0 auto; max-width: 322px; }
.dz-cal-wd, .dz-cal-day { width: 14.2857%; text-align: center; }
.dz-cal-wd { font-size: 14px; font-weight: 700; color: var(--ink-soft); padding-bottom: 2px; }
.dz-cal-day {
  position: relative; height: 38px; line-height: 38px;
  font-size: 17px; font-weight: 700; color: var(--ink-soft);
}
.dz-cal-day.today { color: var(--ink); font-weight: 900; }
.dz-cal-day.today::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 2px dashed var(--orange); border-radius: 50%; box-sizing: border-box;
}
/* 盖了章的那天：红色圆章，白字 */
.dz-cal-day.on { color: #fff; font-weight: 900; z-index: 0; }
.dz-cal-day.on::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  background: #E5484D; border: 2px solid #B4232A; border-radius: 50%; box-sizing: border-box; z-index: -1;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .55);
}
.dz-cal-day.new::before { animation: dz-stamp .5s cubic-bezier(.3, 1.6, .5, 1) .35s both; }
@keyframes dz-stamp { 0% { transform: scale(2.6) rotate(-18deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.dz-cal-count { margin-top: 8px; font-size: 20px; font-weight: 900; }
.dz-cal-next { margin-top: 2px; font-size: 18px; font-weight: 700; color: #B5651D; }
@media (prefers-reduced-motion: reduce) { .dz-cal-day.new::before { animation: none; } }

/* ---------- 模拟广告（测试用） ---------- */
.dz-ad-mask {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: #2B2B33;
}
.dz-ad-card {
  width: 100%; max-width: 380px;
  padding: 26px 20px;
  background: #3A3A45; color: #fff;
  border: 3px dashed #8D8DA0; border-radius: 24px;
  text-align: center;
}
.dz-ad-card > * + * { margin-top: 14px; }
.dz-ad-tag { font-size: 30px; font-weight: 900; }
.dz-ad-note { font-size: 18px; color: #C9C9D6; }
.dz-ad-count { min-height: 28px; font-size: 20px; font-weight: 700; }

/* 自动广告前的一句预告 */
.dz-ad-notice {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1900;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(74, 52, 38, .78);
  color: #fff; font-size: 28px; font-weight: 900; text-align: center;
}

/* 矮屏幕：弹窗里的东西缩小一点，保证按钮看得见 */
@media (max-height: 700px) {
  .dz-modal { padding-top: 14px; }
  .dz-modal-hero { margin: -14px -20px 8px; padding: 8px 0 6px; }
  .dz-modal-mascot { width: 64px; height: 64px; }
  .dz-modal-title { font-size: 24px; margin-bottom: 6px; }
  .dz-modal.m-cheer .dz-modal-title { margin: -24px 0 8px; padding: 4px 22px 6px; }
  .dz-modal-body { margin-bottom: 8px; }
  .dz-sticker { min-height: 70px; padding: 4px 2px; }
  .dz-sticker-pic { font-size: 28px; }
  .dz-btn { min-height: 54px; }
  .dz-btn.small { min-height: 48px; }
}

/* 窄屏幕：贴纸的名字（4 个字）缩小一点，不要折成两行 */
@media (max-width: 380px) {
  .dz-sticker-name { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .dz-mask, .dz-modal, .dz-toast { animation: none; }
  .dz-rays, .cat-open, .cat-shut, .dz-btn.primary.big::after, .dz-modal.m-cheer .dz-modal-mascot { animation: none; }
}
