:root {
  --red: #df0001;
  --red-dark: #b80001;
  --red-pale: #fff2f2;
  --ink: #191b2b;
  --muted: #686b7c;
  --line: #e5e5eb;
  --surface: #fff;
  --green: #15945a;
  --orange: #dc8b10;
  --shadow: 0 14px 42px rgba(32, 21, 37, .07);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #faf9f9;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 50% -10%, #fff 0, #fff 24%, #faf8f8 62%, #f5f3f4 100%); }
button, input, select { font: inherit; }
button, label, select { -webkit-tap-highlight-color: transparent; }
.page { width: min(960px, calc(100% - 32px)); margin: 36px auto 64px; }
.header { text-align: center; margin: 0 auto 30px; }
.header h1 { margin: 0 0 10px; font-size: clamp(26px, 5vw, 38px); line-height: 1.15; letter-spacing: -.035em; }
.header p { margin: 0; color: var(--muted); font-size: 16px; }
.card { padding: 28px 34px; margin-bottom: 16px; border: 1px solid rgba(223,220,225,.88); border-radius: 20px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); }
.gate { width: min(650px, 100%); margin-inline: auto; }
.section-title { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.section-title h2, .success h2 { margin: 0; font-size: 20px; line-height: 1.3; }
.eyebrow { margin: 0 0 3px; color: var(--red); text-transform: uppercase; letter-spacing: .11em; font-size: 11px; font-weight: 800; }
.number { flex: 0 0 34px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; background: var(--red); font-weight: 750; }
.content-indent, .radio-row { margin-left: 48px; }
.plain-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.field label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 650; }
.field input, .field select { width: 100%; height: 48px; padding: 0 14px; border: 1px solid #d8d8e0; border-radius: 11px; color: var(--ink); background: #fff; outline: none; }
.field input:focus, .field select:focus { border-color: var(--red); box-shadow: 0 0 0 4px rgba(223,0,1,.09); }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--red); background: #fffafa; }
.name-combobox { position: relative; }
.child-name-input { padding-right: 40px !important; background-image: linear-gradient(45deg, transparent 50%, #777987 50%), linear-gradient(135deg, #777987 50%, transparent 50%) !important; background-position: calc(100% - 19px) 21px, calc(100% - 14px) 21px !important; background-size: 5px 5px, 5px 5px !important; background-repeat: no-repeat !important; }
.name-options { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0; max-height: 230px; overflow-y: auto; margin: 0; padding: 5px; border: 1px solid #d8d8e0; border-radius: 11px; background: #fff; box-shadow: 0 14px 34px rgba(28,23,34,.16); list-style: none; }
.name-options[hidden] { display: none; }
.name-option, .name-option-empty { padding: 10px 11px; border-radius: 7px; font-size: 14px; line-height: 1.25; }
.name-option { cursor: pointer; }
.name-option:hover, .name-option.is-active { color: var(--red-dark); background: var(--red-pale); }
.name-option[aria-selected="true"] { font-weight: 750; }
.name-option-empty { color: var(--muted); }
.field-help { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.access-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.access-field input { height: 54px; font-size: 18px; letter-spacing: .06em; text-transform: uppercase; }
.primary-btn { min-height: 54px; padding: 0 24px; border: 0; border-radius: 12px; color: #fff; background: var(--red); box-shadow: 0 8px 18px rgba(223,0,1,.19); font-weight: 750; cursor: pointer; transition: background .16s, transform .16s, box-shadow .16s; }
.primary-btn:hover { background: var(--red-dark); transform: translateY(-1px); box-shadow: 0 10px 23px rgba(223,0,1,.24); }
.primary-btn:focus-visible, .secondary-btn:focus-visible, .behavior-option:focus-visible, .remove-photo:focus-visible, .edit-photo:focus-visible, .template-option:focus-visible, .rotate-controls button:focus-visible, .editor-close:focus-visible, .upload:focus-within { outline: 3px solid rgba(223,0,1,.2); outline-offset: 2px; }
.primary-btn:disabled { opacity: .65; cursor: wait; transform: none; }
.error-message, .form-error { min-height: 19px; margin: 8px 0 0; color: var(--red-dark); font-size: 14px; }
.is-hidden { display: none !important; }
.radio-row { display: flex; flex-wrap: wrap; gap: 16px 42px; }
.choice { display: flex; align-items: center; gap: 9px; cursor: pointer; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--red); }
.choice input { width: 20px; height: 20px; margin: 0; }
.children-grid, .contact-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.photo-item { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid #ededf1; }
.photo-item:last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
.photo-title { margin: 0 0 11px; font-weight: 700; }
.optional { color: var(--muted); font-size: 13px; font-weight: 450; }
.upload { display: grid; place-items: center; min-height: 104px; padding: 18px; border: 1.5px dashed #d99a9a; border-radius: 14px; color: var(--red); background: #fffafa; text-align: center; cursor: pointer; transition: border .16s, background .16s; }
.upload:hover { border-color: var(--red); background: var(--red-pale); }
.upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload strong { display: block; margin-bottom: 5px; color: #333441; }
.upload small { color: var(--muted); }
.upload-arrow { color: var(--red); font-size: 21px; margin-right: 4px; }
.preview-row { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: stretch; margin-top: 12px; }
.preview { position: relative; overflow: hidden; min-height: 112px; border-radius: 12px; background: #f1f1f3; }
.preview img { display: block; width: 100%; height: 112px; object-fit: cover; }
.remove-photo { position: absolute; top: 7px; right: 7px; width: 30px; height: 30px; border: 0; border-radius: 50%; color: #fff; background: rgba(0,0,0,.72); cursor: pointer; font-size: 21px; line-height: 1; }
.edit-photo { position: absolute; left: 8px; bottom: 8px; padding: 7px 10px; border: 0; border-radius: 8px; color: #fff; background: rgba(20,20,25,.78); cursor: pointer; font-size: 12px; font-weight: 700; }
.photo-layout { grid-column: 1 / -1; display: block; margin-top: -7px; color: var(--muted); font-size: 12px; }
.comment-field { align-self: end; }
.behavior-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.behavior-option { min-height: 174px; padding: 19px; border: 1px solid #dedee5; border-radius: 14px; color: inherit; background: #fff; text-align: left; cursor: pointer; transition: border .16s, box-shadow .16s, transform .16s; }
.behavior-option:hover, .behavior-option[aria-checked="true"] { border-color: var(--red); box-shadow: 0 7px 20px rgba(45,26,34,.08); transform: translateY(-1px); }
.behavior-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.behavior-dot { width: 21px; height: 21px; border: 2px solid currentColor; border-radius: 50%; }
.good .behavior-dot { color: var(--green); }.mixed .behavior-dot { color: var(--orange); }.bad .behavior-dot { color: var(--red); }
.behavior-option[aria-checked="true"] .behavior-dot { box-shadow: inset 0 0 0 4px #fff; background: currentColor; }
.behavior-text { display: block; color: #4e5060; font-size: 14px; line-height: 1.5; }
.checkbox-group { display: grid; gap: 12px; margin-top: 20px; }
.checkbox-label { display: flex; align-items: flex-start; gap: 10px; color: #333442; font-size: 14px; line-height: 1.45; cursor: pointer; }
.checkbox-label input { flex: 0 0 19px; width: 19px; height: 19px; margin: 1px 0 0; }
.checkbox-label a { color: var(--red-dark); font-weight: 650; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.checkbox-label b { color: var(--red); }.checkbox-label em { color: var(--muted); font-style: normal; font-size: 13px; }
.footer-note { display: flex; gap: 12px; margin: 18px 0 12px; padding: 15px 19px; border: 1px solid #e2e2e7; border-radius: 13px; color: #484a59; background: #f3f3f5; font-size: 14px; line-height: 1.45; }
.form-error { text-align: center; }
.submit-btn { width: 100%; min-height: 62px; margin-top: 2px; font-size: 18px; }
.success { max-width: 650px; margin-inline: auto; text-align: center; }
.success-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 17px; border-radius: 50%; color: #fff; background: var(--green); font-size: 31px; font-weight: 800; }
.success p { color: var(--muted); line-height: 1.5; }.success .eyebrow { color: var(--green); }.submission-number { margin: 22px 0 0; padding: 12px; border-radius: 10px; background: #f4f4f6; }.submission-number strong { color: var(--ink); user-select: all; }

.photo-editor { width: min(960px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 22px; color: var(--ink); background: #fff; box-shadow: 0 28px 90px rgba(20,12,18,.28); }
.photo-editor::backdrop { background: rgba(20,16,20,.72); backdrop-filter: blur(3px); }
.photo-editor-panel { padding: 24px; }
.photo-editor-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.photo-editor-header h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.editor-close { flex: 0 0 40px; width: 40px; height: 40px; border: 0; border-radius: 50%; color: #3d3e48; background: #f1f1f4; cursor: pointer; font-size: 25px; line-height: 1; }
.editor-lead { margin: 10px 0 18px; color: var(--muted); font-size: 14px; }
.template-fieldset { margin: 0 0 16px; padding: 0; border: 0; }
.template-fieldset legend { margin-bottom: 9px; font-size: 13px; font-weight: 700; }
.template-switch { display: flex; gap: 10px; }
.template-option { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 0 14px; border: 1px solid #d9d9e0; border-radius: 10px; color: #494b59; background: #fff; cursor: pointer; font-weight: 650; }
.template-option[aria-checked="true"] { border-color: var(--red); color: var(--red-dark); background: var(--red-pale); box-shadow: inset 0 0 0 1px var(--red); }
.template-icon { display: block; border: 2px solid currentColor; border-radius: 2px; }
.template-icon.landscape { width: 22px; height: 14px; }
.template-icon.portrait { width: 14px; height: 22px; }
.book-preview { position: relative; overflow: hidden; border-radius: 14px; background: #342623; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); user-select: none; }
.book-preview canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: grab; }
.book-preview canvas.is-dragging { cursor: grabbing; }
.drag-hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); padding: 7px 11px; border-radius: 999px; color: #fff; background: rgba(20,16,18,.72); pointer-events: none; font-size: 12px; white-space: nowrap; }
.editor-controls { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 20px; align-items: end; margin-top: 18px; }
.zoom-control { display: grid; gap: 8px; color: #3e404d; font-size: 13px; font-weight: 700; }
.zoom-control input { width: 100%; accent-color: var(--red); cursor: pointer; }
.rotate-controls { display: flex; gap: 8px; }
.rotate-controls button, .secondary-btn { min-height: 42px; padding: 0 14px; border: 1px solid #d8d8df; border-radius: 10px; color: #353743; background: #fff; cursor: pointer; font-weight: 700; }
.rotate-controls button:hover, .secondary-btn:hover { border-color: #b9bac4; background: #f6f6f8; }
.editor-error { min-height: 19px; margin: 10px 0 0; color: var(--red-dark); font-size: 13px; }
.photo-editor-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.photo-editor-actions .primary-btn, .photo-editor-actions .secondary-btn { min-height: 46px; }
body:has(.photo-editor[open]) { overflow: hidden; }

@media (max-width: 760px) {
  .page { width: min(100% - 22px, 960px); margin-top: 22px; }
  .card { padding: 22px 18px; border-radius: 17px; }
  .content-indent, .radio-row { margin-left: 0; }
  .children-grid, .contact-grid, .behavior-grid { grid-template-columns: 1fr; }
  .behavior-option { min-height: 0; }
  .preview-row { grid-template-columns: 128px 1fr; }
  .photo-editor-panel { padding: 18px; }
}
@media (max-width: 520px) {
  .header { margin-bottom: 22px; }.header h1 { font-size: 27px; }.header p { font-size: 15px; }
  .section-title { align-items: flex-start; gap: 10px; }.section-title h2 { font-size: 18px; }
  .access-row { grid-template-columns: 1fr; }.access-row .primary-btn { width: 100%; }
  .radio-row { display: grid; gap: 14px; }
  .preview-row { grid-template-columns: 1fr; }.preview img { height: 170px; }
  .photo-editor { width: calc(100% - 12px); max-height: calc(100dvh - 12px); border-radius: 16px; }
  .photo-editor-panel { padding: 15px; }
  .photo-editor-header h2 { font-size: 20px; }
  .editor-lead { margin-bottom: 14px; }
  .template-switch { display: grid; grid-template-columns: 1fr 1fr; }
  .template-option { justify-content: center; padding: 0 8px; font-size: 12px; }
  .drag-hint { bottom: 7px; font-size: 10px; }
  .editor-controls { grid-template-columns: 1fr; gap: 12px; }
  .rotate-controls button { flex: 1; }
  .photo-editor-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .photo-editor-actions button { padding-inline: 9px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
