* {
  box-sizing: border-box;
}
.app {
  max-width: 800px;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button,
summary,
select {
  cursor: pointer;
}
button,
input,
select,
summary {
  touch-action: manipulation;
}
:focus-visible {
  outline: 2px solid #0071e3;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
.controls {
  flex-wrap: wrap;
}
.search-row { display:flex; gap:10px; align-items:flex-start; margin: -4px 0 16px; flex-wrap:wrap; }
.search-row input { flex:1; min-width:180px; padding:10px 12px; border:1px solid var(--line); border-radius:8px; background:var(--panel); }
#searchResult { display:flex; flex:1 1 100%; gap:6px; flex-wrap:wrap; color:var(--muted); font-size:12px; }
#semesterProgress { color:var(--muted); font-size:12px; }
.search-hit { text-align:left; border:1px solid var(--course-color,#0071e3); border-left:4px solid var(--course-color,#0071e3); border-radius:7px; padding:7px 10px; background:rgba(255,255,255,.75); color:var(--ink); }
.countdown { margin-top:10px; padding:10px 12px; color:#005bb5; font-size:12px; line-height:1.7; font-variant-numeric:tabular-nums; background:rgba(0,113,227,.07); border-radius:8px; }
.countdown div + div { margin-top:3px; color:#4c6175; }
.coursearea { opacity:1; transform:none; filter:none; transition:none; }
#scheduleSurface { display:flow-root; margin-top:-6px; }
#scheduleContent { display:flow-root; }
#scheduleSurface > .weekbar { margin-top:0; }
#scheduleSurface.is-transitioning, #scheduleContent.is-transitioning {
  overflow: hidden;
  overflow: clip;
  will-change: opacity, filter, height;
  transform: translateZ(0);
  overflow-anchor: none;
}
.countdown { transition:background-color .25s ease, color .25s ease; }
html, body { touch-action: pan-y; }
button, input, select, summary { -webkit-tap-highlight-color: transparent; }
.export-button { margin:14px 16px 16px; padding:9px 14px; border:1px solid var(--line); border-radius:8px; background:var(--panel); }
.course-detail { border-left:4px solid var(--course-color, #0071e3); padding-left:10px; }
.course-detail.is-expanding { overflow: hidden; will-change: height; }
.week-grid { display:grid; grid-template-columns:repeat(7,minmax(150px,1fr)); gap:10px; padding:12px; overflow-x:auto; }
.week-day { min-width:150px; background:rgba(255,255,255,.55); border:1px solid var(--line); border-radius:10px; padding:10px; }
.week-day h3 { margin:0 0 10px; font-size:15px; }
.week-day .course-detail { margin:10px 0; }
.week-day .meta { font-size:11px; }
.week-table { display:grid; grid-template-columns:104px repeat(7,minmax(130px,1fr)); min-width:1014px; border-top:1px solid var(--line); border-left:1px solid var(--line); }
.week-corner,.week-day-head,.week-time,.week-cell { border-right:1px solid var(--line); border-bottom:1px solid var(--line); padding:8px; }
.week-corner,.week-day-head { background:rgba(0,113,227,.08); font-weight:700; text-align:center; }
.week-day-head small { display:block; font-size:11px; font-weight:400; color:var(--muted); }
.week-time { color:var(--muted); font-size:12px; line-height:1.5; background:var(--soft); }
.week-cell { min-height:78px; background:rgba(255,255,255,.5); }
.week-course { width:100%; border:0; border-left:4px solid var(--course-color,#0071e3); border-radius:6px; padding:7px; text-align:left; background:color-mix(in srgb, var(--course-color,#0071e3) 12%, white); cursor:pointer; }
.week-course strong,.week-course small { display:block; overflow-wrap:anywhere; }
.week-course small { margin-top:4px; color:var(--muted); font-size:11px; line-height:1.4; }
.week-empty { color:#b3bac5; display:block; text-align:center; padding-top:15px; }
#courseDialog { max-width:min(460px, calc(100vw - 28px)); max-height:calc(100dvh - 32px); width:100%; border:0; border-radius:14px; padding:22px; box-shadow:0 18px 60px rgba(0,0,0,.25); transform-origin:center; }
#courseDialog::backdrop { background:rgba(20,25,35,.32); backdrop-filter:blur(5px); -webkit-backdrop-filter:blur(5px); }
#courseDialog.is-opening::backdrop { animation: backdrop-in 240ms ease both; }
#courseDialog.is-closing::backdrop { animation: backdrop-out 180ms ease both; }
@keyframes backdrop-in { from { opacity:0; } to { opacity:1; } }
@keyframes backdrop-out { from { opacity:1; } to { opacity:0; } }
.dialog-close { position:absolute; right:12px; top:8px; border:0; background:transparent; font-size:26px; cursor:pointer; }
.week-view-panel { overflow:hidden; }
@media (max-width: 700px) { .week-grid { grid-template-columns:repeat(7, minmax(150px,1fr)); } }
@media (max-width: 520px) {
  .app { padding: max(10px, env(safe-area-inset-top)) 10px 18px; }
  .controls { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:6px; }
  .controls > * { width:100%; min-height:44px; padding:8px 4px; }
  .controls input { grid-column:1 / -1; }
  .search-row { margin-top:0; }
  .search-row input { min-height:44px; }
  .week-jump { gap:6px; margin-bottom:12px; }
  .week-jump select { min-height:42px; flex:1; }
  .weekbar { gap:3px; margin-bottom:10px; }
  .weekbar button { min-height:72px; padding:7px 1px; font-size:12px; }
  .weekbar .period-preview { font-size:9px; white-space:nowrap; overflow:hidden; }
  .slot { grid-template-columns:82px minmax(0,1fr); min-height:70px; }
  .time { padding:10px 5px; font-size:10px; }
  .course { padding:10px 8px; }
  .head { gap:8px; }
  .head > b { font-size:11px; padding:5px 8px; }
  .countdown { font-size:11px; line-height:1.6; }
  .week-table { min-width:920px; grid-template-columns:82px repeat(7,minmax(120px,1fr)); }
  .week-cell { min-height:72px; padding:5px; }
  .week-course { padding:6px; font-size:11px; }
  #courseDialog { padding:20px 16px; }
}
.controls > * {
  min-height: 42px;
}
.controls input {
  min-width: 0;
}
.head {
  flex-wrap: wrap;
}
.head > div,
.course {
  min-width: 0;
}
.head > b {
  flex-shrink: 0;
}
.week-jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
}
.week-jump select,
.setting-line select {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
#weekRange,
#featureSummary {
  color: var(--muted);
  font-size: 12px;
}
.weekbar button {
  min-height: 76px;
  overflow-wrap: anywhere;
}
.weekbar button small {
  font-size: 11px;
  line-height: 1.5;
}
.weekbar button[aria-current="date"] {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.weekbar .period-preview {
  display: block;
  font-size: 10px;
}
.weekbar button.active {
  box-shadow:
    inset 0 0 0 2px #fff,
    0 0 0 1px #0071e3;
}
.weekbar button.no-class.active {
  box-shadow:
    inset 0 0 0 2px #fff,
    0 0 0 1px #16823a;
}
.preferences {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  margin-bottom: 16px;
}
.preferences > summary {
  font-weight: 600;
}
#featureSummary {
  margin-left: 10px;
  font-weight: 400;
}
.preference-content {
  padding-top: 14px;
}
.setting-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.setting-line button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 40px;
  padding: 8px 12px;
}
.setting-line input {
  width: 18px;
  height: 18px;
  accent-color: #0071e3;
  vertical-align: middle;
}
.preference-content p {
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}
.preference-content p:empty {
  display: none;
}
.panel:hover {
  transform: none;
}
.slot {
  grid-template-columns: 104px minmax(0, 1fr);
}
.time {
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
}
.course-detail + .course-detail {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.course-detail summary {
  line-height: 1.6;
}
.course-detail summary .name {
  display: inline;
  overflow-wrap: anywhere;
}
.course-detail .meta {
  display: block;
  margin-left: 17px;
  line-height: 1.5;
}
.course-detail dl {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 7px 12px;
  font-size: 12px;
  line-height: 1.6;
  padding: 12px 0 0;
  margin: 10px 0 0;
  border-top: 1px solid var(--line);
}
.course-detail dt {
  color: var(--muted);
}
.course-detail dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.conflict-banner {
  background: #fff1e9;
  color: #9b361c;
  padding: 12px 16px;
  line-height: 1.6;
  border-bottom: 1px solid #f1c7b2;
}
.slot.conflict {
  background: #fff7f2;
}
.conflict-label {
  display: block;
  color: #9b361c;
  font-weight: 700;
}
@media (max-width: 520px) {
  .weekbar {
    gap: 3px;
  }
  .weekbar button {
    padding: 6px 1px;
  }
  .weekbar button small {
    font-size: 10px;
  }
  .weekbar .period-preview {
    font-size: 9px;
  }
  .slot {
    grid-template-columns: 90px minmax(0, 1fr);
  }
  .course {
    padding: 11px 10px;
  }
  .time {
    padding: 11px 7px;
    font-size: 11px;
  }
  .clock {
    max-width: 100%;
  }
  .day {
    font-size: 18px;
  }
  .head {
    padding: 12px;
  }
}
