* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  --ink: #202b4a;
  --muted: #56617a;
  --surface: #fff;
  --wash: #eef1f9;
  --line: #dce1ed;
  --line-strong: #b4bed2;
  --focus: #626bc0;
  --shadow: 0 6px 18px #29385f0d;
  color: var(--ink);
  background: #f2f4fa;
  font: 1rem/1.5 system-ui, sans-serif;
}
body { margin: 0; }
header { background: var(--surface); border-bottom: 1px solid var(--line); }
.mast, main { width: min(100% - 2rem, 1340px); margin-inline: auto; }
.mast { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-block: .75rem; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-size: 1.2rem; font-weight: 800; }
.brand span { display: grid; place-items: center; width: 2.15rem; height: 2.15rem; border-radius: .6rem; background: var(--ink); color: #e7ebff; font: italic bold 1.45rem Georgia, serif; }
a { color: inherit; text-decoration: none; }
small, #description, #status { color: #4c6069; }
h1, h2, p { margin: 0; }
h1 { font: 750 clamp(2.2rem, 6vw, 3.5rem)/1.1 system-ui, sans-serif; margin-bottom: .4rem; }
h2 { font-size: 1.45rem; }
nav { display: flex; flex-wrap: wrap; gap: .4rem; margin-block: .8rem; }
:where(#collections, #tools, .app-rail, .collection-filters) a, button, #download { min-height: 44px; padding: .55rem .75rem; border: 1px solid var(--line-strong); border-radius: .65rem; background: var(--surface); color: inherit; font: inherit; font-weight: 650; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
:where(#collections, #tools, .collection-filters) a[aria-current] { background: #e9edfc; color: #343e87; border-color: #c9d3ef; }
#download { background: #e3eee3; color: #0e503e; border-color: #9fbba8; }
#run { background: #142c3c; color: white; border-color: #142c3c; }
.work { background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; padding: clamp(.85rem, 4vw, 1.5rem); margin-bottom: 1rem; box-shadow: var(--shadow); }
form, label { display: grid; gap: .4rem; }
form { gap: .85rem; margin-top: 1rem; }
.dimensions { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
#photo-preview { display: grid; justify-items: center; gap: .65rem; }
#photo-canvas { display: block; max-width: 100%; height: auto; border: 1px solid #c8c2b3; border-radius: .5rem; background: repeating-conic-gradient(#e5e6df 0% 25%, #fff 0% 50%) 50% / 16px 16px; }
#photo-canvas[data-crop] { cursor: grab; touch-action: none; }
#photo-canvas[data-crop]:active { cursor: grabbing; }
#crop-controls, #label-controls, #photo-paper, #cover-fields, #cleanup-fields { width: 100%; min-width: 0; margin: 0; border: 1px solid #ddd8ca; border-radius: .65rem; }
#cover-fields > * + *, #cleanup-fields > * + * { margin-top: .55rem; }
.check { display: flex; align-items: center; gap: .5rem; min-height: 44px; }
.check input { width: 1.15rem; min-height: auto; height: 1.15rem; accent-color: #0e503e; }
#corners-stage { position: relative; width: fit-content; max-width: calc(100% - 44px); margin: 24px auto; }
#corners-canvas { display: block; max-width: 100%; height: auto; }
button.corner-handle { position: absolute; transform: translate(-50%, -50%); width: 44px; height: 44px; min-height: 0; padding: 0; border: 2px solid #fff4b5; border-radius: 50%; background: #142c3c; color: white; cursor: grab; touch-action: none; }
.corner-handle:active { cursor: grabbing; }
#cleanup-result { margin: 0; }
#cleanup-compare { display: grid; gap: .85rem; }
#cleanup-compare:has(#cleanup-fields[hidden]) { display: none; }
@media (min-width: 680px) {
  #cleanup-compare:has(#cleanup-result:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
#cleanup-result img, #pdf-preview-image { display: block; width: 100%; height: auto; border: 1px solid #ddd8ca; border-radius: .45rem; }
#pdf-preview-panel { display: grid; gap: .75rem; margin-top: 1rem; }
#semester-body, .semester-rows { display: grid; gap: .75rem; }
.semester-rows:empty { display: none; }
.semester-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: .6rem; }
.semester-row { min-width: 0; display: grid; gap: .6rem; margin: 0; border: 1px solid #ddd8ca; border-radius: .65rem; }
.semester-row > button, #semester-body > button { justify-self: start; }
#semester-body input[type=checkbox] { width: 1.15rem; min-height: auto; height: 1.15rem; accent-color: #0e503e; }
#semester-body textarea { width: 100%; resize: vertical; padding: .5rem; border: 1px solid #c8c2b3; border-radius: .5rem; color: inherit; font: inherit; }
#semester-body details > label { margin-top: .5rem; }
.placement-prompt { display: grid; gap: .7rem; padding: clamp(.9rem, 3vw, 1.4rem); border: 1px solid #d4dbcb; border-radius: .85rem; background: #f4f7ed; }
.placement-prompt :is(p,h3) { margin: 0; }
.placement-prompt > p:first-child { color: #435f56; font-size: .84rem; }
.placement-prompt h3 { font-size: clamp(1.1rem, 3vw, 1.42rem); line-height: 1.35; }
.placement-timer { width: fit-content; color: #145745; font-size: 1.75rem; font-variant-numeric: tabular-nums; font-weight: 700; }
.placement-prompt > [role=status]:empty { display: none; }
.placement-controls { display: flex; flex-wrap: wrap; gap: .42rem; }
.placement-controls button[aria-pressed=true] { background: #dcece1; border-color: #87ab98; color: #164a39; }
.focus-clock { padding: clamp(1rem, 4vw, 1.65rem); border: 1px solid #b6d0bf; border-radius: 1rem; background: #edf5ec; color: #184737; }
.focus-clock[data-phase=break] { background: #f5f0e7; color: #6e4928; border-color: #dfc9af; }
.focus-clock > p { margin: 0; }
.focus-clock > [role=timer] { margin-block: .5rem .7rem; font-size: clamp(2.15rem, 11vw, 4rem); line-height: 1.05; font-weight: 650; font-variant-numeric: tabular-nums; }
.focus-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.focus-actions > button:first-child { background: #184737; color: #fff; border-color: transparent; }
.focus-clock > [role=status]:not(:empty) { margin-top: .55rem; }
.focus-settings { padding: .25rem .75rem; border: 1px solid var(--line-strong); border-radius: .65rem; }
.focus-settings > summary { padding: .62rem 0; cursor: pointer; font-weight: 650; }
.focus-settings .semester-fields { margin-bottom: .6rem; }
.focus-settings > button { margin-bottom: .5rem; }
.focus-settings > p:empty { display: none; }
.flashcard-panel :is(h3,.flashcard-answer) { white-space: pre-wrap; overflow-wrap: anywhere; }
.flashcard-answer:not([hidden]) { padding-top: .65rem; border-top: 1px solid var(--line-strong); }
.flashcard-status { color: #486359; font-size: .88rem; }
.flashcard-status:empty { display: none; }
.study-next-action { background: #184737; border-color: #184737; color: #fff; }
#semester-body[data-revision-ready] + .actions #semester-run { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.study-flow-card { display: grid; gap: .35rem; padding: .8rem; margin: .45rem 0; border: 1px solid #afd1be; border-inline-start: 3px solid #388569;
  border-radius: .66rem; background: #f4f9f2; color: #184737; }
.study-flow-card :is(h4,p) { margin: 0; }
.study-flow-card button { justify-self: start; margin-top: .15rem; }
.archive-entry-preview { display: block; color: var(--muted); margin-top: .2rem; }
.local-privacy { margin: .6rem 0 0; color: var(--muted); font-size: .85rem; }
#checksum-result { display: grid; gap: .5rem; }
#copy-checksum { justify-self: start; }
#checksum-value { font-family: ui-monospace, monospace; }
.placement-drills { display: grid; gap: .7rem; margin-top: 1rem; }
.placement-drills > article { padding: .8rem; border: 1px solid #bbccbf; border-radius: .7rem; background: var(--surface); }
.placement-drills :is(h4,h5) { margin: 0; font-size: 1rem; }
.placement-drills p { margin: .55rem 0; }
.placement-drills summary { min-height: 44px; padding-block: .6rem; cursor: pointer; font-weight: 650; }
.placement-drills a { display: inline-flex; align-items: center; min-height: 44px; }
@media (max-width: 520px) {
  .placement-settings, #semester-form[data-placement] #semester-result dl { grid-template-columns: minmax(0, 1fr); }
  #semester-form[data-placement] #semester-result dt { font-weight: 650; }
  #semester-form[data-placement] #semester-result dd:not(:last-child) { margin-bottom: .4rem; }
}
@media (360px <= width <= 520px) {
  .placement-pack-settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .placement-pack-settings > :is(:first-child,:last-child) { grid-column: 1/-1; }
  #semester-form[data-placement] #semester-result:has(.placement-drills) dl { grid-template-columns: minmax(0, 6rem) minmax(0, 1fr); }
}
#semester-result { background: #e3eee3; border-radius: .65rem; padding: .8rem; overflow-wrap: anywhere; }
#semester-result[data-error] { background: #fae9e2; color: #962e27; }
#semester-result h3 { margin: 0; }
#semester-result dl { display: grid; grid-template-columns: 1fr minmax(0, 1.15fr); gap: .45rem .75rem; margin: .65rem 0 0; }
#semester-result dd { margin: 0; color: #33545a; }
#semester-run { background: #142c3c; color: white; border-color: #142c3c; }
#semester-download, #semester-report-download, #data-download { min-height: 44px; padding: .55rem .75rem; border: 1px solid #9fbba8; border-radius: .65rem; background: #e3eee3; color: #0e503e; font-weight: 650; }
#data-form textarea { width: 100%; min-width: 0; resize: vertical; padding: .5rem; border: 1px solid #c8c2b3; border-radius: .5rem; color: inherit; font: inherit; font-weight: 400; }
#data-output { background: #f4f8f1; }
#data-result .actions { margin-top: .6rem; }
#data-run { background: #142c3c; color: white; border-color: #142c3c; }
#data-status:empty { display: none; }
#data-status[data-error] { color: #962e27; }
#table-settings { display: grid; gap: .55rem; min-width: 0; margin: 0; border: 1px solid #ddd8ca; border-radius: .65rem; }
#photo-fit-field { grid-column: 1 / -1; }
#label-controls > * + * { margin-top: .55rem; }
#mark-status { color: #4c6069; }
#photo-canvas[tabindex="0"] { cursor: crosshair; }
.crop-sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(115px, 1fr)); gap: .55rem; margin-bottom: .5rem; }
input[type=range] { accent-color: #0e503e; min-height: 32px; }
#collections a { font-weight: 750; }
#tools { margin-top: -.15rem; }
label { font-weight: 650; }
.picker { border: 1px dashed var(--line-strong); border-radius: .8rem; padding: .85rem; background: #f7f8fd; }
.picker input::file-selector-button { min-height: 40px; padding-inline: .7rem; margin-inline-end: .55rem; font: inherit; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
input, select { width: 100%; min-width: 0; min-height: 44px; color: inherit; font: inherit; }
input:not([type=file]), select { border: 1px solid #c8c2b3; border-radius: .5rem; padding: .4rem .6rem; background: white; }
ol { margin: 0; padding: 0; list-style: none; }
#outcomes { margin: 0; padding: 0; list-style: none; }
#outcomes li { display: grid; gap: .1rem; padding-block: .45rem; }
#outcomes li span { font-weight: 650; }
#outcomes small[data-error] { color: #962e27; }
li { display: flex; align-items: center; gap: .3rem; border-bottom: 1px solid #ebe4d3; padding: .25rem 0; }
li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
li button { padding: .3rem .45rem; min-width: 44px; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
#status:empty { display: none; }
#status[data-error] { color: #962e27; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.app-rail { display: flex; gap: .3rem; width: fit-content; margin: .75rem 0 0; padding: .3rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.app-rail :is(a, button) { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; background: transparent; border: 0; border-radius: 11px; color: var(--muted); }
.app-rail :is(a, button):hover, .app-rail button:focus-visible { color: var(--ink); background: var(--wash); }
.app-rail a[aria-current] { color: white; background: var(--ink); box-shadow: 0 3px 8px #202b4a30; }
.main-content, .directory-results { min-width: 0; }

#directory { padding-block: .85rem 2rem; }
.directory-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1rem;
  padding: clamp(1rem, 3vw, 2rem); background: linear-gradient(112deg, var(--surface) 41%, #e9eefb); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.directory-hero h1 { margin: 0 0 1rem; font-size: clamp(1.85rem, 4vw, 3.2rem); letter-spacing: -.065em; }
.directory-tagline { margin: -.45rem 0 .9rem; color: var(--muted); }
#directory[data-bucket] .directory-tagline { display: none; }
.directory-search { display: flex; align-items: center; gap: .65rem; max-width: 38rem; padding-inline: .8rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 11px; color: var(--muted); }
.directory-search:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.directory-search input:not([type=file]) { padding: .35rem 0; background: transparent; border: 0; outline: 0; color: var(--ink); font-weight: 500; }
.directory-search input::placeholder { color: var(--muted); }
.search-shortcut { flex: none; padding: .13rem .35rem; border: 1px solid var(--line); border-radius: 5px; font-size: .72rem; color: var(--muted); background: var(--wash); }
.directory-note { display: grid; place-items: center; width: clamp(3.5rem, 9vw, 6rem); aspect-ratio: 1; border: 1px solid #b8c3e7; border-radius: 18px; color: #373f7f; transform: rotate(-7deg);
  background: repeating-linear-gradient(0deg, transparent 0 13px, #4853a614 13px 14px), #f6f7ff; box-shadow: 7px 9px 0 #bfc9f0; margin-inline: 0 .85rem; }
.directory-note .icon { width: 48%; height: 48%; }
#directory[data-bucket] .directory-note { display: none; }
#directory[data-bucket] .directory-hero { grid-template-columns: minmax(0, 1fr); background: var(--surface); }

.directory-section-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .25rem .6rem; margin-block: 1rem .55rem; }
.directory-section-heading h2 { font-size: 1.17rem; letter-spacing: -.025em; }
.directory-count, .bucket-count { color: var(--muted); font-size: .77rem; }
.bucket-grid, .tool-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .55rem; }
.bucket-card { --tile: #eaeafe; --glyph: #404791; display: grid; grid-template-columns: auto minmax(0,1fr); gap: .1rem .55rem; align-items: center;
  min-height: 59px; padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.bucket-card[data-bucket=study] { --tile: #e5f2ed; --glyph: #24604b; }
.bucket-card[data-bucket=campus] { --tile: #f8ecdc; --glyph: #80501b; }
.bucket-card[data-bucket=data] { --tile: #efe6f8; --glyph: #694383; }
.bucket-card[data-bucket=careers], .directory-tool[data-collection=placement] { --tile: #f9e6e4; --glyph: #853e55; }
.bucket-card[aria-current] { border-color: #afb9e6; background: #eef0fe; }
.bucket-card h3 { margin: 0; font-size: .87rem; line-height: 1.2; }
.bucket-icon, .tool-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--tile, #eaeafe); color: var(--glyph, #404791); }
.bucket-icon { grid-row: span 2; }
.directory-tool { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: .65rem; min-height: 64px; padding: .55rem .7rem;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.directory-tool strong { font-size: .91rem; line-height: 1.3; overflow-wrap: anywhere; }
.directory-tool:is([data-collection=semester], [data-collection=engineering], [data-collection=lab]) { --tile: #e5f2ed; --glyph: #24604b; }
.directory-tool:is([data-collection=cleanup], [data-collection=tables], [data-collection=code]) { --tile: #efe6f8; --glyph: #694383; }
.directory-tool:is([data-collection=everyday], [data-collection=money]) { --tile: #f8ecdc; --glyph: #80501b; }
.tool-text { min-width: 0; display: grid; gap: .25rem; }
.tool-blurb { font-size: .81rem; color: var(--muted); line-height: 1.4; }
.tool-arrow { width: 15px; height: 15px; color: var(--muted); }
.directory-empty { padding: .75rem 0; color: var(--muted); }
.directory-more { display: block; margin: .8rem auto 0; }
.collection-filters { margin: .85rem 0 .25rem; }
.collection-filters a { font-size: .83rem; }
.directory-categories { display: block; margin: 0; }
.directory-history .tool-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
.directory-history .directory-tool { min-height: 44px; background: transparent; border-color: transparent; padding: .28rem .3rem; }
.directory-history .tool-icon { width: 27px; height: 27px; border-radius: 7px; }
.directory-history .tool-icon .icon { width: 16px; height: 16px; }
.directory-history .directory-tool strong { font-size: .8rem; }
.history-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: .45rem; font-size: .86rem; font-weight: 700; }
.work-heading { display: flex; gap: .5rem; align-items: center; justify-content: space-between; }
.work-heading :is(h1, h2) { margin: 0; font-size: clamp(1.5rem, 3vw, 2.1rem); letter-spacing: -.045em; line-height: 1.2; }
#pin-tool { display: grid; place-items: center; border-color: transparent; background: var(--wash); width: 44px; padding: 0; flex: none; }
#pin-tool[aria-pressed=true] { color: #80501b; background: #f8ecdc; }
#pin-tool[aria-pressed=true] .icon { fill: #eac985; }
.bucket-card, .directory-tool { transition: border-color 150ms ease, box-shadow 150ms ease; }
@media (hover: hover) {
  .bucket-card:hover, .directory-tool:hover { border-color: #a7b0d0; box-shadow: 0 3px 12px #202b4a12; }
}

#tool-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: .65rem; margin-top: .85rem; align-items: start; }
.tool-sidebar { min-width: 0; }
#tool-directory-link { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; font-size: .87rem; font-weight: 700; }
#tool-directory-link .icon { width: 17px; height: 17px; }
.tool-sidebar nav { margin-block: .35rem .75rem; }
.tool-sidebar nav a { font-size: .82rem; min-height: 44px; padding: .55rem .65rem; }
.tool-collections { margin-top: .25rem; }
.tool-collections summary { display: flex; align-items: center; justify-content: space-between; gap: .5rem; list-style: none; min-height: 44px;
  padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: .86rem; font-weight: 700; cursor: pointer; }
.tool-collections summary::-webkit-details-marker { display: none; }
.tool-collections summary .icon { width: 16px; height: 16px; transform: rotate(90deg); }
.tool-collections[open] summary .icon { transform: rotate(-90deg); }
.work { min-width: 0; }
@media (min-width: 960px) {
  main { display: grid; grid-template-columns: 56px minmax(0,1fr); gap: 1rem; }
  .app-rail { display: grid; align-content: start; position: sticky; top: 1rem; height: fit-content; margin-top: .85rem; }
  #directory, #tool-layout { grid-template-columns: 205px minmax(0,1fr); gap: .85rem 1rem; align-items: start; }
  #directory { display: grid; }
  #directory-content, .directory-columns { display: contents; }
  .directory-hero, .directory-results { grid-column: 2; }
  .directory-categories { grid-column: 1; grid-row: 1/span 2; position: sticky; top: 1rem; }
  .directory-categories .directory-section-heading { margin: 0 0 .55rem; }
  .directory-categories .directory-section-heading h2 { font-size: .88rem; }
  .directory-categories .bucket-grid { grid-template-columns: minmax(0,1fr); }
  .directory-results .tool-grid { grid-template-columns: repeat(auto-fit,minmax(min(100%,235px),1fr)); }
  .tool-sidebar nav { display: grid; gap: .18rem; max-height: 56vh; overflow: auto; padding: .2rem; }
  .tool-sidebar #collections a, .tool-sidebar #tools a { background: transparent; border-color: transparent; }
  .tool-sidebar #collections a[aria-current], .tool-sidebar #tools a[aria-current] { color: #343e87; background: #e9edfc; border-color: #c9d3ef; }
}
@media (max-width: 959px) {
  .directory-columns[data-searching] .directory-categories, .directory-history { display: none; }
  .tool-sidebar nav { flex-wrap: nowrap; overflow: auto; scrollbar-width: thin; padding: .25rem; margin-inline: -.25rem; }
  .tool-sidebar nav a { flex: 0 0 auto; white-space: nowrap; }
}
@media (max-width: 540px) {
  .directory-hero { grid-template-columns: minmax(0,1fr); }
  .directory-note, .search-shortcut, .tool-sidebar nav, .tool-collections { display: none; }
  .tool-grid { grid-template-columns: minmax(0,1fr); }
  body:has(#tool-layout:not([hidden])) .app-rail { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .bucket-card, .directory-tool { transition: none; }
}

.site-footer { width: min(100% - 2rem, 1340px); margin: 2rem auto 1.5rem; font-size: .85rem; color: var(--muted); }
.site-footer a { text-decoration: underline; }
.licences { padding-block: 1.5rem; display: grid; gap: 1rem; }
.licences table { border-collapse: collapse; width: 100%; background: var(--surface); }
.licences :is(th, td) { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.licences a { text-decoration: underline; }

[data-entry-tool]:not([data-entry-ready]) .work > :not(.work-heading, #description, .search-guide),
[data-entry-tool]:not([data-entry-ready]) #pin-tool { display: none; }
