.grade-home { background: #fff; color: #192f52; }
.home-wrap { max-width: 1180px; padding-top: clamp(20px,3vw,42px); }
.book-cover { background: white; border: 0; border-radius: 0; box-shadow: none; padding: 16px 0 30px; grid-template-columns: .88fr 1.12fr; }
.book-cover::before { display: none; }
.cover-art { mix-blend-mode: normal; }
.grade-home h1 { font-size: clamp(36px,4.6vw,68px); }
.grade-home .intro { color: #465775; }
.grade-picks a { border: 1px solid #ccd8ee; background: #f3f6ff; color: #203e73; box-shadow: none; border-radius: 14px; }
.grade-picks a:hover { background: #e3eaff; }
.grade-picks a[aria-current="true"], .primary { background: #254ecb; color: #fff; border-color: #254ecb; }
.subject-card, .grade-units, .path-example { background: white; border-color: #d6deea; }
.subject-page { border-top: 1px solid #e2e8f1; padding-top: 22px; margin-top: 0; }
.subject-art { background-image: url('assets/atlas-pictures.webp'); aspect-ratio: 1; background-size: 400% 400%; background-position: 66.6667% 100%; mix-blend-mode: multiply; }
.subject-card[data-subject="science"] .subject-art { background-position: 33.3333% 100%; }
.path-example { background: #f4f7ff; }
.atlas-art { display: inline-block; flex: none; aspect-ratio: 1; width: 62px; background: url('assets/atlas-pictures.webp') no-repeat; background-size: 400% 400%; mix-blend-mode: multiply; }
.overview.exploring { display: block; overflow: auto; }
.overview.exploring :is(#flowThemes,.phone-flow-tools,#phoneFlow,#flowScroll,.flow-bottom) { display: none; }
.flow-header .flow-mode, .atlas-back { min-height: 44px; color: #274fb5; font-weight: 700; }
.flow-mode { padding: 4px 0; }
.exploring .flow-header, #atlas { padding-inline: max(20px,calc((100% - 1100px) / 2)); }
.exploring .flow-header { padding-block: 24px 4px; }
.exploring #flowTitle { font-size: clamp(25px,3vw,38px); }
.exploring #flowHint { color: #485973; font-size: 16px; }
.exploring .flow-title-row { margin-bottom: 0; }
#atlas { padding-block: 20px 36px; word-break: keep-all; overflow-wrap: anywhere; color: #263d61; }
.theme-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.theme-cards button { display: flex; align-items: center; gap: 15px; padding: 20px; min-height: 108px; border: 1px solid #cfdeef; border-radius: 18px; background: linear-gradient(110deg,var(--tint),#f4f9ff 72%); text-align: left; font-size: 20px; }
.theme-cards button:hover, .trail-grades button:hover, .trail-branch button:hover { border-color: #668bdc; }
.trail-heading { display: flex; align-items: center; gap: 12px; margin: 5px 0 20px; font-size: 28px; }
.trail-heading .atlas-art { width: 58px; }
.trail-grades { position: relative; isolation: isolate; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }
.trail-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; z-index: -1; pointer-events: none; }
.trail-lines path { stroke: #547fb2; stroke-width: 2; }
.trail-grades .linked-unit { border-color: #668bdc; }
.trail-grades h3 { margin: 0 0 10px; font-size: 20px; }
.trail-grades button { background: #f9fcff; border: 1px solid #cbdced; border-radius: 12px; padding: 11px; text-align: left; width: 100%; margin-bottom: 7px; font-size: 16px; font-weight: 700; }
.trail-grades small, .trail-branch small { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: #51637c; }
.trail-grades [aria-pressed=true] { box-shadow: inset 0 0 0 2px #315aca; background: #eef3ff; }
.trail-reading { margin-top: 18px; border: 1px solid #d5dfef; border-radius: 16px; background: white; padding: 16px; }
.trail-reading header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.trail-reading h3, .trail-reading h4 { margin: 4px 0; }
.trail-reading h4 { margin-top: 20px; }
.primary { border-radius: 10px; min-height: 44px; padding: 6px 14px; font-weight: 700; }
.trail-branch { display: flex; align-items: stretch; }
.trail-branch > svg { width: 26px; flex: none; }
.trail-branch .pencil-line { stroke: #4e79c5; stroke-width: 2; vector-effect: non-scaling-stroke; }
.trail-branch button { display: flex; align-items: center; gap: 12px; background: #f8faff; text-align: left; flex: 1; border: 1px solid #dbe3f1; border-radius: 10px; padding: 10px; margin: 4px 0; }
.trail-branch .atlas-art { width: 40px; }
.trail-branch strong { display: block; font-size: 16px; margin-bottom: 3px; }
.graph-bar { display: flex; flex: none; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding: 6px 24px; border-bottom: 1px solid #dbe4f1; background: #fff; }
.overview-mode .graph-bar { display: none; }
.graph-bar strong { color: #253d60; font-size: 17px; }
#graphHint { margin-left: 12px; color: #52657e; font-size: 14px; }
.graph-bar .zoom { position: static; flex: none; margin-inline-start: auto; padding: 0; box-shadow: none; }
.graph-bar .zoom button { width: 44px; height: 44px; }
.graph-bar .zoom .fit { display: flex; gap: 5px; align-items: center; justify-content: center; width: auto; padding: 0 9px; font-size: 14px; font-weight: 650; }
.graph-bar .switch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px; border-left: 1px solid #dfe6ef; border-radius: 0 11px 11px 0; color: #384961; font-size: 15px; font-weight: 650; white-space: nowrap; cursor: pointer; }
.graph-bar .switch:hover { background: #edf3ff; }
.switch input { appearance: none; position: relative; width: 38px; height: 22px; margin: 0; background: #69788c; border-radius: 12px; cursor: pointer; }
.switch input::after { content: ''; position: absolute; inset: 3px auto auto 3px; width: 16px; height: 16px; border-radius: 50%; background: white; }
.switch input:checked { background: #315ed1; }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus-visible { outline: 2px solid #315ed1; outline-offset: 3px; }
@media (forced-colors: active) {
  .switch input { appearance: auto; }
  .switch input::after { content: none; }
}
.main .canvas { min-width: 0; overflow: clip; }
.main #detail { position: relative; inset: auto; flex: 0 0 clamp(292px,29vw,390px); align-self: stretch; min-height: 0; max-height: none; width: auto; border: 0; border-left: 1px solid #cfdbeb; border-radius: 0; box-shadow: none; animation: none; }
.main #detail .close { position: sticky; float: right; top: 0; right: auto; width: 44px; height: 44px; z-index: 1; background: white; border: 1px solid #dde5ef; }
.relation-label { pointer-events: all; cursor: pointer; }
.edge-hit { stroke: transparent; stroke-width: 16; cursor: pointer; pointer-events: stroke; }
.edge-hit:focus-visible { stroke: #96b4dc; outline: none; }
.edge-reading { padding: 12px; margin: 10px 0; background: #eff5ff; border-radius: 10px; line-height: 1.55; }
.edge-reading p { margin: 6px 0 0; }
.edge-reading ul { padding-left: 18px; }
.edge-reading h2 { margin: 0 30px 6px 0; font-size: 18px; color: #254877; }
@media(max-width:900px) {
  .graph-bar { padding: 4px 12px; }
  #graphHint { display: block; margin: 3px 0 0; font-size: 12px; }
  .graph-bar strong { font-size: 15px; }
  .main { flex-direction: column; }
  .main #detail { flex: 0 0 42%; border-left: 0; border-top: 2px solid #cad8eb; padding: 12px 16px 24px; }
  .graph-bar .zoom .fit svg { display: none; }
}
.reading-grade .cover-art, .reading-grade .path-example { display: none; }
.reading-grade .book-cover { display: block; padding: 0 0 18px; }
.reading-grade .home-wrap { max-width: 1060px; }
.reading-grade h1 { font-size: clamp(27px,3.1vw,42px); }
.reading-grade .intro { margin: 8px 0 16px; }
.reading-grade .grade-picks a { min-height: 44px; }
.grade-tools, .grade-tools label { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.grade-tools label { font-weight: 700; color: #435575; }
.grade-tools select { min-width: 0; max-width: 100%; min-height: 44px; padding: 6px 10px; border: 1px solid #b9c8df; border-radius: 9px; background: white; color: #243959; font: inherit; }
.grade-subjects { display: flex; gap: 3px; padding: 2px; border-radius: 12px; background: #eef2f7; }
.grade-subjects a { min-height: 44px; padding: 4px 17px; border-radius: 10px; font-weight: 750; }
.grade-subjects [aria-current=true] { background: #273f65; color: white; }
.grade-diagram { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(180px,.74fr) minmax(200px,1fr); align-items: center; gap: clamp(42px,8vw,115px); margin: 20px 0 8px; padding: 20px 26px; background: #f5f8fd; border-radius: 18px; }
.grade-lines { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; }
.grade-lines path { stroke: #527cbb; fill: none; stroke-width: 2.5; }
.grade-lines circle { fill: #446ca4; }
.grade-source { padding: 22px; border: 2px solid #4169b0; border-radius: 14px; background: white; text-align: center; }
.grade-source .atlas-art { display: block; margin: 0 auto 7px; }
.grade-source small,.grade-peer small { display: block; color: #4a6081; font-weight: 650; font-size: 13px; }
.grade-source h3 { font-size: clamp(21px,2vw,29px); margin: 6px 0 14px; }
.grade-peers { display: grid; gap: 10px; }
.grade-peer { min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; background: white; border: 1px solid #b6c9e2; border-radius: 12px; line-height: 1.45; }
.grade-peer:hover { border-color: #456dac; background: #fcfdff; }
.grade-peer .atlas-art { width: 42px; }
.grade-peer strong { display: block; font-size: 18px; }
.grade-reason { display: block; color: #394f70; font-size: 14px; }
.peer-chevron { margin-left: auto; color: #4769a1; font-size: 21px; }
.grade-more { min-height: 44px; color: #284e9c; text-decoration: underline; text-underline-offset: 4px; font-weight: 700; }
.unit-references { margin: 10px 0; color: #435575; line-height: 1.55; }
.unit-references summary { padding: 8px 0; cursor: pointer; font-weight: 400; }
.detail .references > summary, .detail .unit-references > summary { font-size: 1rem; font-weight: 400; color: #8190a3; }
.unit-references p { margin: 6px 0; }
.unit-references a { display: block; width: fit-content; padding: 3px 0; color: #284e9c; text-underline-offset: 3px; }
.review-downloads { margin-block: 16px; }
.review-downloads summary { font-weight: 700; }
.standard-review { list-style: none; padding: 0; margin: 10px 0; }
.standard-review li { padding: 9px 0; border-top: 1px solid #d6deea; }
.standard-review li > small, .standard-review li > strong { display: block; }
.standard-review li > strong { color: #243959; }
.standard-review li > p { margin: 3px 0; }
.unit-references .source-url { display: block; overflow-wrap: anywhere; }
.empty-section { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); width: min(32rem, 85%); margin: 0; padding: 16px; border-radius: 12px; background: #fffdf9; color: #42364a; line-height: 1.65; }
.graph-bar, .overview-mode .top { position: relative; z-index: 5; }
#wordSearch { position: relative; width: 12rem; min-width: 0; text-align: left; }
#wordQuery { width: 100%; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid #b7cce2; border-radius: 12px; background: #f5f9ff; color: #294766; font: inherit; font-size: 16px; }
#wordQuery::placeholder { color: #536f8e; font-size: 14px; opacity: 1; }
#wordQuery:focus-visible { background: #fff; outline: 2px solid #4779af; outline-offset: -2px; }
#wordSearchPanel { position: absolute; top: calc(100% + 3px); left: 0; z-index: 1; width: min(25rem, calc(100vw - 24px)); max-height: min(24rem, 40dvh); padding: 8px; border: 1px solid #cbdced; border-radius: 12px; background: #fbfdff; color: #294766; box-shadow: 0 5px 16px #294e781c; }
#wordSearchPanel:not([hidden]) { display: flex; flex-direction: column; }
#wordSearchCount { margin: 4px 6px 6px; color: #506981; }
#wordSearchResults { margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; }
#wordSearchResults [role="option"] { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 6px; border-top: 1px solid #dce7f2; cursor: pointer; }
#wordSearchResults [role="option"]:hover, #wordSearchResults [aria-selected="true"] { background: #e7f1fd; }
#wordSearchResults strong { color: #294766; font-size: 16px; }
#wordSearchResults small { grid-column: 1 / -1; }
#wordSearchResults span, #wordSearchResults small { color: #506981; font-size: 13px; }
@media (max-width: 600px) {
  #wordSearch { position: static; }
  .overview-mode #wordSearch { flex: 0 1 12rem; }
  #wordSearchPanel { inset-inline: 6px; width: auto; }
  .graph-bar .zoom { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr) 44px 44px auto auto; }
  .zoom #wordSearch { width: 100%; }
}
@media (max-width: 370px) {
  .graph-bar { padding-inline: 6px; }
  .graph-bar .zoom { grid-template-columns: minmax(0, 1fr) auto 44px 44px; gap: 1px; }
  .zoom #wordSearch { grid-column: span 2; position: relative; }
  .zoom #wordSearchPanel { inset-inline: 0 auto; width: calc(100vw - 14px); }
  .graph-bar .zoom .fit { grid-column: 1 / 3; justify-self: end; padding-inline: 4px; }
  .graph-bar .switch { grid-column: span 2; gap: 3px; padding-inline: 2px; font-size: 13px; }
}
@media(max-width:650px) {
  .reading-grade .home-wrap { padding-top: 15px; }
  .reading-grade .subject-page { padding-top: 12px; }
  .grade-tools { gap: 8px; }
  .grade-tools label { flex: 1 1 160px; }
  .grade-tools select { flex: 1; width: 0; }
  .grade-diagram { grid-template-columns: 1fr; gap: 12px; padding: 0 0 0; background: white; }
  .grade-source { display: grid; grid-template-columns: 44px 1fr; gap: 2px 10px; padding: 12px; text-align: left; background: #f2f6ff; }
  .grade-source .atlas-art { grid-row: span 2; align-self: center; width: 44px; margin: 0; }
  .grade-source h3 { margin: 0; }
  .grade-source .primary { grid-column: 2; justify-self: start; margin-top: 5px; }
  .grade-peers { margin-left: 28px; }
  .grade-peer { padding: 9px; }
  .grade-peer .atlas-art { width: 32px; }
}
@media(max-width:900px) {
  .theme-cards { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .theme-cards button { padding: 12px 6px; flex-direction: column; gap: 5px; text-align: center; min-height: 92px; font-size: 16px; }
  .theme-cards .atlas-art { width: 50px; }
  .trail-grades { grid-template-columns: 1fr; }
}
@media(max-width:680px) {
  .book-cover { grid-template-columns: 1fr; }
  .book-cover .cover-art { width: min(100%,420px); }
}

.main .canvas {
  background-color: #fcf9f1;
  background-image: linear-gradient(#e8e1d67a 1px, transparent 1px), linear-gradient(90deg, #e8e1d67a 1px, transparent 1px);
  background-size: 23px 23px;
}
.graph-bar { border-color: #e5dbcf; background: #fffdf9; }
.graph-bar strong { color: #4d3a55; }
#graphHint { color: #6a5c6b; }
#graph .relation-label rect { fill: #fffdf8; stroke: #d4c4d3; }
#graph .relation-label text { fill: #634c70; }
#graph #arrow path { stroke: #78579b; }
.edge-hit:focus-visible { stroke: #c2aad7; }
.edge-hit { stroke-width: 24; }
.learning-example { margin: 8px 0; padding: 10px 13px; border-radius: 10px; background: #f6efdc; color: #473d41; line-height: 1.65; }
.learning-example b { display: block; font-size: 13px; color: #755622; }
.learning-more { margin: 6px 0 12px; color: #554063; }
.learning-more summary, .references summary { padding-block: 10px; cursor: pointer; }
.learning-more p { margin: 2px 0 9px; line-height: 1.65; }
@media(prefers-reduced-motion:no-preference) {
  .pencil-line.reverse { animation-name: trace-reverse; }
  @keyframes trace-reverse { from { stroke-dasharray: 1; stroke-dashoffset: -1; } to { stroke-dasharray: 1; stroke-dashoffset: 0; } }
}
.node:hover .plate { stroke: #725380; stroke-width: 2; }
.node:focus-visible .plate { stroke: #55336e !important; stroke-width: 3 !important; }
.sticker-picture { display: block; overflow: visible; flex: none; pointer-events: none; }
.sticker-glyph { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.sticker-notation { font-family: system-ui, sans-serif; font-weight: 700; }
.main #detail { border-color: #dbcfda; background-color: #fffcf7; }
.main #detail .close { background: #fffdf9; color: #634e69; border-color: #e1d4df; }
.word-portrait {
  display: grid; place-items: center; position: relative; clear: both; isolation: isolate;
  min-height: 128px; margin: 0 0 14px; border-radius: 15px;
  background: radial-gradient(ellipse at center, #fcf5dd 15%, #f6f0e4 95%);
}
.word-portrait::before {
  content: ""; z-index: -1; position: absolute; width: 65%; height: 68%; border-radius: 50%;
  background: #fffdf5; transform: rotate(-6deg);
}
.word-portrait .sticker-picture { max-width: 95%; }
.word-heading .dtype { max-width: 100%; }
.word-heading h1 { color: #46334e; }
.word-heading .desc { color: #4f4652; }
.edge-reading { clear: both; background: #f2eaf7; border: 1px solid #e3d6e9; }
.edge-reading .edge-pictures { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; color: #584064; margin-right: 0; }
.edge-pictures span { display: inline-flex; align-items: center; gap: 4px; }
.relword .sticker-picture { width: 26px; height: 26px; }
.feedback.good .sticker-picture { float: left; margin: 0 7px 3px 0; }
.feedback.good { display: flow-root; }
@media(prefers-reduced-motion:no-preference) {
  .node[aria-pressed=true] .sticker-picture { animation: sticker-settle .23s ease-out; transform-origin: center; transform-box: fill-box; }
  @keyframes sticker-settle { from { transform: rotate(-5deg) scale(.88); } to { transform: rotate(0) scale(1); } }
}
@media(max-width:900px) {
  .sticker-entry { display: flow-root; }
  .word-portrait { float: left; clear: none; width: clamp(78px,24vw,116px); min-height: 78px; margin: 3px 12px 5px 0; }
  .word-portrait .sticker-picture { max-height: 76px; }
  .word-heading .dtype { max-width: calc(100% - 18px); }
  .word-heading h1 { margin: 5px 0; }
  .word-heading .desc { margin-bottom: 8px; }
}

.grade-picks a, .grade-subjects a { display: grid; place-items: center; text-decoration: none; color: inherit; }
.learning-directory { padding: 12px 0 24px; line-height: 1.6; }
.learning-directory ul { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,240px),1fr)); gap: 10px; list-style: none; padding: 0; }
.learning-directory li { padding: 10px 14px; background: #f5f9ff; border-radius: 10px; }
.learning-directory a { color: #315c96; text-underline-offset: 3px; }
.learning-directory small { display: block; color: #506981; }
#loadStatus:not(:empty) { position: fixed; bottom: 12px; left: 12px; z-index: 20; padding: 8px; border-radius: 8px; background: white; color: #294766; }
#loadStatus:empty { display: none; }

#homeButton { text-decoration: none; }
