/* Shared colors for the classroom, book catalog, library and learning activities. */
:root {
  --canvas: #f1f5f3;
  --surface: #fcfdfc;
  --ink: #20352e;
  --muted: #51665c;
  --line: #ccd8d1;
  --field-line: #879b90;
  --green: #17634c;
  --tint: #e3f1e9;
  --board: #253e38;
  --board-edge: #203630;
  --board-raised: #324e46;
  --board-line: #627c70;
  --chalk: #edf2ec;
  --chalk-muted: #c7d7cc;
  --mint: #b0e2c6;
  --amber: #f2cf91;
  --paper: var(--canvas);
  --white: var(--surface);
  --ivory: var(--canvas);
  color: var(--ink);
  background: var(--canvas);
  accent-color: var(--green);
}
::selection { color: #183b2d; background: #c5e8d1 }
:focus-visible { outline-color: var(--green) }
.board :focus-visible, .notes :focus-visible { outline-color: var(--amber) }
.classroom-page, .catalog-page, .library-page { color: var(--ink); background: var(--canvas) }
.top, .library-top, .catalog-page > header {
  background: var(--surface);
  border-top-color: var(--green);
  border-bottom-color: var(--line);
}
.brand, .railbar strong, .card strong { color: var(--ink) }
.tracknav a, .library-top nav a { color: var(--muted) }
.tracknav a[aria-current=page], .library-top nav [aria-current] {
  background: var(--tint);
  border-color: var(--green);
  color: var(--green);
}
.tracknav a:hover, .library-top nav a:hover { color: var(--green); background: var(--tint) }
.search, .searchbox { color: var(--muted); background: var(--canvas); border-color: var(--field-line) }
.search input, .searchbox input { color: var(--ink) }
.search input::placeholder, .searchbox input::placeholder { color: var(--muted); opacity: 1 }
.railbar select, .railbuttons button, .selects select, .controls :is(select,input), #fullcatalog {
  background-color: var(--surface);
  border-color: var(--field-line);
  color: var(--ink);
}
:is(.railbar,.selects,.controls) select {
  appearance: none;
  padding-inline-end: 19px;
  background-image: linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);
  background-position: right 10px center,right 6px center;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}

/* Use a flat matte finish so the two panels stay quiet behind moving figures. */
.board, .notes, .thumbnail, .preview, #practiceFrames svg, #labFrame { background: var(--board); color: var(--chalk) }
.board, .boardhead, .notetop, .equation { border-color: #4f685e }
.boardhead, .notetop, .equation, .tools { background: var(--board-edge); color: var(--chalk-muted) }
.board, .notes { accent-color: var(--mint) }
.notes { scrollbar-color: #7d9687 var(--board) }
.notes h1, .params label, #lead, .steps p, #practiceFrames figcaption, .paper .key { color: var(--chalk) }
.crumb, #focusline, .equation strong, .params output, .step b,
.challenge h2, #feedback:not(:empty), #relatedPractice strong, #activityPicker strong { color: var(--amber) }
.equation span, #parents, #promptline, #practicePicture { color: var(--chalk-muted) }
.steps li { border-color: var(--board-line) }
.steps li::before { background: #9cb1a5 }
.steps li.active { background: var(--board-raised); border-color: var(--mint) }
.steps li.active::before { background: var(--mint) }
.steps .step, #lessonSources a, #relatedPractice a, #parents a { color: var(--mint) }
.challenge { background: #2c443b; border-color: #697664 }
#parents, #practiceFrames svg { border-color: var(--board-line) }
.playrow button, .zoom-tools button, .challenge button, #drawtrial, #activityPicker a {
  background: var(--board-raised);
  color: var(--chalk);
  border-color: #8a9e91;
}
.playrow .reset { color: var(--chalk-muted); background: transparent; border-color: transparent }
.playrow button.primary, .challenge button[aria-pressed=true], #activityPicker a[aria-current] {
  background: var(--mint); color: #19382a; border-color: var(--mint); box-shadow: none;
}
.playrow button:disabled, .zoom-tools button:disabled { color: var(--chalk-muted); opacity: .6 }
.params input, .grid-toggle input { accent-color: var(--mint) }
.control-tip { background: var(--surface); color: var(--ink); border-color: var(--field-line); box-shadow: 0 3px 12px #18352926 }
#divider { background: #192d27; box-shadow: inset 1px 0 #496156,inset -1px 0 #496156 }
#divider span { border-color: #91a89b; background: repeating-linear-gradient(0deg,#496156 0 4px,#b5ccbf 4px 5px); box-shadow: none }
#divider:hover span, #divider:focus-visible span, .resizing #divider span { border-color: var(--amber) }
#divider:focus-visible { outline-color: var(--amber) }
.paper svg text, .preview > svg text, #practiceFrames svg text, .thumbnail svg text {
  fill: var(--chalk); stroke: var(--board-edge); stroke-width: 2px; paint-order: stroke; stroke-linejoin: round;
}
.paper:not(.authored) svg line.ruler-tick, .paper:not(.authored) svg line.partition,
.thumbnail .ruler-tick, .thumbnail .partition { stroke: #34493d }
.paper svg .ruler-tick + text, .thumbnail .ruler-tick + text { fill: #273e31; stroke: none }
/* Dark edges make the individual cubes countable on all three light faces. */
.paper:not(.authored) svg :is(polygon[fill="#cbe2bb"],polygon[fill="#8eb9a1"],polygon[fill="#edc37e"]) { stroke: #365442 }

/* The course list and navigation use the same light reading surface. */
#catalog { background: var(--canvas); border-color: var(--line); box-shadow: none }
.rail { scrollbar-color: #91aa9b transparent }
.card, .course-card, .unit-block { background: var(--surface); border-color: var(--line) }
.card small, .card-goal, #bookEdition, #catalogCount, .unit-block small, .ed-button small { color: var(--muted) }
.card:hover, .ed-button:hover { background: #ebf4ee }
.card[aria-current=page], .ed-button[aria-pressed=true] { color: var(--ink); background: var(--tint) }
.card[aria-current=page] { outline-color: var(--green) }
.card[aria-current=page] .thumbnail::after { color: #203a2c; background: var(--amber) }
.ed-button[aria-pressed=true] { color: var(--green); border-color: var(--field-line) }
.ed-button img { border-color: var(--line); background: var(--surface) }
.course-card:hover, .course-card:focus-visible { border-color: var(--green); box-shadow: 0 2px 9px #20483514 }
.preview { border-color: var(--line) }
.preview .image-caption { background: var(--board-edge); color: var(--chalk); border-color: var(--board-line) }
.preview > img, .preview.cover > img { background: #e5ede8 }
.index-excerpt { color: var(--chalk-muted) }
.index-excerpt b { color: var(--chalk) }
#readbook, .catalog-page a, .plan-page a { color: var(--green) }
.pager button, .library-page .action { color: var(--green); background: var(--surface); border-color: var(--field-line) }
.library-page .action.primary { color: var(--surface); background: var(--green); border-color: var(--green) }
.library-page dialog { border-color: var(--field-line); box-shadow: 0 16px 60px #112e2340 }
.library-page dialog::backdrop { background: #172e24b8 }
.unit-block h2, .local-collection strong { color: var(--ink) }
.local-collection, .plan-page .call, .plan-page th { background: var(--tint) }
.reading-list li, .plan-page :is(h2,td,th) { border-color: var(--line) }
.plan-page { color: var(--ink); background: var(--surface) }
.plan-page small { color: var(--muted) }
.plan-page .call { border-color: var(--green) }
@media (max-width:700px) {
  #divider { box-shadow: inset 0 1px #496156,inset 0 -1px #496156 }
  #divider span { background: repeating-linear-gradient(90deg,#496156 0 4px,#b5ccbf 4px 5px) }
}
@media (forced-colors:active) {
  :is(.railbar,.selects,.controls) select { appearance: auto; background-image: none }
  .card[aria-current=page], .ed-button[aria-pressed=true], .tracknav a[aria-current=page] { outline: 2px solid Highlight; outline-offset: -2px }
  #divider span { border-color: ButtonText }
}

@media (max-width:365px) {
  .classroom-page .top .brand span { position:absolute; width:1px; height:1px; clip-path:inset(50%); overflow:hidden }
  .classroom-page .top .search { gap:2px; min-width:0 }
}


.header-tools { display:flex; align-items:center; gap:6px; margin-inline-start:auto; flex:none }
.plan-head,.study-top > nav,.catalog-page > header > nav { display:flex; align-items:center; gap:clamp(6px,1.6vw,22px); flex-wrap:wrap }
.friend-menu { position:relative; margin:0; font-size:13px; line-height:1.5 }
.friend-menu > summary {
  display:flex; align-items:center; justify-content:center; gap:7px; min-height:32px; padding:3px 9px;
  border:1px solid #bacbc1; border-radius:6px; background:#f7faf8; color:#305748;
  font-weight:600; white-space:nowrap; list-style:none; cursor:pointer;
}
.friend-menu > summary::-webkit-details-marker { display:none }
.friend-menu > summary::after { content:""; width:6px;height:6px;border:solid currentColor; border-width:0 1.5px 1.5px 0; transform:translateY(-2px) rotate(45deg) }
.friend-menu[open] > summary { background:#e7f0ea; border-color:#779b89 }
.friend-menu[open] > summary::after { transform:translateY(2px) rotate(225deg) }
.friend-menu > ul { position:absolute; z-index:40; right:0; top:100%; width:max-content; min-width:160px; margin:4px 0 0; padding:4px; border:1px solid #c3d2c9; border-radius:8px; background:#fff; box-shadow:0 6px 18px #213b3020; list-style:none }
.friend-menu:not([open]) > ul { display:none }
.friend-menu > ul > li { margin:0;padding:0 }
header .friend-menu li a { display:flex;align-items:center;min-height:34px; padding:4px 12px;border-radius:4px; text-decoration:none;color:#264f41;font-size:14px;font-weight:500 }
.friend-menu li a:is(:hover,:focus-visible) { background:#eaf2ec;text-decoration:underline }
@media(pointer:coarse){.friend-menu > summary,header .friend-menu li a{min-height:44px}}
/* The sound control lives in the header so it never covers the lesson or diagram. */
.sound-switch {
  display:inline-flex; align-items:center; justify-content:center; gap:5px; flex:none;
  margin-inline-start:auto; padding:3px 8px; min-height:32px;
  color:#275b4c; background:#eff5f1; border:1px solid #b7c9bd; border-radius:7px;
  font:inherit; font-weight:600; font-size:12px; white-space:nowrap; cursor:pointer;
}
.sound-switch svg { display:block; flex:none }
.sound-switch:focus-visible { outline:3px solid #ad762f; outline-offset:2px }
.sound-switch[aria-pressed=true] .sound-muted,.sound-switch[aria-pressed=false] .sound-waves { display:none }
.sound-switch[aria-pressed=false] { color:#51645b; background:#f7f9f7 }
.top .search { margin-inline-start:auto }
.top .sound-switch { margin-inline-start:0 }
.header-tools .sound-switch { margin-inline-start:0 }
.sheet-head .sound-switch { margin-inline-start:auto }
.sheet-head > div:first-child { min-width:0 }
.phone-jumps { display:none }
@media (pointer:coarse) {
  .sound-switch { min-width:44px;min-height:44px }
  .zoom-tools button,.playrow button,.railbuttons button,.challenge button,.fun-act button,
  #gameControls button,#gradeNav a,#levelNav a,.selects select,.pager button,.sheet-head button {
    min-height:44px;
  }
  .zoom-tools button,.railbuttons button { min-width:44px }
  .zoom-tools { gap:4px }
  .notes .step { min-height:40px }
  #gradeNav a,#levelNav a { display:inline-flex;align-items:center;justify-content:center }
  .fun-filter select,.railbar select { min-height:36px }
  .classroom-page { grid-template-rows:46px minmax(0,1fr) auto }
  .study-top,.library-top,.fun-top,.catalog-page > header { min-height:46px }
}
@media (min-width:701px) and (max-width:1400px) and (orientation:landscape) {
  .top { gap:10px }
  .top .book-label { flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis }
  .classroom-page #catalog { padding-block:5px }
  .classroom-page .thumbnail { height:clamp(48px,7.4dvh,68px) }
  .classroom-page .railbar { margin-bottom:4px;gap:5px 8px }
  .notes .steps p { font-size:15px;line-height:1.7 }
}
@media(max-width:700px) {
  html:not(.embedded-lab) .classroom-page { display:block; height:auto; min-height:100dvh }
  html:not(.embedded-lab) .classroom-page .studio { overflow:visible }
  html:not(.embedded-lab) .classroom-page .board { min-height:min(370px,68dvh) }
  html:not(.embedded-lab) .notes { min-height:0 }
  .classroom-page .top { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center;gap:3px 5px;padding:2px 7px 5px }
  .classroom-page .top .brand { grid-column:1;grid-row:1 }
  .classroom-page .top .tracknav { grid-column:1/-1;grid-row:2;justify-self:start;align-self:stretch;gap:0 }
  .classroom-page .top .tracknav a { min-height:36px; padding-inline:3px }
  .classroom-page .top .header-tools { grid-column:3;grid-row:1 }
  .classroom-page .top .search { grid-column:2;grid-row:1; min-width:0;max-width:none; width:100%; margin:0;padding:4px }
  .classroom-page .top .search input { flex:1;min-width:0;width:100%;font-size:16px }
  .phone-jumps { display:flex; grid-column:1/-1;grid-row:2;justify-self:end;gap:5px }
  .phone-jumps a { display:inline-flex;align-items:center;min-height:36px;padding:0 2px;font-size:12px }
  .notes #lead,.notes .steps p,.notes .challenge p { font-size:16px;line-height:1.7 }
  .classroom-page #catalog {padding-block:8px}
  #catalog .railbar { gap:5px }
  #catalog .card strong {font-size:14px} #catalog .card-goal,#catalog .card small {font-size:12px}
  .embedded-lab .classroom-page .top { display:none }
  .embedded-lab .classroom-page { grid-template-rows:minmax(0,1fr) }
  .fun-top,.library-top,.study-top,.catalog-page > header {display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:0 6px;padding:3px 8px}
  :is(.fun-top,.library-top,.study-top,.catalog-page > header) > nav {grid-column:1/-1;grid-row:2;display:flex;flex-wrap:wrap;gap:0 12px}
  :is(.fun-top,.library-top,.study-top,.catalog-page > header) > .header-tools {grid-row:1;grid-column:2}
  .friend-menu > summary { padding-inline:7px }
  .header-tools {gap:4px}
  .sound-switch span { position:absolute;width:1px;height:1px;clip-path:inset(50%);overflow:hidden }
  .sound-switch { min-width:40px;min-height:40px;padding:4px }
  .library-top nav,.fun-top nav { flex-wrap:wrap;gap:2px }
  .library-top nav a,.fun-top nav a,.study-top a,.catalog-page > header a { display:inline-flex;align-items:center;min-height:32px }
  .sheet-head {gap:5px}
  .sound-switch:focus-visible { outline-offset:0 }
}
@media(max-width:370px) {
  .classroom-page .top .brand span {position:absolute;width:1px;height:1px;clip-path:inset(50%);overflow:hidden}
}
@media(pointer:coarse) and (max-width:700px) {
  .sound-switch {min-width:44px;min-height:44px}
}
