.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}
.level-resource-navigation {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 22px;
  border: 1px solid var(--panel-line);
  border-radius: 24px;
  padding: 8px;
  background: #fff;
  box-shadow: var(--shadow-card);
}

.level-resource-navigation.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.level-resource-navigation.is-double {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.level-resource-tab {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 66px;
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 10px 14px;
  color: var(--muted);
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.level-resource-tab:hover {
  border-color: rgba(75, 47, 189, 0.22);
  background: var(--surface-soft);
  color: var(--brand-navy);
}

.level-resource-tab:focus-visible,
.teacher-booklet-page-field input:focus-visible,
.teacher-booklet-toolbar .button:focus-visible {
  outline: 3px solid rgba(123, 92, 255, 0.34);
  outline-offset: 3px;
}

.level-resource-tab.is-active {
  border-color: rgba(75, 47, 189, 0.42);
  background: var(--brand-cyan-soft);
  color: var(--brand-navy);
}

.level-resource-tab-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  background: var(--brand-yellow);
  color: var(--brand-navy);
}

.level-resource-tab:nth-child(2) .level-resource-tab-icon {
  background: var(--accent-green);
}

.level-resource-tab:nth-child(3) .level-resource-tab-icon {
  background: var(--brand-cyan-soft);
}

.level-resource-tab strong,
.level-resource-tab small {
  display: block;
}

.level-resource-tab strong {
  font-size: 0.96rem;
}

.level-resource-tab small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.teacher-booklet-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.teacher-booklet-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.48fr) minmax(0, 1fr);
  gap: clamp(22px, 4vw, 42px);
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: 30px;
  padding: clamp(18px, 3vw, 28px);
  background: #fff;
  box-shadow: var(--shadow-panel);
}

.teacher-booklet-cover {
  position: relative;
  display: grid;
  width: min(100%, 310px);
  aspect-ratio: 210 / 297;
  place-items: center;
  justify-self: center;
  overflow: hidden;
  border: 1px solid rgba(38, 16, 122, 0.18);
  border-radius: 20px;
  background: #f2efff;
  box-shadow: 0 20px 34px rgba(38, 16, 122, 0.16);
}

.teacher-booklet-cover-loading {
  display: grid;
  gap: 10px;
  place-items: center;
  padding: 20px;
  color: var(--brand-navy);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 900;
}

.teacher-booklet-cover-loading .ui-icon {
  width: 40px;
  height: 40px;
}

.teacher-booklet-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 180ms ease;
  user-select: none;
}

.teacher-booklet-cover.is-ready img {
  opacity: 1;
}

.teacher-booklet-card-body {
  display: grid;
  align-content: center;
  justify-items: start;
  min-width: 0;
}

.teacher-booklet-card-body h3 {
  margin: 4px 0 10px;
  color: var(--brand-navy);
  font-size: clamp(1.55rem, 3vw, 2.35rem);
}

.teacher-booklet-card-body > p {
  max-width: 680px;
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 760;
}

.teacher-booklet-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.teacher-booklet-badges span,
.teacher-booklet-viewer-access {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 5px 11px;
  background: var(--brand-cyan-soft);
  color: var(--brand-navy);
  font-size: 0.76rem;
  font-weight: 1000;
}

.teacher-booklet-assignment-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .teacher-booklet-assignment-actions {
    justify-content: flex-start;
    width: 100%;
  }
}

.teacher-booklet-badges .teacher-booklet-official {
  background: var(--accent-green-soft);
  color: #176544;
}

.teacher-booklet-type {
  margin: 0 !important;
  color: var(--brand-cyan-strong) !important;
  font-size: 0.78rem;
  font-weight: 1000 !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.teacher-booklet-meta {
  display: grid;
  width: 100%;
  grid-template-columns: 0.5fr 1.2fr 0.8fr;
  gap: 10px;
  margin: 6px 0 20px;
}

.teacher-booklet-meta div {
  min-width: 0;
  border-radius: 16px;
  padding: 11px 13px;
  background: var(--surface-soft);
}

.teacher-booklet-meta dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.teacher-booklet-meta dd {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 1000;
}

.teacher-booklet-open {
  min-width: 190px;
}

.teacher-booklet-access-note {
  margin: 10px 0 0 !important;
  color: var(--muted) !important;
  font-size: 0.76rem;
}

.teacher-booklet-viewer-page {
  width: min(100%, 1480px);
  margin: 0 auto;
}

.teacher-booklet-viewer-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 14px;
  border: 1px solid var(--panel-line);
  border-radius: 24px;
  padding: 18px 20px;
  background: #fff;
  box-shadow: var(--shadow-card);
}

.teacher-booklet-viewer-header .back-link {
  margin-bottom: 12px;
}

.teacher-booklet-viewer-header .eyebrow {
  margin-bottom: 4px;
  color: var(--brand-cyan-strong);
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.teacher-booklet-viewer-header h1 {
  margin-bottom: 4px;
  font-size: clamp(1.45rem, 3vw, 2.35rem);
}

.teacher-booklet-viewer-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.teacher-booklet-viewer-access {
  align-self: start;
  background: var(--accent-green-soft);
  color: #176544;
}

.teacher-booklet-viewer-shell {
  display: grid;
  height: clamp(620px, 78vh, 860px);
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(21, 32, 59, 0.64);
  border-radius: 26px;
  background: #19243c;
  box-shadow: 0 28px 64px rgba(22, 29, 52, 0.26);
}

.teacher-booklet-control-stack {
  z-index: 4;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.teacher-booklet-viewer-shell:fullscreen {
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
}

.teacher-booklet-toolbar,
.teacher-booklet-viewer-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #fff;
}

.teacher-booklet-toolbar {
  border-bottom: 1px solid rgba(75, 47, 189, 0.12);
}

.teacher-booklet-toolbar-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.teacher-booklet-toolbar .button {
  min-height: 38px;
  box-shadow: none;
}

.booklet-icon-button {
  width: 40px;
  padding: 0;
}

.booklet-icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.teacher-booklet-fit-button,
.teacher-booklet-width-button {
  min-width: 92px;
}

.teacher-booklet-fit-button.is-active,
.teacher-booklet-width-button.is-active {
  border-color: rgba(75, 47, 189, 0.44);
  background: var(--brand-cyan-soft);
  color: var(--brand-navy);
}

.teacher-booklet-annotation-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 50px;
  padding: 7px 14px 9px;
  background: #fbfaff;
}

.teacher-booklet-tools-label {
  margin-right: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.teacher-booklet-annotation-toolbar .media-annotation-tool span {
  display: inline;
}

.teacher-booklet-annotation-toolbar .media-annotation-tool {
  gap: 6px;
  padding-inline: 10px;
}

.teacher-booklet-annotation-toolbar [data-media-annotation-tool="highlight"].is-active {
  border-color: rgba(224, 172, 0, 0.48);
  background: #fff7bf;
  color: #6f5500;
}

.teacher-booklet-color-field,
.teacher-booklet-size-field {
  display: inline-flex;
  align-items: center;
}

.teacher-booklet-history-tools {
  margin-left: auto;
}

.teacher-booklet-page-field {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.teacher-booklet-page-field input {
  width: 62px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  text-align: center;
  font-weight: 1000;
}

.teacher-booklet-canvas {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  place-items: start center;
  padding: clamp(16px, 3vw, 34px);
  background: #222f4b;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.teacher-booklet-page-surface {
  position: relative;
  display: grid;
  width: 100%;
  flex: 0 0 auto;
  grid-template-areas: "page";
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
}

.teacher-booklet-page-image,
.teacher-booklet-annotation-canvas {
  grid-area: page;
}

.teacher-booklet-page-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  background: #fff;
  user-select: none;
  -webkit-user-drag: none;
}

.teacher-booklet-annotation-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  touch-action: none;
}

.teacher-booklet-viewer-page.is-annotation-pan .teacher-booklet-annotation-canvas {
  pointer-events: none;
}

.teacher-booklet-viewer-page.is-annotation-draw .teacher-booklet-annotation-canvas,
.teacher-booklet-viewer-page.is-annotation-highlight .teacher-booklet-annotation-canvas {
  cursor: crosshair;
}

.teacher-booklet-viewer-page.is-annotation-eraser .teacher-booklet-annotation-canvas {
  cursor: cell;
}

.teacher-booklet-viewer-page.is-loading .teacher-booklet-page-surface,
.teacher-booklet-viewer-page.has-error .teacher-booklet-page-surface {
  visibility: hidden;
}

.teacher-booklet-loading,
.teacher-booklet-error {
  position: absolute;
  inset: 0;
  display: grid;
  gap: 8px;
  align-content: center;
  justify-items: center;
  padding: 30px;
  color: #fff;
  text-align: center;
  z-index: 3;
}

.teacher-booklet-loading[hidden],
.teacher-booklet-error[hidden] {
  display: none;
}

.teacher-booklet-loading-icon,
.teacher-booklet-error > .ui-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
}

.teacher-booklet-loading-icon .ui-icon,
.teacher-booklet-error > .ui-icon {
  width: 30px;
  height: 30px;
}

.teacher-booklet-loading span:last-child,
.teacher-booklet-error span {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.82rem;
  font-weight: 780;
}

.teacher-booklet-error .button {
  margin-top: 8px;
}

.teacher-booklet-viewer-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.teacher-booklet-viewer-footer span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

@media (max-width: 780px) {
  .level-resource-navigation,
  .teacher-booklet-card,
  .teacher-booklet-viewer-header {
    grid-template-columns: 1fr;
  }

  .level-resource-tab {
    min-height: 58px;
  }

  .teacher-booklet-card {
    border-radius: 24px;
  }

  .teacher-booklet-cover {
    width: min(74vw, 290px);
  }

  .teacher-booklet-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .teacher-booklet-meta div:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .teacher-booklet-open {
    width: 100%;
  }

  .teacher-booklet-viewer-header .back-link {
    width: 100%;
  }

  .teacher-booklet-viewer-access {
    justify-self: start;
  }

  .teacher-booklet-viewer-shell {
    height: clamp(560px, 76vh, 720px);
    min-height: 0;
    border-radius: 20px;
  }

  .teacher-booklet-toolbar {
    justify-content: center;
  }

  .teacher-booklet-toolbar-group {
    justify-content: center;
  }

  .teacher-booklet-zoom-controls {
    width: 100%;
  }

  .teacher-booklet-annotation-toolbar {
    justify-content: center;
    overflow-x: auto;
    padding-inline: 10px;
  }

  .teacher-booklet-tools-label,
  .teacher-booklet-annotation-toolbar .media-annotation-tool span,
  .teacher-booklet-size-field {
    display: none;
  }

  .teacher-booklet-history-tools {
    margin-left: 0;
  }

  .teacher-booklet-canvas {
    min-height: 0;
    padding: 12px;
  }

  .teacher-booklet-viewer-footer {
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 430px) {
  .teacher-booklet-toolbar-group:first-child {
    width: 100%;
  }

  .teacher-booklet-zoom-controls {
    display: grid;
    grid-template-columns: 40px minmax(76px, 1fr) minmax(76px, 1fr) 40px 40px;
  }

  .teacher-booklet-fit-button,
  .teacher-booklet-width-button {
    min-width: 0;
  }
}

@media print {
  .teacher-booklet-viewer-page {
    display: none !important;
  }

  body::after {
    display: block;
    padding: 48px;
    color: #26107a;
    font: 700 18px/1.5 system-ui, sans-serif;
    text-align: center;
    content: "This official resource is available for classroom viewing inside the Tortilla Learning Teacher Portal.";
  }
}
