:root { --font-size-description: .875rem; --font-weight-description: 400; --font-size-label: .8125rem; --font-weight-label: 700; --font-size-map: .875rem; --font-size-map-tick: .75rem; font-family: Arial, Helvetica, sans-serif; color: #141414; background: #fff; font-synthesis: none; line-height: 1.5; }
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, input, select, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #005a94; outline-offset: 3px; }
[hidden] { display: none !important; }
/* Let content grow on small screens; spare viewport height belongs to the map. */
main { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; padding: .75rem; }
h2, p { margin-top: 0; }

/* Shared typography. Component rules below only set their differences. */
.field label, .course-headings, .standing-chip, .planner-tabs button, .value-control, .range-limits, .remove-class, .add-class-button, .legend span { font-size: var(--font-size-label); }
.section-heading > p, .field-hint, .disclaimer, .forced-colors-note { color: #586570; }
.section-heading > p, .field-hint, .disclaimer, .forced-colors-note, .input-error, .field-error, .credit-warning { font-size: var(--font-size-description); font-weight: var(--font-weight-description); }
.field label, .course-headings { font-weight: var(--font-weight-label); color: #384550; }
.standing-chip, .planner-tabs button, .add-class-button { font-weight: 600; }

/* History and semester controls. */
.page-shell { display: flex; flex-direction: column; flex: 1 0 auto; width: 100%; min-width: 0; margin: 0; border: 1px solid #d6dde2; border-radius: .75rem; overflow-wrap: anywhere; }
.calculator-card { display: grid; flex: none; grid-template-columns: 40% 60%; }
.history-panel, .semester-panel { display: flex; flex-direction: column; padding: .5rem 1.5rem 1.125rem; min-width: 0; }
.history-panel { border-right: 1px solid #e4e8eb; }
.section-heading { margin-bottom: 1.75rem; }
.semester-panel > .section-heading { margin-bottom: .25rem; }
.section-title { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; margin-bottom: .1875rem; }
.section-heading h2 { font-size: 1.25rem; font-weight: 700; margin: 0; }
.section-heading > p { margin-bottom: 0; }
.section-heading a { color: inherit; text-underline-offset: 2px; }
.history-fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,8rem),1fr)); gap: .875rem; }
.history-fields, #simple-panel, #advanced-panel { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: .25rem; }
input[type=number], select { color: #141414; background: #fff; border: 1px solid #68737d; border-radius: .4375rem; min-width: 0; min-height: 2.5rem; padding: .375rem .625rem; font-size: 1rem; }
input[type=number]:hover, select:hover { border-color: #8996a0; }
.field input:user-invalid, input[aria-invalid=true], select[aria-invalid=true] { border: 2px solid #9b332c; }
.history-fields input { width: 7rem; max-width: 100%; }
.standing-chip { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem .6875rem; margin: 0; max-width: 100%; color: #48535d; background: #edf2f5; border: 3px solid currentColor; border-radius: 999px; }
#current-standing { border-color: #ffb11f; }
.standing-bar { display: flex; align-items: center; justify-content: flex-start; margin-top: auto; padding: .5rem 0; }
.status-dot { flex: none; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.planner-toolbar { margin-bottom: 1rem; }
.planner-toolbar:has(#advanced-tab[aria-selected=true]) { margin-bottom: 0; }
.planner-tabs { display: flex; flex-wrap: wrap; flex-shrink: 0; width: fit-content; max-width: 100%; gap: .1875rem; background: #edf2f5; padding: .1875rem; border-radius: .4375rem; }
.planner-tabs button { background: transparent; border: 2px solid transparent; padding: .4375rem .875rem; min-width: 5.5rem; border-radius: .3125rem; color: #48535d; }
.planner-tabs [aria-selected=true] { background: #fff; color: #006eb6; border-bottom-color: #006eb6; box-shadow: 0 1px 4px #1b303e24; }
#simple-panel { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.slider-field { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,4fr) 5.25rem; column-gap: .875rem; align-items: center; min-width: 0; }
.slider-field > label { grid-column: 1; grid-row: 2; margin-bottom: 0; }
.slider-field > input[type=range] { grid-column: 2; grid-row: 2; }
.slider-field .range-limits { grid-column: 2; grid-row: 3; }
.slider-field .field-error { grid-column: 1 / -1; grid-row: 4; }
.field-hint { margin-bottom: .5rem; }
.input-help { margin: .5rem 0 0; }
.value-control { display: contents; }
.value-control label { grid-column: 3; grid-row: 1; }
.value-control input { grid-column: 3; grid-row: 2; width: 5.25rem; max-width: 100%; border-radius: .375rem; appearance: textfield; -moz-appearance: textfield; }
.value-control input::-webkit-inner-spin-button, .value-control input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=range] { display: block; width: 100%; min-height: 2rem; margin: 0; appearance: none; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; background: #68737d; border-radius: 999px; }
input[type=range]::-webkit-slider-thumb { appearance: none; width: 18px; height: 18px; margin-top: -7px; border: 2px solid #384550; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #26333c33; }
input[type=range]::-moz-range-track { height: 4px; background: #68737d; border-radius: 999px; }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border: 2px solid #384550; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #26333c33; }
.range-limits { display: flex; justify-content: space-between; color: #586570; }
.input-error, .field-error, .credit-warning { color: #9b332c; }
.input-error { margin: 0 0 1rem; }
.field-error { display: block; margin-top: .25rem; }
.field-error:empty { display: none; }

/* Advanced course entries. Keep the header and rows on one shared grid. */
#courses-help { margin-bottom: 0; }
.course-scroll { max-width: 100%; overflow-x: auto; padding: 0 .25rem .25rem; }
.course-entry-grid { --course-columns: minmax(4.5rem,.7fr) minmax(6rem,1fr) 3.5rem minmax(6rem,1fr) 4.5rem; min-width: 29rem; }
.course-headings, .course-fields { display: grid; grid-template-columns: var(--course-columns); gap: .625rem; align-items: start; }
.course-headings { padding: 0 .625rem; }
.course-row { min-inline-size: 0; margin: 0; padding: 0 .5rem; border: 2px solid transparent; border-radius: .375rem; }
.course-fields > label { display: block; min-width: 0; }
.course-row input[type=number], .course-row select { width: 100%; border-radius: .3125rem; font-size: var(--font-size-description); }
.course-row select:disabled { background: #f4f6f7; color: #9ca6ad; }
.course-fields > .retake-toggle { display: flex; align-items: center; justify-content: center; cursor: pointer; min-height: 2.5rem; }
.retake-toggle input { flex: none; width: 1.125rem; height: 1.125rem; accent-color: #006eb6; }
.remove-class, .add-class-button { min-height: 2.5rem; border-radius: .3125rem; }
.remove-class { justify-self: start; max-width: 100%; padding: .375rem .5rem; border: 1px solid transparent; background: transparent; color: #48535d; font-weight: 400; }
.remove-class:hover { color: #9b332c; background: #f4f6f7; text-decoration: underline; text-underline-offset: 2px; }
.course-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.course-actions .add-class-button { flex: none; }
.credit-warning { flex: 1 1 14rem; margin: 0; }
.add-class-button { display: block; border: 1px solid #68737d; background: #fff; color: #005f9e; margin-top: 0; padding: .5rem .6875rem; }
.add-class-button:hover { background: #f2f9fd; border-color: #006eb6; }
/* Standing map and markers. */
.map-section { display: flex; flex-direction: column; flex: 1 0 auto; min-width: 0; background: #f2f9fd; border-top: 1px solid #dfe4e8; border-radius: .625rem; padding: 1rem 1.5rem .75rem; }
.legend { display: flex; flex: none; flex-wrap: wrap; gap: .625rem 1.125rem; margin: 0 0 0 3.8125rem; }
.legend span { display: inline-flex; align-items: center; gap: .4375rem; color: #48535d; }
.legend i { flex: none; width: .8125rem; height: .8125rem; border: 1px solid #141414; border-radius: 2px; }
.chart-frame { position: relative; flex: 1 0 21rem; width: 100%; min-height: 21rem; container-type: size; }
/* Keep canvas sizing from contributing back into the flexible container height. */
/* Scale text within both map dimensions, using a 1000px by 336px reference size. */
.chart-frame canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; font-size: var(--font-size-map); font-size: max(var(--font-size-map), min(1.4cqw, 4.166667cqh)); }
.plot-marker { position: absolute; width: 20px; height: 25px; pointer-events: none; transform: translate(-50%,-100%); filter: drop-shadow(0 2px 2px #00284333); }
.plot-marker i { position: relative; display: block; width: 20px; height: 20px; border: 2px solid #141414; outline: 2px solid #fff; border-radius: 50% 50% 50% 0; background: var(--pin-color); transform: rotate(-45deg); margin: 0 auto; }
.plot-marker i::after { content: ""; position: absolute; left: 6px; top: 6px; width: 4px; height: 4px; border-radius: 50%; background: #fff; }
.projected-marker i { border-style: dashed; }
.plot-marker span { position: absolute; z-index: 1; top: 26px; padding: 0 7px; color: var(--label-color); width: max-content; max-width: min(14em,calc(100vw - 3rem)); text-align: center; background: transparent; text-shadow: -1px -1px 0 #ffffff, 1px -1px 0 #ffffff, -1px 1px 0 #ffffff, 1px 1px 0 #ffffff; font-size: var(--font-size-label); font-size: max(var(--font-size-label), min(1.3cqw, 3.869048cqh)); font-weight: var(--font-weight-label); }
.current-marker { --pin-color: #ffb11f; --label-color: #815400; }
.projected-marker { --pin-color: #6553d3; --label-color: #4540a3; }
.plot-marker.pin-below { transform: translate(-50%,0); }
.plot-marker.pin-below i { margin-top: 5px; transform: rotate(135deg); }
.disclaimer { flex: none; width: 100%; margin: .625rem 0 0; padding: 0 .25rem; }
.forced-colors-note { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
/* Make the keyboard result stop visible while its full summary is being read. */
#calculator-results:focus-within > .sr-only { position: static; width: auto; height: auto; margin: .5rem 0; overflow: visible; clip-path: none; white-space: normal; }

/* Responsive layout and accessibility overrides. */
@media (max-width: 56.25em) and (min-width: 47.5625em) { .history-panel, .semester-panel { padding-inline: 1rem; } }
@media (max-width: 47.5em) {
  .calculator-card { grid-template-columns: 1fr; }
  .history-panel, .semester-panel { padding: .5rem 1.375rem 1.25rem; }
  .history-panel { border-right: 0; border-bottom: 1px solid #e4e8eb; }
  .map-section { padding: 1rem .625rem .75rem; }
  .legend { margin-left: 2.875rem; gap: .625rem .8125rem; }
}
@media (max-width: 28.75em) {
  main { padding: .5rem; }
  .history-panel, .semester-panel { padding: .5rem 1rem 1.125rem; }
  .legend { margin-left: 2.5rem; gap: .5rem .625rem; }
  .legend span { gap: .3125rem; }
}
@media (forced-colors: active) {
  /* Canvas pixels retain their palette: preserve its backdrop and HTML pins too. */
  .chart-frame { forced-color-adjust: none; background: #f2f9fd; }
  /* Keep swatches matched to the plot; legend text still uses the user's theme. */
  .legend i { forced-color-adjust: none; }
  #results-heading, #chart-description { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip-path: none; white-space: normal; }
  .forced-colors-note { display: block; }
  input[type=number], select, button { border-color: CanvasText; }
  :focus-visible { outline-color: Highlight; }
  .planner-tabs [aria-selected=true] { border-bottom: 3px solid Highlight; }
  input[type=range]::-webkit-slider-runnable-track { background: CanvasText; }
  input[type=range]::-moz-range-track { background: CanvasText; }
}
