@font-face {
  font-family: "PangMenTitle";
  src: url('/fonts/pangmen-title.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
:root {
  --font-body: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-title: "PangMenTitle", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-family: var(--font-body);
  color: #183752;
  background: #fff;
  --navy: #153f69;
  --accent: #1c649e;
  --ink: #183752;
  --muted: #526a7d;
  --line: #cbdbe9;
  --soft: #edf5fc;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { position: relative; isolation: isolate; margin: 0; min-height: 100vh; background: #fff; }
body::before, body::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: min(100vh, 1000px);
  pointer-events: none;
}
body::before { z-index: -2; background: var(--page-image) center top / cover no-repeat #e7f2ff; }
body::after {
  z-index: -1;
  background: linear-gradient(to top, #fff 0%, rgba(255,255,255,.96) 21%, rgba(255,255,255,.76) 50%, rgba(255,255,255,.12) 100%);
}
.page-survey { --page-image: url('/backgrounds/survey.png'); }
.page-admin { --page-image: url('/backgrounds/admin.png'); }
@supports (background-image: image-set(url('/backgrounds/survey.webp') type('image/webp'))) {
  .page-survey { --page-image: image-set(url('/backgrounds/survey.webp') type('image/webp'), url('/backgrounds/survey.png') type('image/png')); }
  .page-admin { --page-image: image-set(url('/backgrounds/admin.webp') type('image/webp'), url('/backgrounds/admin.png') type('image/png')); }
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.hidden { display: none !important; }
.shell { width: min(100% - 32px, 1080px); margin-inline: auto; }

.survey-shell { max-width: 800px; padding-bottom: 70px; }
.hero { padding: 66px 4px 58px; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: 13px; font-weight: 800; letter-spacing: .1em; }
h1, h2, h3, h4, p { overflow-wrap: anywhere; }
h1, h2, h3, h4 { font-family: var(--font-title); font-weight: 400; font-synthesis: none; }
h1 { margin: 0 0 20px; font-size: clamp(34px, 6vw, 52px); line-height: 1.2; letter-spacing: -.035em; }
h1 span { color: var(--accent); }
h2 { margin: 0 0 8px; font-size: 27px; line-height: 1.36; }
h3 { margin: 0 0 5px; font-size: 20px; line-height: 1.45; }
h4 { margin: 20px 0 10px; font-size: 16px; }
.lead { max-width: 650px; margin: 0; color: #3e5a72; font-size: 16px; line-height: 1.85; }

/* Reading surfaces and survey choices */
.panel { padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.97); box-shadow: 0 10px 30px rgba(27, 75, 115, .07); }
.intro-panel p:not(.eyebrow) { margin: 0 0 12px; font-size: 15.5px; font-weight: 400; line-height: 1.85; letter-spacing: .012em; }
.intro-panel p:last-child { margin-bottom: 0; }
.privacy-note { color: var(--muted); font-size: 14px !important; }
.section-heading { display: grid; grid-template-columns: 43px minmax(0, 1fr); column-gap: 18px; row-gap: 7px; align-items: center; margin: 52px 0 22px; }
.section-titles { min-width: 0; }
.section-titles .eyebrow { margin-bottom: 2px; line-height: 1.2; }
.section-titles h2 { margin-bottom: 0; line-height: 1.05; }
.section-heading .section-description { grid-column: 2; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.section-number { display: grid; flex: none; place-items: center; width: 43px; height: 43px; border-radius: 12px; background: var(--navy); color: #fff; font-size: 14px; font-weight: 800; }
.questions { display: grid; gap: 18px; }
.question-card { min-width: 0; margin: 0; }
.question-title { font-family: var(--font-title); font-size: 20px; font-style: normal; font-weight: 400; font-synthesis: none; line-height: 1.45; letter-spacing: normal; color: var(--ink); text-wrap: wrap; }
.question-card legend { float: left; width: 100%; max-width: 100%; padding: 0; }
.question-card .choice-grid { clear: both; margin-top: 0; }
.question-number { display: inline-grid; place-items: center; min-width: 35px; height: 28px; margin-right: 11px; border-radius: 7px; background: #e5f2fb; color: var(--accent); font-family: var(--font-body); font-size: 12px; font-weight: 800; vertical-align: 2px; }
.question-help { display: block; margin: 5px 0 0; color: var(--muted); font-family: var(--font-body); font-size: 14px; font-weight: 400; line-height: 1.6; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-top: 18px; }
.choice { position: relative; display: flex; align-items: flex-start; gap: 11px; min-height: 56px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #28465d; cursor: pointer; font-size: 15px; line-height: 1.65; transition: border-color .15s ease, background-color .15s ease; }
.choice:hover { border-color: #79add4; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--soft); color: #164e79; font-weight: 650; }
.choice input { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.choice > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.choice-marker { display: grid; flex: none; place-items: center; width: 20px; height: 20px; margin-top: 2px; border: 2px solid #89a6bd; border-radius: 5px; background: #fff; }
.choice:has(input[type=radio]) .choice-marker { border-radius: 50%; }
.choice:has(input:checked) .choice-marker { border-color: var(--accent); background: var(--accent); }
.choice:has(input:checked) .choice-marker::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; }
.choice:has(input:focus-visible) { outline: 3px solid #89bce0; outline-offset: 2px; }
/* Native sibling selectors keep the selection visible in WebViews without :has(). */
.choice input[type=radio] + .choice-marker { border-radius: 50%; }
.choice input:checked + .choice-marker { border-color: var(--accent); background: var(--accent); }
.choice input:checked + .choice-marker::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; }
.choice input:focus-visible + .choice-marker { outline: 3px solid #89bce0; outline-offset: 2px; }

/* Optional booking */
.booking-heading { margin-top: 62px; }
.booking-switch { display: flex; align-items: center; gap: 16px; cursor: pointer; }
.booking-switch input { flex: none; width: 23px; height: 23px; accent-color: var(--accent); }
.booking-switch strong, .booking-switch small { display: block; }
.booking-switch strong { font-size: 16px; }
.booking-switch small { margin-top: 4px; color: var(--muted); font-size: 13px; font-weight: 400; }
.booking-panel { margin-top: 18px; }
.card-heading { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 22px; }
.card-heading .question-number { flex: none; margin-right: 0; }
.card-heading > :last-child { flex: 1; min-width: 0; }
.card-heading .question-title { display: block; margin: 0; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.region-grid { grid-template-columns: .8fr 1fr 1fr; margin-top: 17px; }
label:not(.choice):not(.booking-switch), .subfield { display: block; font-size: 15px; font-weight: 650; line-height: 1.55; }
label em, legend em { color: #b33e34; font-style: normal; }
input:not([type=checkbox]):not([type=radio]), textarea, select { display: block; width: 100%; min-height: 48px; margin-top: 8px; padding: 12px 13px; border: 1px solid #bfd1df; border-radius: 9px; background: #fff; color: var(--ink); font-size: 16px; }
input:not([type=checkbox]):not([type=radio]), select { height: 52px; min-height: 52px; line-height: 24px; }
input[type=date] { min-width: 0; }
input[type=date]::-webkit-datetime-edit { padding: 0; }
input[type=date]::-webkit-date-and-time-value { min-height: 24px; text-align: left; }
.field-grid > label:not(.choice):not(.booking-switch) { display: flex; flex-direction: column; min-width: 0; }
.field-grid .field-label { display: block; margin-bottom: 8px; }
.field-grid input:not([type=checkbox]):not([type=radio]), .field-grid select { margin-top: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
input::placeholder, textarea::placeholder { color: #758a9b; }
input:disabled { background: #edf3f7; color: #617383; }
textarea { min-height: 100px; resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible, .button:focus-visible { outline: 3px solid #89bce0; outline-offset: 2px; }
.inline-fieldset { min-width: 0; margin: 22px 0; padding: 0; border: 0; }
.inline-fieldset legend { font-size: 15px; font-weight: 650; }
.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.subfield { margin-top: 21px; }
.short-field { max-width: 240px; }
.input-suffix { display: flex; align-items: center; gap: 9px; }
.input-suffix input { margin-top: 8px !important; }
.input-suffix span { margin-top: 8px; color: var(--muted); }
.submit-panel { padding: 27px 0 15px; text-align: center; }
.submit-panel p:last-child { margin-top: 18px; color: var(--muted); font-size: 14px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 11px 22px; border: 1px solid var(--line); border-radius: 10px; text-align: center; text-decoration: none; font-weight: 750; }
.button.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.button.secondary { background: #fff; color: var(--navy); }
.button:disabled { opacity: .55; cursor: not-allowed; }
.submit-panel .button { min-width: 220px; }
.error { min-height: 1.5em; color: #ae392d; font-size: 14px; }
.field-feedback { clear: both; margin: 10px 0; }
#dashboard-error:empty { display: none; }
.notice { padding: 16px; border-radius: 9px; background: #fff2ef; }
.success { margin-top: 40px; padding: 55px 30px; text-align: center; }
.success h2 { margin: 0 0 18px; color: var(--accent); font-size: 28px; text-wrap: balance; }
.success p:not(.eyebrow) { color: var(--muted); line-height: 1.7; text-wrap: balance; }
.success-icon { display: grid; place-items: center; width: 88px; height: 88px; margin: 0 auto 20px; border-radius: 50%; background: #e4f2fa; color: var(--accent); font-size: 46px; }
.site-footer { padding: 24px 0; border-top: 1px solid var(--line); background: rgba(255,255,255,.78); color: #60798d; font-size: 13px; }

/* Administration */
.admin-shell { padding: 60px 0 70px; }
.login-panel { max-width: 440px; margin: 25px auto; }
.login-panel h1 { font-size: 31px; }
.login-panel .button { width: 100%; }
.login-panel input { margin-bottom: 18px; }
.dashboard-head, .section-head, .pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dashboard-head { margin-bottom: 24px; }
.dashboard-head h1 { margin: 0; font-size: 35px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi span { color: var(--muted); font-size: 14px; }
.kpi strong { display: block; margin-top: 10px; color: var(--navy); font-size: 36px; }
.admin-panel { margin-bottom: 18px; }
.admin-panel h2 { margin-bottom: 12px; font-size: 22px; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.6; }
.bar-chart { display: grid; gap: 12px; margin-top: 20px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 2fr) minmax(80px, 3fr) 34px; align-items: center; gap: 12px; font-size: 14px; }
.bar-row > span { overflow-wrap: anywhere; }
.bar-row strong { text-align: right; }
.bar-track { height: 10px; overflow: hidden; border-radius: 30px; background: #e7f0f7; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--accent); }
.stat-question { padding: 18px 0; border-top: 1px solid var(--line); }
.stat-question h3 { font-size: 17px; }
.stat-note { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.pie-chart-wrap { margin-top: 14px; }
.pie-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); align-items: center; gap: 25px; }
.pie-chart { position: relative; display: grid; place-items: center; width: 190px; height: 190px; border-radius: 50%; }
.pie-chart::after { content: ''; position: absolute; inset: 28%; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(203,219,233,.45); }
.pie-center { z-index: 1; display: grid; place-items: center; color: var(--navy); line-height: 1.15; text-align: center; }
.pie-center strong { font-size: 25px; }
.pie-center small { color: var(--muted); font-size: 11px; }
.pie-legend { display: grid; gap: 8px; min-width: 0; }
.pie-legend-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 13px; line-height: 1.45; }
.pie-swatch { width: 10px; height: 10px; border-radius: 3px; }
.pie-label { overflow-wrap: anywhere; }
.pie-legend-row strong { white-space: nowrap; color: var(--navy); font-size: 12px; }
.record-list { display: grid; gap: 10px; margin: 20px 0; }
.record-card { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.record-card summary { display: flex; justify-content: space-between; gap: 12px; padding: 15px; cursor: pointer; list-style: none; }
.record-card summary::-webkit-details-marker { display: none; }
.record-card summary::before { content: '▸'; margin-right: 3px; color: var(--accent); }
.record-card[open] summary::before { content: '▾'; }
.record-card summary strong { margin-right: auto; font-size: 14px; }
.status { padding: 3px 9px; border-radius: 20px; background: #eff3f5; color: #647684; font-size: 12px; }
.status.booked { background: #e5f2fa; color: #1b648e; }
.record-details { padding: 0 15px 17px; border-top: 1px solid var(--line); }
.detail-row { display: grid; grid-template-columns: 190px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid #edf2f6; font-size: 13px; line-height: 1.55; }
.detail-row > span { min-width: 0; overflow-wrap: anywhere; }
.detail-row strong { color: #526a7d; font-weight: 650; }
.pagination { justify-content: flex-end; font-size: 13px; }
.form-feedback { min-height: 1.5em; color: #226e9d; font-size: 14px; }

@media (max-width: 650px) {
  .shell { width: min(100% - 24px, 1080px); }
  .hero { padding: 47px 4px 42px; }
  .hero h1 { font-size: clamp(24px, 6.8vw, 40px); }
  .panel { padding: 22px; }
  .section-heading { margin-top: 42px; }
  .choice-grid, .field-grid, .region-grid, .compact { grid-template-columns: 1fr; }
  .question-title { font-size: 18px; }
  .choice { min-height: 54px; font-size: 16px; }
  .booking-panel { margin-top: 14px; }
  .cards { gap: 8px; }
  .kpi { padding: 15px; }
  .kpi strong { font-size: 26px; }
  .kpi span { font-size: 12px; }
  .section-head { align-items: flex-start; flex-wrap: wrap; }
  .pagination { flex-wrap: wrap; }
  .bar-row { grid-template-columns: minmax(95px, 1.5fr) minmax(50px, 1fr) 24px; gap: 7px; }
  .pie-layout { grid-template-columns: 1fr; justify-items: center; gap: 17px; }
  .pie-legend { width: 100%; }
  .detail-row { grid-template-columns: 1fr; gap: 2px; }
  .admin-shell { padding-top: 30px; }
  .login-panel { margin-top: 90px; }
  .record-card summary { align-items: center; }
  .page-admin::before { background-size: auto 76vh; background-position: 66% top; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .choice { transition: none; }
}

/* Local debug console */
.debug-page { min-height: 100vh; }
.debug-shell { max-width: 1040px; padding: 58px 0 80px; }
.debug-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 26px; }
.debug-header h1 { margin-bottom: 12px; font-size: clamp(34px, 5vw, 48px); }
.debug-header .lead { max-width: 680px; }
.debug-links { display: flex; gap: 10px; flex: none; }
.debug-links .button { white-space: nowrap; }
.debug-panel { margin-bottom: 18px; }
.debug-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.debug-section-head h2 { margin-bottom: 4px; }
.debug-section-head .eyebrow { margin-bottom: 7px; }
.debug-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.debug-badge { display: inline-flex; padding: 6px 10px; border: 1px solid #bfd5e7; border-radius: 999px; background: #eef6fc; color: #27618b; font-size: 12px; font-weight: 700; white-space: nowrap; }
.check-list { display: grid; gap: 8px; margin-top: 20px; }
.check-row { display: grid; grid-template-columns: 25px minmax(0, 1fr) 50px 58px; align-items: center; gap: 10px; min-height: 42px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.75); font-size: 13px; }
.check-row code { justify-self: end; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.check-row > span:last-child { justify-self: end; color: var(--muted); }
.check-dot { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-weight: 800; }
.check-ok .check-dot { background: #e2f3ed; color: #16815f; }
.check-fail .check-dot { background: #fff0ed; color: #b33c28; }
.check-ok code { color: #16815f; }
.check-fail code { color: #b33c28; }
.debug-summary, .debug-test-data { display: flex; flex-wrap: wrap; gap: 9px 18px; margin-top: 18px; color: #49657a; font-size: 14px; }
.debug-summary span, .debug-test-data span { padding: 7px 10px; border-radius: 7px; background: #eef5fa; }
.debug-good { color: #197653; }
.debug-bad { color: #b33c28; }
.runtime-info { display: grid; grid-template-columns: 150px 1fr; gap: 0; margin: 17px 0 0; font-size: 13px; }
.runtime-info dt, .runtime-info dd { margin: 0; padding: 10px 0; border-bottom: 1px solid #e7eff5; }
.runtime-info dt { color: var(--muted); font-weight: 650; }
.runtime-info dd { overflow-wrap: anywhere; color: var(--ink); }
@media (max-width: 650px) {
  .debug-shell { padding-top: 34px; }
  .debug-header { display: block; }
  .debug-links { margin-top: 18px; }
  .debug-links .button { flex: 1; }
  .debug-section-head { display: block; }
  .debug-section-head > .button, .debug-section-head > .debug-badge { margin-top: 14px; }
  .check-row { grid-template-columns: 25px minmax(0, 1fr) 45px; }
  .check-row > span:last-child { grid-column: 2 / 4; justify-self: start; margin-top: -4px; }
  .runtime-info { grid-template-columns: 1fr; }
  .runtime-info dt { padding-bottom: 3px; border: 0; }
  .runtime-info dd { padding-top: 0; }
}

/* Xiaohua booking identity */
.hero-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.brand-logo { display: block; flex: none; width: 56px; height: 56px; object-fit: contain; }
.brand-welcome { margin: 0; font-family: "PangMenTitle", "Microsoft YaHei", "PingFang SC", sans-serif; color: var(--navy); font-size: clamp(15px, 3.8vw, 23px); line-height: 1.35; white-space: nowrap; }
.booking-identity, .booking-needs { margin-top: 18px; }
@media (max-width: 650px) { .hero-brand { gap: 9px; margin-bottom: 16px; } .brand-logo { width: 46px; height: 46px; } }

.booking-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-brand { margin-bottom: 14px; }
