:root {
  --chalk: #fff8df;
  --paper: #f7e4b0;
  --board: #235b44;
  --board-dark: #12382d;
  --red: #d6412d;
  --yellow: #f1d16f;
  --ink: #3d2b1f;
  --muted: #7a4a24;
  --blue-line: rgba(70, 115, 175, 0.18);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #e8c56f; color: var(--ink); }
body { overflow-x: hidden; }
button, a { font: inherit; }
button { cursor: pointer; border: 0; }

.app-shell {
  min-height: 100vh;
  padding: max(14px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 18% 10%, rgba(255,255,255,.28), transparent 30%),
    linear-gradient(135deg, #e9be55, #f8de91 42%, #dca74a);
}

.phone-frame {
  width: min(100%, 430px);
  min-height: min(850px, calc(100vh - 28px));
  border: 7px solid #432818;
  border-radius: 34px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(54, 30, 10, .35);
  position: relative;
}

.home-bg .phone-frame,
.question-screen,
.result-screen {
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--blue-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--blue-line) 1px, transparent 1px);
  background-size: 32px 32px;
}

.screen-card, .question-screen, .result-screen {
  min-height: min(850px, calc(100vh - 42px));
  padding: 22px;
  position: relative;
  isolation: isolate;
}

.blackboard, .small-board {
  background: linear-gradient(145deg, var(--board), var(--board-dark));
  color: var(--chalk);
  border: 4px solid #8d5d2f;
  border-radius: 18px;
  box-shadow: inset 0 0 24px rgba(255,255,255,.08), 0 8px 0 rgba(58, 34, 18, .18);
  text-align: center;
}
.small-board { padding: 11px 12px; font-weight: 800; letter-spacing: .06em; }

.home-screen h1 {
  margin: 28px 0 8px;
  font-size: clamp(42px, 13vw, 58px);
  line-height: 1.02;
  color: var(--red);
  text-shadow: 2px 3px 0 #fff7d7, 4px 5px 0 rgba(35,91,68,.18);
}
.lead { font-size: 18px; line-height: 1.55; color: var(--muted); margin: 0 0 18px; }

.classroom-stage {
  margin: 22px 0;
  padding: 18px 12px 14px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(35,91,68,.95) 0 38%, #bd7b38 38% 100%);
  border: 4px solid #fff3c4;
  box-shadow: 0 10px 0 rgba(0,0,0,.14);
}
.desk-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; justify-items: center; }
.mini-character {
  width: 82px;
  height: 82px;
  object-fit: contain;
  filter: drop-shadow(0 8px 4px rgba(0,0,0,.18));
}
.chalk-note {
  margin-top: 8px;
  color: var(--chalk);
  text-align: center;
  font-weight: 800;
  font-size: 15px;
}

.primary-btn, .secondary-btn, .ghost-btn, .share-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border-radius: 999px;
  padding: 0 22px;
  text-decoration: none;
  font-weight: 900;
  transition: transform .16s ease, filter .16s ease;
}
.primary-btn { width: 100%; background: var(--red); color: #fff8df; box-shadow: 0 8px 0 #8f251a; }
.secondary-btn { background: #fff8df; color: var(--board); border: 3px solid var(--board); }
.ghost-btn, .share-copy { background: rgba(255,248,223,.72); color: var(--muted); border: 2px dashed rgba(122,74,36,.4); }
.primary-btn:active, .secondary-btn:active, .ghost-btn:active, .share-copy:active { transform: translateY(3px); filter: brightness(.98); }
.tiny-tip { text-align: center; color: var(--muted); font-size: 13px; margin: 18px 0 0; }

.blackboard-bg .phone-frame { background: var(--board); }
.question-screen {
  background-color: var(--board);
  background-image: radial-gradient(rgba(255,255,255,.13) 1px, transparent 1px);
  background-size: 18px 18px;
  color: var(--chalk);
}
.progress-row { display: flex; justify-content: center; gap: 8px; margin: 8px 0 26px; }
.flower { opacity: .35; color: #fff; font-size: 22px; }
.flower.active { opacity: 1; color: #ffdf64; text-shadow: 0 2px 0 rgba(0,0,0,.22); }
.question-index { color: rgba(255,248,223,.72); text-align: center; font-weight: 800; }
.question-screen h2 { font-size: 30px; line-height: 1.25; margin: 16px 0 26px; text-align: center; }
.options-list { display: grid; gap: 14px; }
.option-card {
  width: 100%;
  min-height: 68px;
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  text-align: left;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 18px 8px 18px 8px;
  color: var(--ink);
  background: #fff7d7;
  box-shadow: 0 6px 0 rgba(0,0,0,.2);
}
.option-letter {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--red);
  font-weight: 1000;
}
.question-screen .ghost-btn { width: 100%; margin-top: 22px; color: var(--chalk); background: transparent; border-color: rgba(255,248,223,.45); }

.result-screen { padding: 18px; overflow: hidden; }
.result-badge {
  width: fit-content;
  margin: 0 auto 8px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--board);
  color: var(--chalk);
  font-weight: 900;
  border: 3px solid #fff7d7;
}
.hero-character {
  display: block;
  width: 220px;
  height: 220px;
  object-fit: contain;
  margin: -2px auto -20px;
  filter: drop-shadow(0 14px 8px rgba(0,0,0,.18));
  position: relative;
  z-index: 2;
}
.result-card {
  background: rgba(255,248,223,.94);
  border: 4px solid var(--board);
  border-radius: 26px;
  padding: 48px 18px 18px;
  box-shadow: 0 12px 0 rgba(61,43,31,.14);
}
.cadre-bg .result-card { border-color: #d6a625; }
.rebel-bg .result-card { border-color: #3d2b1f; transform: rotate(-.8deg); }
.nostalgia-bg .result-card { border-color: #b88754; }
.kicker { margin: 0; color: var(--muted); font-weight: 900; text-align: center; }
.result-card h2 { margin: 4px 0 8px; text-align: center; font-size: 38px; color: var(--red); }
.quote { margin: 0 auto 12px; text-align: center; font-size: 18px; font-weight: 900; color: var(--board); }
.description { margin: 0; line-height: 1.62; color: var(--ink); }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tag-row span { padding: 6px 10px; border-radius: 999px; background: #f4d270; color: #6f391c; font-size: 12px; font-weight: 900; }
.radar-list { display: grid; gap: 8px; margin-top: 12px; }
.radar-line { display: grid; grid-template-columns: 58px 1fr 32px; align-items: center; gap: 8px; font-size: 12px; font-weight: 900; }
.radar-line b { height: 12px; border-radius: 99px; background: linear-gradient(90deg, var(--red) var(--value), rgba(35,91,68,.13) var(--value)); }
.radar-line em { font-style: normal; color: var(--red); }
.action-row { display: grid; grid-template-columns: 1.25fr .75fr; gap: 10px; margin-top: 16px; }
.share-copy { width: 100%; margin-top: 10px; min-height: 44px; background: rgba(255,255,255,.55); }

.poster-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 30, 25, .72);
}
.poster-dialog {
  width: min(100%, 390px);
  max-height: 92vh;
  overflow: auto;
  background: #fff7d7;
  border-radius: 24px;
  border: 5px solid #432818;
  padding: 18px;
  position: relative;
  text-align: center;
}
.close-btn { position: absolute; right: 12px; top: 10px; width: 36px; height: 36px; border-radius: 50%; background: var(--red); color: #fff; font-size: 24px; }
.poster-dialog h3 { margin: 8px 0 4px; color: var(--red); }
.poster-dialog p { margin: 0 0 12px; color: var(--muted); }
.poster-dialog img { width: 100%; border-radius: 14px; border: 3px solid var(--board); }
.download-link { margin-top: 12px; }
.save-hint { margin: 12px 0 0; padding: 10px 12px; border-radius: 14px; background: #fff3ca; color: var(--board); font-weight: 800; }
.toast { position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%); z-index: 30; background: #235b44; color: #fff8df; padding: 12px 18px; border-radius: 999px; font-weight: 900; box-shadow: 0 10px 30px rgba(0,0,0,.2); }

.cadre-page .phone-frame { background: linear-gradient(#d6412d, #f5d26b); }
.rebel-page .phone-frame { background: linear-gradient(135deg, #a56b3d, #e1b36d); }
.nostalgia-page .phone-frame { background: linear-gradient(135deg, #ead1a0, #bea378); }

@media (max-width: 380px) {
  .screen-card, .question-screen, .result-screen { padding: 16px; }
  .hero-character { width: 194px; height: 194px; }
  .result-card h2 { font-size: 32px; }
  .question-screen h2 { font-size: 26px; }
}
