/* Approved02/screen2: actual public grade DTO. Original02 pixels are decoration,
   never a screen image or data. Exact same-viewport acceptance is a separate gate. */
.m12-grade-directory, .m12-grade-legacy-anchor { display: none; }
@media screen and (max-width: 1100px) {
    body.egitir-v2:has(.m12-grade-directory) { background: #fcfaf5; }
    body.egitir-v2 .m12-grade-page:has(.m12-grade-directory) { width: 100%; max-width: none; padding: 0; background: #fcfaf5; }
    body.egitir-v2 .m12-grade-page:has(.m12-grade-directory) > .v2-public-header { display: none; }
    body.egitir-v2 .m12-grade-page:has(.m12-grade-directory) .workbench-main { width: 100%; max-width: 560px; margin: 0 auto; padding: 18px 16px 32px; }
    body.egitir-v2 .m12-grade-page .m12-grade-directory { display: block; color: #101e2a; padding: 0 0 20px; }
    .m12-grade-directory *, .m12-grade-directory *::before, .m12-grade-directory *::after { box-sizing: border-box; }
    .m12-grade-directory .m12-grade-heading { display: flex; align-items: center; gap: 9px; margin: 0 0 8px; padding: 0; }
    .m12-grade-directory .m12-grade-heading h1 { flex: 1; min-width: 0; margin: 0; font-size: 1.25rem; font-weight: 750; line-height: 1.4; letter-spacing: -.025em; color: #101e2a; }
    .m12-grade-directory .m12-grade-icon-button { display: grid; place-items: center; flex: 0 0 38px; min-height: 40px; color: #101e2a; text-decoration: none; }
    .m12-grade-directory .m12-grade-back > svg { transform: rotate(180deg); }
    .m12-grade-directory .m12-grade-search-shortcut { border: 1px solid #dee3e4; border-radius: 50%; background: #f4f5f3; }
    .m12-grade-directory .m12-grade-intro { margin: 6px 0 15px; color: #40576d; font-size: .9375rem; line-height: 1.35; }
    .m12-grade-directory .m12-grade-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin: 0 0 12px; padding: 0; }
    .m12-grade-directory .m12-grade-choices a { display: grid; place-items: center; min-width: 0; min-height: 36px; padding: 7px 5px; color: #102133; background: #f0f2f1; border: 1px solid #eef0ef; border-radius: 999px; text-decoration: none; font-size: .8125rem; font-weight: 600; line-height: 1.3; text-align: center; overflow-wrap: anywhere; }
    .m12-grade-directory .m12-grade-choices a[aria-current="page"] { color: #fff; background: linear-gradient(135deg, #168f89, #047b78); border-color: #147e7a; }
    .m12-grade-directory .m12-grade-toolbar { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; position: relative; }
    .m12-grade-directory .m12-grade-search { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; min-height: 42px; padding: 0 12px; border: 1px solid #e0e5e7; border-radius: 13px; background: #f8f9f7; color: #40576d; }
    .m12-grade-directory .m12-grade-search input { width: 100%; min-width: 0; min-height: 40px; margin: 0; padding: 8px 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; color: #142838; font: inherit; font-size: .875rem; }
    .m12-grade-directory .m12-grade-search input::placeholder { color: #65768b; opacity: 1; }
    .m12-grade-directory .m12-grade-options { margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
    .m12-grade-directory .m12-grade-options > summary { display: grid; place-items: center; list-style: none; min-width: 44px; min-height: 42px; padding: 8px; border: 1px solid #e0e5e7; border-radius: 13px; color: #233f53; background: #fff; cursor: pointer; }
    .m12-grade-directory .m12-grade-options > summary::-webkit-details-marker { display: none; }
    .m12-grade-directory .m12-grade-options nav { position: absolute; z-index: 4; inset-inline: 0; top: calc(100% + 6px); display: grid; gap: 2px; padding: 6px; border: 1px solid #dce3df; border-radius: 14px; background: #fffdf8; box-shadow: 0 8px 20px #15291b17; }
    .m12-grade-directory .m12-grade-options nav a { min-height: 44px; padding: 10px 12px; color: #163b43; text-decoration: none; border-radius: 9px; }
    .m12-grade-directory .m12-grade-subjects { display: grid; gap: 8px; }
    .m12-grade-directory .m12-grade-subject { margin: 0; padding: 0; border: 0; border-radius: 17px; background: #f0f1e9; overflow: hidden; box-shadow: none; }
    .m12-grade-directory .m12-grade-subject--blue { background: linear-gradient(115deg, #dfedff, #d9e8ff); }
    .m12-grade-directory .m12-grade-subject--green { background: linear-gradient(115deg, #edfad6, #e4f7c9); }
    .m12-grade-directory .m12-grade-subject--violet { background: linear-gradient(115deg, #e9e6ff, #e2e4ff); }
    .m12-grade-directory .m12-grade-subject-link { position: relative; display: flex; align-items: center; gap: 13px; min-width: 0; min-height: 92px; padding: 10px 12px; color: #102133; text-decoration: none; }
    .m12-grade-directory .m12-grade-art { display: block; width: 48px; height: 66px; flex: 0 0 48px; overflow: hidden; }
    .m12-grade-directory .m12-grade-art--icon { display: grid; place-items: center; color: #167b7b; }
    .m12-grade-directory .m12-grade-subject-copy { position: relative; z-index: 1; flex: 1; min-width: 0; }
    .m12-grade-directory :is(.m12-grade-subject--blue, .m12-grade-subject--violet) .m12-grade-subject-copy { padding-inline-end: 32px; }
    .m12-grade-directory .m12-grade-edge { position: absolute; right: 30px; bottom: 9px; width: 60px; height: 34px; pointer-events: none; overflow: hidden; }
    .m12-grade-directory .m12-grade-subject--violet .m12-grade-edge { right: 26px; bottom: 8px; width: 51px; height: 64px; }
    .m12-grade-directory .m12-grade-subject-copy strong { display: block; font-size: 1rem; font-weight: 750; line-height: 1.25; letter-spacing: -.015em; color: #102133; overflow-wrap: anywhere; }
    .m12-grade-directory .m12-grade-subject-copy small { display: block; margin: 4px 0 0; color: #40576d; font-size: .8125rem; line-height: 1.35; overflow-wrap: anywhere; }
    .m12-grade-directory .m12-grade-arrow { display: grid; place-items: center; flex: 0 0 20px; color: #102133; }
    .m12-grade-directory .m12-grade-empty { margin: 12px 0; padding: 14px; border-radius: 12px; background: #f0f2ee; color: #40576d; font-size: .9375rem; line-height: 1.5; }
    .m12-grade-directory .m12-grade-other-work { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 44px; padding: 12px 0; margin-top: 12px; color: #23615f; text-decoration: none; font-size: .875rem; }
    .m12-grade-directory .m12-grade-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
    .m12-grade-directory button.m12-grade-sr:focus-visible { position: static; width: auto; height: auto; min-height: 44px; margin: 0; padding: 8px; clip-path: none; white-space: normal; overflow: visible; }
    .m12-grade-directory [hidden] { display: none !important; }
    .m12-grade-directory :is(a, button, summary, input):focus-visible { outline: 3px solid #007f83; outline-offset: 3px; }
    .m12-grade-page:has(.m12-grade-directory) .workbench-main > :is(.breadcrumbs, .workbench-heading, .workbench-library) { display: none; }
    /* Retained journey links still target the original full lesson library. */
    .m12-grade-page:has(.m12-grade-directory) .workbench-main > .workbench-library:target { display: block; scroll-margin-top: 16px; }
    .m12-grade-page:has(.m12-grade-directory) .m12-grade-legacy-anchor { display: block; border-top: 1px solid #e3e7df; margin-top: 12px; padding-top: 18px; scroll-margin-top: 16px; }
}
@media screen and (max-width: 359px) {
    body.egitir-v2 .m12-grade-page:has(.m12-grade-directory) .workbench-main { padding-inline: 12px; }
    .m12-grade-directory .m12-grade-choices { gap: 5px; }
    .m12-grade-directory .m12-grade-choices a { font-size: .75rem; }
}
@media print {
    .m12-grade-directory { display: none !important; }
}
