/* 你几岁了 — 沿用纸漫画色板：网点纸底、黄招牌、黑边硬阴影 */

:root {
  --paper: #fffdf5;
  --ink: #161616;
  --dim: #6b6b6b;
  --gray: #9a9a9a;
  --red: #e23b2e;
  --yellow: #ffd23f;
  --desk: #efe7d6;
  --cream: #fff8e4;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    system-ui, sans-serif;
  --app-max: 480px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --radius: 3px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  background: var(--desk);
}

body {
  min-height: 100%;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--desk);
  color: var(--ink);
  line-height: 1.45;
  font-weight: 700;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  overflow-x: hidden;
  background-image: radial-gradient(rgba(0, 0, 0, 0.09) 1px, transparent 1.2px);
  background-size: 7px 7px;
}

@supports (min-height: 100dvh) {
  body {
    min-height: 100dvh;
  }
}

button {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

button:focus {
  outline: none;
}

@keyframes btn-pop {
  0% { transform: scale(1); }
  38% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.is-pop {
  animation: btn-pop 0.26s ease;
}

button:disabled {
  opacity: 0.55;
}

.app {
  position: relative;
  z-index: 1;
  max-width: var(--app-max);
  margin: 0 auto;
  min-height: 100vh;
  padding: 14px;
  padding-bottom: 20px;
  display: flex;
  flex-direction: column;
}

@supports (min-height: 100dvh) {
  .app {
    min-height: 100dvh;
  }
}

@supports (padding-top: env(safe-area-inset-top)) {
  .app {
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
}

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.screen.active {
  display: flex;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#screen-quiz.active {
  justify-content: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.panel {
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.bigbtn {
  width: 100%;
  padding: 15px;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 2px;
  background: var(--yellow);
  box-shadow: var(--shadow);
  margin-top: 16px;
}

.ghost {
  width: 100%;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  padding: 12px 8px;
  box-shadow: var(--shadow-sm);
}

/* ---------- 封面 ---------- */

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.signboard {
  position: relative;
  background: var(--yellow);
  border-bottom: 3px solid var(--ink);
  padding: 10px 14px 12px;
  flex-shrink: 0;
}

.signboard::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background-image: radial-gradient(rgba(22, 22, 22, 0.28) 1px, transparent 1.4px);
  background-size: 5px 5px;
  opacity: 0.45;
  pointer-events: none;
}

.sign-kicker {
  position: relative;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.sign-cn {
  position: relative;
  margin-top: 2px;
  font-size: 36px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0.06em;
}

.hero-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 18px 16px 20px;
}

.scene {
  position: relative;
  width: 248px;
  height: 188px;
  margin: 0 auto;
}

.ground {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 1px;
  height: 3px;
  background: var(--ink);
  border-radius: 2px;
}

.bubble {
  position: absolute;
  top: 0;
  left: 155px;
  z-index: 3;
  padding: 4px 12px 5px;
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 6px;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
  transform: translateX(-50%);
}

.bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 10px;
  height: 10px;
  margin-left: -6px;
  background: var(--yellow);
  border-right: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  transform: rotate(45deg);
}

.cake {
  position: absolute;
  left: 37px;
  bottom: 12px;
  width: 52px;
  height: 62px;
}

.flame,
.candle,
.icing,
.cake-body {
  position: absolute;
  border: 2px solid var(--ink);
}

.flame {
  left: 20px;
  top: 0;
  width: 12px;
  height: 14px;
  background: var(--red);
  border-radius: 50%;
}

.flame::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 4px;
  height: 6px;
  background: var(--paper);
  border-radius: 50%;
}

.candle {
  left: 22px;
  top: 12px;
  width: 8px;
  height: 10px;
  background: var(--paper);
}

.icing {
  left: 8px;
  top: 20px;
  width: 36px;
  height: 16px;
  background: var(--paper);
  border-width: 3px;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}

.cake-body {
  left: 2px;
  top: 34px;
  width: 48px;
  height: 24px;
  background: var(--yellow);
  border-width: 3px;
  border-radius: 3px;
}

.person {
  position: absolute;
  left: 111px;
  bottom: 12px;
  width: 88px;
  height: 132px;
}

.hair {
  position: absolute;
  left: 12px;
  top: 0;
  z-index: 2;
  width: 64px;
  height: 26px;
  background: var(--ink);
  border-radius: 32px 32px 8px 8px;
}

.hair::after {
  content: "";
  position: absolute;
  left: 8px;
  bottom: -5px;
  width: 48px;
  height: 10px;
  background: var(--ink);
  border-radius: 0 0 6px 6px;
}

.head {
  position: absolute;
  left: 4px;
  top: 16px;
  width: 80px;
  height: 74px;
  background: #ffe1b0;
  border: 3px solid var(--ink);
  border-radius: 40px;
}

.head::before,
.head::after {
  content: "";
  position: absolute;
  top: 42px;
  width: 10px;
  height: 6px;
  background: rgba(226, 59, 46, 0.4);
  border-radius: 50%;
}

.head::before { left: 8px; }
.head::after { right: 8px; }

.body {
  position: absolute;
  left: 14px;
  top: 82px;
  width: 60px;
  height: 46px;
  background: var(--red);
  border: 3px solid var(--ink);
  border-radius: 8px;
  color: var(--paper);
  font-size: 16px;
  font-weight: 900;
  line-height: 40px;
  text-align: center;
}

.arm {
  position: absolute;
  left: 64px;
  top: 96px;
  z-index: 1;
  width: 18px;
  height: 12px;
  background: #ffe1b0;
  border: 2px solid var(--ink);
  border-radius: 6px;
}

.phone {
  position: absolute;
  left: 72px;
  top: 84px;
  z-index: 2;
  width: 32px;
  height: 44px;
  background: var(--ink);
  border-radius: 5px;
}

.phone span {
  display: block;
  width: 22px;
  height: 26px;
  margin: 4px auto 0;
  background: var(--yellow);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 26px;
  text-align: center;
  border-radius: 2px;
}

.cal-bind {
  background: var(--red);
  color: var(--paper);
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 1px;
  padding: 6px 0;
  border-bottom: 2px solid var(--ink);
}

.cal-q {
  margin: 6px 0 0;
  font-size: 26px;
  font-weight: 900;
  line-height: 1.1;
}

.cal-sub {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--dim);
}

.eye {
  position: absolute;
  top: 26px;
  width: 8px;
  height: 10px;
  background: var(--ink);
  border-radius: 50%;
}

.eye i {
  position: absolute;
  left: 1px;
  top: 1px;
  width: 3px;
  height: 3px;
  background: var(--paper);
  border-radius: 50%;
}

.eye-l { left: 18px; }
.eye-r { left: 50px; }

.mouth {
  position: absolute;
  left: 31px;
  top: 46px;
  width: 18px;
  height: 9px;
  border: 2px solid var(--ink);
  border-top: 0;
  border-radius: 0 0 12px 12px;
}

.tagline {
  margin-top: 20px;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.55;
}

.disclaimer {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray);
}

/* ---------- 点梗 ---------- */

.quiz-top {
  padding: 10px 12px 12px;
  flex-shrink: 0;
}

.quiz-count {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.bar {
  height: 10px;
  margin-top: 8px;
  background: var(--desk);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
}

.bar-in {
  height: 100%;
  width: 0;
  background: var(--yellow);
  transition: width 0.32s ease;
}

.meme-card {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin-top: 14px;
  padding: 28px 20px;
  min-height: 208px;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.meme-card.is-leave {
  transform: translateX(-64px);
  opacity: 0;
}

.meme-card.is-enter {
  transform: translateX(64px);
  opacity: 0;
  transition: none;
}

.meme-kicker {
  display: inline-block;
  align-self: center;
  background: var(--yellow);
  border: 2px solid var(--ink);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
}

.meme-text {
  margin-top: 16px;
  font-size: 32px;
  line-height: 1.35;
  font-weight: 900;
  word-break: break-word;
}

.choice-row {
  display: flex;
  margin-top: 12px;
  flex-shrink: 0;
}

.choice {
  flex: 1 1 0;
  min-width: 0;
  min-height: 56px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 2px;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.choice-yes {
  margin-right: 8px;
  background: var(--yellow);
}

.choice-no {
  margin-left: 8px;
  background: var(--paper);
}

/* ---------- 结算 ---------- */

.settle {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  perspective: 800px;
}

.settle-cal {
  width: 220px;
  text-align: center;
  overflow: hidden;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  transform: rotateX(-88deg);
}

.settle.is-open .settle-cal {
  transform: rotateX(0deg);
  transition: transform 0.45s ease;
}

.settle-num {
  margin: 2px 0 0;
  font-size: 92px;
  line-height: 1;
  font-weight: 900;
  color: var(--red);
  opacity: 0;
  transform: scale(1.4);
}

.settle.is-open .settle-num {
  opacity: 1;
  transform: none;
  transition: opacity 0.3s ease 0.25s, transform 0.3s ease 0.25s;
}

.settle .cal-sub {
  margin: 0 0 16px;
  font-size: 22px;
  font-weight: 900;
  color: var(--ink);
}

.settle-hint {
  margin-top: 22px;
  font-weight: 900;
  font-size: 20px;
}

/* ---------- 结果 ---------- */

.result {
  display: flex;
  flex-direction: column;
}

.poster-frame {
  margin-top: 2px;
}

.poster-frame canvas {
  display: block;
  width: 100%;
  height: auto;
  background: var(--desk);
}

.actions {
  margin-top: 14px;
}

.actions .bigbtn {
  margin-top: 0;
}

.actions-row {
  display: flex;
  margin-top: 10px;
}

.actions-row .ghost {
  flex: 1 1 0;
  min-width: 0;
}

.actions-row .ghost + .ghost {
  margin-left: 10px;
}

.again-btn {
  margin-top: 10px;
}

.result-ad {
  position: relative;
  margin-top: 16px;
  padding: 14px 10px 10px;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius);
}

.result-ad.is-empty {
  display: none;
}

.ad-label {
  position: absolute;
  top: -11px;
  left: 10px;
  z-index: 1;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--dim);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 2px;
}

.ad-slot {
  min-height: 50px;
  overflow: visible;
}

.ad-slot .adsbygoogle {
  display: block;
  width: 100% !important;
  height: auto !important;
  min-height: 50px;
  max-width: 100%;
  margin: 0 auto !important;
  overflow: visible !important;
}

.ad-slot iframe {
  max-width: 100%;
  margin-left: 0 !important;
}

.shotview {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(22, 22, 22, 0.72);
}

.shotview[hidden] {
  display: none;
}

.shotview-card {
  width: 100%;
  max-width: 420px;
  max-height: 92vh;
  overflow: auto;
  padding: 14px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.shotview-cap {
  margin-bottom: 8px;
  text-align: center;
  font-size: 16px;
  font-weight: 900;
}

.shotview-img-wrap {
  position: relative;
  width: 100%;
}

.shotview-img {
  display: block;
  width: 100%;
  height: auto;
  border: 2px solid var(--ink);
  background: var(--desk);
  -webkit-touch-callout: default;
  -webkit-user-select: auto;
  user-select: auto;
}

.shotview-wx-hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 2;
  padding: 6px 12px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  pointer-events: none;
  background: rgba(22, 22, 22, 0.78);
  border: 2px solid var(--ink);
  border-radius: 999px;
  transform: translateX(-50%);
}

.shotview-tip {
  margin: 10px 0 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--dim);
}

.shotview-row {
  display: flex;
}

.shotview-row .ghost {
  flex: 1 1 0;
  min-width: 0;
}

.shotview-row .ghost + .ghost {
  margin-left: 10px;
}

/* ---------- 分享 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  max-width: 86vw;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  border-radius: var(--radius);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transform: translateX(-50%) translateY(8px);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .toast {
    bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  }
}

.sheet-mask {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background: rgba(22, 22, 22, 0.45);
  z-index: 25;
  align-items: flex-end;
  justify-content: center;
}

.sheet-mask.open {
  display: flex;
}

.sheet {
  width: 100%;
  max-width: var(--app-max);
  background: var(--paper);
  border-top: 3px solid var(--ink);
  padding: 10px 16px 16px;
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .sheet {
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
}

.sheet-grip {
  width: 42px;
  height: 5px;
  margin: 0 auto 8px;
  background: var(--ink);
  border-radius: 4px;
}

.sheet-title {
  text-align: center;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.sheet-item {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  min-height: 64px;
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.sheet-badge {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  margin-right: 10px;
  line-height: 32px;
  text-align: center;
  font-weight: 900;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
}

.sheet-main {
  display: block;
  min-width: 0;
}

.sheet-main strong {
  display: block;
  font-size: 16px;
}

.sheet-main em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  color: var(--dim);
}

.sheet-cancel {
  display: block;
  width: 100%;
  margin-top: 12px;
  min-height: 46px;
  font-weight: 900;
  font-size: 16px;
}

.reduce-motion .settle-cal,
.reduce-motion .settle-num,
.reduce-motion .is-pop,
.reduce-motion .bar-in,
.reduce-motion .meme-card {
  animation: none;
  transition: none;
}

.reduce-motion .settle-cal,
.reduce-motion .settle.is-open .settle-cal,
.reduce-motion .settle-num,
.reduce-motion .settle.is-open .settle-num {
  opacity: 1;
  transform: none;
}

@media (max-width: 360px) {
  .sign-cn { font-size: 32px; }
  .meme-text { font-size: 26px; }
  .cal-q { font-size: 22px; }
  .choice { font-size: 16px; min-height: 52px; }
  .hero-body { padding-left: 12px; padding-right: 12px; }
}
