:root {
  color-scheme: light;
  --ink: #17233f;
  --ink-soft: #52617d;
  --blue: #335cff;
  --blue-dark: #2543c8;
  --blue-wash: #eef2ff;
  --orange: #ffb45b;
  --orange-wash: #fff4e5;
  --line: #dfe4ec;
  --line-strong: #cad2df;
  --canvas: #eef1f6;
  --paper: #ffffff;
  --muted: #8a95a8;
  --success: #49b58a;
  --shadow: 0 18px 45px rgba(33, 47, 79, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 90% 0%, rgba(51, 92, 255, 0.09), transparent 28rem),
    var(--canvas);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  padding: 18px clamp(20px, 5vw, 72px);
  color: #fff;
  background:
    linear-gradient(108deg, #17233f 0%, #1e2f5a 62%, #294998 100%);
  box-shadow: 0 8px 24px rgba(23, 35, 63, 0.17);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 14px;
  color: var(--ink);
  background: var(--orange);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.07em;
  box-shadow: 5px 5px 0 rgba(255, 255, 255, 0.08);
}

.brand-overline,
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.topbar .brand-overline {
  color: #aeb9d2;
}

.topbar h1 {
  margin: 4px 0 0;
  color: #fff;
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 760;
  letter-spacing: -0.04em;
  line-height: 1;
}

.year-chip {
  padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #dfe7ff;
  background: rgba(255, 255, 255, 0.09);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(248px, 296px) minmax(0, 1fr);
  gap: 22px;
  width: min(1440px, calc(100% - 40px));
  margin: 28px auto 20px;
}

.control-panel,
.schedule-panel {
  min-width: 0;
  border: 1px solid rgba(202, 210, 223, 0.8);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.control-panel {
  align-self: start;
  padding: 24px 20px 22px;
}

.panel-heading h2,
.schedule-heading h2 {
  margin: 6px 0 0;
  letter-spacing: -0.04em;
}

.panel-heading h2 {
  font-size: 23px;
  line-height: 1.15;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 25px 0 22px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f5f7fa;
}

.mode-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 14px;
  font-weight: 750;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.mode-button:hover {
  color: var(--ink);
}

.mode-button.is-active {
  color: var(--blue);
  background: #fff;
  box-shadow: 0 3px 10px rgba(38, 56, 100, 0.1);
}

.mode-icon {
  color: currentColor;
  font-size: 18px;
  line-height: 1;
}

.control-stack {
  display: grid;
  gap: 15px;
}

.field-label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.field-label span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.field-label b {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 7px;
  color: var(--blue);
  background: var(--blue-wash);
  font-size: 11px;
}

select {
  width: 100%;
  min-height: 45px;
  padding: 0 35px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: none;
  color: var(--ink);
  background-color: #fff;
  font-size: 15px;
  font-weight: 650;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(51, 92, 255, 0.14);
}

.selection-hint {
  display: flex;
  gap: 9px;
  margin-top: 20px;
  padding: 11px 12px;
  border-radius: 11px;
  color: var(--ink-soft);
  background: #f7f8fb;
  font-size: 13px;
  line-height: 1.35;
}

.selection-hint p {
  margin: 0;
}

.hint-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(73, 181, 138, 0.12);
}

.panel-divider {
  height: 1px;
  margin: 23px 0 20px;
  background: var(--line);
}

.legend-block .eyebrow {
  margin-bottom: 11px;
}

.legend-list {
  display: grid;
  gap: 7px;
}

.legend-row {
  display: grid;
  grid-template-columns: 43px minmax(0, 1fr);
  align-items: baseline;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
}

.legend-code {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.schedule-panel {
  padding: 27px clamp(16px, 2.5vw, 32px) 23px;
  overflow: hidden;
}

.schedule-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 0 2px 22px;
}

.schedule-heading h2 {
  max-width: 600px;
  font-size: clamp(26px, 3.2vw, 38px);
  line-height: 1.08;
}

.schedule-meta {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.summary-metrics {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

.metric {
  min-width: 92px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfe;
}

.metric strong,
.metric span {
  display: block;
}

.metric strong {
  color: var(--blue);
  font-size: 20px;
  line-height: 1.1;
}

.metric span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
}

.table-frame {
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: #f8faff;
  -webkit-overflow-scrolling: touch;
}

.schedule-table {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.schedule-table th,
.schedule-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.schedule-table tr > :last-child {
  border-right: 0;
}

.schedule-table tbody tr:last-child > * {
  border-bottom: 0;
}

.schedule-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 58px;
  padding: 9px 10px;
  color: #fff;
  background: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  vertical-align: middle;
}

.schedule-table thead th:first-child {
  left: 0;
  z-index: 3;
  width: 86px;
  border-right-color: rgba(255, 255, 255, 0.15);
}

.day-number {
  display: block;
  margin-bottom: 2px;
  color: var(--orange);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.day-name {
  display: block;
  white-space: nowrap;
}

.schedule-table tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 86px;
  padding: 10px 12px;
  color: var(--ink-soft);
  background: #f5f7fb;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  vertical-align: middle;
}

.lesson-number {
  display: block;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.lesson-label {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.schedule-table td {
  min-width: 126px;
  height: 74px;
  padding: 8px 10px;
  background: #fff;
  vertical-align: top;
}

.schedule-table td.empty {
  background: #fbfcfe;
}

.empty-mark {
  display: grid;
  height: 100%;
  place-items: center;
  color: #c9d0db;
  font-size: 17px;
}

.teacher-slot,
.class-entry {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.teacher-slot + .teacher-slot,
.class-entry + .class-entry {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px dashed var(--line);
}

.teacher-slot > span:last-child {
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
}

.week-tag {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 18px;
  padding: 2px 5px;
  border-radius: 5px;
  color: #9a5f13;
  background: var(--orange-wash);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.class-entry {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
}

.class-entry .week-tag {
  justify-self: start;
  margin-bottom: 2px;
}

.subject-label {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.teacher-name {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.25;
}

.schedule-footnote {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 15px;
  color: var(--muted);
  font-size: 12px;
}

.schedule-footnote p {
  margin: 0;
}

.footnote-mark {
  display: inline-grid;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 2px 2px 24px;
  color: #7c879a;
  font-size: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 880px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .control-panel {
    display: grid;
    grid-template-columns: minmax(210px, 0.7fr) minmax(330px, 1fr);
    column-gap: 24px;
  }

  .panel-heading,
  .mode-switch,
  .selection-hint,
  .panel-divider,
  .legend-block {
    grid-column: 1;
  }

  .mode-switch {
    margin-bottom: 0;
  }

  .control-stack {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: end;
    margin-top: 35px;
  }

  .selection-hint {
    margin-top: 18px;
  }

  .panel-divider,
  .legend-block {
    display: none;
  }
}

@media (max-width: 640px) {
  .topbar {
    min-height: 78px;
    padding: 15px 18px;
  }

  .brand-mark {
    width: 39px;
    height: 39px;
    border-radius: 11px;
    font-size: 20px;
  }

  .brand-overline {
    font-size: 9px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .year-chip {
    padding: 6px 9px;
    font-size: 12px;
  }

  .workspace,
  .site-footer {
    width: min(100% - 24px, 560px);
  }

  .workspace {
    gap: 14px;
    margin-top: 14px;
  }

  .control-panel {
    display: block;
    padding: 20px 16px 18px;
  }

  .mode-switch {
    margin: 20px 0 18px;
  }

  .control-stack {
    margin-top: 0;
  }

  .selection-hint {
    margin-top: 16px;
  }

  .panel-divider,
  .legend-block {
    display: block;
  }

  .schedule-panel {
    padding: 21px 12px 18px;
    border-radius: 16px;
  }

  .schedule-heading {
    display: block;
    padding: 0 4px 17px;
  }

  .schedule-heading h2 {
    font-size: 30px;
  }

  .summary-metrics {
    margin-top: 15px;
  }

  .metric {
    min-width: 0;
    flex: 1;
  }

  .site-footer {
    display: block;
    padding-bottom: 17px;
    font-size: 11px;
  }

  .site-footer span {
    display: block;
  }

  .site-footer span + span {
    margin-top: 3px;
  }
}
