:root {
  --bg: #07090e;
  --ink: #eef3f8;
  --ink-soft: rgba(238, 243, 248, 0.58);
  --ink-faint: rgba(238, 243, 248, 0.38);
  --glass: rgba(18, 24, 36, 0.55);
  --glass-strong: rgba(22, 30, 46, 0.72);
  --glass-line: rgba(255, 255, 255, 0.1);
  --glass-edge: rgba(255, 255, 255, 0.06);
  --accent: #3ecfc0;
  --accent-deep: #1aa89a;
  --accent-glow: rgba(62, 207, 192, 0.22);
  --mark: rgba(62, 207, 192, 0.16);
  --mark-ink: #9af0e6;
  --danger: #ff6b7a;
  --ok: #5ee0a0;
  --warn: #f0c35a;
  --blur: 32px;
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Manrope", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --tab-h: 68px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  padding:
    calc(10px + env(safe-area-inset-top))
    12px
    calc(var(--tab-h) + 16px + env(safe-area-inset-bottom));
}

.aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: #07090e;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(56px);
  opacity: 0.55;
  animation: float 16s ease-in-out infinite;
  will-change: transform;
}

.b1 {
  width: 340px; height: 340px;
  left: -120px; top: -80px;
  background: radial-gradient(circle, #1f6b8a 0%, transparent 68%);
}
.b2 {
  width: 380px; height: 380px;
  right: -140px; top: 18%;
  background: radial-gradient(circle, #6b2d7a 0%, transparent 70%);
  animation-delay: -5s;
  opacity: 0.42;
}
.b3 {
  width: 300px; height: 300px;
  left: 15%; bottom: -40px;
  background: radial-gradient(circle, #1a7a6a 0%, transparent 70%);
  animation-delay: -9s;
}
.b4 {
  width: 220px; height: 220px;
  right: 10%; bottom: 22%;
  background: radial-gradient(circle, #2a4a9a 0%, transparent 70%);
  animation-delay: -2s;
  opacity: 0.35;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(16px, -22px) scale(1.08); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 12px 36px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
}

.shell {
  width: min(440px, 100%);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  margin-bottom: 10px;
}

.brand {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent);
}

h1 {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h2 {
  margin: 8px 0 4px;
  font-size: 17px;
  font-weight: 700;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 11px;
  color: var(--ink);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
}

.glass-btn {
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(12px);
}

.screen {
  border-radius: var(--radius);
  padding: 4px 0 0;
  min-height: 120px;
  animation: rise 0.28s ease both;
}

.screen.glass { padding: 14px; }

.lead {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.muted { color: var(--ink-soft); }
.sm { font-size: 12px; margin: 8px 0 0; }

.form { display: grid; gap: 10px; }

label {
  display: grid;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
}

input {
  width: 100%;
  border: 1px solid var(--glass-line);
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: rgba(62, 207, 192, 0.45);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

button { font: inherit; cursor: pointer; }

.primary {
  border: 0;
  border-radius: 13px;
  padding: 11px 14px;
  font-weight: 700;
  font-size: 14px;
  color: #041412;
  background: linear-gradient(180deg, #5ee0d0 0%, var(--accent-deep) 100%);
  box-shadow: 0 8px 22px rgba(26, 168, 154, 0.28);
}

.primary:disabled { opacity: 0.55; cursor: default; }

.danger-outline {
  width: 100%;
  margin-top: 14px;
  background: rgba(255, 107, 122, 0.12);
  color: var(--danger);
  box-shadow: none;
}

.status {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-soft);
}
.status.error { color: var(--danger); }
.status.ok { color: var(--ok); }

.mfa {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--glass-edge);
  display: none;
  gap: 8px;
}
.mfa.is-open { display: grid; }
.mfa p { margin: 0; font-size: 13px; font-weight: 600; }

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(62, 207, 192, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 8px auto 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* —— home —— */
.home-stack {
  display: grid;
  gap: 10px;
}

.home-card {
  padding: 14px 15px;
  border-radius: 18px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 10px 28px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
}

.home-kicker {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
}

.home-title {
  margin: 0;
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.home-sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.35;
}

.home-card.status-done .home-title { color: var(--ok); }
.home-card.status-soon .home-title { color: var(--warn); }
.home-card.status-now .home-title { color: var(--accent); }

.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.progress-label {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
}

.progress-days {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width 0.45s ease;
}

.progress-range {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--ink-faint);
}

.home-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.home-action {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  color: var(--ink);
  text-align: left;
  backdrop-filter: blur(16px);
}

.home-action strong {
  font-size: 13px;
  font-weight: 700;
}

.home-action span {
  font-size: 11px;
  color: var(--ink-soft);
}

/* periods */
.period-rail {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px;
  margin-bottom: 8px;
  border-radius: 14px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.period-rail::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.chip.is-active {
  background: rgba(62, 207, 192, 0.92);
  color: #041412;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 8px;
  border-radius: 14px;
}

.seg-btn {
  border: 0;
  border-radius: 11px;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-soft);
  background: transparent;
}
.seg-btn.is-active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.weeknav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  margin-bottom: 8px;
  border-radius: 12px;
}

.weeknav[hidden] {
  display: none !important;
}

.nav-arrow {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.nav-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.week-label {
  flex: 1;
  margin: 0;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
}

.meta {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-soft);
}

.grades-col { display: grid; gap: 7px; }

.subject {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "name avgs"
    "marks marks";
  gap: 4px 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.subject-name {
  grid-area: name;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.01em;
  align-self: center;
}

.avg-cols {
  grid-area: avgs;
  display: flex;
  gap: 6px;
  align-items: stretch;
  justify-content: flex-end;
}

.avg-col {
  min-width: 44px;
  text-align: center;
  padding: 3px 6px;
  border-radius: 8px;
  background: rgba(62, 207, 192, 0.12);
}

.avg-col .lbl {
  display: block;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  line-height: 1.1;
}

.avg-col .val {
  display: block;
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.marks {
  grid-area: marks;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.mark {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 26px;
  padding: 3px 5px;
  border-radius: 7px;
  background: var(--mark);
  color: var(--mark-ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
}

.mark-date {
  font-family: var(--font);
  font-size: 8px;
  font-weight: 600;
  color: var(--ink-faint);
  margin-top: 1px;
}

.empty {
  padding: 20px 8px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}

.hint {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 11px;
  color: var(--ink-soft);
}

/* schedule day strip */
.day-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}
.day-strip::-webkit-scrollbar { display: none; }

.day-pill {
  flex: 0 0 auto;
  min-width: 52px;
  padding: 8px 6px;
  border-radius: 14px;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  color: var(--ink-soft);
  text-align: center;
}
.day-pill.is-active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(62, 207, 192, 0.35);
  box-shadow: 0 0 0 1px var(--accent-glow);
}
.day-pill .dow {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.day-pill .dom {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  font-weight: 750;
  font-family: var(--mono);
  color: var(--ink);
}

.sched-day-head {
  margin: 0 0 10px;
}
.sched-day-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.sched-day-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}

.lesson-card {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 16px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.lesson-card .lc-timebox { min-width: 0; }
.lesson-card .lc-time {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 750;
  color: var(--ink);
  line-height: 1.15;
}
.lesson-card .lc-end {
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
}
.lesson-card .lc-num {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-faint);
  font-family: var(--font);
}
.lesson-card .lc-subj {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.lesson-card .lc-meta {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.3;
}
.lesson-card .lc-room::before {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 4px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  vertical-align: 0.05em;
  opacity: 0.7;
}
.lesson-card .lc-teach::before {
  content: "·";
  margin-right: 6px;
  opacity: 0.45;
}
.lesson-card .lc-side {
  display: grid;
  gap: 4px;
  justify-items: end;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(62, 207, 192, 0.14);
  color: var(--accent);
}
.badge.sub {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink-soft);
}
.badge.remote {
  background: rgba(96, 165, 250, 0.18);
  color: #93c5fd;
}
.lunch-break {
  margin: 6px 0 10px;
  padding: 8px 12px;
  border-radius: 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 650;
  color: #f0c35a;
  background: rgba(240, 195, 90, 0.1);
  border: 1px dashed rgba(240, 195, 90, 0.35);
}

.sched-days { display: grid; gap: 8px; }

.day-card {
  border-radius: 14px;
  padding: 10px 11px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
}

.day-card.is-today {
  border-color: rgba(62, 207, 192, 0.4);
}

.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.day-name { font-size: 13px; font-weight: 700; }
.day-date { font-size: 11px; font-weight: 600; color: var(--ink-soft); }
.day-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(62, 207, 192, 0.14);
  border-radius: 999px;
  padding: 2px 7px;
}

.lesson-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.lesson-time {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
}
.lesson-subj { font-size: 12px; font-weight: 650; line-height: 1.25; }
.lesson-kind {
  display: inline-block;
  margin-left: 4px;
  font-size: 9px;
  font-weight: 600;
  color: var(--ink-faint);
}
.lesson-meta {
  margin-top: 2px;
  font-size: 10px;
  color: var(--ink-soft);
}
.day-empty {
  font-size: 11px;
  color: var(--ink-soft);
  padding: 4px 0 2px;
}

.teachers-list { display: grid; gap: 6px; }

.teacher-row {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 13px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
}

.teacher-ava {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(62, 207, 192, 0.12);
}

.teacher-ava.fallback {
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent);
}

.teacher-name {
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  color: #041412;
  background: linear-gradient(145deg, #5ee0d0, #1aa89a);
}

.profile-name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(8px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(420px, calc(100% - 20px));
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 6px;
  border-radius: 24px;
  background: rgba(12, 16, 26, 0.72);
  border: 1px solid var(--glass-line);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
}

.tab {
  display: grid;
  justify-items: center;
  gap: 2px;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  padding: 7px 1px 6px;
  border-radius: 16px;
  font-size: 7.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.15;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.tab span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab svg { opacity: 0.7; }

.tab.is-active {
  color: var(--accent);
  background: rgba(62, 207, 192, 0.12);
  transform: translateY(-1px);
}

.tab.is-active svg { opacity: 1; }

body.has-tabs {
  padding-bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom));
}

body.no-tabs .tabbar { display: none; }
body.no-tabs {
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.field-label {
  display: block;
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

#groupFilter {
  margin-bottom: 8px;
}

.group-select {
  width: 100%;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-sm);
  padding: 11px 32px 11px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  outline: none;
  appearance: none;
  background-color: rgba(0, 0, 0, 0.35);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.group-select:focus {
  border-color: rgba(62, 207, 192, 0.45);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.group-select option {
  background: #121824;
  color: var(--ink);
}

.hidden { display: none !important; }
