/* The overview is a viewport-sized map; course details stay one tap away. */
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; clip-path: inset(50%) !important; white-space: nowrap !important; border: 0 !important; }
#week-select { display: inline-block; width: auto; max-width: 95px; min-width: 0; min-height: 28px; margin: 0; padding: 3px 19px 3px 6px; border: 1px solid var(--line); border-radius: 7px; background-color: var(--surface-strong); background-image: linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%); background-position: calc(100% - 10px) 50%,calc(100% - 6px) 50%; background-size: 4px 4px; background-repeat: no-repeat; color: var(--ink); font-size: 11px; font-weight: 600; line-height: 1.2; appearance: none; -webkit-appearance: none; cursor: pointer; }
.date-strip > div { min-width: 0; }
.calendar-card, .source-card { display: block; grid-column: 1/-1; min-width: 0; }
#calendar-form { display: grid; gap: 15px; width: 100%; min-width: 0; margin-top: 17px; }
#calendar-form > label:not(.check-label) { display: grid; grid-template-columns: minmax(0,190px) minmax(0,220px); align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
#calendar-form input:not([type="checkbox"]) { box-sizing: border-box; min-width: 0; width: 100%; min-height: 40px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-strong); color: var(--ink); font-family: inherit; font-size: 13px; }
#calendar-form input[type="time"] { font-variant-numeric: tabular-nums; }
#calendar-form > .check-label { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12px; line-height: 1.5; }
#calendar-form input[type="checkbox"] { flex: 0 0 auto; width: 19px; height: 19px; margin: 0; accent-color: var(--pink); }
#calendar-form > button { justify-self: start; min-height: 44px; }
#period-editors { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px 14px; min-width: 0; }
#period-editors > label { display: grid; grid-template-columns: 37px minmax(0,1fr) 11px minmax(0,1fr); align-items: center; gap: 4px; min-width: 0; margin: 0; padding: 7px 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--pink-soft); color: var(--muted); font-size: 11px; line-height: 1.4; }
#period-editors > label > span { text-align: center; font-size: 11px; }
#calendar-form .form-error, .form-error { margin: 0; color: #b3425b; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.form-error:empty { display: none; }
#unscheduled-list { margin-top: 13px; }
#unscheduled-list p { padding: 10px 12px; border-radius: 10px; background: var(--pink-soft); }
#unscheduled-list b { display: inline-block; margin-bottom: 4px; font-size: 12px; line-height: 1.5; }
#day-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.person-day { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-strong); }
.person-day > h3 { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0 0 15px; color: var(--ink); font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.person-day > h3::before { content: ""; flex-shrink: 0; width: 8px; height: 18px; border-radius: 6px; }
.person-day.zeng > h3::before { background: #569cdc; }
.person-day.chen > h3::before { background: #e183ac; }
.person-day > .course-card { margin-top: 9px; padding: 13px; min-height: 85px; border-radius: 11px; }
.person-day .course-name { font-size: 13px; }
.person-day .course-meta { white-space: normal; overflow-wrap: anywhere; line-height: 1.65; font-size: 11px; }
.person-day > h4 { margin: 22px 0 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.person-day .muted { color: var(--muted); font-size: 12px; line-height: 1.65; }
.person-day.zeng .status-badge { background: #569cdc; }
.person-day.chen .status-badge { background: #d978a0; }
.compare-day-card > summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 49px; padding: 12px 15px; color: var(--pink-deep); background: var(--pink-soft); font-size: 13px; font-weight: 600; cursor: pointer; list-style: none; }
.compare-day-card > summary::-webkit-details-marker { display: none; }
.compare-day-card > summary::after { content: "+"; flex: 0 0 auto; font-size: 18px; font-weight: 400; }
.compare-day-card[open] > summary::after { content: "−"; }
.compare-day-card > summary > span { flex: 1; color: var(--muted); font-size: 10px; font-weight: 400; text-align: right; }
.compare-table-head > *, .compare-slot > * { min-width: 0; overflow-wrap: anywhere; }
.compare-slot .compare-course + .compare-course { margin-top: 5px; }
.detail-time { font-size: 22px; line-height: 1.55; overflow-wrap: anywhere; }
.toast { position: fixed; z-index: 1000; left: 50%; bottom: max(32px,env(safe-area-inset-bottom)); width: max-content; max-width: min(460px,calc(100vw - 30px)); margin: 0; padding: 12px 19px; border: 1px solid #ffffff30; border-radius: 13px; background: #3e4654f2; color: #fff; box-shadow: 0 9px 32px #1c253329; font-size: 13px; line-height: 1.5; text-align: center; overflow-wrap: anywhere; opacity: 0; pointer-events: none; transform: translate(-50%,12px); transition: opacity 180ms,transform 180ms; }
.toast.open { opacity: 1; transform: translate(-50%,0); }
html { height: 100%; }
body { min-height: 100%; }
.app-shell { position: relative; z-index: 1; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
.person-chip > div { min-width: 0; }
.person-chip strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar.avatar-zeng, [data-person="zeng"] .avatar { border: 3px solid #569cdc; background-color: #e6f2ff; color: #357fbd; box-shadow: 0 0 0 3px #569cdc17; }
.avatar.avatar-chen, [data-person="chen"] .avatar { border: 3px solid #e183ac; background-color: #fff0f6; color: #bf568b; box-shadow: 0 0 0 3px #e183ac17; }
[data-person="zeng"] .avatar-upload:hover .avatar { box-shadow: 0 0 0 4px #569cdc25; }
[data-person="chen"] .avatar-upload:hover .avatar { box-shadow: 0 0 0 4px #e183ac25; }
.visibility-dot { position: relative; flex-shrink: 0; width: 18px; height: 32px; border: 0; background: transparent; border-radius: 8px; box-shadow: none; }
.visibility-dot::before { content: ""; position: absolute; width: 8px; height: 8px; left: 5px; top: 12px; border: 1px solid #b9b5be; border-radius: 50%; background: transparent; }
.visibility-dot.visible { background: transparent; box-shadow: none; }
[data-person="zeng"] .visibility-dot.visible::before { background: #569cdc; border-color: #569cdc; box-shadow: 0 0 0 3px #569cdc17; }
[data-person="chen"] .visibility-dot.visible::before { background: #e183ac; border-color: #e183ac; box-shadow: 0 0 0 3px #e183ac17; }
.date-arrow { min-width: 34px; min-height: 36px; }
.theme-options { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); width: 100%; gap: 7px; }
.theme-option { min-width: 0; min-height: 67px; line-height: 1.35; }
.swatch { width: 100%; }
.setting-card:has(.theme-options), .setting-card.name-card { grid-column: 1/-1; }
.setting-card:has(.theme-options) { display: grid; grid-template-columns: minmax(115px,.45fr) minmax(0,1fr); }
.edit-modal { max-height: calc(100dvh - 30px); overflow-y: auto; overscroll-behavior: contain; }
.detail-drawer { overscroll-behavior: contain; }
.source-overlap { position: absolute; top: 2px; right: 2px; width: 5px; height: 5px; border-radius: 50%; background: #a17c36; font-size: 0; }
.week-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; min-width: 0; padding-top: 9px; color: var(--muted); font-size: 10px; line-height: 1.3; }
.week-foot button { min-height: 28px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-strong); color: var(--pink-deep); font: inherit; }
.week-foot > * { min-width: 0; }
.week-foot span { overflow: hidden; text-overflow: ellipsis; }

body[data-view="week"] { height: 100vh; height: 100dvh; overflow: hidden; }
body[data-view="week"] .app-shell { display: flex; flex-direction: column; width: 100%; max-width: 1800px; height: 100%; min-height: 0; padding: 0 24px 14px; }
body[data-view="week"] .topbar { flex: 0 0 76px; min-height: 0; padding: 12px 8px; }
body[data-view="week"] .brand-mark { width: 42px; height: 42px; font-size: 24px; }
body[data-view="week"] .brand-lockup { gap: 12px; }
body[data-view="week"] .brand-lockup h1 { font-size: 24px; }
body[data-view="week"] .workspace { flex: 1; min-height: 0; grid-template-columns: 164px minmax(0,1fr); gap: 18px; }
body[data-view="week"] .sidebar { min-height: 0; padding: 12px 0; }
body[data-view="week"] .nav-item { padding: 13px 12px; gap: 9px; }
body[data-view="week"] .sidebar-note { font-size: 15px; padding: 10px; }
body[data-view="week"] .main-content { display: flex; flex-direction: column; min-height: 0; }
body[data-view="week"] .people-bar { flex: 0 0 auto; min-height: 66px; grid-template-columns: minmax(0,1fr) 24px minmax(0,1fr) auto; gap: 10px; padding: 10px 16px; }
body[data-view="week"] .avatar-upload, body[data-view="week"] .avatar { width: 40px; height: 40px; }
body[data-view="week"] .person-chip { gap: 10px; }
body[data-view="week"] .person-chip strong { font-size: 14px; }
body[data-view="week"] #view-week { display: flex; flex-direction: column; flex: 1; min-height: 0; margin-top: 12px; padding: 15px 16px 10px; overflow: hidden; }
body[data-view="week"] #view-week .panel-heading { flex: 0 0 auto; min-height: 36px; margin-bottom: 10px; align-items: center; flex-direction: row; }
body[data-view="week"] #view-week .panel-heading h2 { margin: 0; font-size: 21px; }
body[data-view="week"] #view-week .panel-heading .eyebrow { display: none; }
body[data-view="week"] .week-grid-wrap { flex: 1; width: 100%; height: 0; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
body[data-view="week"] #week-grid { display: grid; grid-template-columns: 49px repeat(14,minmax(0,1fr)); grid-template-rows: 39px repeat(10,minmax(0,1fr)); gap: 0; min-width: 0; width: 100%; height: 100%; min-height: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; isolation: isolate; background: var(--surface-strong); }
.week-corner { grid-column: 1; grid-row: 1; display: grid; place-items: center; min-width: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--pink-soft); color: var(--muted); font-size: 9px; }
.week-head { position: relative; z-index: 3; grid-row: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 0; margin: 0; padding: 3px 0; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; color: var(--ink); background: var(--pink-soft); line-height: 1.15; font-size: 11px; }
.week-head b, .week-head strong { font-size: 11px; font-weight: 600; }
.week-head small, .week-head span { color: var(--muted); font-size: 9px; }
.week-head:hover { background: var(--line); }
.week-head.is-today, .week-head.today, .week-head.selected, .week-head.is-selected { box-shadow: inset 0 -3px var(--pink); color: var(--pink-deep); }
.week-head.is-today::after, .week-head.today::after { content: ""; position: absolute; top: 5px; right: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--pink); }
.day-shade { z-index: -1; pointer-events: none; border-right: 1px solid var(--line); background: transparent; }
.day-shade.is-today, .day-shade.today { background: color-mix(in srgb,var(--pink-soft) 55%,transparent); }
.day-shade.is-selected, .day-shade.selected { background: color-mix(in srgb,var(--pink-soft) 38%,transparent); }
.week-time { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 0; padding: 0 2px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: color-mix(in srgb,var(--surface-strong) 60%,var(--pink-soft)); color: var(--muted); line-height: 1.1; font-size: 9px; font-variant-numeric: tabular-nums; }
.week-time b { font-weight: 500; color: var(--ink); font-size: 10px; }
.week-time span, .week-time small { font-size: 8px; }
.week-rule { z-index: 0; align-self: end; height: 1px; border-bottom: 1px solid var(--line); pointer-events: none; }
.week-course { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; min-width: 0; min-height: 0; margin: 2px 1px; padding: 6px 3px; border: 1px solid transparent; border-radius: 6px; overflow: hidden; text-align: left; line-height: 1.3; box-shadow: none; transition: filter 140ms,box-shadow 140ms; }
.week-course.zeng { background: #e5f1fc; border-color: #c7e0f4; color: #275780; }
.week-course.chen { background: #fde9f1; border-color: #f0cddb; color: #9c496f; }
.week-course:hover { filter: brightness(.97); box-shadow: inset 0 0 0 1px currentColor; }
.week-course.is-current, .week-course.current, .week-course.current-card { box-shadow: inset 0 0 0 2px currentColor; }
.week-course .week-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; width: 100%; min-width: 0; overflow: hidden; overflow-wrap: anywhere; word-break: normal; font-size: clamp(10px,.83vw,12px); font-weight: 600; line-height: 1.33; }
.week-course .week-short { display: none; }
.week-course small { display: block; width: 100%; margin-top: auto; padding-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; opacity: .8; font-size: 8px; }
body[data-view="week"] .footer-note { display: none; }
body[data-theme="ink"] .week-course.zeng { background: #294454; border-color: #456578; color: #ceeafa; }
body[data-theme="ink"] .week-course.chen { background: #4e3448; border-color: #72516b; color: #ffdaeb; }
body[data-theme="ink"] .mobile-nav { background: #292e40f5; }

/* Winter: paper white, silver mist and charcoal, with restrained snow. */
body[data-theme="winter"] {
  --bg: #eeeae2;
  --surface: rgba(255,254,250,.88);
  --surface-strong: #fffefa;
  --ink: #383b3b;
  --muted: #86877f;
  --line: #dcded6;
  --pink: #8a938a;
  --pink-deep: #515b54;
  --pink-soft: #edeee7;
  --blue: #b9c0b5;
  --shadow: 0 12px 38px #4c53400c;
  background-color: #eeeae2;
  background-image: radial-gradient(ellipse at 12% 0,#fffdfa 0,transparent 54%),radial-gradient(ellipse at 95% 90%,#d8dbd2 0,transparent 50%);
}
body[data-theme="winter"] .brand-mark { border-color: #b6beb1; background: #fafbf4; color: #6d7b65; }
body[data-theme="winter"] .glass-card, body[data-theme="winter"] .view-panel { border-color: #ffffffd4; box-shadow: 0 10px 32px #41492e0b,inset 0 0 0 1px #eceee5; }
body[data-theme="winter"] .topbar { border-bottom-color: #dce0d5; }
body[data-theme="winter"] .petals { background-image: radial-gradient(circle at 8% 21%,#fffefa 0 2px,transparent 3px),radial-gradient(circle at 94% 42%,#fffefa 0 3px,transparent 4px),radial-gradient(circle at 28% 76%,#fffefa 0 2px,transparent 3px),radial-gradient(circle at 72% 8%,#fffefa 0 2px,transparent 3px); }
body[data-theme="winter"] .petals i { width: 5px; height: 5px; border-radius: 50%; background: #fffefa; box-shadow: 0 0 6px #ffffffd9; animation-duration: 24s; }
body[data-theme="winter"] .sidebar-note { color: #929d8b; }
body[data-theme="winter"] .primary-button { background: #606c60; box-shadow: 0 5px 12px #51604d18; }
body[data-theme="winter"] .mobile-nav { background: #fffefaef; }
.swatch-winter { background: linear-gradient(135deg,#faf7ee 0 45%,#cbd0c5 46% 74%,#656e61 75%); }

@media (max-width: 1200px) and (min-width: 901px) {
  body[data-view="week"] .app-shell { padding: 0 16px 12px; }
  body[data-view="week"] .workspace { grid-template-columns: 132px minmax(0,1fr); gap: 12px; }
  body[data-view="week"] .nav-item { font-size: 12px; padding: 13px 9px; gap: 7px; }
  body[data-view="week"] .people-bar { padding: 9px 12px; gap: 6px; }
  body[data-view="week"] .date-strip { gap: 4px; padding-left: 8px; }
}
@media (max-width: 900px) {
  #period-editors { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .toast { bottom: calc(85px + env(safe-area-inset-bottom)); }
  .mobile-nav { right: 9px; bottom: max(7px,env(safe-area-inset-bottom)); left: 9px; min-height: 57px; padding: 5px; }
  .mobile-nav button { min-height: 44px; padding: 4px 2px; gap: 3px; }
  .app-shell { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .date-arrow { min-width: 38px; min-height: 38px; }
  .today-button, .subtle-button, .day-actions button { min-height: 38px; }
  .setting-card:has(.theme-options) { display: flex; flex-direction: column; }
  .setting-card { min-width: 0; }
  .edit-modal input, .edit-modal select, .name-editors input { min-height: 44px; font-size: 16px; }
  .drawer-close { width: 44px; height: 44px; }
  body[data-view="week"] .app-shell { padding: 0 12px calc(74px + env(safe-area-inset-bottom)); }
  body[data-view="week"] .topbar { flex-basis: 56px; padding: 8px 2px; }
  body[data-view="week"] .brand-mark { width: 34px; height: 34px; font-size: 21px; }
  body[data-view="week"] .brand-lockup h1 { font-size: 21px; }
  body[data-view="week"] .brand-kicker { font-size: 8px; }
  body[data-view="week"] .workspace { grid-template-columns: minmax(0,1fr); gap: 0; }
  body[data-view="week"] .sidebar { display: none; }
  body[data-view="week"] .people-bar { min-height: 62px; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; gap: 10px; padding: 9px 12px; }
  body[data-view="week"] .bloom-divider { display: none; }
  body[data-view="week"] .date-strip { grid-column: auto; gap: 3px; padding: 0 0 0 8px; border-top: 0; border-left: 1px solid var(--line); }
  body[data-view="week"] .date-strip .today-button { margin-left: 3px; padding: 6px 8px; }
  body[data-view="week"] #view-week { padding: 12px 10px 9px; margin-top: 10px; }
  body[data-view="week"] #week-grid { grid-template-columns: 82px repeat(14,minmax(0,1fr)); }
  body[data-view="week"] #view-week .panel-heading h2 { font-size: 19px; }
  .week-course .week-name { font-size: 10px; line-height: 1.35; }
  .week-course { padding: 5px 2px; }
}
@media (max-width: 600px) {
  #calendar-form { gap: 13px; }
  #calendar-form > label:not(.check-label) { grid-template-columns: minmax(0,1fr); gap: 7px; }
  #calendar-form input:not([type="checkbox"]) { min-height: 44px; padding: 7px 5px; font-size: 14px; }
  #calendar-form #term-start { font-size: 16px; }
  #calendar-form > button { justify-self: stretch; }
  #calendar-form > .check-label { align-items: flex-start; font-size: 11px; }
  #period-editors { grid-template-columns: minmax(0,1fr); gap: 7px; }
  #period-editors > label { grid-template-columns: 33px minmax(0,1fr) 10px minmax(0,1fr); padding: 5px 6px; font-size: 10px; }
  #day-list { grid-template-columns: minmax(0,1fr); gap: 13px; }
  .person-day { padding: 13px; }
  .person-day > .course-card { min-height: 83px; }
  .compare-day-card > summary { gap: 7px; padding: 11px; font-size: 12px; }
  .compare-day-card > summary > span { font-size: 9px; }
  .detail-time { font-size: 20px; }
  #week-select { max-width: 77px; min-height: 26px; padding: 3px 17px 3px 5px; font-size: 10px; }
  body[data-view="week"] .app-shell { padding: 0 7px calc(71px + env(safe-area-inset-bottom)); }
  body[data-view="week"] .topbar { flex-basis: 46px; padding: 5px 4px; }
  body[data-view="week"] .brand-lockup { gap: 8px; }
  body[data-view="week"] .brand-mark { width: 30px; height: 30px; font-size: 19px; }
  body[data-view="week"] .brand-lockup h1 { font-size: 18px; }
  body[data-view="week"] .brand-kicker { display: none; }
  body[data-view="week"] .people-bar { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 5px 12px; padding: 8px 10px 3px; min-height: 0; border-radius: 14px; }
  body[data-view="week"] .person-chip { gap: 7px; }
  body[data-view="week"] .person-chip strong { font-size: 12px; }
  body[data-view="week"] .person-chip small { margin-top: 2px; font-size: 9px; }
  body[data-view="week"] .avatar-upload, body[data-view="week"] .avatar { width: 34px; height: 34px; }
  body[data-view="week"] .date-strip { grid-column: 1/-1; display: grid; grid-template-columns: 30px 1fr 30px auto; gap: 4px; min-height: 34px; padding: 3px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  body[data-view="week"] .date-strip > div { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
  body[data-view="week"] .date-strip b { font-size: 11px; }
  body[data-view="week"] .date-strip span { margin: 0; font-size: 10px; }
  body[data-view="week"] .date-arrow { min-width: 30px; width: 30px; min-height: 30px; height: 30px; line-height: 1; }
  body[data-view="week"] .date-strip .today-button { min-height: 28px; margin: 0 0 0 3px; padding: 4px 7px; font-size: 10px; border-radius: 7px; }
  body[data-view="week"] #view-week { margin-top: 7px; padding: 8px 5px 6px; border-radius: 14px; }
  body[data-view="week"] #view-week .panel-heading { min-height: 28px; gap: 6px; margin: 0 3px 7px; }
  body[data-view="week"] #view-week .panel-heading h2 { font-size: 15px; white-space: nowrap; }
  body[data-view="week"] .view-switcher { flex: 0 0 auto; align-self: auto; padding: 2px; border-radius: 8px; }
  body[data-view="week"] .switch { flex: 0 0 auto; padding: 6px 8px; font-size: 10px; border-radius: 6px; }
  body[data-view="week"] #week-grid { grid-template-columns: 72px repeat(14,minmax(0,1fr)); grid-template-rows: 33px repeat(10,minmax(0,1fr)); border-radius: 8px; }
  .week-head { gap: 2px; padding: 2px 0; }
  .week-head b, .week-head strong { font-size: 10px; }
  .week-head small, .week-head span { font-size: 8px; }
  .week-time { gap: 2px; padding: 0 2px; font-size: 9px; }
  .week-time b { font-size: 10px; }
  .week-time span, .week-time small { font-size: 8px; letter-spacing: -.15px; }
  .week-course { align-items: center; justify-content: flex-start; margin: 1px; padding: 4px 0; border-radius: 4px; }
  .week-course .week-name, .week-course small { display: none; }
  .week-course .week-short { display: block; max-width: 100%; max-height: 100%; writing-mode: vertical-rl; text-orientation: upright; overflow: hidden; font-size: 10px; line-height: 1.15; letter-spacing: 1px; font-weight: 600; }
  .week-course.is-current, .week-course.current, .week-course.current-card { box-shadow: inset 0 0 0 1px currentColor; }
  .week-foot { flex-wrap: nowrap; gap: 5px; padding-top: 5px; font-size: 8px; }
  .week-foot button { min-height: 25px; padding: 3px 5px; border-radius: 6px; font-size: 9px; }
  .week-foot span { max-width: 55%; }
  .theme-options { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
  .theme-option { padding: 9px 6px; min-height: 76px; font-size: 11px; }
  .settings-grid { gap: 10px; }
  .setting-card { padding: 15px; }
  .name-editors { grid-template-columns: 1fr; }
  .name-editors label { font-size: 12px; }
  .name-editors .primary-button { min-height: 44px; }
  .compare-course b { font-size: 11px; }
  .compare-course span { white-space: normal; overflow-wrap: anywhere; }
  .current-hero { padding: 17px; }
  .detail-drawer { width: 100%; }
}
@media (max-width: 360px) {
  body[data-view="week"] .app-shell { padding-right: 4px; padding-left: 4px; }
  body[data-view="week"] .people-bar { gap: 4px 8px; padding: 7px 8px 2px; }
  body[data-view="week"] .person-chip { gap: 5px; }
  body[data-view="week"] .person-chip strong { font-size: 11px; }
  body[data-view="week"] .person-chip small { font-size: 8px; }
  body[data-view="week"] .avatar-upload, body[data-view="week"] .avatar { width: 30px; height: 30px; }
  body[data-view="week"] #view-week .panel-heading h2 { font-size: 13px; }
  body[data-view="week"] .switch { padding: 5px 7px; }
  body[data-view="week"] #week-grid { grid-template-columns: 68px repeat(14,minmax(0,1fr)); }
  .week-course .week-short { font-size: 9px; letter-spacing: 0; }
  .week-time span, .week-time small { font-size: 6.5px; }
}
@media (max-height: 740px) and (min-width: 901px) {
  body[data-view="week"] .topbar { flex-basis: 58px; padding: 8px; }
  body[data-view="week"] .people-bar { min-height: 56px; padding: 7px 12px; }
  body[data-view="week"] .avatar-upload, body[data-view="week"] .avatar { width: 36px; height: 36px; }
  body[data-view="week"] #view-week { margin-top: 9px; padding: 10px 10px 7px; }
  body[data-view="week"] #view-week .panel-heading { min-height: 30px; margin-bottom: 8px; }
  body[data-view="week"] #week-grid { grid-template-rows: 34px repeat(10,minmax(0,1fr)); }
  .week-course { padding-top: 4px; padding-bottom: 3px; }
  .week-course .week-name { -webkit-line-clamp: 4; font-size: 10px; line-height: 1.25; }
  .week-course small { font-size: 7px; }
}
@media (max-height: 620px) and (max-width: 600px) {
  body[data-view="week"] .topbar { flex-basis: 37px; padding: 3px; }
  body[data-view="week"] .brand-mark { width: 26px; height: 26px; font-size: 17px; }
  body[data-view="week"] .brand-lockup h1 { font-size: 16px; }
  body[data-view="week"] .app-shell { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  body[data-view="week"] .person-chip small { display: none; }
  body[data-view="week"] .people-bar { padding-top: 5px; gap: 3px 9px; }
  body[data-view="week"] .avatar-upload, body[data-view="week"] .avatar { width: 29px; height: 29px; }
  body[data-view="week"] #view-week { margin-top: 5px; padding-top: 5px; }
  body[data-view="week"] #view-week .panel-heading { min-height: 26px; margin-bottom: 4px; }
  body[data-view="week"] #week-grid { grid-template-rows: 29px repeat(10,minmax(0,1fr)); }
  .week-course { padding-top: 2px; padding-bottom: 2px; }
  .week-course .week-short { font-size: 9px; line-height: 1.05; letter-spacing: 0; }
  .week-time { gap: 0; }
  .week-foot { padding-top: 3px; }
  .week-foot button { min-height: 23px; }
  .mobile-nav { bottom: max(5px,env(safe-area-inset-bottom)); min-height: 50px; padding: 3px; }
  .mobile-nav button { gap: 1px; min-height: 42px; padding: 2px; }
}
@media (max-height: 500px) and (min-width: 601px) {
  body[data-view="week"] .app-shell { padding: 0 8px calc(52px + env(safe-area-inset-bottom)); }
  body[data-view="week"] .topbar { flex-basis: 32px; padding: 3px 4px; }
  body[data-view="week"] .brand-mark { width: 24px; height: 24px; font-size: 16px; }
  body[data-view="week"] .brand-lockup h1 { font-size: 16px; }
  body[data-view="week"] .brand-kicker { display: none; }
  body[data-view="week"] .workspace { grid-template-columns: minmax(0,1fr); }
  body[data-view="week"] .sidebar { display: none; }
  body[data-view="week"] .people-bar { min-height: 38px; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; gap: 8px; padding: 4px 9px; border-radius: 10px; }
  body[data-view="week"] .person-chip { gap: 7px; }
  body[data-view="week"] .avatar-upload, body[data-view="week"] .avatar { width: 27px; height: 27px; }
  body[data-view="week"] .person-chip small, body[data-view="week"] .bloom-divider { display: none; }
  body[data-view="week"] .person-chip strong { font-size: 12px; }
  body[data-view="week"] .date-strip { grid-column: auto; padding: 0 0 0 6px; border-left: 1px solid var(--line); border-top: 0; }
  body[data-view="week"] .date-strip > div { display: flex; gap: 8px; align-items: baseline; }
  body[data-view="week"] .date-strip span { margin: 0; font-size: 10px; }
  body[data-view="week"] .date-strip b { font-size: 11px; }
  body[data-view="week"] .date-arrow { min-width: 24px; width: 24px; min-height: 26px; height: 26px; line-height: 1; }
  body[data-view="week"] .date-strip .today-button { min-height: 26px; padding: 4px 7px; font-size: 10px; }
  body[data-view="week"] #view-week { padding: 4px 7px; margin-top: 4px; border-radius: 10px; }
  body[data-view="week"] #view-week .panel-heading { min-height: 22px; margin-bottom: 4px; }
  body[data-view="week"] #view-week .panel-heading h2 { font-size: 14px; }
  body[data-view="week"] .view-switcher { padding: 1px; }
  body[data-view="week"] .switch { padding: 4px 9px; font-size: 10px; }
  body[data-view="week"] #week-grid { grid-template-columns: 72px repeat(14,minmax(0,1fr)); grid-template-rows: 23px repeat(10,minmax(0,1fr)); border-radius: 6px; }
  .week-head { flex-direction: row; gap: 4px; }
  .week-head b, .week-head strong { font-size: 9px; }
  .week-head small, .week-head span { font-size: 8px; }
  .week-time { flex-direction: row; gap: 2px; }
  .week-time b { font-size: 8px; }
  .week-time small, .week-time span { font-size: 6.5px; }
  .week-course { justify-content: center; margin: 1px; padding: 1px 2px; border-radius: 3px; }
  .week-course .week-name, .week-course small { display: none; }
  .week-course .week-short { display: block; max-height: 100%; overflow: hidden; writing-mode: horizontal-tb; font-size: 9px; font-weight: 600; line-height: 1.2; }
  .week-foot { padding-top: 2px; gap: 5px; font-size: 8px; }
  .week-foot button { min-height: 20px; padding: 2px 6px; font-size: 9px; }
  .mobile-nav { display: grid; min-height: 41px; padding: 2px; bottom: max(4px,env(safe-area-inset-bottom)); border-radius: 11px; }
  .mobile-nav button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 35px; padding: 3px; }
  .mobile-nav button span { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
  .week-course { transition: none; }
  .petals i { animation: none; }
}

/* Single-person mode expands content instead of leaving an empty column. */
#day-list[data-single='True'], #day-list[data-single='true'], #current-layout[data-single='True'], #current-layout[data-single='true'] { grid-template-columns: minmax(0,1fr); }

/* Visibility controls keep a generous touch target while retaining the tiny color dot. */
.visibility-dot { position: relative; width: 36px; height: 36px; min-width: 36px; margin-left: auto; border: 0; border-radius: 50%; background: transparent; }
.visibility-dot::before { content: ""; position: absolute; inset: 50% auto auto 50%; width: 11px; height: 11px; border-radius: 50%; background: #d4c8cf; transform: translate(-50%,-50%); transition: transform .18s, box-shadow .18s, background .18s; }
.visibility-dot.visible::before { background: var(--pink); box-shadow: 0 0 0 4px var(--pink-soft); }
.visibility-dot:hover::before, .visibility-dot:focus-visible::before { transform: translate(-50%,-50%) scale(1.12); box-shadow: 0 0 0 5px var(--pink-soft); }
.visibility-dot:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

/* The people bar can be hidden to give a one-person timetable more vertical room. */
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.people-collapse-button { min-height: 36px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--pink-deep); font-size: 11px; cursor: pointer; transition: background .18s, border-color .18s, transform .18s; }
.people-collapse-button:hover { border-color: var(--pink); background: var(--pink-soft); }
.people-collapse-button:active { transform: scale(.97); }
.people-collapse-button:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.people-bar.is-collapsed { display: none; }
.week-course .week-teacher { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .78; }

@media (max-width: 600px) {
  .topbar-actions { gap: 4px; }
  .people-collapse-button { min-height: 34px; padding: 6px 8px; font-size: 10px; }
}

/* A location is essential at a glance; reserve its space in a single timetable. */
#week-grid[data-people="1"] .week-course small {
  display: block;
  flex: 0 0 auto;
  white-space: normal;
  overflow: visible;
  opacity: 1;
}
#week-grid[data-people="1"] .week-room {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}
#week-grid[data-people="1"] .week-name { min-height: 0; flex-shrink: 1; }

@media (max-width: 600px) {
  #week-grid[data-people="1"] .week-course {
    align-items: stretch;
    padding: 3px 1px;
    gap: 2px;
  }
  #week-grid[data-people="1"] .week-short {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    flex: 0 0 auto;
    min-height: 1.2em;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    overflow-wrap: anywhere;
    letter-spacing: 0;
    font-size: 11px;
    line-height: 1.2;
  }
  #week-grid[data-people="1"] .week-course small { margin-top: auto; padding-top: 0; }
  #week-grid[data-people="1"] .week-teacher { font-size: 9px; }
}
@media (max-width: 600px) and (max-height: 740px) {
  #week-grid[data-people="1"] .week-teacher { display: none; }
}
@media (max-width: 360px) {
  body[data-view="week"] #week-grid[data-people="1"] { --period-width: 60px !important; }
  #week-grid[data-people="1"] .week-course { padding: 2px 1px; }
  #week-grid[data-people="1"] .week-short,
  #week-grid[data-people="1"] .week-room { font-size: 10px; line-height: 1.15; }
}
/* On short landscape screens, put the place beside the name to avoid clipping. */
@media (min-width: 601px) and (max-height: 500px) {
  #week-grid[data-people="1"] .week-course {
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,1.2fr);
    align-items: center;
    column-gap: 3px;
    padding: 1px 2px;
  }
  #week-grid[data-people="1"] .week-short { min-width: 0; font-size: 10px; }
  #week-grid[data-people="1"] .week-course small { min-width: 0; margin: 0; padding: 0; }
  #week-grid[data-people="1"] .week-room { font-size: 10px; }
  #week-grid[data-people="1"] .week-teacher { display: none; }
}
