:root {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #f5f7fb;
  background: #0b1018;
  color-scheme: dark;
  --bg: #0b1018;
  --surface: #141a24;
  --surface-2: #1a2230;
  --muted: #8b95a7;
  --border: rgba(255, 255, 255, 0.1);
  --primary: #60a5fa;
  --chip-bg: #1c2433;
  --text: #ffffff;
  --chevron: rgba(255, 255, 255, 0.28);
  --shadow: none;
}

:root[data-theme="light"] {
  color: #172033;
  background: #f5f7fb;
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --muted: #667085;
  --border: #d9dfeb;
  --primary: #4263eb;
  --chip-bg: #eaf0ff;
  --text: #172033;
  --chevron: #98a2b3;
  --shadow: 0 4px 16px rgba(36, 59, 83, 0.07);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  height: 100%;
  margin: 0;
  min-width: 375px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100%;
  min-height: 0;
}

button {
  font: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

.teacher-link {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.shell {
  height: 100%;
  min-height: 0;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 22px 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.shell > section {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  margin: 4px auto 18px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  width: fit-content;
}

.title {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 22px;
  letter-spacing: -0.4px;
  color: var(--text);
  text-align: left;
}

.screen-header {
  flex: none;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding-bottom: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.screen-header .title {
  margin: 18px 0 22px;
  text-align: center;
}

.back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  width: fit-content;
  margin: 0 auto;
  background: var(--chip-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  padding: 8px 16px;
  font-weight: 500;
  font-size: 14px;
  gap: 6px;
  text-align: center;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.back:active {
  opacity: 0.85;
}

.cards {
  display: grid;
  gap: 12px;
  flex: 1;
  min-height: 0;
  align-content: start;
  overflow-y: auto;
  padding-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  width: 100%;
  margin: 0 auto;
}

.card {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: 16px;
  padding: 18px 16px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: inherit;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.card:active {
  transform: scale(0.985);
  background: var(--surface-2);
}

.card-body {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.card strong {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.card small {
  display: block;
  color: var(--muted);
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.card-chevron {
  flex: none;
  color: var(--chevron);
  font-size: 20px;
  line-height: 1;
  font-weight: 300;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex: none;
}

.schedule-heading {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
}

.schedule-heading .title {
  text-align: left;
  font-size: 30px;
  margin: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding-top: 2px;
}

.group-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  transition: opacity 0.15s ease;
  width: fit-content;
}

.group-chip:active {
  opacity: 0.8;
}

.group-chip-icon {
  opacity: 0.75;
  font-size: 14px;
  line-height: 1;
}

.group-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: inherit;
  font-size: 18px;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

:root[data-theme="light"] .theme-toggle {
  box-shadow: var(--shadow);
}

.theme-toggle:active {
  transform: scale(0.94);
}

.date-navigation {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 14px;
  flex: none;
}

.date-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex: 1;
  position: relative;
  z-index: 1;
  cursor: pointer;
}

.day-navigation-button {
  display: none;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  color: var(--text);
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
  transition: transform 0.18s ease, background-color 0.18s ease, opacity 0.18s ease;
}

.day-navigation-button:hover:not(:disabled) {
  background: var(--surface-2);
  transform: scale(1.06);
}

.day-navigation-button:active:not(:disabled) {
  transform: scale(0.92);
}

.day-navigation-button:disabled {
  cursor: default;
  opacity: 0.35;
}

@media (hover: hover) and (pointer: fine) {
  .day-navigation-button {
    display: inline-flex;
  }
}

.date-pill input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  z-index: 1;
}

.date-pill span {
  pointer-events: none;
}

.day-carousel {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  touch-action: pan-y;
  scrollbar-width: none;
}

.day-carousel::-webkit-scrollbar {
  display: none;
}

.day-page {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 2px 8px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  touch-action: pan-y;
}

.lesson {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.lesson-time {
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
  margin-bottom: 6px;
}

.entry + .entry {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 12px;
}

.room {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

.entry strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.teacher {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
}

.subgroup {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 16px;
  font-size: 16px;
  font-weight: 500;
}

.dots {
  text-align: center;
  color: var(--muted);
  margin-top: 10px;
  font-size: 13px;
  flex: none;
}
