:root {
  --accent: #214f3a;
  --ink: #33443a;
  --gold: #c1a27a;
  --text: #29362e;
  --secondary: #56675b;
  --line: rgba(39, 77, 49, 0.12);
  --glass: rgba(255, 255, 255, 0.82);
  --bg: #f3f6f0;
  --error: #a3322f;
  font-family:
    -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans CJK JP",
    "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: #eef1ea;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  touch-action: manipulation;
}
button,
select {
  color: var(--ink);
}
button {
  border: 0;
  background: transparent;
}
button:disabled {
  cursor: default;
}
button:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible,
.date-strip:focus-visible {
  outline: 3px solid #52775a;
  outline-offset: 3px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h2,
h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
}
h1 {
  font-size: 23px;
  letter-spacing: -0.04em;
  line-height: 1.25;
  font-weight: 650;
  color: var(--accent);
}
.workbench {
  display: flex;
  justify-content: center;
  gap: 64px;
  align-items: center;
  min-height: 100svh;
  padding: 28px;
}
.preview-panel {
  width: 240px;
  flex-shrink: 0;
  align-self: center;
}
@media (min-width: 761px) {
  .preview-panel {
    max-height: calc(100svh - 56px);
    overflow-y: auto;
    scrollbar-width: thin;
  }
}
.brand {
  font-family: "Avenir Next", Avenir, sans-serif;
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}
.preview-panel h2 {
  font-size: 28px;
  margin-top: 16px;
  letter-spacing: -0.04em;
}
.preview-panel > p {
  color: var(--secondary);
  margin-top: 14px;
  font-size: 15px;
  line-height: 1.75;
}
.language {
  display: flex;
  margin: 28px 0;
  gap: 4px;
  background: rgba(255, 255, 255, 0.5);
  padding: 4px;
  border-radius: 30px;
}
.language button {
  flex: 1;
  min-height: 44px;
  border-radius: 30px;
}
.language .active {
  background: var(--accent);
  color: white;
}
.scenes {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}
.scenes button {
  text-align: left;
  padding: 10px 14px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--secondary);
}
.scenes .active {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--accent);
  font-weight: 600;
}
.scenes .active:before {
  content: "●";
  font-size: 10px;
  margin-right: 10px;
  color: var(--ink);
}
.preview-panel .mock-note {
  font-size: 14px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.phone {
  width: 430px;
  max-width: 430px;
  height: min(900px, calc(100svh - 56px));
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(150deg, #fafbf8, #f3f6f0);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: 0 28px 75px -35px rgba(35, 49, 36, 0.33);
}
.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: rgba(250, 251, 248, 0.9);
  gap: 8px;
}
.titlebar .brand {
  font-size: 10px;
  display: block;
  margin-bottom: 7px;
}
.location {
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
}
.location span {
  font-size: 18px;
  margin-right: 3px;
}
main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 22px 18px 28px;
  scrollbar-width: thin;
  scrollbar-color: #c6d2c2 transparent;
  outline: none;
}
main > section + section {
  margin-top: 24px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.section-head > span {
  font-size: 14px;
  color: var(--secondary);
}
.course-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--secondary);
  font-size: 14px;
  margin-bottom: 6px;
}
.teacher-change {
  min-height: 44px;
  padding: 4px 6px;
  border: 1px solid #628565;
  border-radius: 10px;
  background: #fafcf8;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.course-section + .calendar {
  margin-top: 12px;
}
.courses {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.course {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 4px;
  text-align: left;
  padding: 6px 8px;
  border-radius: 17px;
  background: var(--glass);
  border: 1px solid var(--line);
  min-height: 76px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.025);
}
.course-mark {
  grid-row: 1/3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 42px;
  font-size: 23px;
  color: var(--ink);
  background: #eef4e9;
  border-radius: 12px;
}
.course-name {
  font-size: 16px;
  font-weight: 600;
}
.course-meta {
  grid-column: 2;
  font-size: 14px;
  color: var(--secondary);
  margin-top: 2px;
}
.course .chosen {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 16px;
  line-height: 1.2;
}
.course-meta {
  margin-top: auto;
  line-height: 1.4;
  min-height: 1.4em;
}
.course-name {
  line-height: 1.25;
  white-space: pre-line;
  min-height: 2.5em;
  overflow-wrap: anywhere;
}
.course-mark {
  height: 20px;
  width: 20px;
  font-size: 20px;
  line-height: 1;
  background: transparent;
  border-radius: 0;
}
.course.active {
  border: 2px solid #628565;
  background: linear-gradient(135deg, #e5eee0, rgba(255, 255, 255, 0.85));
  box-shadow: 0 6px 20px rgba(35, 49, 36, 0.08);
}
.card {
  border: 1px solid var(--line);
  background: var(--glass);
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
  backdrop-filter: blur(12px);
}
.calendar {
  padding: 8px 10px;
}
.calendar .section-head {
  padding-left: 6px;
  margin: 0 0 4px;
}
.text-button {
  font-weight: 600;
  padding: 8px;
  min-height: 44px;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.calendar .section-head h2 {
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  line-height: 1.4;
}
.date-strip {
  display: flex;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overflow-anchor: none;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #b7c9b0 transparent;
  touch-action: pan-x pan-y;
}
.date-strip .day {
  flex: 0 0 48px;
  width: 48px;
  min-width: 48px;
  min-height: 56px;
  padding: 3px 0;
  gap: 0;
}
.date-strip .weekday {
  line-height: 1.2;
}
.date-strip .day-number {
  font-size: 16px;
  line-height: 1.2;
}
.day.outside:not(.active) {
  color: var(--secondary);
}
.days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}
.day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 78px;
  border-radius: 14px;
  gap: 2px;
  padding: 5px 0;
}
.day .weekday {
  color: var(--secondary);
}
.day-number {
  font-family: "Avenir Next", Avenir, sans-serif;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}
.date-mark {
  font-size: 14px;
  line-height: 1;
  min-height: 14px;
  color: var(--ink);
}
.day.active {
  background: var(--accent);
  color: white;
  box-shadow: inset 0 0 0 2px #e0ebd8;
  font-weight: 700;
}
.day.active .weekday,
.day.active .date-mark {
  color: white;
}
.day:disabled {
  opacity: 1;
  color: var(--secondary);
  background: #eef2ea;
}
.month-navigation {
  display: flex;
  justify-content: space-between;
}
.month .day {
  min-height: 50px;
  gap: 0;
}
.month .day-number {
  font-size: 16px;
}
.month > .weekday {
  text-align: center;
  padding: 6px 0;
  color: var(--secondary);
}
.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.day-head h2 {
  font-size: 20px;
  letter-spacing: -0.025em;
}
.icon-button {
  height: 44px;
  width: 44px;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
}
.icon-button:disabled {
  opacity: 1;
  color: var(--secondary);
  background: #eef2ea;
}
.attendance {
  padding: 0 2px 12px;
  font-size: 14px;
  color: var(--secondary);
}
.attendance summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 5px;
  list-style: none;
}
.attendance summary:before {
  content: "⌄";
  font-size: 18px;
  color: var(--ink);
}
.attendance p {
  padding: 0 14px 6px;
  line-height: 1.7;
}
.viewbar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.segmented {
  display: flex;
  background: #e6ede1;
  padding: 4px;
  border-radius: 28px;
  flex: 1;
}
.segmented button {
  flex: 1;
  min-height: 44px;
  border-radius: 24px;
  font-weight: 600;
}
.segmented .active {
  font-weight: 700;
  background: #fff;
  box-shadow: 0 2px 5px rgba(35, 49, 36, 0.06);
}
.filter-button {
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--glass);
  border-radius: 24px;
  font-weight: 600;
}
.filter-panel {
  padding: 14px;
  margin-bottom: 14px;
}
.filter-fields {
  display: flex;
  gap: 10px;
}
.filter-fields label {
  flex: 1;
  min-width: 0;
}
label {
  display: block;
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
}
select {
  display: block;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  background: #fafbf8;
  padding: 8px;
  border-radius: 10px;
  margin-top: 5px;
}
input {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  margin: 0;
}
.filter-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 10px;
}
.check-label {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 44px;
}
.time-card {
  padding: 16px 12px;
  margin-bottom: 12px;
}
.time-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 14px;
}
.time-heading > span {
  font-size: 14px;
  color: var(--secondary);
  text-align: right;
}
.time {
  font-family: "Avenir Next", Avenir, sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.025em;
  color: var(--accent);
}
.time-end {
  font-size: 14px;
  color: var(--secondary);
  margin-left: 5px;
}
.slot-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.slot-button {
  padding: 10px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 64px;
  border: 1px solid #9eaf9c;
  border-radius: 12px;
  background: #fafcf8;
  min-width: 0;
  font-size: 14px;
  white-space: normal;
}
.slot-button strong {
  font-size: 14px;
  font-weight: 600;
}
.slot-button span {
  font-size: 14px;
}
.slot-button.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.slot-button:disabled {
  border-color: #d5ded0;
  background: #f0f4ec;
  color: #586b5c;
}
.slot-button.booked {
  background: #e3eddd;
  border-color: #c9dac2;
  color: var(--accent);
}
.slot-button.notOpen,
.slot-button.closed {
  border-style: dashed;
}
.selection {
  padding: 16px;
  margin-top: 18px;
  border-color: #9fb89a;
}
.selection h3 {
  margin-bottom: 12px;
}
.selection p {
  margin: 6px 0;
}
.selection .time {
  font-size: 16px;
}
.selection label {
  margin-top: 14px;
}
.selection .muted {
  margin-top: 12px;
}
.actionbar {
  padding: 12px 18px max(14px, env(safe-area-inset-bottom));
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.action-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.action-summary strong {
  font-weight: 600;
}
.action-summary span {
  color: var(--secondary);
  text-align: right;
  flex-shrink: 0;
}
.primary,
.secondary {
  min-height: 48px;
  border-radius: 28px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
}
.primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 12px rgba(35, 49, 36, 0.1);
}
.primary:disabled {
  background: #e4eade;
  color: #596b5c;
  box-shadow: none;
}
.secondary {
  border: 1px solid #a5b69f;
  background: white;
  color: var(--accent);
}
.wide {
  width: 100%;
  margin-top: 14px;
}
.muted {
  font-size: 14px;
  color: var(--secondary);
}
.empty {
  padding: 32px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  margin-top: 10px;
}
.empty h3 {
  font-size: 16px;
  line-height: 1.65;
}
.empty-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8f0e2;
  font-size: 26px;
  color: var(--accent);
}
.error {
  background: #fff0ee;
  color: var(--error);
  border: 1px solid #e4c0bc;
  padding: 14px;
  border-radius: 12px;
  margin: 0 0 14px;
  line-height: 1.65;
}
.timetable {
  padding: 12px 8px;
  overflow: hidden;
}
.timetable table {
  border-collapse: separate;
  border-spacing: 4px;
  width: 100%;
  table-layout: fixed;
}
.timetable caption {
  text-align: left;
  font-weight: 600;
  color: var(--accent);
  padding: 4px 6px 14px;
}
.timetable th {
  font-size: 14px;
  font-weight: 500;
  vertical-align: middle;
}
.timetable thead th:first-child {
  width: 66px;
}
.timetable thead th {
  padding-bottom: 8px;
}
.timetable tbody th {
  text-align: left;
}
.timetable .time {
  font-size: 18px;
}
.timetable tbody th span {
  display: block;
}
.timetable .slot-button {
  width: 100%;
  min-height: 72px;
  padding: 8px 1px;
}
.timetable .slot-button span {
  font-size: 14px;
}
.legend {
  font-size: 14px;
  color: var(--secondary);
  margin: 12px 4px 2px;
  line-height: 1.7;
}
.result {
  text-align: center;
  padding: 6px 0;
}
.result .reservation {
  margin-top: 20px;
  padding: 20px;
}
.result .result-date {
  margin-top: 16px;
}
.result .reservation-meta {
  margin-top: 16px;
  padding-top: 14px;
}
.success-icon {
  background: var(--accent);
  color: white;
  border-radius: 50%;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  font-size: 32px;
  margin: 0 auto 22px;
  box-shadow: 0 6px 20px rgba(35, 49, 36, 0.12);
}
.result-title {
  font-size: 24px;
  letter-spacing: -0.04em;
  margin-bottom: 10px;
}
.reservation {
  text-align: left;
  padding: 24px;
  margin: 26px 0 18px;
  position: relative;
  overflow: hidden;
}
.reservation:before {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gold);
}
.reservation h3 {
  font-size: 20px;
  margin-top: 16px;
}
.status {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
}
.result-date {
  font-size: 16px;
  margin-top: 24px;
  color: var(--ink);
}
.result-time {
  font-size: 36px;
  letter-spacing: -0.05em;
  font-weight: 600;
  font-family: "Avenir Next", Avenir, sans-serif;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
}
.result-time span {
  font-size: 25px;
  font-weight: 400;
}
.reservation-meta {
  border-top: 1px dashed #bfcfba;
  margin-top: 22px;
  padding-top: 18px;
  font-size: 14px;
  color: var(--secondary);
  display: grid;
  gap: 6px;
}
#teacher-sheet {
  position: fixed;
  top: auto;
  margin: 0;
  transform: translateX(-50%);
  max-width: 100vw;
  max-height: 75svh;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
  background: #fafcf8;
  color: var(--text);
  box-shadow: 0 -12px 40px rgba(35, 49, 36, 0.18);
}
#teacher-sheet::backdrop {
  background: rgba(30, 40, 32, 0.3);
}
.teacher-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.teacher-sheet-slot {
  margin: 10px 0 14px;
  font-size: 14px;
  color: var(--secondary);
}
.teacher-options {
  display: grid;
  gap: 8px;
  max-height: 45svh;
  overflow: auto;
}
.teacher-option {
  min-height: 48px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #628565;
  border-radius: 12px;
  background: white;
  font-size: 16px;
  font-weight: 600;
}
.teacher-option[aria-pressed="true"] {
  background: #e5eee0;
}
@media (max-width: 760px) {
  .workbench {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 100svh;
    align-items: center;
  }
  .preview-panel {
    width: 100%;
    max-width: 430px;
    padding: 10px 12px;
    display: flex;
    gap: 6px;
    align-items: center;
    background: #eef1ea;
    align-self: auto;
  }
  .preview-panel > .brand,
  .preview-panel > h2,
  .preview-panel > p,
  .preview-panel > h3 {
    display: none;
  }
  .language {
    margin: 0;
    flex: 0 0 auto;
    background: transparent;
    padding: 0;
    gap: 0;
  }
  .language button {
    padding: 6px 8px;
    font-size: 14px;
    min-height: 44px;
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .scenes {
    display: flex;
    overflow: auto;
    margin: 0;
    gap: 4px;
    min-width: 0;
  }
  .scenes button {
    white-space: nowrap;
    padding: 6px 10px;
    min-height: 44px;
    font-size: 14px;
    border-radius: 24px;
  }
  .scenes .active:before {
    display: none;
  }
  .phone {
    width: 100%;
    height: calc(100svh - 64px);
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .titlebar {
    padding-top: 16px;
    padding-bottom: 16px;
  }
  main {
    padding: 18px 16px 24px;
  }
  .time-heading {
    flex-wrap: wrap;
  }
  .action-summary {
    font-size: 14px;
  }
  .course {
    min-height: 74px;
  }
  .day-head h2 {
    font-size: 19px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .slot-button,
  .course {
    transition:
      background 0.15s,
      border-color 0.15s;
  }
  .result {
    animation: reveal 0.25s ease-out;
  }
  @keyframes reveal {
    from {
      opacity: 0;
      transform: translateY(5px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
@media (forced-colors: active) {
  .slot-button.selected,
  .course.active,
  .day.active {
    outline: 3px solid Highlight;
  }
  .card,
  .slot-button,
  .course {
    border: 1px solid CanvasText;
  }
}

/* main独立滚动；负偏移抵消其内边距，使吸顶区贴合顶栏下缘。 */
.booking-sticky {
  position: sticky;
  top: -18px;
  z-index: 2;
  margin: -18px -16px 0;
  padding: 10px 16px 8px;
  background: #f3f6f0;
  border-bottom: 1px solid var(--line);
}
.booking-sticky .course-summary { margin-bottom: 4px; }
.booking-sticky .course { min-height: 52px; padding: 6px 8px; justify-content: center; gap: 0; }
.booking-sticky .course-mark, .booking-sticky .course-meta, .booking-sticky .chosen { display: none; }
.booking-sticky .course-name { min-height: 0; line-height: 1.25; }
.booking-sticky .day-head { margin: 6px 0 0; }
.booking-sticky .day-head h2 { text-align: center; font-size: 19px; }
.booking-sticky .course.active .course-name { text-decoration: underline; text-underline-offset: 4px; }
.booking-sticky + .calendar { margin-top: 12px; }
@media (min-width: 761px) {
  .booking-sticky { top: -22px; margin: -22px -18px 0; padding: 10px 18px 8px; }
}

/* 日期条保留月历下方的流内位置，到课程下缘才吸附。 */
.booking-sticky { z-index: 3; }
.date-sticky {
  position: sticky;
  top: calc(var(--course-sticky-height) - 18px);
  z-index: 2;
  padding: 6px 16px 8px;
  margin: 0 -16px;
  background: #f3f6f0;
  border-bottom: 1px solid var(--line);
}
.date-sticky .day-head { margin: 0; }
.date-sticky .day-head h2 { text-align: center; font-size: 19px; }
@media (min-width: 761px) {
  .date-sticky { top: calc(var(--course-sticky-height) - 22px); margin: 0 -18px; padding-inline: 18px; }
}
