/* Apple-inspired form surfaces. Source and MIT license: docs/Apple-DESIGN.md. */
:root {
  --blue: #0066cc;
  --blue-dark: #0057ad;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #e5e5e9;
  --pale: #f0f6fd;
  --red: #b42335;
  --background: #f5f5f7;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { background: var(--background); }
.survey-shell { max-width: 808px; padding: 0 32px 64px; }
.intro { padding: 36px 0 40px; text-align: center; }
.brand { color: var(--ink); font-size: 16px; font-weight: 600; letter-spacing: .025em; }
.intro .preview-note {
  display: table; margin: 18px auto 0; padding: 5px 13px;
  background: #ebebef; color: #626267 !important; border: 0;
  border-radius: 999px; font-size: 12px; font-weight: 400;
}
.intro h1 {
  font-size: 56px; font-weight: 600; line-height: 1.17;
  letter-spacing: -.035em; margin: 36px 0 22px;
}
.intro-meta { justify-content: center; gap: 20px; margin-top: 0; font-size: 14px; }
.intro-meta span { display: inline-flex; align-items: center; }
.intro-meta span + span::before { margin-right: 20px; color: #b4b4b9; }

.progress-sticky {
  top: 12px; padding: 14px 22px 16px; border: 1px solid rgba(0,0,0,.045);
  border-radius: 18px; background: rgba(255,255,255,.9);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}
.progress-caption { font-size: 13px; margin-bottom: 10px; color: #56565b; }
#progress-text { font-weight: 600; color: var(--blue); }
progress, progress::-webkit-progress-bar { height: 4px; background: #e8e8ed; }
progress::-webkit-progress-value { background: var(--blue); }
progress::-moz-progress-bar { background: var(--blue); }

.form-caption {
  margin: 24px 0; padding: 20px 24px; border: 0; border-radius: 18px;
  background: #eaf3ff; color: #24476e; font-size: 16px; font-weight: 600; line-height: 1.85;
}
.form-caption p + p { margin-top: 5px; }
.required { color: var(--red); font-size: 1.25em; font-weight: 700; margin-right: 8px; }
.question-wrap { margin-bottom: 20px; }
.question {
  padding: 32px; background: #fff; border: 1px solid rgba(0,0,0,.035);
  border-radius: 18px; scroll-margin-top: 104px;
}
.question-kicker { margin-bottom: 14px; color: #747479; font-size: 12px; letter-spacing: .02em; }
.question h2, .question legend {
  color: var(--ink); font-size: 21px; font-weight: 600;
  line-height: 1.55; letter-spacing: -.012em; margin-bottom: 16px;
}
.question .hint { font-size: 14px; line-height: 1.65; color: var(--muted); margin-bottom: 20px; }
.question .extra { color: #515155; font-size: 16px; }
.question .warning { border-radius: 11px; font-size: 14px; }
.text-input, textarea, .login-card input, .search-row input {
  min-height: 56px; padding: 15px 17px; font-size: 17px; font-weight: 400;
  line-height: 1.65; color: var(--ink); background: #fafafc;
  border: 1px solid #c6c6cb; border-radius: 11px;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}
textarea { min-height: 120px; }
input::placeholder, textarea::placeholder { color: #77777d; opacity: 1; font-size: 15px; }
.text-input:focus, textarea:focus, .login-card input:focus, .search-row input:focus {
  outline: 0; border-color: #0071e3; background: #fff;
  box-shadow: 0 0 0 3px rgba(0,113,227,.17);
}
.question-wrap.invalid .question { border-color: #c8505d; }

.tag-panel { margin: 0 0 22px; }
.tag-help { color: var(--muted); font-size: 13px; line-height: 1.65; margin: 0 0 14px; }
.tag-group {
  padding: 0 14px; background: #f5f5f7; border: 1px solid transparent; border-radius: 11px;
}
.tag-group + .tag-group { margin-top: 6px; }
.tag-label {
  width: 100%; max-width: 100%; min-height: 48px; padding: 10px 0; gap: 10px;
  border: 0; border-radius: 0; margin: 0; background: transparent;
  color: #39393d; font-size: 15px; font-weight: 400; line-height: 1.6;
  transition: color 120ms ease;
}
.tag-label > span:first-child { margin-right: auto; }
.tag-label::after {
  content: "+"; display: grid; place-items: center; width: 23px; height: 23px;
  flex: none; border-radius: 50%; background: #e7e7ec; color: #65656a;
  font-size: 20px; line-height: 1; font-weight: 400;
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease;
}
.tag-label[aria-expanded=true] { background: transparent; color: var(--blue); }
.tag-label[aria-expanded=true]::after { content: "+"; transform: rotate(45deg); background: #dbeaff; color: var(--blue); }
.tag-label .tag-count { color: var(--blue); font-size: 12px; font-weight: 600; }
.tag-group > .tag-options { margin-top: 0; padding: 4px 0 14px; gap: 8px; }
.tag-chip {
  min-height: 44px; padding: 9px 14px; border: 1px solid #d2d2d7;
  border-radius: 999px; background: #fff; color: #45454a; font-size: 14px;
  line-height: 1.6; font-weight: 400;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}
.tag-chip[aria-pressed=true] { color: #fff; background: var(--blue); border-color: var(--blue); }
.options { gap: 10px; }
.option {
  min-height: 60px; padding: 15px 18px; gap: 14px; border-radius: 11px;
  background: #fff; border: 1px solid #c6c6cb; font-size: 17px;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.option .indicator { width: 22px; height: 22px; border-color: #a1a1a6; }
.option .indicator::after { width: 12px; height: 12px; }
.option:has(input:checked) { border-color: var(--blue); background: #f2f7ff; box-shadow: inset 0 0 0 1px var(--blue); }
.option:active { background: #ededf2; }

.primary, .secondary {
  min-height: 48px; padding: 12px 24px; border-radius: 999px;
  font-size: 17px; font-weight: 400;
  transition: transform 140ms ease, background-color 140ms ease;
}
.primary { background: var(--blue); border-color: var(--blue); }
.secondary { color: var(--blue); background: #f5f5f7; border-color: transparent; }
.primary:active, .secondary:active, .tag-chip:active { transform: scale(.97); transition-duration: 80ms; }
.tag-label:active { color: var(--blue); }
button:focus-visible, a:focus-visible, summary:focus-visible, .tag-chip:focus-visible {
  outline: 3px solid #0071e3; outline-offset: 3px;
}
.tag-label:focus-visible { outline-offset: 2px; border-radius: 7px; }
.submit-panel { padding: 20px 0 8px; }
.submit { min-height: 58px; padding: 16px 28px; font-size: 18px; font-weight: 600; }
.upload-picker { min-height: 88px; border: 1px dashed #a4abb4; border-radius: 11px; background: #f5f5f7; font-size: 17px; }
.upload-picker:active { background: #eaf3ff; }
.upload-hint { font-size: 13px; line-height: 1.75; }
.photo { border-color: #e5e5e9; border-radius: 11px; background: #fafafc; padding: 8px; }
.photo img, .file-icon { border-radius: 7px; }
.file-icon { background: #edf3fa; }
.photo button { min-height: 44px; }
.privacy { padding: 18px 4px 8px; font-size: 13px; line-height: 1.8; }
.privacy summary { color: #56565b; min-height: 44px; padding: 10px 0; }
.privacy p { color: #65656a; }
.notice { background: #eaf3ff; border-radius: 18px; padding: 24px; }
.error, .global-error { font-size: 14px; }
.draft-state { color: var(--red); }

dialog { border: 1px solid rgba(0,0,0,.08); border-radius: 24px; padding: 32px; background: #fff; box-shadow: none; }
dialog::backdrop { background: rgba(0,0,0,.32); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog h2 { font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
dialog p { line-height: 1.7; }
dialog[open] { animation: apple-dialog-in 180ms ease-out; }
@keyframes apple-dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.message-page { max-width: 640px; padding: 40px 24px; }
.message-page h1 { font-size: 32px; letter-spacing: -.02em; font-weight: 600; }
.success-icon { width: 80px; height: 80px; line-height: 80px; background: #e5effb; color: var(--blue); font-weight: 400; }
.login-card { border: 0; border-radius: 18px; padding: 36px; }
.login-card h1 { font-weight: 600; letter-spacing: -.025em; }
.admin-header h1 { font-weight: 600; letter-spacing: -.025em; }
.admin-stats, .answer { border: 0; border-radius: 18px; }
.table-scroll { border: 1px solid #e2e2e7; border-radius: 18px; }
th { background: #ededf1; color: #56565b; font-weight: 600; }
.badge { border-radius: 999px; background: #eaf3ff; }
.answer-tags { border-color: var(--line); }

@media (max-width: 600px) {
  .survey-shell { padding: 0 16px 40px; }
  .intro { padding: 28px 4px 28px; }
  .brand { font-size: 15px; }
  .intro .preview-note { margin-top: 14px; font-size: 11px; }
  .intro h1 { font-size: 38px; line-height: 1.2; margin: 28px 0 20px; }
  .intro-meta { font-size: 13px; gap: 16px; }
  .intro-meta span + span::before { margin-right: 16px; }
  .progress-sticky { top: 8px; padding: 12px 18px 14px; border-radius: 16px; }
  .form-caption { padding: 17px 19px; margin: 20px 0; font-size: 15px; line-height: 1.85; }
  .question-wrap { margin-bottom: 16px; }
  .question { padding: 24px 20px; border-radius: 18px; }
  .question-kicker { margin-bottom: 12px; }
  .question h2, .question legend { font-size: 18px; line-height: 1.65; letter-spacing: 0; }
  .text-input, textarea { padding: 14px 15px; font-size: 16px; }
  .option { padding: 14px; font-size: 16px; min-height: 58px; }
  .tag-group { padding: 0 12px; }
  .tag-chip { font-size: 14px; padding: 9px 12px; }
  .tag-label { font-size: 14px; }
  .tag-help { font-size: 13px; }
  .privacy { padding-top: 12px; }
  dialog { padding: 26px; }
  dialog h2 { font-size: 22px; }
  .dialog-actions { gap: 10px; }
  .dialog-actions button { padding: 11px 17px; }
  .message-page h1 { font-size: 27px; }
}
@media (prefers-reduced-transparency: reduce) {
  .progress-sticky { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
  dialog::backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --muted: #444448; }
  .question, .tag-group, .progress-sticky { border-color: #8a8a90; }
  .question-kicker, .tag-help, .hint { color: #444448; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .primary:active, .secondary:active, .tag-chip:active { transform: none; }
}

/* Document-led edition: full-width light/dark bands and compact configurator pills.
   Primary reference: the user's docs/DESIGN-apple.md. */
:root {
  --apple-canvas: #ffffff;
  --apple-parchment: #f5f5f7;
  --apple-tile-dark: #272729;
  --apple-black: #000000;
  --apple-on-dark: #ffffff;
  --apple-secondary-dark: #cccccc;
  --apple-hairline: #e0e0e0;
  --apple-content: 780px;
  --apple-section: 64px;
}
body { background: var(--apple-canvas); }
.survey-shell { width: 100%; max-width: none; padding: 0; }
.intro { padding: 0 0 var(--apple-section); background: var(--apple-canvas); }
.intro > .brand {
  display: flex; justify-content: center; align-items: center; min-height: 44px;
  padding: 0 24px; background: var(--apple-black); color: var(--apple-on-dark);
  font-size: 14px; font-weight: 400; letter-spacing: .02em;
}
.intro .preview-note {
  display: block; margin: 0; padding: 9px 24px; border-radius: 0;
  background: var(--apple-parchment); color: var(--muted) !important;
  font-size: 12px; line-height: 1.5;
}
.intro h1 {
  margin: var(--apple-section) 24px 24px; font-size: 56px; font-weight: 600;
  line-height: 1.07; letter-spacing: -.28px;
}
.intro-meta { margin-top: 0; font-size: 14px; }
.progress-sticky {
  top: 0; width: 100%; padding: 16px 0; border: 0;
  border-bottom: 1px solid var(--apple-hairline); border-radius: 0;
  background: rgba(245,245,247,.92);
}
.progress-caption, .progress-sticky progress {
  width: calc(100% - 64px); max-width: var(--apple-content); margin-left: auto; margin-right: auto;
}
.progress-caption { margin-bottom: 10px; font-size: 14px; }
.form-caption {
  margin: 0; padding: 32px 0; border: 0; border-radius: 0;
  background: var(--apple-tile-dark); color: var(--apple-on-dark);
  font-size: 17px; font-weight: 600; line-height: 1.8;
}
.form-caption p { width: calc(100% - 64px); max-width: var(--apple-content); margin: 0 auto; }
.form-caption p + p { margin: 8px auto 0; color: var(--apple-secondary-dark); font-weight: 400; }
.form-caption .required { color: #ff9da8; }
.question-wrap { margin: 0; background: var(--apple-canvas); scroll-margin-top: 84px; }
.question-wrap:nth-child(even) { background: var(--apple-parchment); }
.question {
  width: calc(100% - 64px); max-width: var(--apple-content); margin: 0 auto; padding: 48px 0;
  border: 0; border-radius: 0; background: transparent; box-shadow: none;
}
.question-kicker { margin-bottom: 16px; font-size: 14px; font-weight: 400; }
.question h2, .question legend {
  font-size: 21px; line-height: 1.55; letter-spacing: -.2px; font-weight: 600; margin-bottom: 16px;
}
.question .hint { font-size: 14px; margin-bottom: 24px; }
.question .extra { font-size: 17px; }
.text-input, textarea { background: var(--apple-canvas); font-size: 17px; border-color: #b8b8bf; }
.text-input:focus, textarea:focus { box-shadow: none; outline: 2px solid #0071e3; outline-offset: 1px; }
.question-wrap.invalid .question { border: 0; }
.question-wrap.invalid .text-input { border-color: var(--red); }
.tag-panel { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-bottom: 24px; }
.tag-help { flex: 0 0 100%; font-size: 14px; margin: 0 0 6px; }
.tag-group, .tag-group + .tag-group { width: auto; max-width: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
.tag-label {
  width: auto; min-height: 44px; padding: 10px 15px; gap: 12px;
  border: 1px solid #d2d2d7; border-radius: 999px;
  background: var(--apple-canvas); color: var(--ink); font-size: 14px; font-weight: 400;
}
.tag-label > span:first-child { margin: 0; }
.tag-label::after { width: 20px; height: 20px; font-size: 18px; background: #f0f0f0; }
.tag-group:has(.tag-label[aria-expanded=true]) { width: 100%; }
.tag-label[aria-expanded=true] { border-color: var(--blue); background: var(--apple-canvas); color: var(--blue); }
.tag-group > .tag-options {
  padding: 16px; margin: 10px 0 4px; border: 1px solid var(--apple-hairline);
  border-radius: 18px; background: var(--apple-canvas); gap: 8px;
}
.tag-chip { min-height: 44px; padding: 10px 15px; font-size: 14px; box-shadow: none; }
.option { background: var(--apple-canvas); border-color: #c6c6cb; border-radius: 18px; font-size: 17px; }
.option:has(input:checked) { background: var(--apple-canvas); border-color: var(--blue); box-shadow: none; outline: 1px solid var(--blue); }
.primary { box-shadow: none; font-size: 17px; font-weight: 400; }
.primary:active, .secondary:active, .tag-chip:active { transform: scale(.95); }
#survey > .privacy { width: calc(100% - 64px); max-width: var(--apple-content); margin: 0 auto; padding: 32px 0 8px; }
.submit-panel { width: calc(100% - 64px); max-width: var(--apple-content); margin: 0 auto; padding: 24px 0 64px; }
.submit { width: 240px; max-width: 100%; margin: 0 auto; min-height: 52px; padding: 14px 24px; font-size: 18px; font-weight: 400; }
.upload-picker { background: var(--apple-canvas); border-color: #a5a5ad; border-radius: 18px; }
.survey-shell > .notice { max-width: var(--apple-content); margin: 24px auto; }
.survey-shell > footer { margin: 0; padding: 32px 24px; background: var(--apple-parchment); }
@media (max-width: 1068px) {
  .intro h1 { font-size: 40px; }
}
@media (max-width: 640px) {
  :root { --apple-section: 48px; }
  .intro { padding-bottom: 40px; }
  .intro h1 { font-size: 34px; margin: 40px 20px 20px; }
  .intro-meta { font-size: 14px; }
  .progress-caption, .progress-sticky progress, .question, .form-caption p,
  #survey > .privacy, .submit-panel { width: calc(100% - 40px); }
  .progress-sticky { padding: 14px 0; }
  .progress-caption { font-size: 13px; }
  .form-caption { padding: 26px 0; font-size: 16px; }
  .question { padding: 36px 0; }
  .question h2, .question legend { font-size: 19px; line-height: 1.6; }
  .question-kicker { font-size: 13px; margin-bottom: 14px; }
  .text-input, textarea, .option { font-size: 17px; }
  .tag-help { font-size: 13px; }
  .tag-group > .tag-options { padding: 12px; }
  .tag-label { padding: 10px 13px; font-size: 14px; }
  .tag-chip { padding: 10px 12px; }
  .submit-panel { padding-bottom: 48px; }
  .survey-shell > .notice { margin: 20px; }
}
@media (max-width: 419px) {
  .intro h1 { font-size: 28px; }
}
@media (prefers-reduced-transparency: reduce) {
  .progress-sticky { background: var(--apple-parchment); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .tag-label, .tag-options, .text-input, .option { border-color: #76767c; }
}
@media (prefers-reduced-motion: reduce) {
  .primary:active, .secondary:active, .tag-chip:active { transform: none; }
}
