:root {
  color-scheme: light;
  font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.55;
  --canvas: #f5f2eb;
  --ink: #28332c;
  --surface: #fffdf8;
  --muted: #566054;
  --border: #dedacf;
  --field-border: #b2b8a9;
  --brand: #375646;
  --brand-dark: #293f33;
  --sage: #dee7da;
  --mist: #e3eaec;
  --oat: #efe5d6;
  --rose: #f0e2e0;
  --danger-ink: #843e46;
  --tone: #efede5;
  --paper-shadow: 0 2px 5px #463c2610;
  --focus: #3e7061;
  --ease-ui: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
body { display: flex; flex-direction: column; min-height: 100vh; margin: 0; }
.site-footer { display: grid; gap: .375rem; padding-block: 1rem 1.5rem; border-top: 1px solid var(--border); text-align: center; font-size: .875rem; color: var(--muted); }
.site-footer span { color: var(--brand-dark); font-weight: 650; white-space: nowrap; }
.site-footer a { color: var(--muted); text-decoration: underline; text-underline-offset: .2em; }
[hidden] { display: none !important; }
a { color: var(--brand); text-decoration: none; }
button, input, select { font: inherit; }
button, .button, .pager a {
  display: inline-flex; justify-content: center; align-items: center; min-height: 2.75rem;
  padding: .5rem .875rem; border: 1px solid var(--border); border-radius: .75rem;
  background: var(--surface); color: var(--ink); font-weight: 650; cursor: pointer;
}
button:hover:not(:disabled), .button:hover, .pager a:hover { background: var(--tone); border-color: var(--field-border); }
button:disabled { background: var(--tone); color: var(--muted); border-color: var(--border); cursor: default; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 3rem; line-height: 1.1; letter-spacing: -.035em; font-weight: 700; }
h2 { font-size: 1.125rem; line-height: 1.75rem; }
h1, h2 { text-wrap: balance; }
.shell { width: min(76rem, calc(100% - 3rem)); margin-inline: auto; }
.top nav a { min-height: 2.75rem; display: inline-flex; align-items: center; }
.skip-link { position: fixed; z-index: 5; left: 1rem; top: 1rem; transform: translateY(-200%); padding: .75rem 1rem; background: #fff; border-radius: .5rem; font-weight: 700; }
.skip-link:focus { transform: none; }

.top { position: relative; z-index: 2; padding-top: 1rem; }
.top-inner {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center;
  gap: 1rem; min-height: 4rem; padding: .5rem 1rem; border: 1px solid var(--border);
  border-radius: 1.25rem; background: var(--surface); box-shadow: var(--paper-shadow);
}
.brand { display: flex; align-items: center; gap: .625rem; color: var(--ink); font-weight: 750; line-height: 1.25; }
.brand-mark {
  position: relative; flex: none; width: 2rem; height: 2rem; border-radius: .65rem; background: var(--brand);
}
.brand-mark::before, .brand-mark::after {
  content: ""; position: absolute; inset: 9px 7px; border: 1px solid #d9f5e7; border-radius: 50%;
}
.brand-mark::before { transform: rotate(45deg); }
.brand-mark::after { transform: rotate(-45deg); }
.top nav { display: flex; align-items: center; gap: .25rem; }
.top nav a { padding: .5rem .875rem; border-radius: .75rem; font-size: .875rem; font-weight: 650; color: var(--muted); }
.top nav a:hover { color: var(--brand-dark); background: var(--tone); }
.top nav a[aria-current] { position: relative; color: var(--brand-dark); background: var(--sage); }
.top nav a[aria-current]::after {
  content: ""; position: absolute; inset: auto 0 .28rem; width: 1rem; height: 2px;
  margin-inline: auto; border-radius: 50%; background: var(--brand); transform: rotate(-3deg);
}
.auth-nav { grid-column: 2 / -1; justify-self: end; }
.account { position: relative; justify-self: end; min-width: 0; }
.account summary { display: flex; align-items: center; gap: .5rem; min-height: 2.75rem; cursor: pointer; list-style: none; font-size: .875rem; }
.account summary::after { content: ""; flex: none; width: .4rem; height: .4rem; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); margin: 0 .25rem .25rem 0; }
.account[open] summary::after { transform: rotate(225deg); margin-bottom: -.25rem; }
.account summary span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 10rem; }
.avatar { display: grid; place-items: center; width: 2.125rem; height: 2.125rem; flex: none; border-radius: 50%; background: var(--mist); color: var(--brand-dark); font-weight: 700; }
.account-menu {
  position: absolute; z-index: 1; right: 0; margin-top: .65rem; min-width: 9.5rem;
  padding: .75rem; display: grid; gap: .5rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: 1rem; box-shadow: 0 .75rem 1.75rem #232c2a20;
}
.account-menu > span { color: var(--muted); font-size: .875rem; padding-inline: .5rem; }
.account-menu > a { display: flex; align-items: center; min-height: 2.75rem; padding-inline: .5rem; border-radius: .5rem; }
.account-menu > a:hover { background: var(--tone); }
.account-menu button { width: 100%; }

main { flex: 1; padding-block: 2rem 3rem; }
.heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.heading p, .instrument-info p, .muted { color: var(--muted); margin-top: .5rem; }
.board-heading {
  min-height: 9rem; padding: 1.5rem 2rem;
  border-radius: 1.5rem; background: var(--sage);
}
.board-heading h1 { position: relative; width: fit-content; padding-bottom: .25rem; }
.board-heading h1::after {
  content: ""; position: absolute; inset: auto auto 0 0; width: 2.5rem; height: 4px;
  border-bottom: 2px solid #77927b; border-radius: 45%; transform: rotate(-3deg);
}
.count { display: grid; justify-items: end; padding: .75rem 1rem; border: 1px solid #cfdbcd; border-radius: 1rem; background: var(--surface); text-align: right; }
.count strong { color: var(--brand-dark); font-size: 2.25rem; font-variant-numeric: tabular-nums; line-height: 1; }
.count span { color: var(--muted); font-size: .875rem; margin-top: .25rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 1.25rem; box-shadow: var(--paper-shadow); }
.booking-guide {
  --guide-ink: #34473b;
  --guide-rule: #cbc5ac;
  --guide-heading-font: "Kaiti SC", STKaiti, KaiTi, system-ui, sans-serif;
  margin-bottom: 1rem;
  border-color: var(--guide-rule);
  border-radius: .875rem 1.25rem .875rem 1rem;
  background: #fcf9ee;
  color: var(--guide-ink);
}
.booking-guide summary {
  display: flex; align-items: center; gap: .625rem; min-height: 3.25rem;
  padding: .75rem clamp(.875rem, 3vw, 1.5rem); cursor: pointer;
}
.booking-guide summary::-webkit-details-marker { display: none; }
.booking-guide summary::after {
  content: ""; flex: none; width: .45rem; height: .45rem; margin: -.2rem .25rem 0 .125rem;
  border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.booking-guide[open] summary::after { transform: rotate(225deg); margin-top: .2rem; }
.booking-guide-title, .booking-guide-sections h2 {
  position: relative; width: fit-content; padding-bottom: .25rem;
  font-family: var(--guide-heading-font); font-size: 1.25rem; line-height: 1.3;
}
.booking-guide-title::after, .booking-guide-sections h2::after {
  content: ""; position: absolute; right: .125rem; bottom: .0625rem; left: -.1rem;
  height: .3rem; border-bottom: 2px solid #72907c; border-radius: 40% 55% 52% 35%; transform: rotate(-1.5deg);
  pointer-events: none;
}
.booking-guide-score {
  flex: none; margin-inline-start: auto; padding: .125rem .5rem; border: 1px solid #d1d9cc;
  border-radius: 1rem; background: #e7eee0; font-size: .875rem;
}
.booking-guide-score strong { font-variant-numeric: tabular-nums; }
.booking-guide-content { padding: 0 clamp(.875rem, 3vw, 1.5rem) 1.5rem; line-height: 1.75; }
.booking-guide-intro { padding: .875rem 0 1rem; border-top: 1px dashed var(--guide-rule); }
.booking-guide-sections { display: grid; gap: 1rem 2rem; }
.booking-guide-sections section { min-width: 0; padding-top: .875rem; border-top: 1px solid #ded9c5; }
.booking-guide-sections h2 { margin-bottom: .5rem; }
.booking-guide-sections ul { margin: .375rem 0; padding-inline-start: 1.25rem; }
.booking-guide-content mark {
  padding: 0 .12em; border-radius: 42% 12% 36% 10% / 15% 24% 12% 32%;
  background: #f4e489; color: inherit; -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.booking-guide-content .guide-caution { background: #f3cdb9; }
.booking-guide-content .guide-underline {
  text-decoration: underline wavy #6d8b76 1px; text-underline-offset: .23em;
}
.controls { padding: 1rem 1.25rem; margin-bottom: 1rem; }
.toolbar, .period { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .85rem; }
.segmented { display: flex; gap: .25rem; background: var(--tone); padding: .25rem; border-radius: .75rem; }
.segmented a { display: grid; place-items: center; min-height: 2.75rem; padding: .5rem .75rem; border-radius: .5rem; color: var(--muted); font-weight: 650; white-space: nowrap; }
.segmented [aria-current] { background: var(--surface); color: var(--brand-dark); box-shadow: 0 1px 3px #232c2a18; }
.segmented a:hover:not([aria-current]) { background: var(--sage); color: var(--brand-dark); }
.filters { display: flex; gap: .55rem; align-items: center; flex-wrap: wrap; }
.filters label { display: flex; flex-wrap: wrap; gap: .42rem; align-items: center; font-size: .9rem; }
input:not([type="checkbox"], [type="hidden"]), select {
  min-height: 2.75rem; padding: .5rem .75rem; border: 1px solid var(--field-border); border-radius: .75rem; background: var(--surface); color: inherit;
}
select { appearance: none; padding-right: 1.8rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2351675e' stroke-width='2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .55rem center; max-width: 100%; }
.period { padding-top: .88rem; margin-top: .9rem; border-top: 1px solid var(--border); }
.period-label { display: flex; gap: .75rem; align-items: baseline; }
.period-label strong { font-size: 1.35rem; }
.period-label span { color: var(--muted); }
.week-strip {
  display: grid; grid-template-columns: repeat(7, minmax(2.25rem, 1fr));
  gap: .35rem; padding: .15rem 0; margin-top: .9rem;
}
.week-strip a {
  display: grid; place-items: center; min-height: 3.25rem; padding: .14rem;
  border: 1px solid transparent; border-radius: .75rem; color: var(--ink); background: var(--tone);
}
.week-strip a span { color: var(--muted); font-size: .875rem; }
.week-strip a strong { font-variant-numeric: tabular-nums; line-height: 1.1; }
.week-strip a:hover { background: var(--sage); border-color: var(--field-border); }
.week-strip a[aria-current] { background: var(--brand); color: #fff; border-color: var(--brand); }
.week-strip a[aria-current] span { color: #f1f5ef; }
.week-strip .today strong { text-decoration: underline; text-underline-offset: .2em; }
.pager { display: flex; gap: .35rem; font-size: .875rem; }
.pager a { padding-inline: .75rem; }
.legend { list-style: none; padding: 0; margin: .85rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem .55rem; }
.legend li { border: 1px solid transparent; border-radius: 2rem; padding: .12rem .55rem; font-size: .875rem; }
.schedule { display: grid; gap: 1rem; }
.instrument { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.instrument-info { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.instrument-info h2 { text-wrap: wrap; }
.instrument-info p { margin-top: .25rem; font-size: .875rem; }
.instrument-visual {
  display: grid;
  place-items: center;
  width: 5rem;
  aspect-ratio: 1;
  flex: none;
  padding: .375rem;
  border-radius: 1rem;
  background: var(--instrument-tint, var(--sage));
}
[data-instrument="photo"] { --instrument-tint: var(--mist); }
[data-instrument^="furnace-"] { --instrument-tint: var(--oat); }
.instrument-visual img { display: block; width: 100%; height: auto; }
.instrument .reservation { display: flex; flex-direction: column; gap: .75rem; flex: 1; }
.slot-groups { display: grid; gap: .67rem; }
.slot-group h3 {
  display: flex; align-items: baseline; justify-content: space-between; gap: .5rem;
  margin-bottom: .5rem; padding-bottom: .25rem; border-bottom: 1px solid var(--border); font-size: .875rem;
}
.slot-group h3 span { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.4rem, 1fr)); gap: .43rem; }
.slot {
  border: 1px solid transparent; border-radius: .58rem; display: flex;
  align-items: center; gap: .36rem; min-height: 3.45rem; padding: .36rem .47rem;
}
.slot strong, .slot small { display: block; font-size: .875rem; white-space: nowrap; }
.slot strong { font-variant-numeric: tabular-nums; }
.slot small { font-weight: 400; }
.slot.booked small { white-space: normal; overflow-wrap: anywhere; }
.slot input { width: 1rem; height: 1rem; flex: none; margin: 0; accent-color: var(--brand); }
.legend .free, .slot.free { background: #edf2ea; color: #385344; border-color: #cbd8ca; }
label.free { cursor: pointer; }
label.free:hover { border-color: var(--brand); background: var(--sage); }
label.free:has(input:checked) { border-color: var(--brand); background: #d1dfd1; box-shadow: inset 0 0 0 1px var(--brand); }
label.free:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
label.free input:focus-visible { outline: none; }
.legend .booked, .slot.booked { background: var(--oat); color: #674d35; border-color: #e1d4c2; }
.legend .mine, .slot.mine { background: var(--mist); color: #3e5264; border-color: #d1dbe1; }
.legend .locked, .slot.locked { background: #eeefed; color: #505b57; border-color: #d9ddda; }
.legend :is(.suspended, .credit-blocked), .slot:is(.suspended, .credit-blocked), .instrument-info .suspended-tag { background: var(--rose); color: var(--danger-ink); border-color: #e0cecb; }
.instrument-info .suspended-tag { display: inline-block; border-radius: .45rem; padding: .15rem .48rem; }
.legend .closed, .slot.closed, .slot.past { background: #f3f0eb; color: #655e55; border-color: #e5e0d8; }
.sunday { min-height: 2.85rem; }
.reserve-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-top: auto; font-size: .875rem; color: var(--muted); }
.reserve-actions[data-selection="ready"] span { color: var(--brand-dark); font-weight: 700; }
.reserve-actions[data-selection="invalid"] span { color: var(--danger-ink); font-weight: 700; }
.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.primary:hover:not(:disabled) { background: var(--brand-dark); border-color: var(--brand-dark); }
.danger { color: var(--danger-ink); border-color: transparent; background: transparent; }
.danger:hover:not(:disabled) { background: var(--rose); border-color: transparent; }
.records-group + .records-group { margin-top: 2rem; }
.records-group > h2 { margin-bottom: .75rem; }
.records { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); gap: 1rem; }
.record { min-width: 0; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.record-header, .record-footer { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.record-header h3 { font-size: 1.125rem; line-height: 1.5; margin-top: .25rem; overflow-wrap: anywhere; }
.record-date, .record-time span { color: var(--muted); font-size: .875rem; }
.record .instrument-visual, .record-empty .instrument-visual { width: 4.5rem; }
.record-footer { margin-top: auto; padding-top: .75rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.record-time { display: grid; gap: .125rem; }
.record-time strong { font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.record-footer .danger { padding-inline: .5rem; font-size: .875rem; }
.record-empty { display: grid; justify-items: center; gap: .75rem; padding: 2.5rem 1rem; text-align: center; }
.record-empty p { color: var(--muted); }
.record-empty .button { margin-top: .25rem; }
.empty { padding: 1rem; }
.notice { display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: 1rem; background: var(--sage); color: var(--brand-dark); }
.notice p { flex: 1; overflow-wrap: anywhere; }
.notice-mark { display: grid; place-items: center; flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--surface); font-weight: 700; }
.notice button { min-height: 2.75rem; background: transparent; border-color: transparent; color: inherit; padding-inline: .6rem; flex: none; }
.notice.error, .errorlist { color: var(--danger-ink); }
.notice.error { background: var(--rose); }
.notice.warning { background: var(--oat); }

.auth.card, .auth-panel { margin-inline: auto; padding: clamp(1rem, 4vw, 2rem); }
.auth.card { max-width: 30rem; margin-block: 2rem; }
.auth-panel { max-width: 36rem; }
.auth h1, .auth-panel h1 { font-size: 1.875rem; line-height: 2.25rem; }
.auth-header { padding: 1rem 1.25rem; border-radius: .875rem; background: var(--sage); }
.registration .auth-header { background: var(--oat); }
.auth-header p { margin-top: .375rem; color: var(--muted); font-size: .875rem; }
.auth-form { margin-top: 1.15rem; }
.auth form > p + p { margin-top: .8rem; }
.auth form label, .auth-panel label { display: block; margin-bottom: .25rem; font-size: .875rem; font-weight: 650; }
:is(.auth, .auth-panel) form input:not([type="hidden"]), :is(.auth, .auth-panel) .primary { width: 100%; }
:is(.auth, .auth-panel) .primary { margin-top: 1rem; min-height: 2.85rem; }
.auth-switch { margin-top: 1rem; text-align: center; font-size: .925rem; color: var(--muted); }
.auth-switch a { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.auth-panel input[aria-invalid="true"] { border-color: var(--danger-ink); background: #fbf3f2; }
.login { max-width: 27rem; margin-top: clamp(.5rem, 3vw, 2rem); }
.login .auth-form { display: grid; gap: .875rem; }
.login .primary { margin-top: .25rem; }
.login .auth-switch { padding-top: 1rem; border-top: 1px solid var(--border); }
.auth-errors { padding: .625rem .75rem; border-radius: .75rem; background: var(--rose); }
.auth-errors .errorlist { list-style: none; margin: 0; padding: 0; }
.registration fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.registration fieldset + fieldset { margin-top: 1.25rem; }
.registration legend { width: 100%; margin-bottom: .75rem; padding: 0 0 .5rem; border-bottom: 1px solid var(--border); font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.field small { display: block; font-size: .82rem; }
.errorlist { font-size: .875rem; padding-left: 1.1rem; margin: .35rem 0 .5rem; }
.page-heading { padding: 1rem clamp(1rem, 3vw, 2rem); flex-wrap: wrap; border-radius: 1.5rem; background: var(--oat); }

@media (prefers-reduced-motion: no-preference) {
  [data-enter], .notice { animation: page-enter .42s var(--ease-ui) both; }
  .account[open] .account-menu { animation: page-enter .24s var(--ease-ui) both; }
  .button, button, .top nav a, .account-menu a, .segmented a, .week-strip a, .pager a, label.free {
    transition: background-color .2s var(--ease-ui), border-color .2s var(--ease-ui), transform .2s var(--ease-ui);
  }
  .button:active, button:not(:disabled):active, .week-strip a:active, label.free:active { transform: scale(.98); }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .button:hover:not(:active), button:not(:disabled):hover:not(:active) { transform: translateY(-1px); }
}
@keyframes page-enter {
  from { opacity: .6; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 48rem) {
  .booking-guide-sections { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 58rem) {
  .schedule { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .instrument { grid-column: span 3; }
  .instrument--all-day { grid-column: span 2; }
}
@media (max-width: 42rem) {
  .shell { width: calc(100% - 1.5rem); }
  .top { padding-top: .75rem; }
  .top-inner { grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; padding: .5rem .75rem; border-radius: 1rem; }
  .top nav:not(.auth-nav) { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .top nav:not(.auth-nav) a { justify-content: center; padding-inline: .25rem; }
  .top nav a { padding-inline: .5rem; }
  .account summary span:last-child { max-width: 7rem; }
  main { padding-block: 1rem 2rem; }
  h1 { font-size: 2rem; line-height: 2.5rem; }
  .controls, .instrument, .record { padding: 1rem; }
  .instrument-visual { width: 4.25rem; padding: .25rem; }
  .board-heading { min-height: 0; padding: 1rem; border-radius: 1.25rem; }
  .heading p { font-size: .875rem; }
  .count { padding: .5rem .75rem; }
  .count strong { font-size: 1.75rem; }
}
@media (max-width: 25rem) {
  .form-grid { gap: .5rem; }
  .auth-header { padding: .75rem; }
  .registration fieldset + fieldset { margin-top: .75rem; }
  .registration legend { margin-bottom: .5rem; }
  .registration .primary { margin-top: .75rem; }
  .auth.card { padding: .75rem 1rem; }
  .auth-form, .auth .primary { margin-top: .75rem; }
  .week-strip { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .25rem; }
  .week-strip a span { font-size: .75rem; }
  .board-heading { gap: .5rem; }
  .count { flex: 0 0 5.75rem; }
  .count span { font-size: .8125rem; }
  .account summary span:last-child { max-width: 4.75rem; }
  .filters input, .filters select { max-width: 100%; }
  .period { align-items: stretch; }
  .pager { width: 100%; }
  .pager a { flex: 1; }
}
@media (max-width: 23rem) {
  .registration fieldset:first-of-type .form-grid { grid-template-columns: 1fr; }
}

