:root {
  --board-ink: #222222;
  --board-word: #fff189;
  --board-word-hover: #ffeb6a;
  --board-folder: #c1dcf5;
  --board-folder-hover: #aed1f0;
  --board-focus: #174a83;
}

body { background: #fff; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.board-chrome { position: sticky; z-index: 2; top: 0; background: #fff; }
.sentence-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 104px;
  padding: max(8px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
}
.sentence-copy { flex: 1; min-width: 0; position: relative; }
#sentence-hint { font-size: 17px; color: #4a5055; }
.sentence-tiles {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 2px 0;
}
.sentence-tiles:empty { display: none; }
.sentence-token {
  display: grid;
  flex: 0 0 auto;
  justify-items: center;
  align-content: center;
  gap: 1px;
  padding: 2px 7px;
  min-width: 56px;
  max-width: min(255px, 100%);
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.sentence-token .choice-picture { width: 55px; height: 48px; }
.sentence-token .choice-numeral { font-size: 2.1rem; }
.sentence-token .choice-picture svg { width: 40px; height: 40px; }
.sentence-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.sentence-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 44px;
  min-height: 48px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-weight: 700;
}
.sentence-actions button:hover:not(:disabled) { background: #eef2f7; }
.sentence-actions button.speak-sentence { background: var(--board-ink); color: #fff; }
.sentence-actions button.speak-sentence:hover:not(:disabled) { background: #3d444c; }
.sentence-actions button:disabled { opacity: .33; }
#speech-status { margin: 3px 0 0; color: #444c54; font-size: 13px; line-height: 1.2; }
#message { font-size: 1rem; }

.board-nav {
  display: grid;
  grid-template-columns: 1fr minmax(0, max-content) 1fr;
  align-items: center;
  min-height: 51px;
  padding-inline: max(6px, env(safe-area-inset-left)) max(6px, env(safe-area-inset-right));
  color: #fff;
  background: var(--board-ink);
}
.board-nav h1 { font-size: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: .025em; text-align: center; }
.nav-group { display: flex; gap: 1px; }
.nav-group:last-child { justify-self: end; }
.nav-group button {
  display: grid;
  place-items: center;
  width: 45px;
  height: 46px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
}
.nav-group button:hover:not(:disabled) { background: #454545; }
.nav-group button:focus-visible { outline-color: #fff; outline-offset: -3px; }
.nav-group button[aria-pressed="false"] { color: #ffe77e; }

.classic-main { padding: 10px max(10px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
.classic-shortcuts { display: flex; flex-wrap: wrap; margin: 0 0 10px; }
.classic-shortcuts .secondary { min-height: 48px; font-size: 16px; font-weight: 650; text-decoration: none; }
.classic-shortcuts .secondary + .secondary { margin-left: 8px; }
#care-shortcut-status { margin: 0 0 10px; }
.classic-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  scroll-margin-top: 168px;
}
.classic-tiles:focus { outline: none; }
.classic-tile {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 135px;
  padding: 12px 6px 9px;
  border: 0;
  border-radius: 14px;
  background: var(--board-word);
  box-shadow: 0 2px 4px #212c3a2b;
}
.classic-tile strong {
  max-width: 100%;
  font-size: 1.125rem;
  line-height: 1.12;
  font-weight: 700;
  text-align: center;
  overflow-wrap: anywhere;
}
.classic-tile:hover { background: var(--board-word-hover); }
.classic-tile.last-choice { box-shadow: inset 0 0 0 3px var(--board-ink), 0 2px 4px #212c3a2b; }
.classic-tile:focus-visible, .sentence-actions button:focus-visible { outline: 3px solid var(--board-focus); outline-offset: -4px; }
.classic-tile:active:not(:disabled) { transform: none; }
.folder-tile {
  --tab-height: 9px;
  --folder-color: var(--board-folder);
  padding-top: calc(12px + var(--tab-height));
  border-radius: 0 0 5px 5px;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 2px 2px #212c3a30);
}
.folder-tile::before, .folder-tile::after {
  content: "";
  position: absolute;
  z-index: -1;
  background: var(--folder-color);
}
.folder-tile::before { inset: var(--tab-height) 0 0; border-radius: 0 5px 5px 5px; }
.folder-tile::after { inset: 0 auto auto 0; height: calc(var(--tab-height) + 1px); width: 48%; border-radius: 5px 13px 0 0; }
.folder-tile:hover { --folder-color: var(--board-folder-hover); background: transparent; }
.choice-picture {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.classic-tile .choice-picture { width: 85%; height: 87px; }
.choice-picture img, .choice-picture svg { display: block; width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; }
.choice-picture svg { width: 65%; height: 80%; max-width: 88px; }
.choice-numeral { font-size: 3rem; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1; }
.few-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.few-choices .classic-tile { min-height: 152px; }
.few-choices .choice-picture { height: 100px; }
.classic-page-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
}
.classic-page-controls p { font-size: 15px; font-variant-numeric: tabular-nums; }
.no-choices { grid-column: 1 / -1; padding: 20px 8px; color: #4a5055; }
.classic-flash-actions { display: flex; gap: 12px; justify-content: space-between; margin: 5px 0 16px; }
.classic-tool-links { display: flex; gap: 8px; }
.tile .choice-picture { width: 72px; height: 72px; flex-shrink: 0; }

.board-admin-dialog { width: min(710px, calc(100% - 20px)); }
.admin-content { padding: 16px 20px 20px; }
#admin-status { font-size: 15px; color: #294b6d; }
#admin-status:empty { display: none; }
#admin-status.is-error { color: #8b211a; }
#admin-login { display: grid; gap: 8px; max-width: 330px; margin-top: 12px; }
#admin-login .primary { margin-top: 6px; }
#admin-editor > .field-note { margin: 0 0 12px; }
#admin-editor > label { display: block; margin-bottom: 4px; }
#admin-search { width: 100%; margin-bottom: 12px; }
#admin-groups { display: grid; gap: 6px; }
.admin-group details { border: 1px solid #d7dee6; border-radius: 8px; }
.admin-group summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 45px;
  padding: 4px 12px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}
.admin-group-state { margin-left: auto; color: #4a5560; font-size: 13px; font-weight: 500; }
.admin-group summary:has(.admin-group-state)::after { margin-left: 7px; }
.admin-group summary::-webkit-details-marker { display: none; }
.admin-group summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin: 0 3px 3px auto;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.admin-group details[open] summary::after { transform: rotate(225deg); margin-bottom: -3px; }
.admin-group summary:hover { background: #f1f5f9; }
.admin-group-items { padding: 0 12px 6px; }
.admin-group .choice-picture { width: 35px; height: 31px; }
.admin-group .choice-numeral { font-size: 1.2rem; }
.admin-group .admin-folder-toggle, .admin-group .admin-tile-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  flex-direction: row;
  font-size: 15px;
  border-top: 1px solid #e3e8ed;
  cursor: pointer;
}
.admin-group .admin-folder-toggle { font-weight: 700; }
.admin-group input[type="checkbox"] {
  width: 21px;
  min-height: 0;
  height: 21px;
  margin: 0 2px 0 auto;
  accent-color: var(--board-focus);
}
.admin-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid #d7dee6;
  background: #fff;
}
@media (min-width: 550px) {
  .classic-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 740px) {
  .classic-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .classic-tile { min-height: 151px; }
  .classic-tile .choice-picture { height: 101px; }
}
@media (min-width: 970px) {
  .classic-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 1170px) {
  .classic-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .classic-tile { min-height: 173px; }
  .classic-tile .choice-picture { height: 117px; }
  .classic-tile strong { font-size: 1.25rem; }
}
@media (min-width: 740px) {
  .classic-tiles.few-choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .few-choices .classic-tile { min-height: 195px; }
  .few-choices .choice-picture { height: 125px; }
}
@media (max-width: 549px) {
  .sentence-bar { min-height: 82px; gap: 5px; padding-inline: 9px; }
  .sentence-token { font-size: 16px; }
  #sentence-hint { font-size: 15px; }
  .sentence-actions { gap: 0; }
  .sentence-actions button { padding-inline: 6px; }
  .sentence-actions .speak-sentence { gap: 5px; padding-inline: 8px; }
  .nav-group button { width: 42px; }
  .board-nav h1 { font-size: 14px; }
  .classic-tiles { scroll-margin-top: 144px; }
  .admin-content { padding-inline: 13px; }
  .admin-footer { padding-inline: 13px; }
}
@media print {
  .print-grid .choice-picture { display: flex; width: 0.55in; height: 0.55in; border: 0; padding: 0; }
  .print-grid .choice-picture img { width: 100%; height: 100%; object-fit: contain; }
}
