.library-nav a.library-link{display:inline-flex;align-items:center;justify-content:center;text-decoration:none;white-space:nowrap}
.section-card-bottom .grammar-study-link{margin-top:10px;display:flex;justify-content:center;text-decoration:none}
.grammar-library{padding:48px 0 64px;max-width:1040px}
.grammar-library .button,.grammar-viewer .button{display:inline-flex;align-items:center;justify-content:center;text-decoration:none;gap:8px}
.grammar-heading{display:flex;justify-content:space-between;align-items:center;gap:24px;margin-bottom:28px}
.grammar-heading h1{margin:0 0 12px}.grammar-heading p{margin:0;color:var(--muted)}.grammar-heading .eyebrow{color:var(--vermilion);margin-bottom:12px}.grammar-heading>.button{flex-shrink:0}
.grammar-total{font-size:14px;white-space:nowrap;padding:12px 16px;border-radius:var(--radius-sm);background:var(--blue-soft);color:var(--blue)}
.grammar-filters{display:flex;align-items:end;gap:16px;margin:0 0 28px;flex-wrap:wrap}.grammar-filters label{display:grid;gap:8px;font-size:14px;font-weight:600}.grammar-filters label:first-child{flex:1;min-width:200px}.grammar-filters input,.grammar-filters select{width:100%;padding:12px 14px;border:1px solid var(--control);border-radius:var(--radius-sm);background:var(--surface);color:var(--ink);font:inherit;font-size:16px;min-height:48px}.grammar-filters>span{align-self:center;margin-top:24px;color:var(--muted);font-size:14px}
.grammar-exams{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px}.grammar-exam-card{display:flex;flex-direction:column;padding:24px;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);box-shadow:var(--shadow);min-width:0}.grammar-exam-card.has-pictures{border-color:var(--blue)}.grammar-exam-top{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:24px}.grammar-exam-card h2{font-size:24px;margin:0 0 12px}.grammar-exam-card p{font-size:14px;color:var(--muted);margin:0 0 24px}.grammar-exam-card>.button{margin-top:auto;width:100%}
.grammar-back{display:inline-flex;align-items:center;min-height:44px;margin-bottom:20px;color:var(--blue);font-weight:600;font-size:14px;text-decoration:none}.grammar-back:hover{text-decoration:underline}.grammar-note{padding:16px 20px;background:var(--blue-soft);border-radius:var(--radius-sm);font-size:14px;color:var(--muted);margin-bottom:24px}
.grammar-sheets{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:28px;align-items:start}.grammar-sheet{min-width:0;overflow:hidden;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}.grammar-preview{position:relative;display:block;padding:0;border:0;border-radius:0;background:var(--surface-soft);width:100%;aspect-ratio:2/3;overflow:hidden}.grammar-preview img{display:block;width:100%;height:auto;aspect-ratio:2/3}.grammar-preview:hover .grammar-expand{background:var(--blue-hover)}.grammar-preview:focus-visible{outline-offset:-4px}.grammar-expand{position:absolute;bottom:16px;right:16px;background:var(--blue);color:var(--surface);padding:10px 14px;border-radius:10px;font-size:14px;font-weight:600;box-shadow:var(--shadow)}.grammar-sheet-info{padding:20px 24px 24px}.grammar-sheet-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.grammar-sheet-heading h2{font-size:22px;margin:0}.grammar-sheet-heading span{font-size:14px;color:var(--muted)}.grammar-sheet details{margin:12px 0}.grammar-sheet summary{cursor:pointer;min-height:44px;align-content:center;font-size:14px;color:var(--blue)}.grammar-sheet ul{list-style:none;padding:0;margin:4px 0 16px}.grammar-sheet li{display:grid;gap:4px;padding:10px 0;border-top:1px solid var(--line);font-size:14px}.grammar-sheet li span:first-child{font-weight:600;font-size:16px}.grammar-sheet li span:last-child{color:var(--muted)}.grammar-sheet-info>.button{width:100%}
.grammar-empty{grid-column:1/-1;text-align:center;padding:48px 24px;border:1px dashed var(--control);border-radius:var(--radius);background:var(--surface)}.grammar-empty h2{font-size:24px}.grammar-empty p{color:var(--muted);max-width:520px;margin:16px auto 24px}.grammar-empty-icon{display:inline-block;background:var(--blue-soft);color:var(--blue);padding:16px;border-radius:16px;font-size:24px;margin-bottom:16px}
body.grammar-viewer-open{overflow:hidden}.grammar-viewer{width:calc(100vw - 32px);max-width:1360px;height:calc(100dvh - 32px);max-height:calc(100dvh - 32px);padding:0;overflow:hidden;border-radius:20px}.grammar-viewer[open]{display:flex;flex-direction:column}.grammar-viewer-bar{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:12px 20px;border-bottom:1px solid var(--line)}.grammar-viewer-bar h2{margin:0;font-size:20px}.grammar-viewer-controls{display:flex;gap:8px;align-items:center;flex-wrap:wrap;padding:12px 20px;border-bottom:1px solid var(--line)}.grammar-viewer-controls .button{padding:8px 14px;min-width:44px;min-height:44px}.grammar-viewer-controls [data-zoom-label]{min-width:96px;text-align:center;font-size:13px;color:var(--muted)}.grammar-viewer-controls [data-viewer-download]{margin-left:auto}.grammar-viewer-stage{overflow:auto;flex:1;min-height:0;overscroll-behavior:contain;background:var(--surface-soft);padding:12px}.grammar-viewer-stage img{display:block;height:auto;margin:0 auto;max-width:none;aspect-ratio:2/3}.grammar-viewer-note{padding:10px 20px;margin:0;color:var(--muted);font-size:13px}.grammar-viewer-note a{color:var(--blue);display:inline-block;line-height:28px}
@media(max-width:1100px){.grammar-library{padding-left:24px;padding-right:24px}.topbar{gap:16px}.library-nav{margin-right:0}.theme-label{display:none}}
@media(max-width:850px){.grammar-exams{grid-template-columns:repeat(2,minmax(0,1fr))}.topbar{height:auto;min-height:100px;flex-wrap:wrap;padding-block:16px}.library-nav{margin-left:auto}.theme-control{width:100%;justify-content:flex-end}}
@media(max-width:768px){.topbar{grid-template-columns:1fr;gap:12px}.topbar .brand{grid-column:1;grid-row:1}.topbar .library-nav{grid-column:1;grid-row:2;justify-content:stretch;width:100%;margin:0}.library-nav .library-link{flex:1;padding:10px 12px}.topbar .theme-control{grid-row:3}.grammar-library{padding:28px 20px 40px}.grammar-heading{align-items:flex-start;flex-direction:column;gap:16px}.grammar-heading h1{font-size:32px}.grammar-heading>.button{width:100%}.grammar-total{font-size:13px}.grammar-sheets{grid-template-columns:1fr;gap:24px}.grammar-filters{gap:12px}.grammar-filters>span{margin-top:0}.grammar-note{padding:16px}.grammar-viewer{width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border:0;border-radius:0}.grammar-viewer-bar{padding:12px 16px;padding-top:max(12px,env(safe-area-inset-top))}.grammar-viewer-controls{padding:8px 12px;gap:6px}.grammar-viewer-controls .button{padding:8px 10px}.grammar-viewer-controls [data-zoom-label]{min-width:80px}.grammar-viewer-note{padding-bottom:max(10px,env(safe-area-inset-bottom))}}
@media(max-width:480px){.grammar-exams{grid-template-columns:1fr}.grammar-exam-card{padding:24px}.grammar-filters label:first-child{flex-basis:100%}.grammar-sheet-info{padding:20px}.grammar-viewer-bar h2{font-size:17px}}
@media(prefers-reduced-motion:reduce){.grammar-library *, .grammar-viewer *{scroll-behavior:auto;transition:none}}
