:root {
  color-scheme: light;
  --ink: #29352d;
  --muted: #66736b;
  --line: #dce5dd;
  --green: #3c7654;
  --pale: #eff7f0;
  --cream: #fbfaf5;
  --danger: #9a3636;
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "PingFang TC", sans-serif;
}

* { box-sizing: border-box; }
body { min-width: 320px; margin: 0; color: var(--ink); background: var(--cream); font-size: 16px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
.masthead { padding: max(29px, env(safe-area-inset-top)) 20px 21px; border-bottom: 1px solid var(--line); background: #fff; }
.header-inner, .shell { width: min(100%, 720px); margin: 0 auto; }
h1 { margin-bottom: 8px; font-size: 25px; letter-spacing: .03em; }
.eyebrow { margin: 0 0 5px; color: var(--green); font-size: .85rem; font-weight: 700; letter-spacing: .12em; }
.teacher-appointment { margin: 0 0 22px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.teacher-appointment h2 { margin: 0 0 8px; font-size: 25px; letter-spacing: .03em; }
.appointment-link { display: block; margin-top: 16px; color: var(--ink); font-size: 20px; font-weight: 700; line-height: 1.35; text-decoration: none; }
.appointment-link:hover { color: var(--green); text-decoration: none; }
.teacher-appointment .appointment-link { border-radius: 11px; }
.encourage { margin: 0; font-size: 16px; line-height: 1.55; }
.activity-view .encourage, .activity-view .teacher-appointment { display: none; }
.shell { min-height: 100vh; padding: 16px 12px calc(44px + env(safe-area-inset-bottom)); }
.portal-page .masthead { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: 6px; }
.portal-page .eyebrow { margin-bottom: 0; }
.portal-shell { min-height: 0; }
.portal-shell .teacher-appointment { margin-bottom: 16px; }
.activity-support-frame { border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 1px 2px rgb(36 61 42 / 4%); overflow: hidden; }
.activity-support-intro { padding: 18px 16px 8px; }
.activity-support-content { padding: 16px; }
:is(.activity-view, .appointment-page) .activity-support-frame { border: 0; background: transparent; box-shadow: none; overflow: visible; }
:is(.activity-view, .appointment-page) .activity-support-intro { padding: 0 4px 12px; border-bottom: 0; }
:is(.activity-view, .appointment-page) .activity-support-content { padding: 0; }
.loading, .empty, .error { padding: 22px 16px; color: var(--muted); text-align: center; }
.activity-list { display: grid; gap: 16px; }
.activity-card { margin: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 1px 2px rgb(36 61 42 / 4%); }
.activity-card-head, .detail-head { padding: 17px 16px 13px; border-bottom: 1px solid var(--line); border-radius: 11px 11px 0 0; background: var(--pale); }
.activity-title { display: block; width: auto; min-height: 0; margin: 0 0 8px; padding: 0; border: 0; color: var(--ink); background: transparent; font-size: 20px; font-weight: 700; line-height: 1.35; text-align: left; }
.activity-list .activity-card-head { display: block; color: var(--ink); text-decoration: none; border-bottom: 0; border-radius: 11px; }
.activity-list .activity-card-head:hover .activity-title { color: var(--green); }
.activity-list .activity-card-head:focus-visible { outline: 3px solid #dcefe0; outline-offset: 2px; }
time, .detail-head p { display: block; margin: 0; color: var(--green); font-size: 15px; font-weight: 700; }
.route { margin: 8px 0 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.detail-head h2 { margin: 0 0 8px; font-size: 20px; line-height: 1.35; }
.support-list { margin: 0; padding: 0 16px; list-style: none; }
.slot { display: grid; grid-template-columns: minmax(0, 1fr) calc(4em + 26px); gap: 14px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line); }
.slot:last-child { border-bottom: 0; }
.slot h3 { margin: 0 0 5px; font-size: 16px; line-height: 1.45; }
.slot p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.claim-fields { display: grid; gap: 7px; }
input, select { display: block; width: 100%; min-height: 45px; padding: 10px 12px; border: 1px solid #b8c7b9; border-radius: 9px; color: var(--ink); background: #fff; font-size: 16px; line-height: 1.5; }
input:focus, select:focus, button:focus-visible { outline: 3px solid #dcefe0; border-color: var(--green); outline-offset: 2px; }
.activity-detail { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; position: fixed; z-index: 3; bottom: max(8px, env(safe-area-inset-bottom)); left: 50%; width: min(calc(100vw - 16px), 696px); transform: translateX(-50%); padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgb(255 255 255 / 96%); box-shadow: 0 3px 16px rgb(36 61 42 / 14%); }
.button { min-height: 52px; padding: 12px 15px; border: 1px solid var(--green); border-radius: 10px; font-size: 18px; font-weight: 600; line-height: 1.4; }
.button--primary { color: #fff; background: var(--green); }
.actions .button--secondary { color: #fff; border-color: var(--green); background: var(--green); }
.button:disabled { opacity: .65; cursor: wait; }
.notice { position: fixed; z-index: 2; right: 18px; bottom: max(20px, env(safe-area-inset-bottom)); max-width: calc(100vw - 36px); padding: 13px 16px; border-radius: 11px; color: #fff; background: var(--green); box-shadow: 0 6px 24px rgb(0 0 0 / 18%); }
.notice--error { background: var(--danger); }
.appointment-intro { margin: 0; font-size: 16px; line-height: 1.55; }
.appointment-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 1px 2px rgb(36 61 42 / 4%); }
.appointment-page .detail-head .appointment-intro { color: var(--muted); font-size: 15px; font-weight: 400; }
.appointment-page .appointment-table-wrap { border: 0; border-radius: 0 0 11px 11px; box-shadow: none; }
.appointment-table { width: 100%; table-layout: fixed; border-collapse: collapse; text-align: center; }
.appointment-table thead th:first-child { width: 108px; }
.appointment-table th, .appointment-table td { padding: 13px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: middle; }
.appointment-table tr:last-child th, .appointment-table tr:last-child td { border-bottom: 0; }
.appointment-table th:last-child, .appointment-table td:last-child { border-right: 0; }
.appointment-table thead th { color: var(--ink); background: var(--pale); font-size: 15px; }
.appointment-table tbody th { padding-inline: 8px; color: var(--muted); font-size: 14px; font-weight: 600; }
.appointment-weekday { display: block; margin-top: 4px; font-size: 13px; }
.booking-open, .booking-name { width: 100%; min-height: 41px; padding: 7px 8px; border: 0; border-radius: 8px; font-size: 15px; font-weight: 700; }
.booking-open { color: var(--green); background: var(--pale); }
.booking-open:hover { background: #dfeee1; }
.booking-name { color: var(--ink); background: #f5f2e9; text-decoration: underline; text-decoration-color: #c7d1c8; text-underline-offset: 3px; }
.appointment-page .shell { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
.appointment-actions { grid-template-columns: 1fr; }
.appointment-actions a { display: block; text-align: center; text-decoration: none; }
.appointment-dialog { width: min(calc(100vw - 28px), 480px); padding: 0; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: #fff; box-shadow: 0 16px 50px rgb(36 61 42 / 22%); }
.appointment-dialog::backdrop { background: rgb(32 44 35 / 38%); }
.appointment-dialog form { display: grid; gap: 15px; padding: 22px; }
.appointment-dialog h2 { margin: 0; font-size: 21px; }
.appointment-dialog label { display: grid; gap: 7px; font-weight: 700; }
.dialog-time { margin: -7px 0 1px; color: var(--green); font-weight: 700; line-height: 1.5; }
.field-hint { margin: -7px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.form-error { margin: -4px 0 0; color: var(--danger); font-weight: 700; line-height: 1.5; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 2px; }
.dialog-actions--three { grid-template-columns: 1fr 1fr 1fr; }
.dialog-actions .button { min-height: 48px; padding: 10px 9px; font-size: 15px; }
.button--plain { color: var(--green); border-color: var(--green); background: #fff; }
.button--danger { color: #fff; border-color: var(--danger); background: var(--danger); }

@media (max-width: 560px) {
  .masthead { padding: max(22px, env(safe-area-inset-top)) 16px 18px; }
  .shell { padding: 15px 8px calc(36px + env(safe-area-inset-bottom)); }
  .activity-card-head, .detail-head { padding: 16px 14px 14px; }
  .support-list { padding: 0 14px; }
  .slot { grid-template-columns: minmax(0, 1fr) calc(4em + 26px); gap: 10px; }
  .actions { width: calc(100vw - 16px); }
  .activity-support-intro { padding: 16px 14px 6px; }
  .activity-support-content { padding: 14px; }
  .appointment-dialog form { padding: 20px 16px; }
  .appointment-table thead th:first-child { width: 96px; }
  .appointment-table th, .appointment-table td { padding-inline: 6px; }
  .dialog-actions--three { grid-template-columns: 1fr 1fr; }
  .dialog-actions--three .button--primary { grid-column: 1 / -1; }
}
