:root {
  --ink: #11203a;
  --muted: #667085;
  --line: #dce4ee;
  --panel: #ffffff;
  --bg: #f3f6fa;
  --blue: #1559d6;
  --blue-dark: #0f3f9f;
  --green: #15865d;
  --orange: #ea580c;
}

* { box-sizing: border-box; }
[hidden], .hidden { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}
button, input, select, textarea { font: inherit; font-size: 16px; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.catalog-shell { width: min(100%, 1080px); margin: 0 auto; min-height: 100vh; background: #fff; }
.catalog-screen { display: none; }
.catalog-screen.active { display: block; }
.section-title span { margin: 0 0 8px; color: var(--blue); font-size: 13px; font-weight: 800; }
.review-section, .recorded-section, .filter-panel, .course-pick-section { padding: 24px; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-title h2 { margin: 0; font-size: 24px; }
.section-title small { color: var(--muted); }
.compact-review-section { padding: 10px 24px 12px; border-bottom: 1px solid #edf1f6; background: #fff; }
.review-rail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.review-rail-head strong { color: #344054; font-size: 14px; }
.review-rail-head small { color: #98a2b3; font-size: 12px; }
.review-strip { display: flex; gap: 8px; overflow-x: auto; padding: 1px 1px 5px; scrollbar-width: thin; }
.review-thumb { flex: 0 0 auto; width: 76px; height: 56px; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #f5f7fa; transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease; }
.review-thumb:hover { transform: translateY(-1px); }
.review-thumb.active { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(21, 89, 214, 0.13); }
.review-thumb img { width: 100%; height: 100%; display: block; object-fit: cover; }
.review-viewer { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease, margin-top 0.38s cubic-bezier(0.22, 1, 0.36, 1); }
.review-viewer.open { grid-template-rows: 1fr; margin-top: 8px; opacity: 1; }
.review-viewer-inner { min-height: 0; overflow: hidden; border-radius: 8px; background: #f7f9fc; }
.review-viewer.open .review-viewer-inner { border: 1px solid var(--line); }
.review-viewer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 40px; padding: 0 8px 0 12px; border-bottom: 1px solid var(--line); background: #fff; }
.review-viewer-toolbar strong { overflow: hidden; color: #344054; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.review-viewer-toolbar button { flex: 0 0 auto; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #667085; font-size: 24px; line-height: 1; }
.review-viewer-toolbar button:hover { background: #eef2f7; }
.review-viewer img { display: block; width: 100%; height: min(62vh, 620px); object-fit: contain; background: #f7f9fc; }

.filter-panel { display: grid; gap: 16px; background: #fff; }
.delivery-note { margin: -4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.filter-block { display: grid; gap: 10px; }
.filter-label { color: #344054; font-size: 14px; font-weight: 800; }
.filter-label small { color: var(--muted); font-weight: 500; }
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: #f6f8fb; }
.segmented button, .choice-row button { min-height: 44px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #475467; }
.segmented button.active { background: #fff; color: var(--blue); box-shadow: 0 1px 5px rgba(16, 24, 40, 0.12); font-weight: 800; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-row button { min-width: 84px; padding: 9px 14px; border-color: var(--line); background: #fff; }
.choice-row button.active { border-color: var(--blue); background: #eef4ff; color: var(--blue); font-weight: 800; }
.filter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.filter-grid label { display: grid; gap: 8px; color: #344054; font-size: 14px; font-weight: 800; }
select { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.form-hint { min-height: 20px; margin: -8px 0 0; color: var(--orange); font-size: 13px; }
.primary-action { width: 100%; min-height: 52px; border: 0; border-radius: 8px; background: var(--blue); color: #fff; font-weight: 800; }
.primary-action:hover { background: var(--blue-dark); }
.recorded-section { border-top: 10px solid var(--bg); }
.recorded-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.recorded-card { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-align: left; color: var(--ink); }
.recorded-card span, .recorded-card small { color: var(--muted); }
.recorded-card strong { font-size: 18px; }
.recorded-card-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.recorded-card-actions b { color: var(--blue); font-size: 21px; }
.recorded-signup { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; padding: 0 16px; border-radius: 7px; background: var(--blue); color: #fff; font-weight: 800; text-decoration: none; }
.recorded-pending { color: var(--muted); font-size: 13px; }
.custom-request-inline { padding-top: 2px; }
.custom-request-form { display: grid; gap: 15px; }
.bot-trap { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
.custom-request-form h2 { margin: 0; padding-right: 32px; }
.custom-request-form > div > p { margin: 6px 0 0; color: var(--muted); line-height: 1.5; }
.custom-request-form label { display: grid; gap: 7px; color: #344054; font-size: 14px; font-weight: 800; }
.custom-request-form label small { color: var(--muted); font-weight: 500; }
.custom-request-form input, .custom-request-form textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); resize: vertical; }
.custom-request-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.custom-request-form .form-hint { margin: -5px 0; }
.custom-request-form button:disabled { opacity: 0.65; cursor: wait; }

.schedule-header { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.98); }
.schedule-header h1 { margin: 0; font-size: 24px; text-align: center; }
.schedule-header p { margin: 4px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.plan-mode .schedule-header { grid-template-columns: 1fr; }
.plan-mode .schedule-header .back-button,
.plan-mode .schedule-header .text-button { display: none; }
.plan-intro { margin: 18px 18px 0; padding: 14px 16px; border-left: 4px solid var(--blue); background: #f4f7fd; }
.plan-intro p { margin: 0; color: #344054; line-height: 1.65; }
.plan-intro small { display: block; margin-top: 6px; color: var(--muted); }
.plan-review-section { padding-bottom: 12px; }
.back-button, .text-button, .dialog-close { border: 0; background: transparent; color: var(--blue); }
.back-button { width: 42px; height: 42px; padding: 0; color: var(--ink); font-size: 42px; line-height: 0.8; }
.text-button { padding: 8px 0; white-space: nowrap; }
.calendar-panel { margin: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.calendar-topline { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.calendar-topline > strong { white-space: nowrap; }
.course-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; color: #344054; font-size: 13px; }
.color-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--course-color); }
.active-weeks { display: grid; gap: 18px; max-height: 430px; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.month-block { display: grid; gap: 8px; }
.month-block h3 { margin: 0 0 2px; font-size: 18px; }
.week-days { display: grid; grid-template-columns: repeat(7, minmax(74px, 1fr)); min-width: 540px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.week-day { min-height: 92px; padding: 10px 7px; border: 0; border-right: 1px solid var(--line); background: #fff; color: var(--ink); text-align: center; }
.week-day:last-child { border-right: 0; }
.week-day.empty { color: #98a2b3; background: #f8fafc; cursor: default; }
.week-day.active { background: #eef4ff; box-shadow: inset 0 0 0 2px var(--blue); }
.week-day strong, .week-day span { display: block; }
.week-day span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.day-dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 5px; min-height: 10px; margin-top: 10px; }
.calendar-scroll-hint { margin: 14px 0 0; color: #98a2b3; font-size: 13px; text-align: center; }
.course-pick-section { padding-top: 8px; }
.timeline { display: grid; gap: 10px; }
.time-group { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; align-items: start; }
.time-label { padding-top: 22px; color: #344054; font-weight: 700; }
.time-courses { display: grid; gap: 8px; }
.course-option { display: grid; grid-template-columns: 34px 12px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; width: 100%; min-height: 88px; padding: 14px; border: 1px solid var(--course-color); border-radius: 8px; background: #fff; color: var(--ink); text-align: left; }
.course-option.selected { background: color-mix(in srgb, var(--course-color) 6%, white); box-shadow: 0 0 0 2px color-mix(in srgb, var(--course-color) 18%, transparent); }
.check-ring { width: 28px; height: 28px; display: grid; place-items: center; border: 2px solid #aeb8c6; border-radius: 50%; color: transparent; }
.selected .check-ring { border-color: var(--course-color); background: var(--course-color); color: #fff; }
.course-copy strong, .course-copy span { display: block; }
.course-copy strong { font-size: 18px; }
.course-copy span { margin-top: 5px; color: var(--muted); font-size: 13px; }
.course-price { font-size: 18px; font-weight: 800; white-space: nowrap; }
.course-detail-link { padding-left: 10px; border-left: 1px solid var(--line); color: var(--blue); font-size: 14px; font-weight: 800; }
.conflict-note { margin: 2px 0 4px 46px; color: var(--orange); font-size: 13px; }
.empty-result { padding: 28px 16px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); text-align: center; }
.bottom-spacer { height: 120px; }
.selection-bar { position: fixed; left: 50%; bottom: 0; z-index: 6; width: min(100%, 1080px); display: grid; grid-template-columns: 1fr minmax(150px, 40%); gap: 18px; align-items: center; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; box-shadow: 0 -10px 30px rgba(16, 24, 40, 0.1); transform: translateX(-50%); }
.selection-bar span { font-size: 18px; }
.selection-bar p { margin: 5px 0 0; color: var(--muted); }
.selection-bar p strong { color: var(--blue); font-size: 24px; }
.selection-bar button { min-height: 52px; border: 0; border-radius: 8px; background: var(--blue); color: #fff; font-size: 18px; font-weight: 800; }

.course-dialog { width: min(560px, calc(100% - 28px)); max-height: 84vh; padding: 24px; border: 0; border-radius: 8px; color: var(--ink); box-shadow: 0 26px 80px rgba(15, 23, 42, 0.28); }
.course-dialog::backdrop { background: rgba(15, 23, 42, 0.48); }
.dialog-close { position: absolute; top: 10px; right: 12px; width: 38px; height: 38px; color: var(--muted); font-size: 28px; }
.dialog-body { display: grid; gap: 16px; }
.dialog-body h2 { margin: 0; padding-right: 32px; }
.dialog-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.dialog-meta span { padding: 5px 9px; border-radius: 999px; background: #eef4ff; color: var(--blue); font-size: 13px; }
.dialog-section h3 { margin: 0 0 7px; font-size: 15px; }
.dialog-section p { margin: 0; color: #475467; line-height: 1.7; white-space: pre-wrap; }
.teacher-detail-section { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 14px; align-items: start; }
.teacher-detail-section h3 { grid-column: 1 / -1; }
.teacher-detail-section p { padding-top: 4px; }
.teacher-detail-section p strong { display: block; margin-bottom: 4px; color: var(--ink); }
.detail-image-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.detail-image-gallery a { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: #f8fafc; }
.detail-image-gallery img { display: block; width: 100%; height: 150px; object-fit: cover; }
.teacher-detail-media { grid-template-columns: repeat(2, 72px); margin: 0; }
.teacher-detail-media img { width: 72px; height: 88px; }
.outline-detail-media { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lesson-date-list { max-height: 180px; overflow: auto; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: #475467; line-height: 1.8; }
.signup-copy { width: 100%; min-height: 150px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; color: var(--ink); }
.assistant-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.assistant-item { padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.assistant-item strong, .assistant-item span { display: block; }
.assistant-item span { margin-top: 5px; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 96px; z-index: 20; padding: 10px 15px; border-radius: 8px; background: #111827; color: #fff; font-size: 14px; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: 0.18s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 680px) {
  .catalog-shell { width: 100%; }
  .review-section, .recorded-section, .filter-panel, .course-pick-section { padding: 14px; }
  .compact-review-section { padding: 8px 14px 9px; }
  .review-rail-head { margin-bottom: 6px; }
  .review-strip { gap: 6px; padding-bottom: 3px; }
  .review-thumb { width: 62px; height: 46px; }
  .review-viewer.open { margin-top: 7px; }
  .review-viewer img { height: min(58vh, 460px); }
  .filter-panel { gap: 12px; }
  .filter-block { gap: 7px; }
  .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .filter-grid label { gap: 6px; font-size: 13px; }
  select { min-height: 42px; padding: 7px 8px; }
  .segmented button, .choice-row button { min-height: 40px; }
  .segmented button { padding: 7px 4px; font-size: 14px; white-space: nowrap; }
  .choice-row { gap: 6px; }
  .choice-row button { min-width: 0; padding: 7px 11px; }
  #campus-options { display: grid; grid-template-columns: repeat(2, 1fr); }
  .recorded-list { grid-template-columns: 1fr; }
  .recorded-card-actions { grid-template-columns: minmax(0, 1fr) auto; }
  .recorded-signup { grid-column: 1 / -1; }
  .schedule-header { grid-template-columns: 34px 1fr auto; padding: 12px; }
  .schedule-header h1 { font-size: 20px; }
  .plan-mode .schedule-header { padding: 13px 14px; }
  .plan-mode .schedule-header h1 { font-size: 19px; }
  .plan-intro { margin: 12px 12px 0; padding: 12px; }
  .calendar-panel { margin: 12px; padding: 14px 12px; }
  .calendar-topline { display: grid; }
  .course-legend { justify-content: flex-start; max-height: 52px; overflow: auto; }
  .active-weeks { max-height: 310px; }
  .week-days { min-width: 100%; grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .week-day { min-height: 64px; padding: 6px 2px; }
  .week-day strong { font-size: 13px; }
  .week-day span { font-size: 10px; }
  .day-dots { gap: 3px; margin-top: 6px; }
  .day-dots .color-dot { width: 7px; height: 7px; }
  .time-group { grid-template-columns: 54px minmax(0, 1fr); gap: 7px; }
  .time-label { font-size: 13px; }
  .course-option { grid-template-columns: 30px 9px minmax(0, 1fr) auto; min-height: 82px; padding: 12px 10px; }
  .course-price { grid-column: 3; font-size: 15px; }
  .course-detail-link { grid-column: 4; grid-row: 1 / span 2; align-self: stretch; display: flex; align-items: center; padding-left: 8px; }
  .course-copy strong { font-size: 16px; }
  .course-copy span { font-size: 12px; }
  .conflict-note { margin-left: 37px; }
  .selection-bar { grid-template-columns: 1fr 150px; gap: 10px; padding: 11px 14px calc(11px + env(safe-area-inset-bottom)); }
  .selection-bar p strong { font-size: 21px; }
  .selection-bar button { min-height: 48px; }
  .assistant-list { grid-template-columns: 1fr; }
  .custom-request-grid { grid-template-columns: 1fr; }
  .teacher-detail-section { grid-template-columns: 1fr; }
  .teacher-detail-section h3 { grid-column: auto; }
  .teacher-detail-media { grid-template-columns: repeat(3, 72px); }
  .outline-detail-media { grid-template-columns: 1fr; }
  .outline-detail-media img { height: 180px; object-fit: contain; }
}
