:root {
  --bg: #0a0d13;
  --panel: #12161f;
  --card: #151a24;
  --border: #232838;
  --text: #e9ecf3;
  --muted: #8890a3;
  --accent: #3a7bfd;
  --accent-dim: #1f3763;
  --violet: #6d5bd0;
  --green: #2e8b6b;
  --grey: #2a2f3c;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.phone {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 16px 40px;
}

.muted { color: var(--muted) !important; }

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.topbar h1 {
  font-size: 22px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
}
.gear-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
  font-size: 16px;
}
.gear-btn:hover { color: var(--text); border-color: var(--accent); }

/* Chips */
.chip-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.chip {
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(58, 123, 253, 0.06);
  white-space: nowrap;
}
.chip-icon {
  cursor: pointer;
  padding: 8px 11px;
  font-size: 15px;
  background: none;
  color: var(--text);
  border-color: var(--border);
}
.chip-grow {
  flex: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mode-link { color: inherit; text-decoration: none; }

/* Week toggle */
.week-toggle {
  display: flex;
  background: var(--panel);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.week-btn {
  flex: 1;
  text-align: center;
  padding: 9px 6px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.week-btn.active {
  background: var(--accent-dim);
  color: #cfe0ff;
}

/* Day tabs */
.day-tabs {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}
.day-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 2px;
  text-decoration: none;
  color: var(--muted);
  border-radius: 10px;
}
.day-tab-code { font-size: 12px; font-weight: 600; }
.day-tab-num { font-size: 14px; font-weight: 700; }
.day-tab.active {
  color: var(--accent);
}
.day-tab.active .day-tab-num {
  background: var(--accent);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.date-pill {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
  padding-left: 2px;
}

/* Lesson cards */
.lesson-list { display: flex; flex-direction: column; gap: 10px; }
.lesson-slot { display: flex; flex-direction: column; gap: 8px; }
.lesson-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.lesson-empty { opacity: 0.55; }

.lesson-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  background: var(--grey);
}
.ic-pz { background: rgba(109, 91, 208, 0.22); }
.ic-lk { background: rgba(46, 139, 107, 0.22); }
.ic-pr { background: rgba(58, 123, 253, 0.2); }
.ic-empty { background: transparent; border: 1px solid var(--border); color: var(--muted); }

.lesson-body { flex: 1; min-width: 0; }
.lesson-subject {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 3px;
}
.lesson-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}
.lesson-teacher {
  font-size: 12.5px;
  color: #c4cadb;
  margin-bottom: 1px;
}
.lesson-room {
  font-size: 12.5px;
  color: var(--muted);
}
.lesson-link { color: var(--accent); text-decoration: none; }

.lesson-time {
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.lesson-time-dash { color: var(--muted); font-weight: 400; font-size: 11px; }

/* Modal (week picker) */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: 100%;
  max-width: 460px;
  max-height: 75vh;
  background: var(--panel);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  border: 1px solid var(--border);
  border-bottom: none;
  display: flex;
  flex-direction: column;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.modal-close {
  background: var(--grey);
  border: none;
  color: var(--text);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
}
.modal-list { overflow-y: auto; padding: 6px 0; }
.modal-item {
  display: block;
  padding: 13px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.modal-item:hover { background: rgba(255,255,255,0.03); }

/* Setup screen */
.setup-wrap { padding-top: 24px; }
.setup-head { text-align: center; margin-bottom: 28px; }
.setup-icon { font-size: 34px; margin-bottom: 10px; }
.setup-head h1 { font-size: 21px; font-weight: 800; margin: 0 0 10px; }
.setup-sub { color: var(--muted); font-size: 13.5px; line-height: 1.5; margin: 0; }

.setup-error {
  background: rgba(220, 60, 60, 0.12);
  border: 1px solid rgba(220, 60, 60, 0.4);
  color: #ff9a9a;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}

.setup-block { margin-bottom: 22px; }
.setup-label { font-size: 13.5px; font-weight: 700; margin-bottom: 10px; }
.choice-row { display: flex; gap: 10px; }
.choice {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: var(--card);
  position: relative;
}
.choice input { position: absolute; opacity: 0; }
.choice:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(58, 123, 253, 0.08);
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 15px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  font-family: inherit;
}
.btn-primary:hover { background: #2f6ae0; }
.btn-ghost {
  display: block;
  text-align: center;
  color: var(--muted);
  text-decoration: none;
  padding: 14px;
  font-size: 13.5px;
}
