@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Patrick+Hand&display=swap");

:root {
  --cream: #fff9ef;
  --paper: #fffdf8;
  --ink: #332e31;
  --soft-ink: #706b72;
  --coral: #bd5552;
  --deep-coral: #a84b4f;
  --blue: #245f78;
  --line: #e8d7c1;
  --soft-panel: rgba(247, 237, 222, .7);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: #fff;
  font-family: "Nunito", ui-rounded, system-ui, sans-serif;
  line-height: 1.42;
}
button, input, select, textarea { font: inherit; }
button, select, .upload-box { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(36, 95, 120, .3); outline-offset: 2px; }

.create-page {
  width: min(100%, 560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 clamp(20px, 6vw, 38px) max(28px, env(safe-area-inset-bottom));
  background: #fff;
}

.flow-header { display: flex; min-height: 58px; align-items: center; justify-content: space-between; margin: 0 calc(-1 * clamp(20px, 6vw, 38px)); padding: 0 clamp(20px, 6vw, 38px); border-bottom: 1px solid rgba(36,95,120,.12); background:#fff; box-shadow:0 3px 13px rgba(62,47,36,.055); }
.lc-logo {
  width: max-content;
  background: linear-gradient(90deg, #ef756b 0 18%, #efb742 18% 35%, #7da76f 35% 52%, #7caec1 52% 70%, #9b83a7 70% 86%, #ef756b 86%);
  background-clip: text;
  color: var(--coral);
  font-family: "Patrick Hand", cursive;
  font-size: clamp(17px, 4.5vw, 23px);
  letter-spacing: .025em;
  text-decoration: none;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lc-logo::after { content: ""; display: inline-block; width: 1.25em; height: 1.25em; margin-left: .15em; vertical-align: -.33em; background: url("../little-chapter/images/little-chapter-star.png") center / contain no-repeat; }
.close-flow { width: 40px; height: 40px; border: 0; background: transparent; color: var(--blue); font-size: 26px; line-height: 1; }

.screen { display: none; min-height: calc(100vh - 82px); padding-top: clamp(22px, 6vh, 48px); animation: reveal 180ms ease-out; }
.screen.active { display: flex; flex-direction: column; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } }

h1 { margin: 0; color: var(--blue); font-size: clamp(25px, 7vw, 34px); font-weight: 800; letter-spacing: -.035em; line-height: 1.12; }
.screen > p { margin: 10px 0 0; color: var(--soft-ink); font-size: clamp(14px, 3.8vw, 17px); }
.screen > p strong { color: var(--coral); }

.confirmation-screen { align-items: center; justify-content: center; padding-top: 24px; text-align: center; }
.success-mark { position: relative; width: 74px; height: 74px; margin: 4px 0 22px; border-radius: 50%; background: linear-gradient(145deg, #cc716b, var(--coral)); box-shadow: 0 12px 24px rgba(155, 67, 65, .2); }
.success-mark::after { content: ""; position: absolute; top: 21px; left: 23px; width: 27px; height: 15px; border-bottom: 3px solid white; border-left: 3px solid white; transform: rotate(-45deg); }
.confirmation-screen > p { max-width: 390px; }

.order-receipt { width: 100%; margin: 25px 0 20px; padding: 17px 18px; border: 1px solid var(--line); border-radius: 15px; background: rgba(249, 241, 229, .72); text-align: left; }
.order-receipt div { display: grid; grid-template-columns: 1fr auto; gap: 15px; padding: 3px 0; }
.order-receipt dt { color: var(--soft-ink); font-size: 13px; }
.order-receipt dd { margin: 0; font-size: 13px; font-weight: 800; }

.primary-button, .secondary-button { min-height: 50px; border-radius: 12px; font-weight: 800; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 16px; border: 0; background: linear-gradient(135deg, var(--coral), #b94e50); color: white; box-shadow: 0 8px 18px rgba(155, 67, 65, .16); }
.confirmation-screen .primary-button { width: 100%; padding: 12px 18px; font-size: clamp(15px, 4.2vw, 18px); }
.primary-button span[aria-hidden] { margin-left: auto; font-size: 24px; font-weight: 400; }
.secondary-button { border: 1px solid var(--line); background: rgba(255, 253, 248, .75); color: var(--ink); }
.email-note { margin-top: 18px !important; font-size: 12px !important; }

.step-screen { padding-top: 12px; }
.step-heading { margin-bottom: 14px; text-align: center; }
.step-heading p { margin: 0; color: var(--blue); font-family: "Patrick Hand", cursive; font-size: clamp(18px, 5vw, 22px); line-height: 1.1; }
.step-heading strong { font-weight: 400; }
.progress { position: relative; display: flex; align-items: center; justify-content: space-between; margin: 0 8px 6px; }
.progress::before { content: ""; position: absolute; z-index: 0; top: 50%; right: 13px; left: 13px; height: 2px; background: var(--line); transform: translateY(-50%); }
.progress span { position: relative; z-index: 1; display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; background: #f3ebdf; font-size: 12px; font-weight: 800; }
.progress .current { background: var(--coral); color: white; }
.step-count { display: block; margin-bottom: clamp(28px, 7vh, 54px); color: var(--soft-ink); text-align: center; }
.step-screen h1 { font-size: clamp(24px, 6.5vw, 32px); }

.upload-box { display: grid; min-height: 190px; margin-top: 22px; place-items: center; align-content: center; gap: 9px; padding: 14px; border: 2px dashed rgba(237, 112, 107, .55); border-radius: 18px; background: rgba(255, 253, 248, .52); text-align: center; }
.upload-box input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-placeholder { display: grid; place-items: center; gap: 3px; }
.upload-box strong { margin-top: 6px; color: var(--blue); }
.upload-box span { color: var(--soft-ink); font-size: 13px; }
.upload-box small { margin-top: 4px; color: var(--soft-ink); font-size: 11px; }
.upload-symbol { display: grid; width: 42px; height: 42px; place-items: center; border: 2px solid var(--coral); border-radius: 50%; color: var(--coral) !important; font-size: 26px !important; line-height: 1; }
.upload-box.dragging { border-color: var(--blue); background: rgba(36, 95, 120, .05); }
.upload-box.has-photos .upload-placeholder { display: none; }
.photo-previews { display: none; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.upload-box.has-photos .photo-previews { display: grid; }
.photo-previews img { display: block; width: 100%; height: 118px; border: 4px solid var(--paper); border-radius: 10px; object-fit: cover; box-shadow: 0 5px 12px rgba(67, 45, 31, .14); }
.upload-more { color: var(--blue) !important; font-size: 12px !important; font-weight: 800; }
.upload-status { margin: 10px 0 0 !important; color: var(--blue) !important; font-size: 12px !important; font-weight: 750; text-align: center; }
.upload-status.error { color: #943c38 !important; }
.tip { margin-top: 14px !important; color: var(--ink) !important; font-size: 12px !important; }

.age-field { display: block; margin-top: 34px; padding: 13px 17px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 253, 248, .7); }
.age-field select { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--blue); font-size: 26px; font-weight: 800; }
.change-note { margin-top: 46px !important; padding: 13px 15px; border-radius: 12px; background: var(--soft-panel); color: var(--ink) !important; font-size: 12px !important; }

.interest-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 24px; }
.interest-grid button { min-height: 42px; padding: 7px 5px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 253, 248, .72); color: var(--ink); font-size: 12px; font-weight: 700; }
.interest-grid button[aria-pressed="true"] { border-color: var(--coral); background: rgba(237, 112, 107, .12); color: var(--deep-coral); }
.interest-grid .other-interest { grid-column: 1 / -1; }
.other-input { width: 100%; min-height: 46px; margin-top: 9px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); }

.textarea-field { position: relative; display: block; margin-top: 24px; }
.textarea-field textarea { display: block; width: 100%; min-height: 176px; resize: vertical; padding: 17px 17px 32px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 253, 248, .75); color: var(--ink); }
.textarea-field > small { position: absolute; right: 13px; bottom: 10px; color: var(--soft-ink); }
.textarea-field.compact textarea { min-height: 106px; resize: none; }

.step-actions { display: grid; grid-template-columns: .72fr 1.28fr; gap: 12px; margin-top: auto; padding-top: 28px; }
.step-actions.one-action { grid-template-columns: 1fr; }
.step-actions button { width: 100%; padding: 10px 16px; }

.preview-screen { padding-top: clamp(32px, 7vh, 58px); }
.preview-art { display: grid; min-height: 390px; margin: 24px 0 17px; place-items: center; }
.large-letter { position: relative; width: min(100%, 330px); min-height: 390px; padding: 40px 31px 32px; border: 1px solid #ddcbb4; border-radius: 5px; background: linear-gradient(145deg, #f7eedc, #f3e7d1 72%, #efe0c6); color: #564630; font-family: "Patrick Hand", cursive; box-shadow: 0 13px 25px rgba(75, 54, 39, .15); transform: rotate(-1deg); }
.large-letter::after { content: ""; position: absolute; top: 16px; right: 17px; width: 27px; height: 27px; background: url("../little-chapter/images/little-chapter-star.png") center / contain no-repeat; opacity: .82; transform: rotate(8deg); pointer-events: none; }
.large-letter strong { display: block; padding-right: 31px; font-size: 19px; font-weight: 400; }
.large-letter p { margin: 32px 0; font-size: 19px; line-height: 1.48; white-space: pre-line; }
.large-letter small { display: block; color: var(--coral); font-size: 16px; white-space: pre-line; }
.large-letter [contenteditable="true"] { border-radius: 4px; cursor: text; }
.large-letter [contenteditable="true"]:hover,
.large-letter [contenteditable="true"]:focus { outline: 1px dashed rgba(36, 95, 120, .45); outline-offset: 4px; }
.preview-tools { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 12px; }
.preview-tools button { padding: 8px 10px; }
.full-button { width: 100%; min-height: 54px; padding: 11px 18px; }

.done-screen { align-items: center; justify-content: center; text-align: center; }
.mail-mark { position: relative; width: 92px; height: 68px; margin-bottom: 26px; border: 2px solid var(--coral); border-radius: 8px; background: rgba(237, 112, 107, .09); }
.mail-mark::before, .mail-mark::after { content: ""; position: absolute; top: 16px; width: 54px; height: 2px; background: var(--coral); }
.mail-mark::before { left: 2px; transform: rotate(35deg); }
.mail-mark::after { right: 2px; transform: rotate(-35deg); }
.mail-mark span { position: absolute; z-index: 2; top: -17px; left: 31px; width: 28px; height: 28px; border-radius: 50%; background: var(--coral); }
.done-screen > p { max-width: 360px; }
.received-list { display: grid; width: 100%; gap: 11px; margin: 27px 0 12px; padding: 17px 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 253, 248, .6); list-style: none; text-align: left; }
.received-list li { position: relative; padding-left: 27px; font-size: 13px; }
.received-list li::before { content: "✓"; position: absolute; top: 0; left: 0; display: grid; width: 18px; height: 18px; place-items: center; border-radius: 50%; background: rgba(102, 150, 91, .17); color: #5d8d52; font-size: 11px; font-weight: 800; }
.link-button { margin-top: 17px; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 390px) {
  .create-page { padding-inline: 17px; }
  .flow-header { margin-inline:-17px; padding-inline:17px; }
  .screen { min-height: calc(100vh - 72px); }
  .step-count { margin-bottom: 24px; }
  .interest-grid { gap: 7px; }
  .large-letter { min-height: 365px; padding: 36px 26px 28px; }
}

@media (prefers-reduced-motion: reduce) { .screen { animation: none; } }
