/* =========================================================
   styles.css · 原创手绘水彩风 3D 儿童立体翻页书界面样式
   ========================================================= */

:root {
  --desk-top: #f7efe0;
  --desk-bottom: #eadcc4;
  --ink-dark: #3e2f26;
  --ink-soft: #755f4d;
  --paper-white: #fffdf7;
  --shadow-card: 0 5px 0 rgba(74, 54, 38, 0.16), 0 12px 24px rgba(74, 54, 38, 0.12);
  --font-kid: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Comic Sans MS", sans-serif;
}

[hidden] {
  display: none !important;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-kid);
  color: var(--ink-dark);
  background:
    radial-gradient(circle at 50% 34%, #fffcf4 0%, var(--desk-top) 56%, var(--desk-bottom) 100%);
}

/* 水彩纸桌面微纹理 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.28;
  background-image:
    radial-gradient(rgba(128, 96, 62, 0.12) 1px, transparent 0),
    radial-gradient(rgba(128, 96, 62, 0.06) 1px, transparent 0);
  background-size: 24px 24px, 12px 12px;
  background-position: 0 0, 6px 6px;
}

/* ---------------- 顶部控制栏 ---------------- */
.top-bar {
  position: fixed;
  top: 16px;
  left: 20px;
  right: 20px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.brand-badge,
.top-controls > * {
  pointer-events: auto;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 10px 14px;
  background: var(--paper-white);
  border: 3.5px solid var(--ink-dark);
  border-radius: 28px 34px 30px 32px;
  box-shadow: var(--shadow-card);
}

.brand-icon {
  font-size: 28px;
  line-height: 1;
  animation: gentleBob 3s ease-in-out infinite;
}

.brand-text h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
}

.brand-sub {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sticker-counter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  background: #ffefc2;
  border: 3.5px solid var(--ink-dark);
  border-radius: 999px;
  font-size: 18px;
  font-weight: 900;
  color: var(--ink-dark);
  box-shadow: var(--shadow-card);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sticker-counter.pop {
  transform: scale(1.18);
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--paper-white);
  border: 3.5px solid var(--ink-dark);
  border-radius: 999px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-dark);
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease;
}

.pill-btn.btn-quiz {
  background: #e5f5e0;
}

.pill-btn.btn-quiz.active-mode {
  background: #ffe08a;
}

.pill-btn:hover {
  transform: translateY(-2px) scale(1.03);
}

.pill-btn:active {
  transform: translateY(2px) scale(0.96);
}

/* ---------------- 「猜猜我是谁」横幅 ---------------- */
.quiz-banner {
  position: fixed;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 28;
  width: min(720px, calc(100% - 36px));
  padding: 12px 18px;
  background: #fff9e0;
  border: 3.5px solid var(--ink-dark);
  border-radius: 26px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  animation: dockSlideUp 0.28s ease;
}

.quiz-text {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-dark);
  flex: 1 1 320px;
}

.quiz-actions {
  display: flex;
  gap: 8px;
}

.quiz-mini-btn {
  padding: 7px 14px;
  border-radius: 999px;
  border: 2.5px solid var(--ink-dark);
  background: #ffffff;
  color: var(--ink-dark);
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.quiz-mini-btn.btn-exit {
  background: #ffe3d9;
}

/* ---------------- 3D 立体书主画布 ---------------- */
.book-stage {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 5;
}

.book-canvas-wrap {
  width: 100%;
  height: 100%;
}

.book-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  overflow: hidden;
}

/* ---------------- 左右大号翻页箭头 ---------------- */
.turn-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 3.5px solid var(--ink-dark);
  background: #fff6dc;
  color: var(--ink-dark);
  font-size: 22px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.arrow-left { left: 22px; }
.arrow-right { right: 22px; }

.turn-arrow:hover {
  transform: translateY(-50%) scale(1.1);
}

.turn-arrow:active {
  transform: translateY(-50%) scale(0.94);
}

/* ---------------- 封面态开书引导 ---------------- */
.cover-prompt {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.open-book-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 32px;
  border-radius: 999px;
  border: 4px solid var(--ink-dark);
  background: linear-gradient(180deg, #f7b863 0%, #e58e49 100%);
  color: #ffffff;
  font-family: inherit;
  font-size: 21px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(74, 54, 38, 0.28), 0 14px 26px rgba(186, 108, 52, 0.28);
  animation: softPulse 2.4s ease-in-out infinite;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.open-book-btn:hover {
  transform: translateY(-3px) scale(1.04);
}

.prompt-tip {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  background: rgba(255, 253, 247, 0.9);
  padding: 5px 14px;
  border-radius: 999px;
}

/* ---------------- 开书态底部当前页标题条 ---------------- */
.scene-caption {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(560px, calc(100% - 32px));
}

.caption-main {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 22px;
  background: var(--paper-white);
  border: 3.5px solid var(--ink-dark);
  border-radius: 999px;
  box-shadow: var(--shadow-card);
}

.caption-emoji {
  font-size: 28px;
  line-height: 1;
}

.caption-words {
  display: flex;
  flex-direction: column;
}

.caption-words strong {
  font-size: 18px;
  font-weight: 900;
}

.caption-words span {
  font-size: 13px;
  color: var(--ink-soft);
}

.page-dots {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2.5px solid var(--ink-dark);
  background: #f5ebd8;
  cursor: pointer;
  padding: 0;
  transition: width 0.25s ease, background-color 0.25s ease;
}

.page-dot.active {
  width: 30px;
  background: #e5934b;
}

/* ---------------- 动物特写认知互动坞 ---------------- */
.animal-dock {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: min(750px, calc(100% - 28px));
  padding: 16px 22px;
  background: rgba(255, 253, 247, 0.97);
  border: 4px solid var(--ink-dark);
  border-radius: 28px;
  box-shadow: 0 18px 40px rgba(74, 52, 30, 0.22);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: dockSlideUp 0.34s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dock-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dock-emoji {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  background: #fff2d6;
  border: 3px solid var(--ink-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.dock-title h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 900;
}

.dock-title p {
  margin: 3px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.dock-back-btn {
  padding: 9px 16px;
  border-radius: 999px;
  border: 3px solid var(--ink-dark);
  background: #ffe6d6;
  color: var(--ink-dark);
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.dock-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dock-tag {
  padding: 5px 12px;
  border-radius: 999px;
  background: #f2f8ec;
  border: 2px solid #b6d6a2;
  font-size: 13px;
  font-weight: 800;
  color: #42693e;
}

.dock-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dock-palette {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  background: #faf2e2;
  border-radius: 999px;
  border: 2px solid #e4d4ba;
}

.palette-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-soft);
}

.swatch-row {
  display: flex;
  gap: 8px;
}

.swatch-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.swatch-btn:hover { transform: scale(1.16); }
.swatch-btn.active { transform: scale(1.18); outline: 3px solid var(--ink-dark); }

.dock-actions {
  display: flex;
  gap: 10px;
}

.dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 3.5px solid var(--ink-dark);
  color: #ffffff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dock-btn:hover { transform: translateY(-2px) scale(1.03); }
.dock-btn:active { transform: translateY(2px) scale(0.96); }

.btn-speak {
  background: linear-gradient(180deg, #74bce6 0%, #4a97c7 100%);
  box-shadow: 0 4px 0 rgba(58, 42, 30, 0.24);
}

.btn-feed {
  background: linear-gradient(180deg, #88c978 0%, #5da853 100%);
  box-shadow: 0 4px 0 rgba(58, 42, 30, 0.24);
}

/* ---------------- 粒子特效 ---------------- */
.fx-confetti {
  position: absolute;
  width: 12px;
  height: 12px;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  animation: confettiBurst 1.05s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

.fx-food {
  position: absolute;
  font-size: 52px;
  transform: translate(-50%, -50%);
  animation: foodFlyUp 0.62s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.fx-heart {
  position: absolute;
  font-size: 26px;
  animation: heartFloat 1.1s ease-out forwards;
}

@keyframes gentleBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes softPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

@keyframes dockSlideUp {
  from { opacity: 0; transform: translate(-50%, 24px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes confettiBurst {
  0% { transform: translate(0, 0) rotate(0deg) scale(0.6); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(1.1); opacity: 0; }
}

@keyframes foodFlyUp {
  0% { transform: translate(-50%, 0) scale(1.15) rotate(-14deg); opacity: 0.95; }
  75% { transform: translate(-50%, -220px) scale(0.95) rotate(12deg); opacity: 1; }
  100% { transform: translate(-50%, -245px) scale(0.2); opacity: 0; }
}

@keyframes heartFloat {
  0% { transform: translate(0, 0) scale(0.5); opacity: 0; }
  25% { opacity: 1; transform: translate(var(--dx), -26px) scale(1.18); }
  100% { transform: translate(var(--dx), -115px) scale(0.9); opacity: 0; }
}

@media (max-width: 720px) {
  .brand-sub,
  .btn-label {
    display: none;
  }

  .turn-arrow {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .arrow-left { left: 10px; }
  .arrow-right { right: 10px; }

  .dock-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
