:root {
  color-scheme: light;
  --navy: #12355b;
  --navy-dark: #0b2540;
  --gold: #c7922e;
  --paper: #ffffff;
  --canvas: #f2f5f7;
  --ink: #1f2933;
  --muted: #5f6c78;
  --line: #d7dee5;
  --success: #16754a;
  --danger: #b42318;
  --warning-bg: #fff8e7;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); line-height: 1.65; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.site-header {
  display: flex; align-items: center; gap: 16px; padding: 26px max(24px, calc((100vw - 980px) / 2));
  color: white; background: linear-gradient(125deg, var(--navy-dark), var(--navy));
  border-bottom: 4px solid var(--gold);
}
.site-header h1 { margin: 0; font-size: clamp(1.45rem, 4vw, 2rem); letter-spacing: .04em; }
.brand-mark { display: grid; place-items: center; width: 52px; height: 52px; border: 1px solid #ffffff80; border-radius: 50%; font-size: 1.45rem; font-weight: 700; }
.eyebrow { margin: 0 0 2px; color: inherit; font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }

.layout { width: min(940px, calc(100% - 32px)); margin: 28px auto 60px; display: grid; gap: 22px; }
.notice, .card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 24px #10243a0b; }
.notice { padding: 20px 26px; border-left: 5px solid var(--gold); background: var(--warning-bg); }
.notice h2 { margin: 0 0 8px; font-size: 1.05rem; color: var(--navy); }
.notice ol { margin: 0; padding-left: 1.4rem; }
.default-duration { margin: 12px 0 0; color: var(--danger); font-weight: 800; }
.card { padding: clamp(22px, 4vw, 34px); }

.step-heading { display: flex; gap: 14px; align-items: center; margin-bottom: 24px; }
.step-heading > span { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; background: var(--navy); color: white; font-weight: 800; }
.step-heading p { margin: 0; color: var(--muted); font-size: .8rem; font-weight: 700; letter-spacing: .08em; }
.step-heading h2 { margin: 0; color: var(--navy-dark); font-size: 1.25rem; }
.field { display: grid; gap: 6px; color: var(--navy-dark); font-weight: 700; }
.field > span { color: var(--danger); }
input, select, textarea { width: 100%; border: 1px solid #b8c4ce; border-radius: 8px; background: white; padding: 11px 12px; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 3px solid #cfe2f5; border-color: var(--navy); }
.date-field { max-width: 320px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.purpose-field { margin-top: 18px; }

.status { min-height: 1.7rem; color: var(--muted); }
.time-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 10px; }
.slot { border: 1px solid #acd8c3; border-radius: 8px; padding: 9px 6px; background: #f1fbf6; color: var(--success); font-weight: 750; }
.slot:hover, .slot.selected { color: white; background: var(--success); border-color: var(--success); }
.slot.busy { color: #8f3d37; background: #fff2f0; border-color: #efb8b3; cursor: not-allowed; text-decoration: line-through; }
.legend { color: var(--muted); font-size: .82rem; }
.dot { display: inline-block; width: 10px; height: 10px; margin: 0 5px 0 14px; border-radius: 50%; }
.dot:first-child { margin-left: 0; }
.available { background: var(--success); }
.busy-dot { background: #c95c53; }
.turnstile-area { min-height: 70px; margin: 20px 0 10px; }
.turnstile-loading { margin: 0; color: var(--muted); font-size: .9rem; }
.error { color: var(--danger); background: #fff2f0; border-left: 4px solid var(--danger); padding: 10px 12px; }

.primary, .secondary { border-radius: 9px; padding: 12px 20px; font-weight: 800; }
.primary { border: 1px solid var(--navy); background: var(--navy); color: white; }
.primary:hover { background: var(--navy-dark); }
.primary:disabled { cursor: wait; opacity: .65; }
.secondary { border: 1px solid #aab7c2; background: white; color: var(--navy); }
#booking-form > .primary { width: 100%; margin-top: 12px; }

.dialog { width: min(720px, calc(100% - 30px)); border: 0; border-radius: 16px; padding: 30px; box-shadow: 0 24px 80px #07192b55; }
.dialog::backdrop { background: #07192b99; backdrop-filter: blur(3px); }
.dialog .eyebrow { color: var(--gold); }
.dialog h2 { margin-top: 2px; color: var(--navy); }
.dialog-close { position: absolute; right: 18px; top: 14px; border: 0; background: none; font-size: 1.8rem; color: var(--muted); }
.preview-list { display: grid; grid-template-columns: 9rem 1fr; border-top: 1px solid var(--line); }
.preview-list dt, .preview-list dd { margin: 0; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.preview-list dt { color: var(--muted); font-weight: 700; }
.preview-list dd { white-space: pre-wrap; overflow-wrap: anywhere; }
.policy { margin: 20px 0; padding: 16px; background: var(--warning-bg); border-radius: 8px; }
.policy h3, .policy p { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.success-dialog { text-align: center; }
.success-dialog > button { width: 100%; margin-top: 10px; }
.success-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; background: #e6f6ee; color: var(--success); font-size: 2rem; font-weight: 900; }
.print-area { display: none; }
.policy ol { margin: 8px 0 0; padding-left: 1.4rem; }
.policy li { margin: 4px 0; }

@media (max-width: 650px) {
  .form-grid { grid-template-columns: 1fr; }
  .dialog { padding: 24px 18px; }
  .preview-list { grid-template-columns: 7rem 1fr; }
  .dialog-actions { flex-direction: column-reverse; }
}

@media print {
  @page { size: A4; margin: 1.2cm; }
  body { background: white; color: black; font-family: "Microsoft JhengHei", sans-serif; }
  .no-print, dialog { display: none !important; }
  .print-area { display: block; }
  .print-area h1 { text-align: center; font-size: 20pt; margin: 0 0 22px; }
  .print-area table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .print-area th, .print-area td { border: 1px solid black; padding: 10px; vertical-align: middle; overflow-wrap: anywhere; }
  .print-area th { width: 17%; background: #eee; }
  .purpose-cell { height: 110px; vertical-align: top !important; white-space: pre-wrap; }
  .print-policy { margin-top: 16px; border: 1px solid black; padding: 12px; font-size: 10pt; }
  .print-policy p { margin: 4px 0; }
  .signatures { display: flex; justify-content: space-between; margin-top: 54px; }
  .signatures span { width: 42%; border-bottom: 1px solid black; padding-bottom: 8px; }
  .print-date { text-align: right; margin-top: 30px; font-size: 9pt; }
}

