:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --ink: #142033;
  --muted: #667085;
  --line: #d7dee8;
  --accent: #2457a6;
  --accent-dark: #183d78;
  --green: #147a4d;
  --green-soft: #e6f5ed;
  --red: #c9332c;
  --red-soft: #fde7e5;
  --shadow: 0 18px 48px rgba(20, 32, 51, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1040px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 0 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1;
}

h2 {
  font-size: 1.1rem;
}

.clock {
  min-width: 98px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 1.35rem;
  font-weight: 800;
  text-align: center;
}

.controls,
.status-panel,
.schedule-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(92px, 0.4fr) minmax(180px, 1fr) minmax(92px, 0.4fr) auto;
  gap: 14px;
  align-items: end;
  padding: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.switch {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  outline: none;
  background: #ffffff;
}

.field select:disabled {
  background: #eef3f8;
  color: var(--muted);
  opacity: 1;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(36, 87, 166, 0.15);
}

.compact-field {
  min-width: 92px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 15px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

#refresh-now {
  border: 1px solid var(--line);
  background: #eef3f8;
  color: var(--ink);
}

#refresh-now:hover {
  background: #e3eaf3;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 4px;
  white-space: nowrap;
}

.switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.status-panel {
  margin-top: 18px;
  padding: 20px;
}

.status-panel.is-break {
  border-color: rgba(20, 122, 77, 0.28);
  background: var(--green-soft);
}

.status-panel.is-class {
  border-color: rgba(201, 51, 44, 0.28);
  background: var(--red-soft);
}

.status-panel.is-error {
  border-color: rgba(201, 51, 44, 0.38);
}

.status-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 850;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}

.is-break .status-dot {
  background: var(--green);
}

.is-class .status-dot,
.is-error .status-dot {
  background: var(--red);
}

#status-detail {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.schedule-section {
  margin-top: 18px;
  overflow: hidden;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

#updated-at {
  color: var(--muted);
  font-size: 0.88rem;
}

.schedule-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.schedule-item {
  display: grid;
  grid-template-columns: 122px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-height: 76px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.schedule-item:last-child {
  border-bottom: 0;
}

.schedule-item.is-current {
  background: var(--red-soft);
  color: var(--red);
}

.schedule-time {
  font-weight: 850;
  white-space: nowrap;
}

.schedule-subject {
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.schedule-location {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.schedule-item.is-current .schedule-location {
  color: #8d2d2a;
}

.empty-row {
  padding: 22px 18px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 20px, 1040px);
    padding-top: 16px;
  }

  .topbar,
  .controls,
  .section-head {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .actions {
    justify-content: stretch;
  }

  .actions button {
    flex: 1 1 120px;
  }

  .clock {
    width: 100%;
  }

  .schedule-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
