:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --ink: #1b1d22;
  --muted: #5d6270;
  --line: #e4e2db;
  --accent: #1f5eff;
  --accent-ink: #ffffff;
  --accent-soft: #e8eeff;
  --good: #0f7b4f;
  --radius: 14px;
  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121317; --surface: #1b1d23; --ink: #eceef3; --muted: #9aa0ad;
    --line: #2b2e37; --accent: #6f95ff; --accent-ink: #0b0d12; --accent-soft: #1e2640; --good: #4fd19a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.55; font-size: 16px; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }

/* header / footer */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; }
.logo { font-weight: 800; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; font-size: 19px; }
.logo span { color: var(--accent); }
.nav { display: flex; gap: 18px; font-size: 14px; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--ink); }
@media (max-width: 600px) { .nav .hide-sm { display: none; } }
.site-footer { margin-top: 64px; padding: 28px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 8px; }
.site-footer a { color: var(--muted); }

/* typography */
h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.15; letter-spacing: -0.025em; margin: 36px 0 10px; }
h2 { font-size: 22px; letter-spacing: -0.015em; margin: 40px 0 12px; }
h3 { font-size: 17px; margin: 24px 0 6px; }
.lede { color: var(--muted); font-size: 18px; margin: 0 0 24px; max-width: 640px; }
.crumbs { font-size: 13px; color: var(--muted); margin-top: 20px; }
.crumbs a { color: var(--muted); }

/* cards and calculator */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.calc { display: grid; grid-template-columns: 1fr 260px; gap: 20px; align-items: start; }
@media (max-width: 760px) { .calc { grid-template-columns: 1fr; } }
.result { position: sticky; top: 16px; background: var(--accent); color: var(--accent-ink); border-radius: var(--radius); padding: 20px; }
.result .label { font-size: 13px; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.06em; }
.result .big { font-size: 44px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.result .row { display: flex; justify-content: space-between; margin-top: 12px; font-variant-numeric: tabular-nums; }
.result .note { font-size: 14px; margin-top: 12px; opacity: 0.95; }

table.inputs { width: 100%; border-collapse: collapse; }
table.inputs th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding: 0 6px 6px; }
table.inputs td { padding: 4px 3px; vertical-align: middle; }
input, select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; width: 100%; min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.grade-cell { display: flex; gap: 6px; }
.grade-cell select { min-width: 74px; }
.grade-cell input.small { width: 78px; flex: none; }
td:has(.credits) { width: 84px; }
td:has(.remove) { width: 36px; }
.icon-btn { border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--accent-soft); color: var(--ink); }
.btn-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 9px 14px; border-radius: 10px; cursor: pointer; }
.btn.primary { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn:hover { filter: brightness(0.97); }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 14px; font-weight: 600; }
.field .hint { font-size: 13px; color: var(--muted); }
.prior { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
@media (max-width: 760px) {
  table.inputs .name { min-width: 70px; }
  td:has(.credits) { width: 62px; }
  .grade-cell input.small { width: 62px; }
  .grade-cell select { min-width: 64px; padding-right: 4px; }
  table.inputs td { padding: 4px 2px; }
  .card { padding: 14px; }
  .r-table-wrap { overflow-x: auto; }
}

/* content */
table.scale { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.scale th, table.scale td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--line); }
table.scale th { font-size: 13px; color: var(--muted); }
table.scale tr:last-child td { border-bottom: 0; }
.prose { max-width: 680px; }
.prose li { margin-bottom: 6px; }
.source { font-size: 13px; color: var(--muted); }
details { border-bottom: 1px solid var(--line); padding: 12px 0; }
summary { font-weight: 600; cursor: pointer; }

/* home */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tile { display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.tile strong { display: block; font-size: 16px; }
.tile span { font-size: 14px; color: var(--muted); }
.tile .tag { display: inline-block; margin-top: 8px; font-size: 12px; font-family: var(--mono); background: var(--accent-soft); color: var(--accent); padding: 2px 8px; border-radius: 999px; }
.search { max-width: 420px; margin-bottom: 14px; }

/* ad slots: reserve space so the layout doesn't jump when ads load */
.ad-slot { margin: 28px 0; min-height: 100px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); font-size: 12px; }
.ad-slot:empty::before { content: "Ad space"; }
body.ads-off .ad-slot { display: none; }

/* phones: keep the result visible while typing, and drop the optional course-name column */
@media (max-width: 760px) {
  .result { position: sticky; top: auto; bottom: 10px; padding: 14px 16px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
  .result .big { font-size: 32px; }
  .result .row { margin-top: 6px; }
}
@media (max-width: 480px) {
  .gpa-table td:first-child, .gpa-table th:first-child { display: none; }
}

/* schedule tool */
.sched-step { margin-bottom: 14px; }
.step-label { display: block; font-weight: 700; margin-bottom: 10px; }
.sched-breaks { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; columns: 2; column-gap: 28px; }
@media (max-width: 640px) { .sched-breaks { columns: 1; } }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px 16px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over, .drop:focus { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.drop span { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; }
#sched-preview { max-width: 100%; max-height: 220px; margin-top: 12px; border-radius: 10px; border: 1px solid var(--line); }
.sched-text { border: 0; padding: 12px 0 0; }
.sched-text textarea { width: 100%; font: inherit; font-size: 14px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 10px; margin: 8px 0; }
.sched-status { font-weight: 600; margin: 10px 0 0; }
.sched-status:empty { display: none; }
.hint { color: var(--muted); font-size: 14px; }
.sched-table td { white-space: nowrap; }
.sched-table .code { min-width: 96px; }
.sched-table .loc { min-width: 110px; }
.sched-table input[type="time"] { min-width: 104px; }
.days { display: flex; gap: 3px; }
.day input { position: absolute; opacity: 0; pointer-events: none; }
.day span { display: inline-grid; place-items: center; width: 30px; height: 36px; border: 1px solid var(--line); border-radius: 8px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--muted); user-select: none; }
.day input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.day input:focus-visible + span { outline: 2px solid var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.sched-table .type { min-width: 118px; }
