:root {
  color-scheme: light;
  --cream: #f3e7d2;
  --cream-deep: #e7d8bf;
  --paper: #fffaf3;
  --ink: #2a2118;
  --ink-soft: #5c5146;
  --green: #1b5e3b;
  --green-deep: #144a2f;
  --leaf: #e5f3ea;
  --coral: #d86a52;
  --coral-deep: #9e3f2e;
  --coral-soft: #fde7e0;
  --gold: #f6e7b8;
  --gold-ink: #6a4e08;
  --line: rgba(42, 33, 24, 0.14);
  --shadow: 0 12px 28px rgba(72, 44, 18, 0.08);
  --focus: #a56b00;
}

* { box-sizing: border-box; }

html { font-size: 18px; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "WenQuanYi Micro Hei", "Droid Sans Fallback", sans-serif;
  line-height: 1.7;
  background-color: var(--cream);
  background-image:
    radial-gradient(ellipse at 0% 0%, #fbe8c8 0%, transparent 46%),
    radial-gradient(ellipse at 100% 0%, #f8d5cb 0%, transparent 42%),
    radial-gradient(ellipse at 50% 100%, #e4f0e4 0%, transparent 40%);
  overflow-x: hidden;
}

img, svg { max-width: 100%; height: auto; }

button, input, textarea { font: inherit; color: inherit; }

a { color: var(--green); }

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 30;
  background: var(--green);
  color: var(--paper);
  padding: 12px 16px;
  min-height: 48px;
  border-radius: 12px;
  text-decoration: none;
}

.skip:focus { top: 12px; }

.page {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 16px max(16px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow-wrap: anywhere;
}

.margin-art {
  display: none;
  position: fixed;
  top: 72px;
  width: 150px;
  pointer-events: none;
}

.margin-art.left { left: 18px; }
.margin-art.right { right: 18px; top: 220px; }

h1, h2, h3, p { overflow-wrap: anywhere; }

h1 {
  margin: 0 0 8px;
  font-size: 1.7rem;
  line-height: 1.35;
  letter-spacing: 0.02em;
}

h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  line-height: 1.4;
}

h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  line-height: 1.45;
}

p { margin: 0 0 12px; }

.kicker {
  margin: 0 0 4px;
  color: var(--coral-deep);
  font-weight: 700;
}

.section-label {
  margin: 0 0 10px;
  font-weight: 700;
}

.lead { margin: 0 0 14px; }

.hero {
  display: block;
  width: 100%;
  border-radius: 24px;
  margin-bottom: 16px;
}

.card, .door, .q-link, .quote, .feedback, .preview, .group, .note, .banner {
  border-radius: 20px;
}

.card, .quote, .feedback, .preview, .note, .banner {
  background: var(--paper);
  border: 2px solid var(--line);
  box-shadow: var(--shadow);
}

.card, .note, .banner, .feedback, .preview {
  padding: 16px;
  margin: 0 0 14px;
}

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

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.topbar a, .btn, a.btn {
  min-height: 48px;
  min-width: 44px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--green);
  background: var(--paper);
  color: var(--green-deep);
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.4;
  cursor: pointer;
  max-width: 100%;
}

.btn, a.btn {
  display: flex;
  width: 100%;
  margin: 0 0 10px;
}

.btn-row > .btn,
.btn-row > a.btn,
.stack > .btn,
.stack > a.btn { margin: 0; }

.topbar a { width: auto; }

.btn-primary {
  background: var(--green);
  color: #fffaf3;
  border-color: var(--green);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(27, 94, 59, 0.35);
}

.btn-coral {
  background: var(--paper);
  color: var(--coral-deep);
  border-color: #e7b2a6;
}

button.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.door {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  background: var(--paper);
  border: 2px solid var(--line);
  box-shadow: var(--shadow);
  padding: 14px;
  min-height: 48px;
  margin: 0 0 12px;
}

.door-art {
  flex: 0 0 76px;
  width: 76px;
  height: 76px;
}

.door-copy { display: grid; gap: 2px; min-width: 0; }

.door-title { font-weight: 800; font-size: 1.2rem; }

.door-text, .door-meta { display: block; }

.door-meta { color: var(--green-deep); font-weight: 700; }

.door:nth-of-type(1) { border-left: 8px solid var(--green); }
.door:nth-of-type(2) { border-left: 8px solid var(--coral); }
.door:nth-of-type(3) { border-left: 8px solid #c8880a; }

.quote {
  margin: 0 0 14px;
  padding: 12px 14px 12px 16px;
  border-left: 8px solid var(--green);
  border-radius: 0 18px 18px 0;
}

.quote p:last-child, .card p:last-child, .note p:last-child { margin-bottom: 0; }

.example-tag {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--coral-deep);
  font-weight: 800;
}

.score {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--leaf);
  border: 2px solid rgba(27, 94, 59, 0.18);
  font-weight: 700;
}

.q-link {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: inherit;
  background: var(--paper);
  border: 2px solid var(--line);
  padding: 12px 14px;
  min-height: 48px;
  margin: 0 0 10px;
}

.q-main { font-weight: 700; flex: 1 1 180px; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--cream-deep);
  font-weight: 700;
}

.badge.good { background: #d7f0e2; color: #145032; }
.badge.later { background: var(--gold); color: var(--gold-ink); }
.badge.retry { background: var(--coral-soft); color: var(--coral-deep); }

.field, .blank {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
  font-weight: 700;
}

input[type="text"], textarea {
  width: 100%;
  max-width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid #c9b89a;
  background: #fffdf8;
  font-weight: 500;
}

textarea { min-height: 96px; resize: vertical; }

.piece-text { margin: 0 0 8px; font-weight: 700; }

.choice { justify-content: flex-start; text-align: left; }

.choice.is-on {
  background: var(--leaf);
  border-color: var(--green);
  box-shadow: inset 0 0 0 2px var(--green);
}

.feedback.good { background: #e7f6ec; border-color: #8fceb0; }
.feedback.try { background: var(--coral-soft); border-color: #f0b5a6; }

.feedback h2 { color: var(--green-deep); }
.feedback.try h2 { color: var(--coral-deep); }

.nudge {
  min-height: 1.7em;
  margin: 0;
  font-weight: 700;
  color: var(--coral-deep);
}

.group {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 2px;
  padding: 14px;
  min-height: 48px;
  border-radius: 18px;
  border: 2px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  font-weight: 700;
}

.group.is-on {
  border-color: var(--green);
  background: var(--leaf);
  box-shadow: inset 0 0 0 2px var(--green);
}

.group-kicker { color: var(--coral-deep); }

.check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-height: 48px;
  padding: 12px;
  border-radius: 14px;
  background: #fffdf8;
  border: 2px solid var(--line);
}

.check input {
  width: 24px;
  height: 24px;
  margin-top: 4px;
  flex: 0 0 auto;
}

.preview { background: #fffdf8; }

.center { text-align: center; }

.pre { white-space: pre-wrap; }

.footer {
  margin-top: 8px;
  color: var(--ink-soft);
}

.banner {
  background: var(--gold);
  border-color: #e3cc86;
}

.modal-back {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(42, 33, 24, 0.46);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.modal {
  width: min(100%, 520px);
  max-height: min(86vh, 640px);
  overflow: auto;
  background: var(--paper);
  border-radius: 22px;
  padding: 18px;
  border: 2px solid var(--line);
}

.print-sheet { display: none; }

.spot { width: min(100%, 260px); display: block; margin: 0 0 12px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

@media (min-width: 720px) {
  .page { padding-top: 28px; }
  .modal-back { align-items: center; }
}

@media (min-width: 1180px) {
  .margin-art { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

@media print {
  body { background: white; }
  .margin-art, .no-print, .footer, .topbar, .skip { display: none !important; }
  .page { max-width: none; padding: 0; }
  .print-sheet { display: block !important; }
  .print-sheet h1 { text-align: center; font-size: 28px; }
  .print-sheet .pre { white-space: pre-wrap; }
}
