/* 睡前盲盒 —— 卡通粉蓝奶油色系 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Yuanti SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  color: #5a4a5f;
  background: linear-gradient(180deg, #ffeaf4 0%, #e8f4ff 55%, #fff6e8 100%);
  min-height: 100vh;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

/* 顶部 */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 6px;
}
header .logo { font-size: 20px; font-weight: 800; color: #ff6f91; letter-spacing: 1px; }
header .logo small { font-size: 11px; color: #b9a8c0; font-weight: 500; display: block; letter-spacing: 3px; }
#snd {
  border: none; background: #ffffffcc; width: 42px; height: 42px; border-radius: 50%;
  font-size: 18px; box-shadow: 0 3px 10px rgba(180, 140, 190, .25); cursor: pointer;
}

/* 主区 */
#main { flex: 1; padding: 8px 18px 90px; }
.head { display: flex; justify-content: space-between; align-items: center; margin: 6px 2px 4px; }
.head .date { font-size: 15px; font-weight: 700; color: #7a6a85; }
.head .streak { font-size: 13px; color: #ff8a5c; font-weight: 700; }

/* 门口场景 */
.scene { position: relative; text-align: center; padding: 14px 0 6px; }
.bubble {
  display: inline-block; background: #fff; border-radius: 18px; padding: 10px 18px;
  font-size: 15px; color: #6a5a75; box-shadow: 0 6px 18px rgba(190, 150, 200, .25);
  position: relative; margin-bottom: 6px; animation: pop .5s ease both;
}
.bubble::after {
  content: ""; position: absolute; bottom: -8px; left: 50%; margin-left: -8px;
  border: 8px solid transparent; border-top-color: #fff; border-bottom: none;
}
.char-wrap { position: relative; height: 300px; display: flex; align-items: flex-end; justify-content: center; }
.char { height: 230px; max-width: 85%; object-fit: contain; animation: bob 2.6s ease-in-out infinite; filter: drop-shadow(0 10px 16px rgba(160, 120, 170, .3)); }
.re-badge {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  background: #fff; border-radius: 999px; padding: 6px 14px; font-size: 13px;
  color: #8a7a95; box-shadow: 0 4px 12px rgba(190, 150, 200, .25); white-space: nowrap;
}

/* 选盒货架：7 个盒子，角色在盒后探头（占真实行高，避免行间遮挡） */
.shelf-title { text-align: center; font-size: 19px; font-weight: 800; color: #6a4a72; margin: 10px 0 2px; }
.shelf { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 16px; padding: 10px 6px 8px; }
.sbox { position: relative; width: 84px; cursor: pointer; animation: pop .5s ease both; transition: transform .15s ease; display: flex; flex-direction: column; align-items: center; }
.sbox:active { transform: scale(.93); }
.sbox .peek { position: relative; height: 54px; display: flex; align-items: flex-end; justify-content: center; margin-bottom: -12px; }
.sbox .peek img {
  height: 64px; max-width: 82px; object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(160, 120, 170, .3));
  animation: bob 2.8s ease-in-out infinite;
}
.sbox .mini .lid {
  position: relative; z-index: 2; height: 25px; border-radius: 8px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .08);
  transition: transform .45s cubic-bezier(.2, .8, .3, 1.4), opacity .4s;
}
.sbox .mini .lid::before { content: ""; position: absolute; left: -4px; right: -4px; top: 0; height: 100%; border-radius: 9px; background: inherit; }
.sbox .mini .bow { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); display: flex; }
.sbox .mini .bow i { width: 20px; height: 15px; background: #ffffffd9; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }
.sbox .mini .bow i:first-child { transform: rotate(-24deg); margin-right: -3px; }
.sbox .mini .bow i:last-child { transform: rotate(24deg); }
.sbox .mini .body {
  position: relative; height: 58px; margin: 2px 4px 0; border-radius: 6px 6px 10px 10px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .07), 0 8px 16px rgba(160, 120, 170, .28);
  overflow: hidden;
}
.sbox .mini .rv { position: absolute; left: 50%; top: 0; bottom: 0; width: 13px; margin-left: -6.5px; background: #ffffffd9; border-radius: 2px; }
.sbox .sname { text-align: center; font-size: 12.5px; color: #7a6a85; font-weight: 700; margin-top: 7px; }
.sbox.opening { animation: wiggle .8s ease-in-out 1; pointer-events: none; }
.sbox.opening .mini .lid { transform: translateY(-95px) rotate(24deg) scale(1.08); opacity: 0; }
.sbox.opening .mini .body { transform: scale(.92); transition: transform .5s ease; }
.sbox.opening .peek img { animation: pop-jump .7s ease .3s 1; }
.shelf-tip { text-align: center; font-size: 12.5px; color: #a898b0; padding: 2px 12px 0; }

/* 惊喜盒：彩虹渐变 + 问号，点开随机蹦出角色 */
.sbox.mystery .mini .lid, .sbox.mystery .mini .body {
  background: linear-gradient(120deg, #ff9eb8, #ffd08a, #9fe3b0, #8fd0f5, #c3a8ef);
}
.sbox.mystery .qmark {
  height: 54px; display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 4px; font-size: 38px; font-weight: 900; color: #ff8fab;
  text-shadow: 0 0 12px #ffffff, 0 2px 0 #fff;
  animation: bob 2.4s ease-in-out infinite;
}

/* 开盒瞬间的台词气泡 */
.open-toast {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  background: #fff; border-radius: 18px; padding: 9px 18px; max-width: 86%;
  font-size: 14.5px; color: #6a5a75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 8px 22px rgba(190, 150, 200, .35);
  animation: pop .4s ease both, bob 1.6s ease-in-out infinite;
  z-index: 5;
}

/* 陪伴角色横幅 */
.companion {
  display: flex; align-items: center; gap: 12px; background: #fff;
  border-radius: 16px; padding: 8px 14px; margin: 12px 0 0;
  box-shadow: 0 6px 18px rgba(190, 150, 200, .18);
}
.companion img { height: 44px; width: auto; object-fit: contain; }
.companion .comp-txt { font-size: 14px; color: #7a6a85; font-weight: 700; }
.companion .comp-say { display: block; font-size: 12px; font-weight: 500; color: #a898b0; margin-top: 2px; }

/* 彩带 */
.confetti-wrap { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti-wrap .cf {
  position: absolute; bottom: 40%; width: 9px; height: 14px; border-radius: 3px; opacity: 0;
  animation: fly 1.3s ease-out forwards;
}
.confetti-wrap .cf.star { width: 16px; height: 16px; border-radius: 0; background: none !important;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }

/* 卡片 */
.card {
  background: #fff; border-radius: 22px; padding: 18px 18px 16px; margin: 14px 0;
  box-shadow: 0 8px 24px rgba(190, 150, 200, .18);
}
.q-card { animation: pop .45s ease both; }
.q-card:nth-child(2) { animation-delay: .08s; }
.box-title { font-size: 21px; font-weight: 800; color: #6a4a72; margin: 16px 2px 4px; }
.box-title .theme { color: #ff8fab; font-size: 15px; margin-left: 6px; }
.box-sub { font-size: 12.5px; color: #a898b0; margin: 0 2px 6px; }
.q-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.q-no { background: #ffd3e0; color: #d6467c; font-weight: 800; font-size: 12.5px; border-radius: 999px; padding: 3px 11px; }
.q-diff { color: #ffb040; font-size: 13px; letter-spacing: 2px; }
.q-tags { font-size: 11.5px; color: #9a8aa5; }
.q-title { font-size: 17.5px; font-weight: 800; color: #5a3a66; margin-bottom: 8px; }
.q-body p { font-size: 15px; line-height: 1.75; margin: 6px 0; }
.tips { background: #fff7e4; border-radius: 14px; padding: 12px 14px; margin-top: 10px; }
.tips p { font-size: 13.5px; line-height: 1.7; margin: 4px 0; color: #8a7440; }
.ans-box { margin-top: 10px; }
.ans-sec { border-radius: 14px; padding: 12px 14px; margin-top: 8px; font-size: 14px; line-height: 1.7; }
.ans-sec b { display: inline-block; margin-bottom: 4px; }
.ans-key { background: #e8f7ee; color: #2e6a46; }
.ans-sec:not(.ans-key):not(.wow):not(.theory) { background: #f3eefa; color: #574a72; }
.wow { background: #ffeef6; color: #b0507e; }
.theory { background: #eaf3ff; color: #3f5a85; font-size: 13px; }
.review-card b { color: #6a4a72; }
.review-item { padding: 6px 2px 0; font-size: 14px; color: #7a6a85; }

/* 按钮 */
.btn {
  display: block; width: 100%; border: none; border-radius: 18px; cursor: pointer;
  font-size: 15.5px; font-weight: 700; padding: 14px 16px; margin: 12px 0 4px;
  background: linear-gradient(135deg, #ff9eb8, #ff6f91); color: #fff;
  box-shadow: 0 8px 18px rgba(255, 111, 145, .35);
  transition: transform .12s ease;
}
.btn:active { transform: scale(.97); }
.btn.big { font-size: 17px; padding: 16px; }
.btn.ghost { background: #fff; color: #a06a90; box-shadow: 0 4px 12px rgba(190, 150, 200, .18); }
.btn.ans { background: linear-gradient(135deg, #8ed0a8, #56b47c); box-shadow: 0 8px 18px rgba(86, 180, 124, .3); }
.btn.copy { background: linear-gradient(135deg, #9db8f0, #6f8fe8); box-shadow: 0 8px 18px rgba(111, 143, 232, .3); }
.btn.back { margin-top: 20px; }

/* 历史页 */
.his-row {
  display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 16px;
  padding: 12px 14px; margin: 8px 0; box-shadow: 0 4px 14px rgba(190, 150, 200, .14); font-size: 14px;
}
.his-row .his-date { color: #9a8aa5; font-size: 12.5px; min-width: 92px; }
.his-row .his-type { flex: 1; font-weight: 700; color: #6a5a75; }
.his-row .his-st { font-size: 12px; color: #ff8fab; }
.his-row.lock { opacity: .45; }

/* 底部导航 */
#nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; display: flex; gap: 10px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: #ffffffee; backdrop-filter: blur(8px);
}
.nav-btn {
  flex: 1; border: none; background: #f5eef7; color: #9a8aa5; border-radius: 16px;
  padding: 12px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.nav-btn.on { background: linear-gradient(135deg, #ff9eb8, #ff6f91); color: #fff; }

.hide { display: none; }

/* 动画 */
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(-7deg) translateX(-3px); }
  30% { transform: rotate(7deg) translateX(3px); }
  45% { transform: rotate(-8deg); }
  60% { transform: rotate(8deg); }
  75% { transform: rotate(-5deg) scale(1.06); }
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pop-jump { 0% { transform: translateY(0); } 40% { transform: translateY(-26px) scale(1.12); } 100% { transform: translateY(0); } }
@keyframes fly {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(540deg); opacity: 0; }
}
