:root {
  color-scheme: light;
  --bg: #cbd8e6;
  --surface: #f6f8fb;
  --surface-2: #e5edf6;
  --surface-3: #fff;
  --text: #18314d;
  --muted: #526b83;
  --line: #a7bad0;
  --line-strong: #7293b6;
  --accent: #135baf;
  --accent-soft: #d8eafd;
  --green: #277444;
  --green-line: #6fa977;
  --gym-fill-odd: #dff2d4;
  --gym-fill-even: #d5eeeb;
  --gym-line-even: #65a7a7;
  --red: #cb352b;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --timeline-height: 1440px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background: repeating-linear-gradient(0deg, #ccd9e8 0 2px, #d5e0ec 2px 4px);
  font: 12px/1.35 Verdana, Tahoma, "Microsoft YaHei", "PingFang SC", sans-serif;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible { outline: 2px solid #f7ad35; outline-offset: 1px; }
button:disabled { cursor: default; opacity: .5; }
[hidden] { display: none !important; }

.app-shell {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  width: min(960px, 100%);
  height: 100vh;
  height: 100dvh;
  min-height: 100svh;
  margin: 0 auto;
  padding: max(8px, var(--safe-top)) 8px max(8px, var(--safe-bottom));
  border-right: 1px solid #859bb2;
  border-left: 1px solid #859bb2;
  background: #e8eef5;
  box-shadow: 0 0 0 1px #eef4fa inset, 0 0 14px #67819c66;
  overflow: hidden;
}
.app-shell.gym-mode { grid-template-rows: auto auto minmax(0, 1fr); }
.app-shell.login-mode { grid-template-rows: minmax(0, 1fr); place-items: center; }
.gym-mode .toolbar-side { display: none; }
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 60px;
  padding: 8px 12px;
  border: 1px solid #0a3766;
  border-bottom-color: #082e58;
  background: linear-gradient(#65a0d2 0%, #3d7bb8 46%, #2264a5 47%, #0d4785 100%);
  color: #fff;
  box-shadow: 0 1px 0 #a5c7e8 inset, 0 2px 3px #627d9b88;
  text-shadow: 0 1px 1px #123f72;
}
.header-meta { margin: 0 0 2px; color: #dcecff; font-size: 10px; }
.header-actions { display: flex; gap: 5px; align-items: center; }
.push-sheet { max-width: 420px; }
.push-help { margin: 10px 0; color: var(--muted); line-height: 1.55; }
.push-label { display: block; margin: 10px 0 4px; font-weight: 700; }
.push-input { display: block; width: 100%; padding: 9px; border: 1px solid var(--line-strong); border-radius: 3px; background: #fff; color: var(--text); font: inherit; }
.push-status { min-height: 2.8em; margin: 10px 0; color: var(--muted); line-height: 1.4; }
.push-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.push-actions button { padding: 7px 10px; border: 1px solid #7d9bb9; border-radius: 3px; background: linear-gradient(#fff, #dce8f4 49%, #c9d9e9 50%, #e8eff7); color: #1e507f; box-shadow: 0 1px 0 #fff inset; font-weight: 700; }
h1 { margin: 0; font-size: 20px; line-height: 1.1; letter-spacing: .03em; }
h1 small { margin-left: 6px; color: #c4dcf5; font-size: 9px; font-weight: 400; letter-spacing: .14em; white-space: nowrap; }
h2 { margin: 0; font-size: 17px; line-height: 1.2; }
.ghost-button,
.round-button,
.week-choice,
.action-button,
.undo-trigger,
.undo-all,
.undo-choices button,
.detail-skip {
  border: 1px solid #7d9bb9;
  border-radius: 3px;
  background: linear-gradient(#fff, #dce8f4 49%, #c9d9e9 50%, #e8eff7);
  color: #1e507f;
  box-shadow: 0 1px 0 #fff inset, 0 1px 1px #7794b366;
  font-weight: 700;
}
.ghost-button { padding: 6px 9px; border-color: #a9c7e8; font-size: 10px; white-space: nowrap; }
.ghost-button:active,
.round-button:active,
.action-button:active,
.week-choice:active { background: #bbd2e8; box-shadow: 0 1px 2px #516c87 inset; }

.week-card {
  border: 1px solid #889fb8;
  border-top: 0;
  background: linear-gradient(#f8fbfe, #dbe7f2);
  box-shadow: 0 1px 0 #fff inset;
}
.week-nav-row {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  min-height: 46px;
  gap: 5px;
  padding: 4px 8px;
}
.round-button { width: 33px; height: 30px; font-size: 22px; line-height: 1; }
.week-summary { border: 0; background: transparent; text-align: center; padding: 1px 5px; }
.week-summary strong { display: block; color: #174f87; font-size: 16px; line-height: 1.1; }
.week-summary span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.day-strip { display: none; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; padding: 0 6px 6px; }
.week-card.show-days .day-strip { display: grid; }
.day-chip {
  min-width: 0;
  border: 1px solid #b4c4d6;
  border-radius: 2px;
  padding: 3px 0;
  background: linear-gradient(#fff, #e8eff6);
  text-align: center;
}
.day-chip .dow, .day-chip .dom { display: block; }
.day-chip .dow { font-size: 9px; }
.day-chip .dom { font-size: 12px; font-weight: 800; }
.day-chip.has-class .dow::after { content: "•"; margin-left: 1px; color: #d47c16; }
.day-chip.selected { border-color: #4d7cad; background: linear-gradient(#d9ebfa, #b8d4ed); color: #0f497f; }
.day-chip.today .dom { color: #b04410; }

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 6px;
  min-height: 43px;
  padding: 6px 6px 0;
  border-bottom: 1px solid #7897b7;
  background: linear-gradient(#eaf1f8, #cbdceb);
}
.segmented { display: flex; align-items: end; gap: 2px; }
.segment {
  min-width: 62px;
  height: 31px;
  border: 1px solid #8fa9c3;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  padding: 4px 9px;
  background: linear-gradient(#f8fbff, #c8d9e9);
  color: #4c6580;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 1px 0 #fff inset;
}
.segment.active { height: 34px; border-color: #668eb8; background: linear-gradient(#fff, #edf4fc); color: #14568e; }
.toolbar-side { display: flex; flex-direction: column; align-items: end; justify-content: center; gap: 1px; padding-bottom: 4px; }
.legend-chip { display: inline-flex; align-items: center; gap: 3px; color: #345570; font-size: 9px; white-space: nowrap; }
.legend-swatch { width: 11px; height: 9px; border: 1px solid; }
.legend-swatch.odd { border-color: var(--green-line); background: var(--gym-fill-odd); }
.legend-swatch.even { border-color: var(--gym-line-even); background: var(--gym-fill-even); }
.toolbar-note { color: #6d8298; font-size: 8px; }

.panel { display: none; min-height: 0; }
.panel.active { display: block; }
.week-panel.active { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.day-panel.active { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 7px; overflow: hidden; }
.gym-panel.active { display: block; overflow-y: auto; overscroll-behavior: contain; border: 1px solid #7897b7; border-top: 0; background: #f6f8fb; }
.gym-pane-head, .gym-section-head { display: flex; align-items: center; justify-content: space-between; gap: 7px; border-bottom: 1px solid #8daac5; background: linear-gradient(#f8fbff, #d7e6f5); color: #214e79; box-shadow: 0 1px 0 #fff inset; }
.gym-pane-head { padding: 7px 10px; border-bottom-color: #638bb4; }
.gym-pane-head strong { font-size: 14px; }
.gym-pane-head span, .gym-section-head span { color: #617993; font-size: 9px; }
.gym-section { border-bottom: 1px solid #aabed1; background: #fff; }
.gym-section-head { min-height: 30px; padding: 4px 9px; font-size: 11px; font-weight: 700; }
.gym-live-content { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; min-height: 73px; padding: 10px; }
.gym-live-title { min-width: 100%; color: #174f84; font-size: 15px; }
.gym-timer { font: bold 21px/1 Verdana, sans-serif; font-variant-numeric: tabular-nums; color: #1c6941; }
.gym-live-content > .action-button { min-height: 38px; margin-left: auto; padding: 7px 12px; }
.gym-mini-tabs { display: flex; gap: 2px; }
.gym-mini-tabs button, .gym-data-actions button, .gym-more { border: 1px solid #829fba; border-radius: 2px; padding: 5px 8px; background: linear-gradient(#fff, #dce8f4); color: #20527d; font-weight: 700; }
.gym-mini-tabs button.selected { border-color: #4d7cad; background: #c9e0f4; }
.gym-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gym-metrics > div { display: grid; gap: 4px; padding: 9px; border-right: 1px solid #cad7e3; }
.gym-metrics > div:last-child { border-right: 0; }
.gym-metrics span { color: #607791; font-size: 9px; }
.gym-metrics strong { font: bold clamp(13px, 3.5vw, 18px) Verdana, sans-serif; color: #174f84; }
.gym-comparison { border-top: 1px solid #c3d2e0; padding: 6px 9px; color: #516d87; font-size: 10px; }
.gym-chart-controls { display: flex; gap: 12px; padding: 8px 9px 2px; }
.gym-chart-controls label { color: #526c84; font-size: 10px; }
.gym-chart-controls select { border: 1px solid #8fa9c3; padding: 4px; background: #fff; color: #214f78; font: inherit; }
.gym-chart-scroll { overflow-x: auto; padding: 0 8px; }
.gym-chart { display: flex; gap: 3px; align-items: end; min-width: max(100%, calc(var(--chart-count) * 29px)); height: 157px; border-bottom: 1px solid #91abc3; background: repeating-linear-gradient(to top, #e3ebf2 0 1px, transparent 1px 28px); }
.gym-chart-column { position: relative; flex: 1 0 25px; height: 100%; min-width: 25px; }
.gym-chart-bar { position: absolute; bottom: 24px; left: 3px; right: 3px; border: 1px solid #346895; background: linear-gradient(90deg, #6299c8, #3472a9); }
.gym-chart-value { position: absolute; bottom: 139px; left: 0; right: 0; color: #355e82; font-size: 8px; text-align: center; font-variant-numeric: tabular-nums; }
.gym-chart-label { position: absolute; bottom: 5px; left: 0; right: 0; color: #607990; font-size: 8px; text-align: center; white-space: nowrap; }
.gym-chart-unit { padding: 5px 9px 8px; color: #607990; font-size: 9px; }
.gym-chart-empty { margin: 0; padding: 28px 9px; color: #627b91; font-size: 11px; }
.gym-history-head, .gym-history-row { display: grid; grid-template-columns: 1fr 1.6fr .7fr; align-items: center; gap: 5px; width: 100%; text-align: left; }
.gym-history-head { padding: 5px 9px; border-bottom: 1px solid #c4d3e1; background: #edf3f9; color: #5b728a; font-size: 9px; }
.gym-history-row { min-height: 36px; border: 0; border-bottom: 1px solid #dde6ee; padding: 5px 9px; background: #fff; color: #1f405e; font-variant-numeric: tabular-nums; }
.gym-history-row:nth-of-type(even) { background: #f4f8fb; }
.gym-history-row strong { text-align: right; }
.gym-history-row small { display: block; color: #8d642c; font-size: 8px; }
.gym-history-row:active { background: #dcecf9; }
.gym-empty { margin: 0; padding: 12px 9px; color: #647c91; }
.gym-more { display: block; margin: 8px 9px; }
.gym-data-actions { display: flex; gap: 5px; padding: 10px 9px 3px; }
.gym-message { margin: 0; padding: 4px 9px 12px; color: #5c7288; font-size: 10px; }
.timeline-shell, .day-map { min-height: 0; border: 1px solid #7897b7; border-top: 0; background: #fff; }
.timeline-scroll, .day-map { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; }
.timeline-scroll { width: 100%; height: 100%; }
.timeline-grid {
  display: grid;
  grid-template-columns: 59px repeat(7, minmax(0, 1fr));
  grid-template-rows: 41px var(--timeline-height);
  width: 100%;
  min-width: 0;
  background: #fff;
}
.corner-head, .day-head {
  position: sticky;
  top: 0;
  z-index: 20;
  border-right: 1px solid #82a0be;
  border-bottom: 1px solid #6e91b5;
  background: linear-gradient(#eef5fc, #bed3e7);
  color: #244f78;
  box-shadow: 0 1px 0 #fff inset;
}
.corner-head { grid-column: 1; grid-row: 1; display: grid; place-items: center; text-align: center; font-size: 9px; }
.day-head { display: grid; place-items: center; padding: 2px 0; text-align: center; }
.day-head strong { display: block; font-size: 10px; }
.day-head span { display: block; color: #5c7287; font-size: 8px; }
.day-head.selected { background: linear-gradient(#fff6d8, #f1cf88); color: #70420d; }
.day-head.today strong { text-decoration: underline; text-decoration-thickness: 2px; }
.time-axis { position: relative; z-index: 8; grid-column: 1; grid-row: 2; border-right: 1px solid #82a0be; background: #e8eff7; }
.period-slot, .map-period {
  position: absolute;
  display: grid;
  place-items: center;
  border-top: 1px solid #a0b6cc;
  border-bottom: 1px solid #a0b6cc;
  line-height: 1;
  pointer-events: none;
}
.day-endpoint { position: absolute; z-index: 2; left: 2px; color: #42617e; font: 8px/1 Verdana, sans-serif; pointer-events: none; }
.day-endpoint.first { transform: translateY(2px); }
.day-endpoint.last { transform: translateY(calc(-100% - 2px)); }
.period-slot { z-index: 1; left: 2px; right: 2px; }
.period-slot strong, .map-period strong { color: #204d78; font-size: 9px; }
.period-slot span, .map-period span { position: absolute; right: 1px; color: #244f78; font-size: 7px; font-variant-numeric: tabular-nums; }
.period-slot .period-start, .map-period .period-start { top: 1px; }
.period-slot .period-end, .map-period .period-end { bottom: 1px; }
.gym-time-tag {
  position: absolute;
  z-index: 9;
  right: 1px;
  transform: translateY(-50%);
  border: 1px dashed #65a06f;
  padding: 0 2px;
  background: #e9f6e4;
  color: #23683a;
  font: bold 7px/1.1 Verdana, sans-serif;
  pointer-events: none;
}
.day-lane { position: relative; height: var(--timeline-height); min-width: 0; overflow: hidden; border-right: 1px solid #b3c5d7; background: #fff; }
.day-lane:nth-of-type(even) { background: #f8fbfe; }
.day-lane.selected-col { box-shadow: 0 0 0 2px #f3b64e inset; }
.gym-band { position: absolute; z-index: 0; left: 0; right: 0; pointer-events: none; }
.gym-odd .gym-band { background: var(--gym-fill-odd); }
.gym-even .gym-band { background: var(--gym-fill-even); }
.period-guide, .gym-guide, .current-time-line { position: absolute; left: 0; right: 0; height: 0; pointer-events: none; }
.period-guide { z-index: 1; border-top: 1px solid #c3d1df; }
.period-guide.minor { border-top: 1px dotted #cdd8e3; }
.gym-guide { z-index: 2; border-top: 1px solid var(--green-line); }
.gym-even .gym-guide { border-color: var(--gym-line-even); }
.gym-guide.aux { border-top-style: dashed; }
.current-time-line { z-index: 7; border-top: 2px solid var(--red); }
.current-time-line::before { content: ""; position: absolute; left: -3px; top: -4px; width: 6px; height: 6px; border: 1px solid #fff; border-radius: 50%; background: var(--red); }
.lane-hitbox { position: absolute; z-index: 3; inset: 0; border: 0; background: transparent; }
.course-block {
  position: absolute;
  z-index: 5;
  left: 1px;
  right: 1px;
  overflow: hidden;
  margin: 0;
  border: 1px solid #234d7399;
  border-radius: 3px;
  padding: 5px 3px;
  background: var(--course-color);
  color: #fff;
  text-align: left;
  text-shadow: 0 1px 1px #18314d99;
  box-shadow: 0 1px 0 #ffffff88 inset, 0 2px 3px #435d7777;
}
.course-block.skipped { border: 1px dashed #526f89; background: #e2eaf2; color: #35516c; text-shadow: none; box-shadow: none; }
.course-block.skipped::before { display: none; }
.course-skip-label { display: block; margin-top: 4px; color: #765b31; font-size: 8px; font-weight: 800; }
.course-block::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 43%;
  background: linear-gradient(#ffffff55, #ffffff08);
  pointer-events: none;
}
.course-block > span { position: relative; z-index: 1; }
.course-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; font-size: clamp(8px, 2.35vw, 11px); line-height: 1.14; font-weight: 800; }
.course-period { display: block; margin-top: 4px; font-size: clamp(7px, 1.9vw, 10px); font-weight: 800; line-height: 1.08; white-space: nowrap; }
.course-time { display: block; margin-top: 3px; font-size: clamp(6px, 1.55vw, 9px); line-height: 1.1; white-space: nowrap; letter-spacing: -.07em; font-variant-numeric: tabular-nums; }
.course-block.compact .course-time { display: none; }
.micro-copy { margin: 0; border: 1px solid #9fb5ca; border-top: 0; padding: 3px 6px; overflow: hidden; background: #e1ebf4; color: #52708b; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.day-dashboard {
  max-height: min(335px, 47dvh);
  overflow-y: auto;
  border: 1px solid #7999b9;
  border-top: 0;
  background: #f7f9fc;
  box-shadow: 0 1px 0 #fff inset;
}
.dashboard-date {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 5px;
  padding: 6px 9px;
  border-bottom: 1px solid #91aeca;
  background: linear-gradient(#f8fbff, #d6e6f5);
}
.dashboard-date strong { font-size: 12px; }
.dashboard-date span { color: #5c748d; font-size: 9px; white-space: nowrap; }
.now-row { display: grid; grid-template-columns: 67px minmax(0, 1fr); align-items: center; gap: 10px; padding: 9px 11px 8px; }
.clock {
  position: relative;
  width: 62px;
  height: 62px;
  border: 4px ridge #a9bdd1;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, #526f8b 0 1deg, #f9fbfd 1deg 30deg);
  box-shadow: 0 1px 3px #47647e77;
}
.clock::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: radial-gradient(circle, #fff 55%, #e2ebf4); }
.hand { position: absolute; z-index: 2; left: 50%; bottom: 50%; border-radius: 1px; transform: translateX(-50%) rotate(var(--rotation)); transform-origin: center bottom; background: #1e4368; }
.hand.hour { width: 4px; height: 16px; }
.hand.minute { width: 2px; height: 23px; background: #b33d2e; }
.clock-center { position: absolute; z-index: 3; top: 50%; left: 50%; width: 5px; height: 5px; transform: translate(-50%, -50%); border-radius: 50%; background: #b33d2e; }
.clock-digital { color: #1d5b98; font: bold 12px Verdana, sans-serif; font-variant-numeric: tabular-nums; }
.now-text h2 { margin-top: 2px; font-size: clamp(15px, 4vw, 19px); }
.now-text p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.event-notices { display: grid; gap: 3px; padding: 0 10px 8px; }
.event-notice { display: grid; grid-template-columns: 5px 1fr; align-items: baseline; gap: 6px; border: 1px solid #b9cadb; padding: 5px 7px; background: #fff; font-size: 10px; }
.notice-dot { width: 5px; height: 5px; background: #346fa7; }
.event-notice.gym .notice-dot { background: #3b8f4d; }
.event-notice.soon .notice-dot { background: #cf8129; }
.event-notice.skip .notice-dot { background: #947446; }
.event-notice small { grid-column: 2; color: var(--muted); font-size: 9px; }
.dashboard-actions { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 10px 9px; }
.action-button, .undo-trigger, .undo-all, .undo-choices button { padding: 5px 8px; font-size: 10px; }
.gym-action { border-color: #3f7d47; background: linear-gradient(#bbebad, #73b56f 49%, #4f984e 50%, #85c27d); color: #173f24; }
.skip-action { border-color: #ab874f; background: linear-gradient(#fff7db, #efd8a6 49%, #d9b978 50%, #f2d9a6); color: #684820; }
.undo-bar { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 10px 9px; }
.undo-all { border-color: #ab874f; background: linear-gradient(#fff7db, #efd8a6 49%, #d9b978 50%, #f2d9a6); color: #684820; }
.undo-choices { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 10px 9px; }
.undo-bar .undo-choices { padding: 0; }
.day-map { background: #fff; }
.map-heading { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; gap: 7px; border-bottom: 1px solid #6e91b5; padding: 6px 9px; background: linear-gradient(#edf5fc, #bdd2e7); box-shadow: 0 1px 0 #fff inset; }
.map-heading strong { color: #214e79; font-size: 11px; }
.map-heading span { color: #5d748c; font-size: 9px; }
.day-map-inner { display: grid; grid-template-columns: 73px minmax(0, 1fr); height: var(--timeline-height); }
.map-axis, .map-track { position: relative; }
.map-axis { border-right: 1px solid #8ba8c4; background: #e8eff7; }
.map-period { z-index: 1; left: 4px; right: 3px; }
.map-period strong { font-size: 10px; }
.map-period span { font-size: 8px; }
.map-track { overflow: hidden; background: #fff; }
.map-gym-edge { position: absolute; z-index: 2; right: 3px; transform: translateY(-50%); border: 1px solid #75a479; padding: 1px 3px; background: #e6f5df; color: #286b3c; font-size: 8px; }
.map-gym-edge.end { color: #53745a; }
.gym-even .map-gym-edge { border-color: #72a9aa; background: #e2f4f1; color: #286d70; }
.map-course {
  position: absolute;
  z-index: 4;
  left: 7px;
  right: 7px;
  display: flex;
  flex-direction: column;
  align-items: start;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
  border: 1px solid #9db3c8;
  border-left: 5px solid var(--course-color);
  border-radius: 2px;
  padding: 5px 8px;
  background: linear-gradient(#fff, #e8eef6);
  text-align: left;
  box-shadow: 0 1px 0 #fff inset, 0 1px 2px #6b819877;
}
.map-course.skipped { border: 1px dashed #7891a7; border-left: 5px dashed #7891a7; background: #e9eef3; box-shadow: none; }
.map-course.skipped strong { color: #536c82; }
.map-course strong { font-size: clamp(12px, 3.3vw, 15px); line-height: 1.15; }
.map-course span { color: #506b83; font-size: 9px; line-height: 1.2; }
.day-progress { position: absolute; z-index: 5; top: 0; left: 0; width: 4px; background: var(--red); opacity: .75; pointer-events: none; }
.day-now-line { position: absolute; z-index: 6; left: 0; right: 0; border-top: 2px solid var(--red); pointer-events: none; }
.day-now-line span { position: absolute; top: -13px; right: 3px; border: 1px solid #98261e; padding: 0 3px; background: #d84a3f; color: #fff; font: bold 9px Verdana, sans-serif; }

.sheet-dialog { width: min(540px, calc(100% - 16px)); max-width: 540px; border: 0; padding: 0; background: transparent; }
.loading-error { width: min(440px, 90vw); margin: 20vh auto; border: 2px solid #416c98; padding: 18px; background: #f0f5fa; box-shadow: 0 5px 14px #173b6270; text-align: center; }
.login-box { width: min(390px, calc(100vw - 28px)); margin: auto; border: 2px solid #365f88; background: #f0f5fa; box-shadow: 0 7px 20px #173b6270; }
.login-head { display: flex; align-items: baseline; justify-content: space-between; padding: 11px 14px; background: linear-gradient(#6b9dc9, #2866a3 48%, #1b528a 49%, #104374); color: white; text-shadow: 0 1px #123f72; }
.login-head strong { font-size: 19px; }.login-head span { font-size: 9px; letter-spacing: .12em; }
.login-body { display: grid; gap: 8px; padding: 17px 14px; font-size: 12px; }
.login-body p { margin: 0 0 7px; line-height: 1.5; }
.login-body label { color: #244c73; font-weight: bold; }
.login-body input { width: 100%; border: 1px solid #8da9c2; border-radius: 2px; padding: 8px; background: white; color: #183651; font: inherit; }
.login-body input[readonly] { background: #e7eef5; font-size: 10px; }
.login-body button { margin-top: 6px; border: 1px solid #174b84; border-radius: 2px; padding: 9px; background: linear-gradient(#79aae0, #2162a6 48%, #164c89 49%, #174575); color: white; font-weight: bold; text-shadow: 0 1px #123b68; }
#loginMessage { min-height: 1.5em; color: #9d351b; }
.sheet-dialog::backdrop { background: #10294488; }
.sheet { max-height: min(78vh, 680px); overflow: auto; border: 2px solid #365f88; border-radius: 4px; padding: 0 11px 12px; background: #f0f5fa; box-shadow: 0 6px 18px #18314d88; }
.sheet-grabber { display: none; }
.sheet-head { display: flex; justify-content: space-between; gap: 9px; margin: 0 -11px; border-bottom: 1px solid #1d5082; padding: 8px 11px; background: linear-gradient(#6b9dc9, #2866a3 48%, #1b528a 49%, #104374); color: white; text-shadow: 0 1px #123f72; }
.sheet-kicker { display: block; margin-bottom: 2px; color: #d6e8f8; font-size: 9px; }
.close-button { width: 24px; height: 24px; border: 1px solid #c1d9ee; border-radius: 2px; background: linear-gradient(#fff, #b8d2ea); color: #164879; font-size: 19px; line-height: 1; text-shadow: none; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.detail-item { min-width: 0; border: 1px solid #b0c2d4; padding: 7px 8px; background: #fff; }
.detail-item.full { grid-column: 1 / -1; }
.detail-item span { display: block; color: var(--muted); font-size: 9px; }
.detail-item strong { display: block; margin-top: 2px; overflow-wrap: anywhere; font-size: 11px; }
.detail-skip { margin-top: 10px; padding: 6px 9px; font-size: 10px; }
.week-picker-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 10px; }
.week-choice { padding: 7px 3px; font-size: 11px; }
.week-choice.active { border-color: #9f6c19; background: linear-gradient(#fff8dc, #e4c585); color: #71470d; }
.week-choice.current::after { content: "•"; margin-left: 1px; color: #b04410; }

@media (max-width: 560px) {
  .app-shell { padding-right: 5px; padding-left: 5px; }
  .timeline-grid { grid-template-columns: 53px repeat(7, minmax(0, 1fr)); }
  .day-head strong { font-size: 9px; }
  .day-head span { font-size: 7px; }
  .period-slot strong { font-size: 8px; }
  .period-slot span { font-size: 7px; }
  .course-block { padding: 4px 2px; }
  .course-period { margin-top: 2px; }
  .legend-chip { font-size: 8px; }
}
@media (max-width: 380px) {
  h1 small { display: none; }
  .timeline-grid { grid-template-columns: 51px repeat(7, minmax(0, 1fr)); }
  .course-title { font-size: 8px; }
  .course-time { font-size: 6px; }
}
@media (max-height: 720px) {
  .app-header { min-height: 48px; padding: 5px 9px; }
  h1 { font-size: 18px; }
  .week-nav-row { min-height: 39px; }
  .toolbar { min-height: 39px; }
  .day-dashboard { max-height: 43dvh; }
  .now-row { padding-top: 5px; padding-bottom: 5px; }
  .clock { width: 54px; height: 54px; }
  .now-row { grid-template-columns: 58px minmax(0, 1fr); }
}
