:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: #f7f1ea;
  color: #352d2b;
  line-height: 1.65;
  --ink: #352d2b;
  --muted: #857b75;
  --line: #e6dad1;
  --paper: #fffdfa;
  --rose: #a86562;
  --rose-dark: #854f4e;
  --green: #556d62;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.page-width { width: min(960px, calc(100% - 40px)); margin-inline: auto; }
.site-header { display: flex; justify-content: space-between; align-items: center; padding: 24px 0; position: relative; z-index: 2; }
.brand { display: inline-flex; gap: 10px; align-items: center; text-decoration: none; font-weight: 700; letter-spacing: .03em; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: .08em; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #c58c84; border-radius: 50%; color: var(--rose); font-family: serif; }
.quiet-link { color: var(--muted); font-size: 13px; text-underline-offset: 4px; }
.main-content { padding: 44px 0 20px; position: relative; z-index: 1; }
.hero { max-width: 680px; padding: 38px 0 30px; }
.eyebrow { margin: 0 0 8px; color: var(--rose); font-size: 11px; font-weight: 700; letter-spacing: .17em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 18px; font-size: clamp(38px, 7vw, 70px); line-height: 1.16; letter-spacing: -.07em; font-weight: 700; }
h1 em { color: var(--rose); font-style: normal; }
h2 { margin-bottom: 0; font-size: clamp(21px, 3vw, 28px); letter-spacing: -.04em; }
h3 { margin: 0; font-size: 17px; }
.hero-copy { max-width: 540px; color: var(--muted); font-size: 16px; }
.panel { border: 1px solid var(--line); border-radius: 18px; background: rgb(255 253 250 / 92%); box-shadow: 0 14px 36px rgb(104 72 58 / 6%); }
.form-panel, .result-panel, .admin-section, .auth-panel { padding: clamp(22px, 4vw, 34px); }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 26px; }
.status-pill { border: 1px solid #d8cbc3; border-radius: 999px; padding: 5px 11px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.status-pill[data-state="ready"] { border-color: #a9c1b1; background: #f0f7f1; color: #3f684d; }
.status-pill[data-state="warning"] { border-color: #dfb68d; background: #fff5e9; color: #996336; }
.status-pill[data-state="error"] { border-color: #deb3ad; background: #fff0ed; color: #914841; }
.privacy-note { display: flex; gap: 14px; align-items: flex-start; margin: 0 0 24px; padding: 15px 18px; border: 1px solid #ecd2c7; border-radius: 12px; background: #fff8f4; color: #654a43; }
.privacy-note strong { font-size: 14px; }
.privacy-note p { margin: 3px 0 0; color: #8e7168; font-size: 12px; }
.privacy-icon { color: var(--rose); font-size: 26px; line-height: 1; }
.improvement-notice { margin: 18px 0 0; padding: 16px 18px; border-top: 1px solid #e5d8d0; color: #7a6860; font-size: 12px; line-height: 1.75; }
.improvement-notice strong { color: #604d46; font-size: 13px; }
.improvement-notice p { margin: 5px 0 0; }
.field-stack { display: grid; gap: 22px; }
.input-field, .choice-field { display: grid; gap: 8px; min-width: 0; }
.choice-field { border: 0; padding: 0; margin: 0; }
.input-field[data-invalid="true"], .choice-field[data-invalid="true"] { border-radius: 10px; outline: 2px solid rgb(154 72 66 / 45%); outline-offset: 7px; }
.field-label { display: flex; align-items: center; gap: 8px; color: #584d48; font-size: 13px; font-weight: 700; }
.required-mark { color: var(--rose); font-size: 10px; font-weight: 600; }
input, select, textarea { width: 100%; border: 1px solid #d9cbc2; border-radius: 9px; padding: 11px 13px; color: var(--ink); background: #fffefa; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #b17972; box-shadow: 0 0 0 3px rgb(177 121 114 / 13%); }
textarea { min-height: 110px; resize: vertical; line-height: 1.7; }
input::placeholder, textarea::placeholder { color: #b0a49d; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 9px; }
.choice-option { position: relative; display: flex; align-items: center; gap: 9px; min-height: 46px; padding: 10px 13px; border: 1px solid #e0d4cc; border-radius: 9px; color: #695d57; background: #fffefa; cursor: pointer; font-size: 13px; transition: border-color .18s, background .18s, transform .18s; }
.choice-option:hover { border-color: #c3948d; transform: translateY(-1px); }
.choice-option:has(input:checked) { border-color: #b97973; background: #fff3f0; color: #754744; }
.choice-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--rose); }
.primary-button, .secondary-button, .text-button, .icon-button { border-radius: 8px; transition: opacity .18s, background .18s, border-color .18s, transform .18s; }
.primary-button { display: inline-flex; justify-content: center; align-items: center; gap: 20px; min-height: 46px; border: 1px solid var(--rose-dark); padding: 10px 18px; color: #fff; background: var(--rose-dark); font-weight: 700; }
.primary-button:hover { background: #6e4242; transform: translateY(-1px); }
.primary-button:disabled, .secondary-button:disabled { cursor: wait; opacity: .5; transform: none; }
.primary-button.loading { opacity: .78; }
.fortune-page #fortune-submit { width: 100%; margin-top: 28px; }
.secondary-button { display: inline-flex; justify-content: center; align-items: center; min-height: 40px; border: 1px solid #cdbbb1; padding: 8px 13px; color: #65554e; background: #fffdfa; font-size: 13px; }
.secondary-button:hover { border-color: #a67970; background: #fff6f2; }
.compact-button { text-decoration: none; }
.text-button { border: 0; padding: 7px 0; color: var(--muted); background: transparent; font-size: 12px; }
.text-button:hover { color: var(--rose-dark); }
.danger-text { color: #9a4d47; }
.form-message { min-height: 1.5em; margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.form-message[data-state="ready"] { color: #3e684e; }
.form-message[data-state="warning"] { color: #996336; }
.form-message[data-state="error"], .error-message { color: #9a4842; }
.result-panel { position: relative; margin-top: 24px; overflow: hidden; }
.result-ribbon { position: absolute; top: 0; right: 0; padding: 7px 14px; border-bottom-left-radius: 10px; color: #fff; background: var(--rose); font-size: 10px; letter-spacing: .14em; }
.result-heading { margin-bottom: 14px; padding-right: 105px; }
.result-question { margin: 0 0 22px; color: var(--rose-dark); font-size: 14px; font-weight: 700; }
.result-copy { padding: 24px; border-radius: 12px; background: #fbf5ef; color: #4d413c; line-height: 2; }
.result-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-top: 20px; }
.disclaimer { margin: 20px 0 0; color: #a0948d; font-size: 11px; text-align: center; }
.site-footer { display: flex; gap: 18px; flex-wrap: wrap; padding: 30px 0 34px; color: #9a8e87; font-size: 11px; }
.site-footer span + span::before { content: "·"; margin-right: 18px; }
.site-footer a { text-underline-offset: 3px; }
.petals { position: fixed; inset: 0; overflow: hidden; pointer-events: none; opacity: .72; }
.petals span { position: absolute; top: -40px; width: 13px; height: 18px; border-radius: 70% 20% 70% 20%; background: #edc9c2; transform: rotate(35deg); animation: fall 14s linear infinite; }
.petals span:nth-child(1) { left: 8%; animation-delay: -3s; animation-duration: 17s; }
.petals span:nth-child(2) { left: 28%; animation-delay: -8s; animation-duration: 13s; transform: rotate(90deg) scale(.8); }
.petals span:nth-child(3) { left: 52%; animation-delay: -11s; animation-duration: 19s; transform: rotate(15deg) scale(.65); }
.petals span:nth-child(4) { left: 71%; animation-delay: -4s; animation-duration: 15s; transform: rotate(70deg) scale(.9); }
.petals span:nth-child(5) { left: 88%; animation-delay: -13s; animation-duration: 18s; transform: rotate(115deg) scale(.7); }
.petals span:nth-child(6) { left: 42%; animation-delay: -6s; animation-duration: 16s; transform: rotate(55deg) scale(.55); }
@keyframes fall { 0% { translate: 0 -10vh; } 50% { translate: 55px 52vh; } 100% { translate: -25px 110vh; } }

.access-page { min-height: 100vh; background: radial-gradient(circle at 50% 12%, #fffdf9 0, #f7f1ea 52%, #f0e6df 100%); }
.access-shell { position: relative; z-index: 1; width: min(480px, calc(100% - 32px)); margin: 0 auto; padding: clamp(34px, 9vh, 90px) 0 40px; }
.access-brand { width: fit-content; margin: 0 auto 22px; }
.access-panel { padding: clamp(26px, 6vw, 42px); }
.access-panel h1 { margin-bottom: 13px; font-size: clamp(32px, 8vw, 48px); text-align: left; }
.access-copy { margin-bottom: 27px; color: var(--muted); font-size: 13px; }
.access-form { display: grid; gap: 17px; }
.access-form .primary-button { width: 100%; }
.access-note { margin: 22px 0 0; padding-top: 17px; border-top: 1px solid var(--line); color: #9a8e87; font-size: 11px; text-align: center; }

.admin-content { padding: 34px 0 24px; }
.admin-intro { padding: 28px 0 24px; }
.admin-intro h1 { margin-bottom: 8px; font-size: clamp(32px, 5vw, 50px); }
.admin-intro p:last-child { color: var(--muted); }
.admin-section { margin-top: 20px; }
.section-note { margin: -12px 0 22px; color: var(--muted); font-size: 13px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.full-width { grid-column: 1 / -1; }
.settings-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.field-help { color: #9b8f88; font-size: 11px; }
.invite-url-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.invite-url-output { color: #5f514b; background: #f8f4f1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.invite-url-output::selection { color: #fff; background: var(--rose); }
.auth-panel { display: grid; gap: 14px; margin-bottom: 20px; }
.auth-panel h2 { font-size: 20px; }
.inline-form { display: flex; gap: 10px; }
.inline-form input { flex: 1; }
.form-builder-section { background: #f5efeb; }
.form-builder-bar { display: flex; justify-content: space-between; align-items: end; margin: 0 -2px 16px; border-bottom: 1px solid #dfd3cc; }
.builder-tabs { display: flex; align-items: flex-end; }
.builder-tab { position: relative; padding: 8px 18px 11px; color: var(--rose-dark); font-size: 13px; font-weight: 700; }
.builder-tab::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--rose); }
.save-status { display: inline-flex; align-items: center; gap: 7px; padding: 8px 2px 11px; color: var(--muted); font-size: 12px; }
.save-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #b8ada6; }
.save-status[data-state="saved"]::before { background: #699078; }
.save-status[data-state="dirty"] { color: #94633f; }
.save-status[data-state="dirty"]::before { background: #c6874c; }
.save-status[data-state="loading"]::before { background: var(--rose); animation: statusPulse 1s ease-in-out infinite alternate; }
@keyframes statusPulse { to { opacity: .35; } }
.form-cover-card { position: relative; overflow: hidden; margin-bottom: 22px; border: 1px solid #e0d4cd; border-top: 7px solid var(--rose); border-radius: 12px; padding: 24px 26px 18px; background: var(--paper); box-shadow: 0 5px 18px rgb(92 64 54 / 6%); }
.form-cover-field { display: block; }
.form-cover-title, .form-cover-description { border: 0; border-bottom: 1px solid transparent; border-radius: 0; padding: 7px 2px; background: transparent; box-shadow: none; }
.form-cover-title { font-family: inherit; font-size: clamp(23px, 4vw, 31px); font-weight: 650; letter-spacing: -.04em; }
.form-cover-description { min-height: 62px; margin-top: 3px; color: #6f625c; font-size: 13px; resize: vertical; }
.form-cover-title:hover, .form-cover-description:hover { border-bottom-color: #ded1ca; }
.form-cover-title:focus, .form-cover-description:focus { border-color: var(--rose); box-shadow: none; }
.form-cover-meta { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-top: 12px; padding-top: 13px; border-top: 1px solid #eee5df; color: var(--muted); font-size: 11px; }
.answer-style-field { display: flex; align-items: center; gap: 9px; color: #665954; font-weight: 700; }
.answer-style-field select { width: auto; min-width: 94px; padding: 6px 28px 6px 9px; border-color: #ded1ca; font-size: 12px; }
.fields-toolbar { display: flex; justify-content: space-between; align-items: end; gap: 15px; margin: 0 0 11px; }
.fields-toolbar h3 { margin-bottom: 2px; }
.fields-toolbar p { margin-bottom: 0; font-size: 12px; }
.builder-canvas { display: grid; grid-template-columns: minmax(0, 1fr) 118px; gap: 14px; align-items: start; }
.builder-side-toolbar { position: sticky; top: 16px; }
.add-question-button { display: flex; width: 100%; min-height: 82px; flex-direction: column; justify-content: center; align-items: center; gap: 5px; border: 1px solid #ded1ca; border-radius: 11px; color: #675852; background: var(--paper); box-shadow: 0 5px 15px rgb(92 64 54 / 7%); font-size: 11px; font-weight: 700; transition: border-color .18s, color .18s, transform .18s, box-shadow .18s; }
.add-question-button span:first-child { color: var(--rose); font-size: 29px; font-weight: 300; line-height: .9; }
.add-question-button:hover { border-color: #bc8b83; color: var(--rose-dark); box-shadow: 0 8px 19px rgb(92 64 54 / 10%); transform: translateY(-1px); }
.field-editors { display: grid; gap: 15px; min-width: 0; }
.field-editor { position: relative; overflow: hidden; border: 1px solid #dfd4cd; border-radius: 12px; padding: 0 24px 19px; background: var(--paper); box-shadow: 0 4px 14px rgb(92 64 54 / 5%); transition: border-color .18s, box-shadow .18s, transform .18s; }
.field-editor::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: transparent; transition: background .18s; }
.field-editor.is-active { border-color: #cfa8a1; box-shadow: 0 8px 22px rgb(92 64 54 / 10%); }
.field-editor.is-active::before { background: var(--rose); }
.field-editor.is-dragging { opacity: .5; transform: scale(.99); }
.field-editor.is-drag-target { border-color: var(--rose); box-shadow: 0 0 0 3px rgb(168 101 98 / 13%); }
.question-card-header { display: flex; min-height: 40px; align-items: center; gap: 9px; border-bottom: 1px solid #f0e8e3; }
.question-drag-handle { color: #afa39c; cursor: grab; font-size: 21px; line-height: 1; user-select: none; }
.question-drag-handle:active { cursor: grabbing; }
.question-number { flex: 1; color: #9b8f88; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.question-order-actions { display: flex; gap: 2px; }
.question-action-button { display: grid; width: 29px; height: 29px; place-items: center; border: 0; border-radius: 50%; color: #877a74; background: transparent; font-size: 13px; }
.question-action-button:hover:not(:disabled) { color: var(--rose-dark); background: #f9eeea; }
.question-action-button:disabled, .question-footer-button:disabled, .remove-option-button:disabled { cursor: default; opacity: .28; }
.question-main-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(170px, 210px); gap: 14px; align-items: start; padding-top: 18px; }
.question-title-field, .question-type-field { display: block; }
.question-title-field input { border: 0; border-bottom: 1px solid #cfc1ba; border-radius: 5px 5px 0 0; padding: 13px 12px; background: #f7f3f0; box-shadow: none; font-size: 15px; font-weight: 650; }
.question-title-field input:focus { border-color: var(--rose); box-shadow: inset 0 -2px 0 var(--rose); }
.question-type-field select { min-height: 48px; border-color: #d8cbc4; background-color: #fffefa; font-size: 13px; }
.question-answer-editor { padding: 19px 3px 8px; }
.text-answer-preview { width: min(68%, 390px); margin-bottom: 18px; padding: 5px 0 8px; border-bottom: 1px dotted #b9ada6; color: #aaa09a; font-size: 12px; }
.text-answer-preview.is-long { width: min(86%, 510px); min-height: 48px; }
.placeholder-field { display: grid; max-width: 510px; gap: 6px; }
.placeholder-field input { padding: 8px 10px; border-color: #e1d6cf; font-size: 12px; }
.question-option-list { display: grid; gap: 8px; }
.question-option-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) 30px; align-items: center; gap: 9px; }
.option-marker { display: block; width: 16px; height: 16px; border: 2px solid #b1a6a0; }
.option-marker.radio { border-radius: 50%; }
.option-marker.checkbox { border-radius: 3px; }
.question-option-row input { border: 0; border-bottom: 1px solid transparent; border-radius: 0; padding: 7px 4px; background: transparent; box-shadow: none; font-size: 13px; }
.question-option-row input:hover { border-bottom-color: #dfd3cc; }
.question-option-row input:focus { border-color: var(--rose); box-shadow: none; }
.remove-option-button { display: grid; width: 28px; height: 28px; place-items: center; border: 0; border-radius: 50%; color: #a0958e; background: transparent; font-size: 19px; line-height: 1; }
.remove-option-button:hover:not(:disabled) { color: #944e49; background: #faefec; }
.add-option-button { justify-self: start; margin: 3px 0 0 28px; border: 0; padding: 6px 4px; color: var(--rose-dark); background: transparent; font-size: 12px; font-weight: 700; }
.add-option-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.question-details { margin: 7px 0 13px; border-top: 1px solid #f0e8e3; }
.question-details summary { width: fit-content; padding: 10px 0 4px; color: #8a7e77; cursor: pointer; font-size: 11px; font-weight: 700; }
.question-details-body { display: grid; grid-template-columns: minmax(180px, 290px) 1fr; gap: 13px; align-items: end; padding: 8px 2px 4px; }
.question-details-body input { padding: 8px 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.question-detail-help { margin: 0 0 7px; color: #a0958e; font-size: 10px; }
.question-card-footer { display: flex; justify-content: flex-end; align-items: center; gap: 14px; padding-top: 14px; border-top: 1px solid #eee5df; }
.question-footer-actions { display: flex; gap: 4px; }
.question-footer-button { border: 0; border-radius: 6px; padding: 6px 9px; color: #766963; background: transparent; font-size: 11px; }
.question-footer-button:hover:not(:disabled) { background: #f7efeb; color: var(--rose-dark); }
.required-switch { display: inline-flex; align-items: center; gap: 8px; padding-left: 14px; border-left: 1px solid #e5dbd5; color: #695c56; cursor: pointer; font-size: 12px; font-weight: 700; }
.required-switch input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.switch-track { position: relative; width: 34px; height: 19px; border-radius: 999px; background: #c9bfba; transition: background .18s; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 13px; height: 13px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 20%); transition: translate .18s; }
.required-switch input:checked + .switch-track { background: var(--rose); }
.required-switch input:checked + .switch-track .switch-thumb { translate: 15px 0; }
.required-switch input:focus-visible + .switch-track { outline: 3px solid rgb(168 101 98 / 20%); outline-offset: 2px; }
.form-builder-actions { justify-content: flex-end; margin: 20px 132px 0 0; padding-top: 18px; border-top: 1px solid #ded3cc; }
.history-note { margin-bottom: 18px; padding: 12px 14px; border-left: 3px solid #c58c84; background: #fff7f2; color: #795c54; font-size: 12px; }
.history-list { display: grid; gap: 12px; }
.history-card { padding: 17px; border: 1px solid #e6dad1; border-radius: 10px; background: #fffefa; }
.history-card-header { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid #eee5df; }
.history-section-label { margin: 14px 0 5px; color: var(--rose-dark); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.history-question { margin: 0; padding: 11px 12px; border-radius: 8px; color: #66544d; background: #fbf5f1; font-size: 13px; line-height: 1.75; }
.history-answer { color: #594c46; font-size: 13px; line-height: 1.85; }
.empty-state { margin: 0; padding: 28px 0; color: var(--muted); text-align: center; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 22px; }
code { padding: 2px 5px; border-radius: 4px; background: #f1e9e4; font-size: .9em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .builder-canvas { grid-template-columns: 1fr; }
  .builder-side-toolbar { position: static; }
  .add-question-button { min-height: 48px; flex-direction: row; }
  .add-question-button span:first-child { font-size: 23px; }
  .question-main-row { grid-template-columns: 1fr; }
  .question-details-body { grid-template-columns: 1fr; }
  .question-detail-help { margin-bottom: 0; }
  .form-builder-actions { margin-right: 0; }
}

@media (max-width: 640px) {
  .page-width { width: min(100% - 28px, 960px); }
  .site-header { padding-top: 15px; }
  .main-content { padding-top: 20px; }
  .hero { padding-top: 22px; }
  h1 { font-size: 41px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .result-heading { padding-right: 0; }
  .settings-grid { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
  .inline-form { flex-direction: column; }
  .invite-url-row { grid-template-columns: 1fr; }
  .fields-toolbar { align-items: flex-start; flex-direction: column; }
  .form-cover-card { padding: 20px 18px 15px; }
  .form-cover-meta { align-items: flex-start; flex-direction: column; }
  .field-editor { padding-right: 16px; padding-left: 16px; }
  .question-card-footer { justify-content: space-between; }
  .question-footer-button { padding-inline: 7px; }
  .site-footer { gap: 8px; }
  .site-footer span + span::before { margin-right: 8px; }
}
