* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { min-width: 320px; overflow-x: hidden; }
button, input, select, textarea { color: inherit; font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.icon { display: inline-block; width: 16px; height: 16px; flex: none; background: currentColor; mask-position: center; mask-repeat: no-repeat; mask-size: contain; }
.icon-lock { mask-image: url("assets/icons/lock.svg"); }
.icon-sort { mask-image: url("assets/icons/sort.svg"); }
.icon-chevron { mask-image: url("assets/icons/chevron-down.svg"); }
.icon-filter { mask-image: url("assets/icons/filter.svg"); }
.icon-external { mask-image: url("assets/icons/external.svg"); }
.icon-download { mask-image: url("assets/icons/download.svg"); }
.icon-pencil { mask-image: url("assets/icons/pencil.svg"); }
.icon-check { mask-image: url("assets/icons/check.svg"); }
.icon-revisit { mask-image: url("assets/icons/revisit.svg"); }
.icon-close { mask-image: url("assets/icons/close.svg"); }
.icon-share { mask-image: url("assets/icons/share.svg"); }
.icon-import { mask-image: url("assets/icons/import.svg"); }
.icon-arrow { mask-image: url("assets/icons/arrow-right.svg"); }

.topbar { height: 76px; padding: 0 var(--pd-gutter-desktop); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--pd-rule); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--pd-ink); text-decoration: none; font: 500 22px/1 var(--pd-font-display); letter-spacing: -0.01em; }
.brand:hover { color: var(--pd-ink); }
.brand-mark { position: relative; width: 32px; height: 32px; display: grid; place-items: center; overflow: hidden; color: var(--pd-paper); background: var(--pd-ink); clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%); font: italic 15px/1 var(--pd-font-display); }
.brand-mark i { position: absolute; top: 0; right: 0; width: 8px; height: 8px; background: var(--pd-pen); }
.topnav { display: flex; align-items: center; gap: 32px; }
.topnav > a { color: var(--pd-ink-2); text-decoration: none; font-size: 15px; }
.topnav > a:hover { color: var(--pd-pen); }
.topnav .nav-library { color: var(--pd-ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--pd-pen); text-decoration-thickness: 2px; text-underline-offset: 8px; }
.device-status, .mobile-backup { height: 32px; padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; color: var(--pd-ink-2); border: 1px dashed var(--pd-rule); border-radius: var(--pd-radius); }
.device-status .pd-label { color: var(--pd-ink-2); }
.reset-button { min-height: 32px; padding: 0; border: 0; border-bottom: 1px solid var(--pd-rule); background: transparent; color: var(--pd-ink-3); font: 500 10px var(--pd-font-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.reset-button:hover { color: var(--pd-pen); border-color: var(--pd-pen); }
.mobile-backup { display: none; text-decoration: none; }

main { max-width: 1440px; margin: 0 auto; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 452px; gap: 72px; align-items: end; padding: 84px var(--pd-gutter-desktop) 80px; }
.hero-kicker { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--pd-ink-2); }
.hero-kicker > span { width: 8px; height: 8px; background: var(--pd-pen); }
h1 { margin: 28px 0 0; font: 400 100px/0.94 var(--pd-font-display); letter-spacing: -0.035em; color: var(--pd-ink); }
h1 em { font-style: italic; font-weight: 400; }
.underlined { position: relative; display: inline-block; }
.underlined img { position: absolute; left: 0; right: 4%; bottom: -10px; width: 100%; height: 16px; }
.hero-copy { max-width: 520px; margin: 40px 0 0; color: var(--pd-ink-2); font-size: 20px; line-height: 1.5; }
.desk-stack { position: relative; }
.desk-stack::before { content: ""; position: absolute; inset: 10px -8px -10px 8px; z-index: -1; background: var(--pd-desk); border: 1px solid var(--pd-rule); transform: rotate(2.2deg); }
.desk-card { position: relative; background: var(--pd-sheet); border: 1px solid var(--pd-rule); box-shadow: var(--pd-shadow-sheet); }
.desk-card::before { content: ""; position: absolute; top: 0; bottom: 0; left: 18px; width: 1px; background: var(--pd-pen-line); }
.desk-card-head { height: 52px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; }
.desk-card-head > span:last-child { display: inline-flex; align-items: center; gap: 6px; color: var(--pd-ink-3); }
.desk-card-head > span:last-child .pd-label { color: var(--pd-ink-3); font-size: 10px; }
.desk-stat { min-height: 92px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--pd-ruled-line); }
.desk-stat > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.desk-stat strong { font-size: 16px; font-weight: 500; }
.desk-stat small { color: var(--pd-ink-3); font-size: 13px; }
.stat-number { display: flex; align-items: center; gap: 18px; }
.tally-window { width: 114px; height: 30px; overflow: hidden; }
.tally-window img { width: 114px; height: 30px; }
.stat-number span { font: 400 44px/1 var(--pd-font-display); letter-spacing: -0.02em; }
.circled { position: relative; width: 70px; height: 54px; display: inline-flex; align-items: center; justify-content: center; font: 400 40px/1 var(--pd-font-display); }
.circled img { position: absolute; inset: 0; width: 70px; height: 54px; }
.average { color: var(--pd-pen); font: italic 400 48px/1 var(--pd-font-display); letter-spacing: -0.02em; }
.phone-stats { display: none; }

.workspace { display: grid; grid-template-columns: var(--pd-sidebar) minmax(0, 1fr); gap: var(--pd-sidebar-gap); padding: 0 var(--pd-gutter-desktop) 96px; }
.filters { align-self: start; display: flex; flex-direction: column; gap: 24px; }
.sheet-grabber { display: none; }
.filter-heading { display: flex; align-items: baseline; justify-content: space-between; }
.filter-heading h2 { margin: 0; font: 400 28px/1 var(--pd-font-display); letter-spacing: -0.015em; }
.filter-heading button { padding: 0; border: 0; background: transparent; color: var(--pd-pen); font-size: 13px; }
.filters-scroll { display: flex; flex-direction: column; gap: 24px; }
fieldset { min-width: 0; margin: 0; padding: 20px 0 0; border: 0; border-top: 1px solid var(--pd-rule); }
legend { margin: 0 0 10px; padding: 0; }
fieldset label { height: 36px; display: flex; align-items: center; gap: 12px; color: var(--pd-ink); font-size: 15px; cursor: pointer; }
fieldset input { position: absolute; opacity: 0; pointer-events: none; }
.filter-indicator { width: 18px; height: 12px; flex: none; border: 1.5px solid var(--pd-ink-3); border-radius: 50%; background: transparent; }
fieldset input:checked + .filter-indicator { border-color: var(--pd-ink); background: var(--pd-ink); }
fieldset label:has(input:checked) { font-weight: 500; }
fieldset b { margin-left: auto; color: var(--pd-ink-3); font: 400 12px var(--pd-font-mono); }
.filters-footer { display: none; }

.library { min-width: 0; }
.library-top { display: flex; align-items: flex-end; justify-content: space-between; border-bottom: 1px solid var(--pd-ink); }
.tabs { min-width: 0; display: flex; gap: 2px; }
.tabs button { height: 46px; padding: 0 18px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; border: 1px solid transparent; border-radius: 4px 4px 0 0; background: transparent; color: var(--pd-ink-2); font-size: 15px; }
.tabs button.active { margin-bottom: -1px; border-color: var(--pd-ink); border-bottom-color: var(--pd-sheet); background: var(--pd-sheet); color: var(--pd-ink); font-weight: 600; }
.tabs b { color: var(--pd-ink-3); font: 500 12px var(--pd-font-mono); }
.tabs [data-tab="revisit"] b { color: var(--pd-pen); }
.phone-word { display: none; }
.sort-wrap { height: 38px; margin: 0 0 8px; padding: 0 12px; display: inline-flex; align-items: center; gap: 10px; background: var(--pd-sheet); border: 1px solid var(--pd-rule); border-radius: var(--pd-radius); }
.sort-wrap .icon { width: 14px; height: 14px; color: var(--pd-ink-3); }
.sort-wrap select { max-width: 132px; padding: 0; appearance: none; border: 0; outline: 0; background: transparent; color: var(--pd-ink); font-size: 14px; cursor: pointer; }
.mobile-tools { display: none; }
.search-and-chips { min-height: 74px; padding: 14px 0 18px; display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr) auto; align-items: center; gap: 16px; }
.search-wrap { height: 38px; padding: 0 10px; display: flex; align-items: center; gap: 8px; background: var(--pd-sheet); border: 1px solid var(--pd-rule); border-radius: var(--pd-radius); }
.search-wrap .pd-label { color: var(--pd-ink-3); }
.search-wrap input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--pd-ink); font-size: 14px; }
.search-wrap input::placeholder { color: var(--pd-ink-3); }
.search-wrap kbd { color: var(--pd-ink-3); font: 400 11px var(--pd-font-mono); }
.filter-chips { min-width: 0; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chip { height: 30px; padding: 0 8px 0 12px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border: 1px solid var(--pd-rule); border-radius: var(--pd-radius); background: var(--pd-sheet); color: var(--pd-ink); font-size: 13px; }
.filter-chip .icon { width: 14px; height: 14px; color: var(--pd-ink-3); }
.result-count { color: var(--pd-ink-3); font: 500 11px var(--pd-font-mono); text-transform: uppercase; white-space: nowrap; }

.paper-sheet { position: relative; }
.paper-sheet::before { content: ""; position: absolute; z-index: 2; top: 0; bottom: 0; left: var(--pd-margin-line-x); width: 1px; background: var(--pd-pen-line); pointer-events: none; }
.list-head, .paper-row { display: grid; grid-template-columns: var(--pd-list-columns); column-gap: var(--pd-list-column-gap); }
.mobile-year-heading { display: none; }
.list-head { min-height: 34px; align-items: center; border-bottom: 1px solid var(--pd-ruled-line); color: var(--pd-ink-3); font-size: 10px; }
.list-head > span:first-child { text-align: right; padding-right: 22px; }
.paper-row { min-height: 86px; padding: 20px 0; align-items: center; border-bottom: 1px solid var(--pd-ruled-line); }
.paper-row.is-revisit { background: var(--pd-pen-row); }
.year-cell { align-self: start; padding: 2px 22px 0 0; text-align: right; font: 400 30px/1 var(--pd-font-display); letter-spacing: -0.02em; }
.status-button { align-self: start; width: 20px; height: 20px; margin-top: 4px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--pd-ink-3); border-radius: var(--pd-radius); background: var(--pd-sheet); color: var(--pd-ink-3); }
.status-button .icon { width: 14px; height: 14px; }
.status-button.done { border-color: var(--pd-blue); background: var(--pd-blue-wash); color: var(--pd-blue); }
.status-button.revisit { border-color: var(--pd-pen); border-radius: 50%; background: var(--pd-pen-wash); color: var(--pd-pen); }
.status-button.revisit .icon { width: 12px; height: 12px; }
.course-cell { align-self: start; display: flex; align-items: center; gap: 10px; }
.course-code { width: 56px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--pd-ink); border-radius: 2px; font: 500 11px var(--pd-font-mono); letter-spacing: 0.06em; }
.mobile-type, .mobile-open { display: none; }
.paper-info { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.paper-title { color: var(--pd-ink); text-decoration: none; font: 400 21px/1.2 var(--pd-font-display); letter-spacing: -0.01em; }
.paper-title:hover { color: var(--pd-pen); }
.paper-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.paper-meta .pd-label { color: var(--pd-ink-3); }
.solution-link { display: inline-flex; align-items: center; gap: 4px; color: var(--pd-ink-2); text-decoration: underline; text-decoration-color: var(--pd-rule); }
.solution-link .icon { width: 12px; height: 12px; }
.note-preview { margin-top: 8px; display: flex; align-items: flex-start; gap: 8px; color: var(--pd-pen); font: italic 400 15px/1.35 var(--pd-font-display); }
.note-preview .icon { width: 14px; height: 14px; margin-top: 3px; }
.note-preview span:last-child { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.difficulty-cell { display: inline-flex; align-items: center; gap: 10px; }
.pips { display: inline-flex; align-items: center; gap: 3px; }
.pips i { width: 11px; height: 11px; border: 1px solid var(--pd-rule); border-radius: 1px; background: transparent; }
.pips i.on { border-color: var(--pd-ink); background: var(--pd-ink); }
.difficulty-cell .pd-label { color: var(--pd-ink-2); letter-spacing: 0.06em; }
.difficulty-cell.brutal .pips i { border-color: var(--pd-pen); background: var(--pd-pen); }
.difficulty-cell.brutal .pd-label { color: var(--pd-pen); }
.difficulty-community { margin-top: 5px; color: var(--pd-ink-3); font: 400 9px var(--pd-font-mono); }
.score-cell { color: var(--pd-pen); font: italic 400 26px/1 var(--pd-font-display); letter-spacing: -0.01em; }
.empty-value { color: var(--pd-ink-3); font: 400 12px var(--pd-font-mono); }
.paper-actions { padding-right: 4px; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.paper-actions a, .paper-actions button { height: 36px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; border-radius: var(--pd-radius); background: transparent; color: var(--pd-ink-2); border: 1px solid transparent; text-decoration: none; font-size: 13px; font-weight: 500; }
.paper-actions .check-in { min-width: 88px; border-color: var(--pd-ink); background: var(--pd-sheet); color: var(--pd-ink); }
.paper-row.is-revisit .paper-actions .check-in { border-color: var(--pd-pen); color: var(--pd-pen); }
.paper-actions .download-paper { width: 36px; padding: 0; border-color: var(--pd-rule); }
.paper-actions .icon { width: 15px; height: 15px; }
.paper-actions a:hover, .paper-actions button:hover { border-color: var(--pd-pen); color: var(--pd-pen); }
.empty { padding: 72px 24px; text-align: center; border-bottom: 1px solid var(--pd-ruled-line); color: var(--pd-ink-3); }
.empty strong { display: block; margin-bottom: 6px; color: var(--pd-ink); font: 400 28px var(--pd-font-display); }
.load-more { width: 100%; min-height: 48px; margin-top: 18px; border: 1px solid var(--pd-rule); border-radius: var(--pd-radius); background: var(--pd-sheet); color: var(--pd-ink); font-size: 14px; }
.load-more:hover { border-color: var(--pd-ink); }

.backup-section { padding: 88px var(--pd-gutter-desktop); display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 72px; align-items: start; border-top: 1px solid var(--pd-rule); }
.backup-copy { display: flex; flex-direction: column; gap: 20px; }
.backup-kicker { margin: 0; display: flex; align-items: center; gap: 10px; color: var(--pd-ink); }
.backup-copy h2 { margin: 0; font: 400 52px/1.02 var(--pd-font-display); letter-spacing: -0.03em; }
.backup-copy h2 em { font-weight: 400; }
.backup-copy > p:not(.backup-kicker):not(.sync-label) { margin: 0; color: var(--pd-ink-2); font-size: 17px; line-height: 1.55; }
.sync-label { margin: 0; color: var(--pd-ink-3); }
.backup-card { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-left: -1px; background: var(--pd-sheet); border: 1px solid var(--pd-rule); box-shadow: var(--pd-shadow-sheet); }
.backup-card article { min-width: 0; padding: 32px 32px 36px; display: flex; flex-direction: column; gap: 14px; border-left: 1px dashed var(--pd-rule); }
.backup-card .step { color: var(--pd-pen); }
.backup-card h3 { margin: 0; font: 400 30px/1.1 var(--pd-font-display); letter-spacing: -0.015em; }
.backup-card p { min-height: 70px; margin: 0; color: var(--pd-ink-2); font-size: 15px; line-height: 1.55; }
.primary-button, .secondary-button, .cancel-button, .clear-entry { min-height: 42px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: var(--pd-radius); font-size: 14px; font-weight: 500; white-space: nowrap; }
.primary-button { border: 1px solid var(--pd-ink); background: var(--pd-ink); color: var(--pd-paper); }
.primary-button:hover { background: var(--pd-ink-hover); }
.secondary-button { border: 1px solid var(--pd-ink); background: var(--pd-sheet); color: var(--pd-ink); }
.file-button { align-self: flex-start; cursor: pointer; }

dialog { width: min(580px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); padding: 0; overflow: hidden; border: 1px solid var(--pd-rule); border-radius: var(--pd-radius-dialog); background: var(--pd-sheet); color: var(--pd-ink); box-shadow: var(--pd-shadow-dialog); }
dialog::backdrop { background: var(--pd-scrim); }
dialog:focus { outline: none; }
html:has(dialog[open]), body:has(dialog[open]) { overflow: hidden; }
.dialog-body { scrollbar-width: none; }
.dialog-body::-webkit-scrollbar { display: none; }
#rating-form { max-height: calc(100dvh - 28px); display: flex; flex-direction: column; }
.dialog-head { height: 60px; padding: 0 20px 0 32px; flex: none; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--pd-rule); }
.dialog-head > span { display: inline-flex; align-items: center; gap: 10px; }
.dialog-head > span > i { width: 8px; height: 8px; background: var(--pd-pen); }
.dialog-head .pd-label { color: var(--pd-ink); }
.dialog-close { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--pd-ink-2); }
.dialog-close .icon { width: 18px; height: 18px; }
.dialog-body { padding: 28px 32px 32px; overflow-y: auto; display: flex; flex-direction: column; gap: 28px; }
.paper-heading { display: flex; flex-direction: column; gap: 10px; }
.paper-heading > div { display: flex; align-items: center; gap: 12px; }
.paper-heading h2 { margin: 0; font: 400 32px/1.1 var(--pd-font-display); letter-spacing: -0.02em; }
.form-group { display: flex; flex-direction: column; gap: 12px; }
.form-heading { display: flex; align-items: baseline; justify-content: space-between; }
.form-heading label { font-size: 15px; font-weight: 600; }
.community-summary { margin: -7px 0 0; color: var(--pd-ink-3); font: 400 10px var(--pd-font-mono); }
.difficulty-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.difficulty-picker button { height: 64px; border: 1px solid var(--pd-rule); border-radius: var(--pd-radius); background: var(--pd-paper); color: var(--pd-ink); font: 400 28px var(--pd-font-display); }
.difficulty-picker button:hover, .difficulty-picker button.active { border-color: var(--pd-ink); background: var(--pd-ink); color: var(--pd-paper); }
.difficulty-scale { display: flex; justify-content: space-between; font-size: 10px; }
.difficulty-scale span:last-child { color: var(--pd-pen); }
.score-row { width: 300px; height: 56px; padding: 0 14px; display: grid; grid-template-columns: 1fr auto 1fr 54px; align-items: center; gap: 8px; border: 1px solid var(--pd-ink); border-radius: var(--pd-radius); background: var(--pd-paper); box-shadow: inset 0 0 0 1px var(--pd-ink); }
.score-row input { min-width: 0; width: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: var(--pd-pen); font: italic 400 25px var(--pd-font-display); }
.score-row > span, .score-row output { color: var(--pd-ink-3); font: 400 13px var(--pd-font-mono); }
.score-row output { text-align: right; }
.note-wrap { position: relative; height: 104px; padding-left: 46px; overflow: hidden; border: 1px solid var(--pd-rule); border-radius: var(--pd-radius); }
.note-wrap::before { content: ""; position: absolute; top: 0; bottom: 0; left: 34px; width: 1px; background: var(--pd-pen-line); }
.note-wrap textarea { width: 100%; height: 100%; padding: 6px 14px 0 0; resize: none; border: 0; outline: 0; background: transparent; color: var(--pd-ink); font: 400 17px/28px var(--pd-font-display); }
.note-wrap textarea::placeholder { color: var(--pd-ink-3); }
.revisit-check { padding: 16px 18px; display: flex; align-items: center; gap: 14px; border: 1px solid var(--pd-pen-border); border-radius: var(--pd-radius); background: var(--pd-pen-wash); cursor: pointer; }
.revisit-check > .icon { width: 20px; height: 20px; color: var(--pd-pen); }
.revisit-check > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.revisit-check strong { font-size: 15px; font-weight: 600; }
.revisit-check small { color: var(--pd-ink-2); font-size: 13px; }
.revisit-check input { position: absolute; opacity: 0; pointer-events: none; }
.revisit-check > i { position: relative; width: 42px; height: 24px; flex: none; border-radius: 12px; background: var(--pd-rule); }
.revisit-check > i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--pd-sheet); box-shadow: var(--pd-shadow-sheet); transition: transform 160ms ease; }
.revisit-check input:checked + i { background: var(--pd-pen); }
.revisit-check input:checked + i::after { transform: translateX(18px); }
.dialog-actions { min-height: 76px; padding: 0 32px; flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--pd-rule); background: var(--pd-paper); }
.dialog-actions .primary-button { min-height: 44px; border: 1px solid var(--pd-ink); }
.cancel-button, .clear-entry { min-height: 44px; border: 1px solid transparent; background: transparent; color: var(--pd-ink-2); }
.clear-entry { margin-right: auto; color: var(--pd-pen); }
.dialog-actions .icon { width: 16px; height: 16px; }

#toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; padding: 12px 16px; opacity: 0; transform: translateY(12px); pointer-events: none; background: var(--pd-ink); color: var(--pd-paper); border-radius: var(--pd-radius); box-shadow: var(--pd-shadow-sheet); font-size: 13px; transition: opacity 180ms ease, transform 180ms ease; }
#toast.show { opacity: 1; transform: translateY(0); }
.filter-scrim { display: none; }

@media (max-width: 1270px) {
  .hero { grid-template-columns: minmax(0, 1fr) 390px; gap: 48px; }
  h1 { font-size: 80px; }
  .tally-window { width: 88px; }
  .tally-window img { width: 88px; }
  :root { --pd-list-columns: 70px 20px 52px minmax(0, 1fr) 128px 70px 172px; --pd-list-column-gap: 12px; --pd-margin-line-x: 70px; }
  .paper-actions a, .paper-actions button { padding: 0 7px; font-size: 12px; }
  .paper-actions .check-in { min-width: 78px; }
}

@media (max-width: 1099px) {
  .hero { grid-template-columns: 1fr; }
  .desk-stack { max-width: 580px; }
  .workspace { grid-template-columns: 1fr; }
  .filters { position: fixed; z-index: 51; left: 0; right: auto; bottom: 0; top: 72px; width: 100vw; max-width: 100vw; padding: 0 24px; gap: 0; overflow: hidden; border-radius: var(--pd-radius-sheet) var(--pd-radius-sheet) 0 0; background: var(--pd-sheet); box-shadow: var(--pd-shadow-bottom-sheet); transform: translateY(110%); transition: transform 180ms ease; }
  body.filters-open { overflow: hidden; }
  body.filters-open .filters { transform: translateY(0); }
  .filter-scrim { position: fixed; inset: 0; z-index: 50; background: var(--pd-scrim); }
  body.filters-open .filter-scrim { display: block; }
  .filters .sheet-grabber { height: 24px; flex: none; display: flex; justify-content: center; padding-top: 10px; }
  .sheet-grabber span { width: 40px; height: 4px; border-radius: 2px; background: var(--pd-rule); }
  .filter-heading { flex: none; padding: 6px 0 14px; }
  .filter-heading h2 { font-size: 30px; }
  .filter-heading button { min-height: 44px; font-size: 14px; }
  .filters-scroll { flex: 1; min-height: 0; overflow-y: auto; gap: 0; }
  .filters-scroll fieldset { padding: 16px 0 6px; }
  .filters-footer { flex: none; display: block; margin: 0 -24px; padding: 14px 24px 22px; border-top: 1px solid var(--pd-rule); background: var(--pd-paper); }
  .filters-footer button { width: 100%; min-height: 52px; border: 1px solid var(--pd-ink); border-radius: var(--pd-radius); background: var(--pd-ink); color: var(--pd-paper); font-size: 16px; font-weight: 500; }
  .library-top > .sort-wrap { display: none; }
  .mobile-tools { padding: 14px 0 0; display: flex; gap: 8px; }
  .mobile-tools > button { min-height: 44px; flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--pd-ink); border-radius: var(--pd-radius); background: var(--pd-sheet); font-size: 15px; font-weight: 500; }
  .mobile-tools > button b { min-width: 20px; height: 20px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--pd-ink); color: var(--pd-paper); font: 400 11px var(--pd-font-mono); }
  .mobile-tools .sort-wrap { height: 44px; margin: 0; }
  .search-and-chips { grid-template-columns: minmax(190px, 280px) 1fr auto; }
  .list-head { display: none; }
  .paper-sheet::before { left: 48px; }
  .paper-row { min-height: 0; padding: 18px 16px 18px 0; grid-template-columns: 48px 56px minmax(0, 1fr) auto; column-gap: 12px; }
  .year-cell { display: none; }
  .status-button { grid-column: 1; grid-row: 1 / span 2; justify-self: center; }
  .course-cell { grid-column: 2; grid-row: 1; }
  .paper-info { grid-column: 3 / 5; grid-row: 1; }
  .difficulty-wrap { grid-column: 2; grid-row: 2; margin-top: 12px; }
  .score-cell { grid-column: 3; grid-row: 2; margin-top: 12px; }
  .paper-actions { grid-column: 4; grid-row: 2; margin-top: 10px; }
  .backup-section { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 749px) {
  .topbar { height: 60px; padding: 0 12px 0 16px; }
  .brand { gap: 10px; font-size: 19px; }
  .brand-mark { width: 28px; height: 28px; font-size: 13px; clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%); }
  .brand-mark i { width: 7px; height: 7px; }
  .topnav { display: none; }
  .mobile-backup { height: 44px; display: inline-flex; gap: 6px; }
  .hero { padding: 32px 16px 28px; gap: 0; }
  .hero-kicker { gap: 8px; font-size: 10px; }
  .hero-kicker > span { width: 7px; height: 7px; }
  .hero-kicker { font-size: 0; }
  .hero-kicker::after { content: "THSC Year 11 & 12"; font: 500 10px var(--pd-font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
  h1 { margin-top: 18px; font-size: 46px; line-height: 0.98; letter-spacing: -0.03em; }
  .underlined img { bottom: -6px; height: 10px; }
  .hero-copy { margin-top: 22px; font-size: 16px; line-height: 1.5; }
  .desk-stack { display: none; }
  .phone-stats { margin-top: 28px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--pd-sheet); border: 1px solid var(--pd-rule); box-shadow: var(--pd-shadow-sheet); }
  .phone-stats > div { min-width: 0; min-height: 82px; padding: 16px 13px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; border-left: 1px solid var(--pd-ruled-line); }
  .phone-stats > div:first-child { border-left: 0; }
  .phone-stats strong { font: 400 34px/1 var(--pd-font-display); }
  .phone-stats .pd-label { font-size: 9px; white-space: nowrap; }
  .phone-stats .circled { width: 40px; height: 34px; margin-left: -6px; }
  .phone-stats .circled img { left: -2px; top: -3px; width: 44px; height: 40px; }
  .phone-stats .average { color: var(--pd-pen); font-style: italic; }
  .workspace { padding: 32px 16px 64px; }
  .filters { top: 96px; padding: 0 16px; }
  .filters-footer { margin: 0 -16px; padding: 14px 16px 22px; }
  .year-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-bottom: 8px; }
  .year-options label { height: 46px; justify-content: center; gap: 8px; border: 1px solid var(--pd-rule); border-radius: var(--pd-radius); background: var(--pd-paper); }
  .year-options .filter-indicator { display: none; }
  .year-options label:has(input:checked) { border-color: var(--pd-ink); background: var(--pd-ink); color: var(--pd-paper); }
  .year-options b { margin: 0; color: inherit; font-size: 11px; opacity: 0.8; }
  fieldset > label, .type-options label { min-height: 46px; height: 46px; gap: 14px; font-size: 16px; }
  .filter-indicator { width: 20px; height: 13px; }
  .type-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
  .library-top { overflow: hidden; }
  .tabs { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { height: 44px; padding: 0 10px; font-size: 15px; }
  .tabs button:first-child { padding-left: 12px; }
  .desktop-word { display: none; }
  .phone-word { display: inline; }
  .mobile-tools { margin: 0 -16px; padding: 14px 16px 0; }
  .mobile-tools .sort-wrap { padding: 0 10px; }
  .mobile-tools .sort-wrap select { max-width: 74px; }
  .search-and-chips { min-height: 0; margin: 0 -16px; padding: 12px 16px 8px; display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; }
  .search-and-chips::-webkit-scrollbar { display: none; }
  .search-wrap { min-width: 196px; height: 32px; order: 2; }
  .search-wrap .pd-label, .search-wrap kbd { display: none; }
  .filter-chips { order: 1; overflow: visible; }
  .filter-chip { height: 32px; }
  .result-count { display: none; }
  .paper-sheet { margin: 8px -16px 0; }
  .paper-row { grid-template-columns: 48px minmax(0, 1fr); padding: 18px 16px 18px 0; column-gap: 0; }
  .status-button { grid-column: 1; grid-row: 1; justify-self: center; }
  .course-cell { grid-column: 2; grid-row: 1; padding-left: 12px; }
  .course-code { width: 48px; height: 24px; }
  .mobile-type, .mobile-open { display: inline; }
  .desktop-open { display: none; }
  .paper-info { grid-column: 2; grid-row: 2; padding: 8px 0 0 12px; }
  .paper-meta { display: none; }
  .paper-title { font-size: 20px; }
  .note-preview { margin-top: 4px; }
  .difficulty-wrap { grid-column: 2; grid-row: 3; margin: 10px 0 0 84px; display: flex; align-items: center; gap: 14px; }
  .paper-row:has(.score-cell.empty-value) .difficulty-wrap { margin-left: 12px; }
  .paper-row:has(.difficulty-wrap > .empty-value) .difficulty-wrap { display: none; }
  .score-cell { grid-column: 2; grid-row: 3; justify-self: start; align-self: start; margin: 10px 0 0 12px; font-size: 24px; }
  .score-cell.empty-value { display: none; }
  .mobile-year-heading { min-height: 58px; padding: 22px 16px 8px 60px; display: flex; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--pd-ruled-line); }
  .mobile-year-heading strong { font: 400 28px/1 var(--pd-font-display); letter-spacing: -0.02em; }
  .mobile-year-heading .pd-label { font-size: 10px; }
  .paper-actions { grid-column: 2; grid-row: 4; margin: 10px 0 0 12px; padding: 0; justify-content: space-between; }
  .paper-actions .open-paper { margin-right: auto; padding-left: 0; }
  .paper-actions .download-paper { width: 44px; height: 44px; }
  .paper-actions .check-in { min-width: 96px; height: 44px; padding: 0 14px; font-size: 14px; }
  .paper-actions .open-paper { height: 44px; font-size: 14px; }
  .load-more { min-height: 52px; }
  .backup-section { padding: 64px 16px; grid-template-columns: 1fr; gap: 32px; }
  .backup-copy h2 { font-size: 42px; }
  .backup-card { grid-template-columns: 1fr; }
  .backup-card article { padding: 24px; }
  .backup-card p { min-height: 0; }
  .backup-card button, .backup-card .file-button { min-height: 48px; }
  dialog { width: 100%; max-width: none; height: calc(100dvh - 44px); max-height: calc(100dvh - 44px); margin: auto 0 0; border-width: 1px 0 0; border-radius: var(--pd-radius-sheet) var(--pd-radius-sheet) 0 0; box-shadow: var(--pd-shadow-bottom-sheet); }
  #rating-form { height: 100%; max-height: calc(100dvh - 44px); }
  dialog .sheet-grabber { height: 20px; flex: none; display: flex; justify-content: center; padding-top: 10px; }
  .dialog-head { height: 48px; padding: 0 6px 0 16px; border-bottom: 0; }
  .dialog-head > span { gap: 8px; }
  .dialog-head > span > i { width: 7px; height: 7px; }
  .dialog-close { width: 44px; height: 44px; }
  .dialog-body { padding: 4px 16px 20px; gap: 22px; }
  .paper-heading { gap: 8px; }
  .paper-heading > div { gap: 10px; }
  .paper-heading .course-code { width: 48px; height: 24px; }
  .paper-heading h2 { font-size: 26px; line-height: 1.12; }
  .form-group { gap: 10px; }
  .difficulty-picker { gap: 6px; }
  .difficulty-picker button { height: 56px; font-size: 24px; }
  .score-row { width: 280px; height: 52px; }
  .note-wrap { height: 88px; padding-left: 38px; }
  .note-wrap::before { left: 26px; }
  .revisit-check { padding: 12px 14px; }
  .dialog-actions { min-height: auto; padding: 14px 16px 22px; }
  .dialog-actions .primary-button { width: 100%; min-height: 52px; font-size: 16px; }
  .dialog-actions .cancel-button { display: none; }
  .dialog-actions .clear-entry { position: absolute; right: 54px; top: 22px; z-index: 2; min-height: 44px; margin: 0; padding: 0 6px; font-size: 12px; }
  #toast { right: 16px; bottom: 16px; left: 16px; text-align: center; }
}
