:root {
  --ink: #21302f;
  --muted: #687270;
  --paper: #fff8ef;
  --paper-strong: #fff0d9;
  --line: rgba(36, 48, 46, 0.16);
  --amber: #f2a93b;
  --red: #d94b3d;
  --teal: #187b73;
  --green: #2f9f72;
  --blue: #3c72b8;
  --dark: #1e2727;
  --shadow: 0 24px 60px rgba(28, 44, 41, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 12%, rgba(242, 169, 59, 0.24), transparent 30%),
    radial-gradient(circle at 82% 88%, rgba(24, 123, 115, 0.18), transparent 32%),
    linear-gradient(135deg, #f7dcc0, #cfe2d5 56%, #f9efe6);
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.phone-frame {
  width: min(420px, 100%);
  height: min(860px, calc(100vh - 36px));
  min-height: 620px;
  border-radius: 30px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--shadow);
  border: 10px solid #172321;
  position: relative;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 60px;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 250, 242, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  z-index: 3;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fffaf2;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.progress-wrap {
  display: grid;
  gap: 6px;
}

.progress-label {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.progress-track {
  height: 8px;
  border-radius: 99px;
  background: rgba(33, 48, 47, 0.1);
  overflow: hidden;
}

.progress-bar {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--amber), var(--red));
  border-radius: inherit;
  transition: width 240ms ease;
}

.scene {
  flex: 1;
  overflow: hidden auto;
  padding: 20px;
  position: relative;
}

.scene::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.68;
  background-image:
    linear-gradient(rgba(33, 48, 47, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(33, 48, 47, 0.035) 1px, transparent 1px);
  background-size: 20px 20px;
}

.scene > * {
  position: relative;
}

.scene.dark {
  color: #fff7e9;
  background:
    linear-gradient(rgba(16, 23, 24, 0.9), rgba(24, 30, 30, 0.94)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 28px);
}

.scene.dark::before {
  opacity: 0.15;
}

.chapter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 99px;
  background: rgba(24, 123, 115, 0.12);
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

.dark .chapter {
  background: rgba(242, 169, 59, 0.18);
  color: #ffd287;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.title {
  margin-top: 14px;
  font-size: 30px;
  line-height: 1.16;
  letter-spacing: 0;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
}

.subtitle {
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--muted);
}

.dark .subtitle {
  color: rgba(255, 248, 232, 0.76);
}

.hero-visual {
  margin: 16px -8px 12px;
  height: 330px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 18px 38px rgba(64, 38, 16, 0.2);
}

.hero-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.primary-btn,
.secondary-btn,
.danger-btn {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 10px 20px rgba(30, 39, 39, 0.12);
}

.primary-btn {
  background: var(--teal);
  color: white;
}

.secondary-btn {
  background: #fff7ec;
  color: var(--ink);
  border: 1px solid var(--line);
}

.danger-btn {
  background: var(--red);
  color: white;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.stack {
  display: grid;
  gap: 14px;
}

.note {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 8px;
  background: rgba(24, 123, 115, 0.1);
  border: 1px solid rgba(24, 123, 115, 0.17);
  color: #28524d;
  line-height: 1.55;
  font-weight: 700;
}

.dark .note {
  color: #fff2d6;
  background: rgba(242, 169, 59, 0.15);
  border-color: rgba(242, 169, 59, 0.25);
}

.chat-screen {
  margin-top: 18px;
  padding: 14px;
  background: #e8f0e5;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.chat-title {
  text-align: center;
  font-weight: 900;
  margin-bottom: 12px;
}

.bubble-line {
  display: flex;
  gap: 9px;
  align-items: flex-end;
  margin: 10px 0;
}

.bubble-line.me {
  flex-direction: row-reverse;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #f6c15b;
  font-size: 12px;
  font-weight: 900;
}

.bubble {
  max-width: 78%;
  border: 0;
  border-radius: 8px;
  padding: 11px 12px;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  background: white;
  color: var(--ink);
}

.me .bubble {
  background: #9de074;
}

.bubble.played {
  outline: 3px solid rgba(24, 123, 115, 0.28);
}

.emotion-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.emotion-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf2;
  min-height: 64px;
  text-align: left;
  padding: 14px;
  cursor: pointer;
  font-weight: 800;
}

.emotion-btn.selected {
  color: white;
  background: var(--teal);
  border-color: var(--teal);
}

.factory-gate {
  margin: 20px 0;
  min-height: 245px;
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 209, 130, 0.14), transparent 35%),
    repeating-linear-gradient(90deg, #202a2c 0 32px, #182123 32px 64px);
  border: 1px solid rgba(255, 255, 255, 0.13);
  position: relative;
}

.factory-gate::before,
.factory-gate::after {
  content: "";
  position: absolute;
  width: 80px;
  height: 120%;
  top: -10%;
  background: rgba(255, 219, 143, 0.18);
  transform: rotate(17deg);
}

.factory-gate::before {
  left: 28px;
}

.factory-gate::after {
  right: 22px;
  transform: rotate(-17deg);
}

.npc {
  margin-top: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.npc-face {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #ffd36f;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: var(--dark);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.08);
}

.npc-speech {
  flex: 1;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 12px;
  line-height: 1.55;
}

.salt-card {
  margin-top: 16px;
  height: 295px;
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.7)),
    radial-gradient(circle at 48% 58%, #ddd 0 55px, transparent 56px),
    linear-gradient(135deg, #dbcbb8, #f7eee0);
  position: relative;
  overflow: hidden;
  color: var(--ink);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.fake-headline {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 18px;
  font-weight: 900;
  font-size: 22px;
  color: var(--red);
}

.salt-bottle {
  position: absolute;
  width: 94px;
  height: 130px;
  left: calc(50% - 47px);
  top: 98px;
  border-radius: 18px 18px 8px 8px;
  background: rgba(255, 255, 255, 0.68);
  border: 2px solid rgba(33, 48, 47, 0.18);
  filter: blur(1.2px);
}

.stamp {
  position: absolute;
  right: 22px;
  bottom: 28px;
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 4px solid rgba(217, 75, 61, 0.45);
  border-radius: 50%;
  color: rgba(217, 75, 61, 0.55);
  transform: rotate(-13deg);
  font-weight: 900;
}

.hotspot {
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(217, 75, 61, 0.8);
  background: rgba(217, 75, 61, 0.08);
  cursor: pointer;
  animation: pulse 1.35s infinite;
}

.hotspot.done {
  border-color: var(--green);
  background: rgba(47, 159, 114, 0.18);
  animation: none;
}

@keyframes pulse {
  50% {
    transform: scale(1.08);
  }
}

.hotspot.one {
  left: 20px;
  top: 42px;
}

.hotspot.two {
  left: calc(50% - 26px);
  top: 128px;
}

.hotspot.three {
  right: 30px;
  bottom: 36px;
}

.counter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.counter-box {
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.counter-value {
  display: block;
  margin-top: 8px;
  color: #ffd36f;
  font-size: 30px;
  font-weight: 900;
}

.range {
  width: 100%;
  accent-color: var(--amber);
  margin-top: 22px;
}

.ledger {
  margin-top: 18px;
  padding: 16px;
  background: #111717;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ledger-row {
  display: flex;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.18);
}

.wrapper-stack {
  margin-top: 14px;
  height: 128px;
  display: grid;
  place-items: center;
}

.wrapper-sheet {
  width: 88%;
  min-height: 86px;
  display: grid;
  place-items: center;
  padding: 10px;
  border-radius: 8px;
  background: #fbecd4;
  color: var(--dark);
  font-weight: 900;
  transform: rotate(var(--r));
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
  grid-area: 1 / 1;
  transition: transform 250ms ease, opacity 250ms ease;
}

.wrapper-sheet.torn {
  opacity: 0;
  transform: translateY(-24px) rotate(10deg);
}

.memory-card {
  margin: 18px auto;
  min-height: 290px;
  border-radius: 8px;
  background: var(--red);
  color: white;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 26px;
  box-shadow: 0 18px 36px rgba(217, 75, 61, 0.25);
  user-select: none;
}

.memory-card h3 {
  font-size: 30px;
  line-height: 1.45;
}

.lock-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.lock-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border-radius: 8px;
  background: #fff8ef;
  border: 1px solid var(--line);
  font-weight: 800;
}

.lock-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(217, 75, 61, 0.14);
}

.lock-item.open .lock-icon {
  background: rgba(47, 159, 114, 0.15);
}

.screenshot {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px rgba(30, 39, 39, 0.1);
}

.screenshot .fake-badge {
  display: inline-flex;
  margin-top: 12px;
  padding: 6px 10px;
  border-radius: 99px;
  background: rgba(217, 75, 61, 0.1);
  color: var(--red);
  font-weight: 900;
}

.trust-zone {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.drag-card,
.drop-zone {
  min-height: 110px;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fffaf2;
  line-height: 1.5;
}

.drag-card {
  cursor: grab;
  font-weight: 800;
}

.drag-card.bad {
  border-color: rgba(217, 75, 61, 0.35);
}

.drag-card.good {
  border-color: rgba(47, 159, 114, 0.35);
}

.drop-zone {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(24, 123, 115, 0.45);
  color: var(--teal);
  font-weight: 900;
}

.drop-zone.success {
  background: rgba(47, 159, 114, 0.13);
}

.video-cover {
  margin-top: 18px;
  min-height: 230px;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 8px;
  color: white;
  background:
    linear-gradient(rgba(217, 75, 61, 0.82), rgba(33, 48, 47, 0.82)),
    radial-gradient(circle at center, #f6c15b, #d94b3d);
  padding: 24px;
}

.video-cover strong {
  display: block;
  font-size: 28px;
  line-height: 1.35;
}

.manual {
  margin-top: 18px;
  min-height: 360px;
  padding: 20px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(242, 169, 59, 0.14), transparent 28%),
    #fffaf2;
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.5);
}

.manual-page {
  min-height: 250px;
  display: grid;
  align-content: center;
  gap: 18px;
}

.manual-page h3 {
  color: var(--teal);
  font-size: 26px;
}

.manual-controls {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.small-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
}

.steps {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.step-btn {
  border: 1px solid var(--line);
  background: #fffaf2;
  border-radius: 8px;
  min-height: 58px;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  font-weight: 800;
}

.step-btn.done {
  background: rgba(47, 159, 114, 0.14);
  border-color: rgba(47, 159, 114, 0.34);
}

.celebrate {
  margin-top: 16px;
  min-height: 120px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  background: linear-gradient(135deg, #f8cc59, #fff3c5);
  color: #6b3e00;
  font-weight: 900;
  font-size: 26px;
  opacity: 0;
  transform: scale(0.94);
  transition: 240ms ease;
}

.celebrate.show {
  opacity: 1;
  transform: scale(1);
}

.achievement {
  margin-top: 18px;
  min-height: 360px;
  display: grid;
  align-content: center;
  text-align: center;
  gap: 14px;
  border-radius: 8px;
  padding: 24px;
  color: #fff;
  background:
    linear-gradient(rgba(24, 123, 115, 0.84), rgba(33, 48, 47, 0.84)),
    url("./assets/family-hero.png") center / cover;
}

.achievement .badge {
  width: 112px;
  height: 112px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 3px solid rgba(255, 255, 255, 0.7);
  font-size: 50px;
}

.letter {
  margin-top: 18px;
  padding: 18px;
  border-radius: 8px;
  background: #fffdf7;
  border: 1px solid var(--line);
  transform-origin: top;
  transform: scaleY(0);
  max-height: 0;
  overflow: hidden;
  transition: 280ms ease;
  line-height: 1.8;
}

.letter.open {
  transform: scaleY(1);
  max-height: 420px;
}

.poster {
  margin-top: 18px;
  border-radius: 8px;
  min-height: 260px;
  padding: 22px;
  color: white;
  background: linear-gradient(145deg, #d94b3d, #187b73);
  display: grid;
  align-content: center;
  gap: 12px;
  text-align: center;
}

.record-btn {
  width: 116px;
  height: 116px;
  margin: 18px auto 0;
  border-radius: 50%;
  border: 0;
  color: white;
  background: var(--red);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 24px rgba(217, 75, 61, 0.25);
}

.record-btn.recording {
  animation: pulse 800ms infinite;
}

.data-board {
  margin-top: 18px;
  min-height: 330px;
  border-radius: 8px;
  padding: 22px;
  color: white;
  background:
    linear-gradient(rgba(30, 39, 39, 0.86), rgba(30, 39, 39, 0.92)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 28px);
  display: grid;
  place-items: center;
  text-align: center;
}

.big-number {
  display: block;
  font-size: 44px;
  color: #ffd36f;
  font-weight: 900;
  margin: 14px 0;
}

.qr {
  width: 132px;
  height: 132px;
  margin: 16px auto;
  background:
    linear-gradient(90deg, #111 12px, transparent 12px) 0 0 / 24px 24px,
    linear-gradient(#111 12px, transparent 12px) 0 0 / 24px 24px,
    #fff;
  border: 10px solid #fff;
  box-shadow: 0 10px 18px rgba(30, 39, 39, 0.12);
}

.toast {
  position: sticky;
  bottom: 8px;
  z-index: 5;
  margin-top: 14px;
  border-radius: 8px;
  padding: 12px;
  background: rgba(33, 48, 47, 0.92);
  color: white;
  text-align: center;
  font-weight: 800;
  transform: translateY(18px);
  opacity: 0;
  transition: 220ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 480px) {
  .app-shell {
    padding: 0;
  }

  .phone-frame {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .scene {
    padding: 18px;
  }

  .hero-visual {
    height: 300px;
  }
}
