/* ============ Themes ============ */
:root, :root[data-theme="light"] {
  --bg: #f6f7f9;
  --bg-image: none;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --text: #16191d;
  --muted: #5f6873;
  --border: #e2e5ea;
  --accent: #2257d6;
  --accent-text: #ffffff;
  --accent-soft: #e8eefc;
  --ok: #157347;
  --ok-soft: #e6f4ec;
  --no: #b42318;
  --no-soft: #fdecea;
  --warn-soft: #fff6e0;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --blur: none;
  --header-bg: rgba(255, 255, 255, .92);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1216;
  --surface: #181c22;
  --surface-2: #20252c;
  --text: #e9ecef;
  --muted: #9aa4af;
  --border: #2b313a;
  --accent: #7aa2ff;
  --accent-text: #0f1216;
  --accent-soft: #1d2a45;
  --ok: #5fd08f;
  --ok-soft: #14301f;
  --no: #ff8a7a;
  --no-soft: #3a1a17;
  --warn-soft: #33290f;
  --shadow: none;
  --header-bg: rgba(15, 18, 22, .92);
  color-scheme: dark;
}
:root[data-theme="blur"] {
  --bg: #1b1d3a;
  --bg-image:
    radial-gradient(circle at 15% 20%, #6d5dfc 0, transparent 40%),
    radial-gradient(circle at 85% 15%, #ff6fb1 0, transparent 38%),
    radial-gradient(circle at 70% 85%, #2fd3c4 0, transparent 40%),
    radial-gradient(circle at 20% 90%, #ffb648 0, transparent 35%);
  --surface: rgba(255, 255, 255, .14);
  --surface-2: rgba(255, 255, 255, .10);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, .78);
  --border: rgba(255, 255, 255, .28);
  --accent: #ffffff;
  --accent-text: #3b2a8c;
  --accent-soft: rgba(255, 255, 255, .22);
  --ok: #b6ffd6;
  --ok-soft: rgba(80, 220, 150, .22);
  --no: #ffd0cb;
  --no-soft: rgba(255, 100, 90, .22);
  --warn-soft: rgba(255, 200, 80, .22);
  --shadow: 0 8px 32px rgba(10, 10, 40, .25);
  --blur: blur(18px) saturate(140%);
  --header-bg: rgba(255, 255, 255, .12);
  color-scheme: dark;
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: var(--bg-image);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: clamp(1.6rem, 6vw, 2.4rem); line-height: 1.15; margin: 0 0 10px; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
h3 { font-size: 1rem; margin: 18px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

main { max-width: 1040px; margin: 0 auto; padding: 16px 16px 160px; }

/* glass + surfaces */
.panel, .card, .course, .site-header, .bottom-nav, .tray, .theme-switch, input, select, .auth-card, .step {
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

/* ============ Header ============ */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; margin-right: auto; }
.brand svg { flex: none; }
.top-nav { display: flex; gap: 4px; }
.top-nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.top-nav a.active { color: var(--text); background: var(--surface-2); font-weight: 600; }

.theme-switch { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.theme-switch button {
  display: grid; place-items: center; width: 34px; height: 30px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.theme-switch button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

/* ============ Mobile bottom nav ============ */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: none; grid-template-columns: repeat(4, 1fr);
  background: var(--header-bg); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px 10px; font-size: .72rem; color: var(--muted); text-decoration: none;
}
.bottom-nav a.active { color: var(--accent); font-weight: 600; }

@media (max-width: 760px) {
  .top-nav { display: none; }
  .bottom-nav { display: grid; }
}

/* ============ Buttons & inputs ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  min-height: 46px; padding: 10px 20px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; }

input[type=search], input[type=email], input[type=password], input[type=text], select {
  font: inherit; width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
}
input::placeholder { color: var(--muted); }
select option { color: #16191d; background: #fff; }

/* ============ Landing ============ */
.landing-hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: center;
  padding: 32px 0 24px;
}
.landing-hero .eyebrow { display: inline-block; font-size: .8rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; margin-bottom: 12px; }
.landing-hero h1 { font-size: clamp(2rem, 7vw, 3rem); }
.landing-hero .lead { font-size: 1.1rem; color: var(--muted); margin-bottom: 20px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-art { width: 100%; height: auto; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 32px; }
.stat { text-align: center; padding: 16px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.stat strong { display: block; font-size: 1.6rem; }
.stat span { font-size: .85rem; color: var(--muted); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.step { padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.step .num { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 700; margin-bottom: 10px; }
.step p { color: var(--muted); margin: 0; font-size: .95rem; }
.cta { text-align: center; padding: 24px 0; }

@media (max-width: 760px) {
  .landing-hero { grid-template-columns: 1fr; padding-top: 12px; gap: 16px; }
  .hero-art { order: -1; max-width: 360px; margin: 0 auto; }
  .hero-actions .btn { flex: 1 1 100%; }
  .steps { grid-template-columns: 1fr; }
}

/* ============ Page heading ============ */
.page-head { padding: 16px 0 8px; }
.page-head p { color: var(--muted); }

/* ============ Course picker ============ */
.search-row { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 8px 0; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.quick-label { font-size: .85rem; color: var(--muted); margin: 12px 0 0; }
.pill {
  font: inherit; font-size: .9rem; min-height: 38px; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.pill[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: transparent; }

.course-list { display: grid; gap: 8px; }
.course {
  display: flex; align-items: center; gap: 12px; min-height: 60px;
  padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
}
.course.on { border-color: var(--accent); background: var(--accent-soft); }
.course input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.course .txt { display: flex; flex-direction: column; min-width: 0; }
.course .title { font-weight: 500; }
.course .meta { font-size: .8rem; color: var(--muted); }
.course .code { font-family: ui-monospace, Consolas, monospace; font-weight: 700; }

.tray {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  background: var(--header-bg); border-top: 1px solid var(--border);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.tray-inner { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.tray-info { flex: 1; min-width: 0; }
.tray-count { font-weight: 600; }
.chips { display: flex; gap: 6px; overflow-x: auto; margin-top: 4px; scrollbar-width: none; }
.chip { flex: none; font: inherit; font-size: .78rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
@media (max-width: 760px) {
  .tray { bottom: calc(58px + env(safe-area-inset-bottom)); padding-bottom: 10px; }
}

/* ============ Results ============ */
.results-bar { display: flex; gap: 8px; align-items: center; margin: 8px 0 4px; }
.results-bar input { flex: 1; }
details.filters { margin: 8px 0; }
details.filters summary { cursor: pointer; list-style: none; display: inline-flex; }
details.filters summary::-webkit-details-marker { display: none; }
.filter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.toggle { display: flex; gap: 10px; align-items: center; font-size: .9rem; color: var(--muted); margin-top: 10px; }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent); }
@media (max-width: 760px) { .filter-grid { grid-template-columns: 1fr; } }

.field-group { margin: 22px 0; }
.field-group h2 { display: flex; justify-content: space-between; align-items: baseline; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.card {
  display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
}
.card:hover { border-color: var(--accent); }
.card.almost { background: var(--warn-soft); }
.card .uni { font-size: .78rem; color: var(--muted); }
.card .pname { font-weight: 650; }
.card .meta { font-size: .82rem; color: var(--muted); }
.card .missing { font-size: .82rem; color: var(--no); }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--text); margin-right: 4px; }

/* ============ Program page ============ */
.back { display: inline-block; margin: 8px 0; text-decoration: none; }
.program-head .uni { color: var(--muted); font-size: .9rem; }
.status { display: inline-block; padding: 8px 12px; border-radius: 10px; font-size: .95rem; margin-top: 6px; }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.no { background: var(--no-soft); color: var(--no); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 12px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px; margin: 12px 0; box-shadow: var(--shadow); }
.grid .panel { margin: 0; }
.avg { font-size: 2rem; font-weight: 700; margin: 0 0 4px; }
.reqs { list-style: none; padding: 0; margin: 0; }
.reqs li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.reqs li:last-child { border-bottom: 0; }
.reqs li.ok { color: var(--ok); }
.reqs li.no { color: var(--no); }
.reqs .have { font-weight: 700; text-decoration: underline; }
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { background: var(--accent-soft); border-radius: 999px; padding: 5px 12px; font-size: .9rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.panel ul { padding-left: 20px; margin: 0; }
.panel ul li { margin-bottom: 4px; }

/* ============ Auth ============ */
.auth-wrap { display: grid; place-items: center; padding: 24px 0; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.6rem; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: .92rem; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); font-size: .9rem; margin-bottom: 16px; }
.error { color: var(--no); font-size: .9rem; min-height: 1.2em; margin: 4px 0 10px; }
.switch-auth { text-align: center; margin-top: 14px; font-size: .95rem; }

.site-footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 24px 16px 140px; }
