:root {
  --paper: #f7f4e9;
  --paper-deep: #ece6d4;
  --ink: #18201c;
  --muted: #647068;
  --line: #cbd0c6;
  --marker: #c8ff36;
  --marker-dark: #8fc600;
  --yellow: #ffe86a;
  --red: #a94436;
  --shadow: 5px 7px 0 rgba(24, 32, 28, .13);
  --display: "Bookman Old Style", Rockwell, Georgia, serif;
  --body: Aptos, "Trebuchet MS", Calibri, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); font-family: var(--body); background: var(--paper); line-height: 1.5; min-height: 100vh; }
.paper-grain { position: fixed; inset: 0; pointer-events: none; opacity: .3; z-index: -1; background-image: repeating-linear-gradient(0deg, transparent 0 31px, rgba(58,96,76,.09) 31px 32px), radial-gradient(circle at 15% 30%, rgba(30,40,35,.07) 0 1px, transparent 1.2px); background-size: auto, 17px 19px; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--marker-dark); outline-offset: 3px; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: .7rem 1rem; color: white; background: var(--ink); transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.hero, main, footer { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.hero { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 3rem; align-items: end; padding: 64px 0 34px; }
.eyebrow, .section-label { margin: 0 0 .45rem; text-transform: uppercase; letter-spacing: .18em; font-weight: 800; font-size: .74rem; }
.eyebrow span { color: var(--marker-dark); }
h1, h2 { font-family: var(--display); letter-spacing: -.045em; }
h1 { margin: 0; font-size: clamp(3.4rem, 9vw, 7.8rem); line-height: .77; max-width: 880px; }
h1 span { position: relative; z-index: 0; }
h1 span::after { content: ""; position: absolute; z-index: -1; height: .25em; left: -.03em; right: -.05em; bottom: .06em; background: var(--marker); transform: rotate(-1deg); }
.subtitle { margin: 1.6rem 0 0; font-size: clamp(1rem, 2vw, 1.35rem); font-weight: 700; }
.sticky-note { width: 190px; padding: 1.15rem 1.2rem; display: grid; gap: .55rem; background: var(--yellow); box-shadow: var(--shadow); transform: rotate(2.4deg); border: 1px solid rgba(24,32,28,.18); }
.sticky-note strong { font-family: var(--display); }
.sticky-note span { display: flex; justify-content: space-between; font-size: .84rem; }
kbd { min-width: 1.6rem; text-align: center; background: rgba(255,255,255,.55); border: 1px solid rgba(24,32,28,.35); border-radius: 3px; box-shadow: 0 2px 0 rgba(24,32,28,.25); }
.search-section { position: relative; margin: 18px 0 30px; }
.search-shell { position: relative; display: flex; align-items: center; background: white; border: 3px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); }
.search-icon { font-family: var(--display); font-size: 2.8rem; line-height: 1; padding-left: 1rem; transform: rotate(-15deg); }
#searchInput { width: 100%; border: 0; color: var(--ink); background: transparent; padding: 1.25rem 4rem 1.25rem 1rem; font-family: var(--display); font-size: clamp(1.45rem, 4vw, 2.35rem); font-weight: 700; outline: 0; }
#searchInput::placeholder { color: #899088; }
.search-mark { position: absolute; left: 4.8rem; right: 4rem; bottom: .9rem; height: 7px; background: var(--marker); opacity: .55; pointer-events: none; transform: rotate(-.3deg); }
.icon-button { border: 0; background: transparent; font-size: 2rem; line-height: 1; cursor: pointer; padding: .5rem .8rem; }
#clearSearch { position: absolute; right: .5rem; z-index: 2; }
.instant-result { display: none; margin: 18px 0 0 2.5%; padding: 1rem 1.25rem 1.15rem; width: min(760px, 95%); border-left: 5px solid var(--marker-dark); background: rgba(255,255,255,.82); box-shadow: 3px 4px 0 rgba(24,32,28,.1); }
.instant-result.visible { display: block; animation: ink-in .2s ease-out; }
.instant-result strong { font-family: var(--display); font-size: 1.2rem; }
.instant-result .category-tag { margin-left: .6rem; }
.toolbar { position: relative; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: center; padding-bottom: 28px; border-bottom: 2px dashed var(--line); }
.filters, .actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.filter, .btn { border: 1.5px solid var(--ink); background: var(--paper); padding: .58rem .78rem; font-weight: 800; cursor: pointer; box-shadow: 2px 3px 0 rgba(24,32,28,.14); transition: transform .14s, box-shadow .14s, background .14s; }
.filter:hover, .btn:hover { transform: translate(-1px,-2px); box-shadow: 4px 5px 0 rgba(24,32,28,.16); }
.filter.active, .btn.marker { background: var(--marker); }
.btn.big { width: 100%; padding: .95rem; }
.data-menu { position: absolute; z-index: 20; right: 0; top: 54px; min-width: 230px; padding: .5rem; background: white; border: 2px solid var(--ink); box-shadow: var(--shadow); }
.data-menu button { display: block; width: 100%; padding: .7rem; text-align: left; border: 0; background: transparent; cursor: pointer; }
.data-menu button:hover, .data-menu button:focus-visible { background: var(--marker); }
.data-menu .danger { color: var(--red); border-top: 1px dashed var(--line); }
.collection-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 36px 0 18px; }
.collection-heading h2 { margin: 0; font-size: clamp(2rem,5vw,3.4rem); }
.count-pill { margin: 0; padding: .35rem .8rem; border-radius: 99px; background: var(--ink); color: white; font-weight: 800; white-space: nowrap; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; align-items: stretch; }
.card { position: relative; display: flex; flex-direction: column; min-height: 270px; padding: 1.15rem; background: rgba(255,255,255,.82); border: 1.5px solid var(--ink); box-shadow: 3px 4px 0 rgba(24,32,28,.12); animation: card-in .35s both; overflow: hidden; }
.card:nth-child(4n+2) { transform: rotate(.25deg); }
.card:nth-child(4n+3) { transform: rotate(-.2deg); }
.card::before { content: ""; position: absolute; width: 64px; height: 15px; top: -5px; left: 50%; transform: translateX(-50%) rotate(-2deg); background: rgba(255,232,106,.8); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.abbr { margin: .25rem 0 0; font: 900 clamp(1.75rem,4vw,2.8rem)/1 var(--display); letter-spacing: -.04em; overflow-wrap: anywhere; }
.favorite-button { border: 0; background: transparent; font-size: 1.45rem; cursor: pointer; color: #9ba19c; }
.favorite-button.active { color: var(--ink); text-shadow: 2px 2px 0 var(--marker); }
.category-tag { display: inline-flex; width: fit-content; margin: .75rem 0 .55rem; padding: .18rem .5rem; background: var(--paper-deep); border: 1px solid var(--line); font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.meaning { margin: 0 0 .55rem; font-weight: 900; font-size: 1.05rem; background: linear-gradient(transparent 64%, rgba(200,255,54,.65) 64%); width: fit-content; }
.explanation { margin: 0; color: #35413a; }
.example { margin: .85rem 0 0; padding-left: .7rem; border-left: 3px solid var(--yellow); color: #4d584f; font-style: italic; }
.formula-line { margin: .8rem 0 0; padding: .55rem .7rem; background: var(--ink); color: white; font-family: "Courier New", monospace; font-size: .82rem; font-weight: 700; }
.unit-ref { display: inline-flex; width: fit-content; margin-top: .75rem; padding: .15rem .45rem; border: 1px dashed var(--muted); color: var(--muted); font-size: .72rem; font-weight: 900; }
.resource-links { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }
.resource-links a { padding: .3rem .5rem; color: var(--ink); background: var(--paper-deep); border: 1px solid var(--line); font-size: .75rem; font-weight: 900; text-decoration: none; }
.resource-links a:hover, .resource-links a:focus-visible { background: var(--marker); border-color: var(--ink); }
.card-actions { display: flex; gap: .35rem; margin-top: auto; padding-top: 1rem; justify-content: flex-end; opacity: .25; transition: opacity .15s; }
.card:hover .card-actions, .card:focus-within .card-actions { opacity: 1; }
.card-actions button { border: 0; background: transparent; text-decoration: underline; cursor: pointer; font-size: .8rem; }
.match-note { margin-top: .65rem; color: var(--muted); font-size: .78rem; }
.empty-state { padding: 70px 20px; text-align: center; border: 2px dashed var(--line); }
.empty-state > span { display: inline-grid; place-items: center; width: 78px; height: 78px; border-radius: 50%; background: var(--yellow); font: 900 3rem var(--display); transform: rotate(8deg); }
.empty-state h2 { font-size: 2rem; margin-bottom: .4rem; }
.library { margin-top: 72px; padding-top: 32px; border-top: 4px solid var(--ink); }
.library-heading { align-items: center; margin-top: 0; }
.library-intro { max-width: 680px; margin: .55rem 0 0; color: var(--muted); }
.source-link { text-decoration: none; white-space: nowrap; }
.course-blocks { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 26px 0 24px; }
.block-ticket { position: relative; padding: 1rem; min-height: 120px; background: white; border: 2px solid var(--ink); box-shadow: 3px 4px 0 rgba(24,32,28,.14); overflow: hidden; }
.block-ticket::after { content:""; position:absolute; width:90px; height:90px; right:-35px; bottom:-42px; border-radius:50%; background:var(--block-color,var(--marker)); opacity:.65; }
.block-ticket h3 { margin: .15rem 0 .45rem; font-family: var(--display); font-size: 1.25rem; }
.block-filter { display:block; padding:0; border:0; background:transparent; font-family:var(--display); font-weight:900; font-size:1rem; text-align:left; cursor:pointer; }
.block-filter::after { content:' ↘'; color:var(--marker-dark); }
.block-ticket p { margin: 0; color: var(--muted); font-size: .86rem; }
.block-ticket a { display:inline-block; margin-top:.7rem; color:var(--ink); font-weight:900; font-size:.8rem; }
.block-ticket.active { background: var(--marker); }
.unit-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.unit-card { position: relative; display: grid; grid-template-columns: auto 1fr; gap: .8rem 1rem; padding: 1rem; background: rgba(255,255,255,.78); border: 1.5px solid var(--ink); }
.unit-code { display: grid; place-items: center; align-self: start; min-width: 70px; min-height: 48px; padding: .35rem; background: var(--ink); color: white; font: 900 1rem var(--display); transform: rotate(-1deg); }
.unit-card h3 { margin: 0; font-family: var(--display); font-size: 1.05rem; letter-spacing: -.02em; }
.unit-meta { margin: .2rem 0 0; color: var(--muted); font-size: .78rem; }
.unit-card .resource-links { grid-column: 2; margin: 0; }
.unit-card[hidden] { display: none; }
.control-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-top: 18px; }
.control-card { padding: .8rem; color: var(--ink); background: var(--yellow); border: 1.5px solid var(--ink); text-decoration: none; font-weight: 900; box-shadow: 2px 3px 0 rgba(24,32,28,.14); }
.control-card span { display:block; margin-top:.2rem; color:var(--muted); font-size:.75rem; }
.library-empty { grid-column:1/-1; padding: 2rem; text-align:center; border:2px dashed var(--line); color:var(--muted); }
footer { display: flex; justify-content: space-between; gap: 2rem; margin-top: 60px; padding: 28px 0 50px; border-top: 3px solid var(--ink); color: var(--muted); }
.scribble { font-family: "Segoe Print", "Comic Sans MS", cursive; color: var(--ink); transform: rotate(-1deg); }
dialog { width: min(680px,calc(100% - 24px)); max-height: calc(100vh - 24px); padding: 0; color: var(--ink); background: var(--paper); border: 3px solid var(--ink); box-shadow: 12px 14px 0 rgba(24,32,28,.22); }
dialog::backdrop { background: rgba(19,27,22,.62); backdrop-filter: blur(2px); }
dialog form, .learn-sheet { padding: 1.35rem; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; border-bottom: 2px dashed var(--line); margin-bottom: 1rem; }
.dialog-head h2 { margin: 0 0 1rem; font-size: 2rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid label { display: grid; gap: .35rem; font-weight: 800; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid input:not([type=checkbox]), .form-grid textarea { width: 100%; border: 1.5px solid var(--ink); background: white; padding: .7rem; resize: vertical; }
.optional { font-weight: 400; color: var(--muted); }
.favorite-check { display: flex !important; flex-direction: row; align-items: center; }
.favorite-check input { width: 1.15rem; height: 1.15rem; accent-color: var(--marker-dark); }
.dialog-actions, .learn-actions { display: flex; justify-content: flex-end; gap: .7rem; margin-top: 1rem; }
.error-message { min-height: 1.2rem; color: var(--red); font-weight: 800; }
.learn-dialog { width: min(610px,calc(100% - 24px)); }
.learn-progress { color: var(--muted); font-weight: 800; }
.learn-dialog h2 { font-size: clamp(3rem,10vw,6rem); margin: 2rem 0; text-align: center; }
.learn-answer { padding: 1.2rem; margin: 1rem 0; background: white; border-left: 8px solid var(--marker); }
.learn-answer h3 { font-family: var(--display); font-size: 1.6rem; margin: 0 0 .5rem; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translate(-50%,130%); padding: .75rem 1rem; color: white; background: var(--ink); box-shadow: 4px 5px 0 var(--marker-dark); transition: transform .2s; font-weight: 800; }
.toast.show { transform: translate(-50%,0); }
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes ink-in { from { opacity: 0; transform: translateY(-4px); } }
@media (max-width: 900px) { .card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .hero { gap: 1rem; } .sticky-note { width: 160px; } .toolbar { align-items: flex-start; } .course-blocks { grid-template-columns: repeat(2,minmax(0,1fr)); } .control-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 620px) { .hero, main, footer { width: min(100% - 20px,1180px); } .hero { display: block; padding-top: 38px; } h1 { font-size: clamp(3.2rem,17vw,5rem); } .sticky-note { display: none; } .search-shell { box-shadow: 5px 6px 0 var(--ink); } .search-icon { font-size: 2rem; padding-left: .65rem; } #searchInput { font-size: 1.35rem; padding: 1rem 3rem 1rem .6rem; } .search-mark { left: 3rem; bottom: .65rem; } .actions { width: 100%; } .actions .btn { flex: 1 1 42%; } .data-menu { top: 104px; left: 0; right: auto; } .card-grid, .unit-grid, .course-blocks, .control-grid { grid-template-columns: 1fr; } .card { min-height: 240px; } .card-actions { opacity: 1; } .form-grid { grid-template-columns: 1fr; } .form-grid .wide { grid-column: auto; } footer { display: block; } .dialog-actions { flex-wrap: wrap; } .library-heading { display:block; } .source-link { display:inline-block; margin-top:1rem; } .unit-card { grid-template-columns:1fr; } .unit-card .resource-links { grid-column:1; } .unit-code { width:fit-content; min-height:auto; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
@media print { .paper-grain, .toolbar, .sticky-note, .card-actions, footer { display: none !important; } body { background: white; } .hero { padding: 20px 0; } .search-section { display: none; } .card-grid { grid-template-columns: repeat(2,1fr); } .card { break-inside: avoid; box-shadow: none; } }
