:root {
  color-scheme: light;
  --ink: #241e2b;
  --muted: #675f70;
  --muted-2: #584f68;
  --paper: #fffdfb;
  --paper-2: #f8f5f7;
  --plum: #492e83;
  --plum-dark: #2c1c54;
  --plum-soft: #eee8f8;
  --coral: #ee785c;
  --teal: #166d8f;
  --green: #276f4b;
  --line: #8b8198;
  --shadow: 0 18px 48px rgba(44, 28, 84, 0.12);
  --radius: 18px;
  --sidebar: 356px;
  font-family: "Segoe UI", "Aptos", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 4%, rgba(238, 120, 92, 0.12), transparent 26rem),
    var(--paper-2);
}

button,
input,
select {
  font: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(22, 109, 143, 0.35);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  color: white;
  background: var(--plum-dark);
  border-radius: 8px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 30px;
  color: white;
  background: rgba(44, 28, 84, 0.97);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px);
}

.brand,
.topbar-actions,
.brand > span:last-child {
  display: flex;
  align-items: center;
}

.brand {
  gap: 13px;
}

.brand > span:last-child {
  align-items: flex-start;
  flex-direction: column;
  line-height: 1.15;
}

.brand strong {
  font-size: 19px;
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 8px);
  gap: 3px;
  align-items: end;
  width: 35px;
  height: 35px;
  padding: 7px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.brand-mark i {
  display: block;
  background: white;
  border-radius: 4px 4px 2px 2px;
}

.brand-mark i:nth-child(1) { height: 9px; opacity: 0.7; }
.brand-mark i:nth-child(2) { height: 17px; background: var(--coral); }
.brand-mark i:nth-child(3) { height: 13px; opacity: 0.9; }

.topbar-actions {
  gap: 16px;
}

.version {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.secondary-button,
.tour-row button {
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  color: white;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.secondary-button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: calc(100vh - 78px);
}

.sidebar {
  position: sticky;
  top: 78px;
  align-self: start;
  height: calc(100vh - 78px);
  padding: 24px 20px 18px;
  overflow-y: auto;
  background: rgba(255, 253, 251, 0.94);
  border-right: 1px solid var(--line);
}

.intro-card {
  padding: 21px;
  background: linear-gradient(145deg, var(--plum-soft), #fff7f3);
  border: 1px solid rgba(73, 46, 131, 0.12);
  border-radius: var(--radius);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--plum);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.intro-card h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: -0.025em;
}

.intro-card p {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.tour-panel {
  margin-top: 22px;
}

.tour-panel > label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.tour-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.tour-row select,
.search-wrap input {
  width: 100%;
  min-height: 42px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.tour-row select {
  padding: 0 34px 0 11px;
}

.tour-row button {
  color: white;
  background: var(--plum);
  border-color: var(--plum);
  font-size: 12px;
  font-weight: 700;
}

.tour-row button:hover {
  background: var(--plum-dark);
}

.search-wrap {
  position: relative;
  margin: 18px 0 14px;
}

.search-wrap input {
  padding: 0 38px 0 13px;
}

.search-wrap span {
  position: absolute;
  top: 8px;
  right: 13px;
  color: var(--muted-2);
  font-size: 22px;
}

.screen-navigation {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nav-group h2 {
  margin: 0 0 6px 9px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.screen-link {
  width: 100%;
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
}

.screen-link:hover {
  color: var(--ink);
  background: var(--paper-2);
}

.screen-link.active {
  color: var(--plum-dark);
  background: var(--plum-soft);
}

.screen-link .number {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  color: var(--muted-2);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
}

.screen-link.active .number {
  color: white;
  background: var(--plum);
  border-color: var(--plum);
}

.screen-link .label {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-link .arrow {
  opacity: 0;
  color: var(--plum);
}

.screen-link:hover .arrow,
.screen-link.active .arrow {
  opacity: 1;
}

.empty-navigation {
  padding: 14px;
  color: var(--muted);
  background: var(--paper-2);
  border-radius: 10px;
  font-size: 12px;
}

.offline-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px 6px 0;
  color: var(--green);
  font-size: 11px;
  font-weight: 650;
}

.offline-note span {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: white;
  background: var(--green);
  border-radius: 50%;
  font-size: 10px;
}

.viewer {
  width: min(100%, 1680px);
  margin: 0 auto;
  padding: 40px clamp(22px, 4vw, 64px) 60px;
}

.viewer-header {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: flex-start;
}

.viewer-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dot {
  width: 4px;
  height: 4px;
  background: var(--coral);
  border-radius: 50%;
}

.viewer h2 {
  margin: 8px 0 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(29px, 3vw, 44px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

#screenDescription {
  max-width: 740px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.viewer-tools {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  color: var(--plum);
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.icon-button:hover {
  border-color: var(--plum);
}

.role-row {
  min-height: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 16px 0;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  color: var(--plum);
  background: var(--plum-soft);
  border: 1px solid rgba(73, 46, 131, 0.12);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.canvas {
  position: relative;
  margin: 0;
  padding: clamp(8px, 1.5vw, 18px);
  overflow: hidden;
  background:
    linear-gradient(45deg, #f6f2f7 25%, transparent 25%),
    linear-gradient(-45deg, #f6f2f7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f6f2f7 75%),
    linear-gradient(-45deg, transparent 75%, #f6f2f7 75%),
    white;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.canvas img {
  display: block;
  width: 100%;
  height: auto;
  background: white;
  border-radius: 10px;
  transition: opacity 150ms ease;
}

.canvas.loading-image img {
  opacity: 0.18;
}

.loading {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  display: none;
  padding: 10px 14px;
  color: var(--plum);
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  transform: translate(-50%, -50%);
}

.canvas.loading-image .loading {
  display: block;
}

.canvas figcaption {
  margin: 12px 4px 1px;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}

.viewer-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(80px, 220px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-top: 20px;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 11px 13px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
}

.nav-button > span { min-width: 0; }

.nav-button.next {
  justify-content: flex-end;
  text-align: right;
}

.nav-button:hover:not(:disabled) {
  background: white;
}

.nav-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.nav-button > span:first-child,
.nav-button.next > span:last-child {
  color: var(--plum);
  font-size: 21px;
}

.nav-button small,
.nav-button strong {
  display: block;
}

.nav-button small {
  margin-bottom: 2px;
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.nav-button strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress {
  height: 4px;
  overflow: hidden;
  background: var(--line);
  border-radius: 99px;
}

.progress span {
  display: block;
  width: 4%;
  height: 100%;
  background: linear-gradient(90deg, var(--plum), var(--coral));
  border-radius: inherit;
  transition: width 180ms ease;
}

.guide-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 38px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.guide-card > div {
  min-height: 95px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 21px;
  background: rgba(255, 255, 255, 0.78);
}

.guide-number {
  color: #c4522f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
}

.guide-card p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.guide-card strong {
  color: var(--ink);
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 30px;
  color: rgba(255, 255, 255, 0.65);
  background: var(--plum-dark);
  font-size: 10px;
  letter-spacing: 0.04em;
}

body.presentation-mode .sidebar,
body.presentation-mode .viewer-header,
body.presentation-mode .role-row,
body.presentation-mode .guide-card,
body.presentation-mode .page-footer {
  display: none;
}

body.presentation-mode .app-shell {
  display: block;
}

body.presentation-mode .viewer {
  width: 100%;
  max-width: none;
  padding: 18px;
}

body.presentation-mode .canvas {
  max-width: min(100%, calc((100vh - 170px) * 1.40625));
  margin-inline: auto;
}

body.presentation-mode .viewer-footer {
  max-width: 960px;
  margin-inline: auto;
}

@media (max-width: 1040px) {
  :root { --sidebar: 300px; }
  .viewer { padding-inline: 26px; }
  .viewer-header { flex-direction: column; gap: 16px; }
  .guide-card { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar { height: auto; min-height: 72px; padding: 12px 16px; }
  .version { display: none; }
  .secondary-button { padding: 9px 10px; font-size: 11px; }
  .brand small { display: none; }
  .app-shell { display: block; }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .intro-card { display: none; }
  .screen-navigation {
    max-height: 260px;
    padding-right: 4px;
    overflow-y: auto;
  }
  .offline-note { display: none; }
  .viewer { padding: 26px 12px 42px; }
  .viewer-tools { width: 100%; }
  .icon-button { justify-content: center; flex: 1; }
  .canvas { border-radius: 12px; }
  .viewer-footer { grid-template-columns: 1fr 1fr; gap: 8px; }
  .progress { grid-column: 1 / -1; grid-row: 1; }
  .nav-button { grid-row: 2; }
  .page-footer { flex-direction: column; }
}

@media print {
  .topbar,
  .sidebar,
  .viewer-header,
  .role-row,
  .viewer-footer,
  .guide-card,
  .page-footer {
    display: none !important;
  }
  .app-shell { display: block; }
  .viewer { padding: 0; }
  .canvas { padding: 0; border: 0; box-shadow: none; }
  .canvas figcaption { display: none; }
}

/* Passe accessibilité et consultation — 27 août 2026 */
html[data-ui-scale="90"] { font-size: 14.4px; }
html[data-ui-scale="100"] { font-size: 16px; }
html[data-ui-scale="125"] { font-size: 20px; }
html[data-ui-scale="150"] { font-size: 24px; }
html[data-ui-scale="200"] { font-size: 32px; }

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
.canvas-viewport:focus-visible {
  outline: 3px solid #167ea5;
  outline-offset: 3px;
}

button,
.icon-button,
.screen-link,
select,
input {
  min-height: 44px;
}

.brand strong { font-size: 1.1875rem; }
.brand small,
.eyebrow,
.tour-panel > label,
.offline-note,
.role-chip,
.canvas figcaption { font-size: 0.75rem; }
.version,
.tour-row button,
.screen-link .label,
.empty-navigation,
.icon-button,
.nav-button strong,
.guide-card p { font-size: 0.75rem; }
.intro-card h1,
.guide-number { font-size: 1.5rem; }
.intro-card p { font-size: 0.8125rem; }
.search-wrap span { font-size: 1.375rem; }
.nav-group h2,
.screen-link .number,
.viewer-meta,
.nav-button small,
.page-footer { font-size: 0.75rem; }
.viewer h2 {
  font-size: clamp(1.8125rem, 3vw, 2.75rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}
#screenDescription { font-size: 0.875rem; }
.nav-button > span:first-child,
.nav-button.next > span:last-child { font-size: 1.3125rem; }

.display-panel {
  position: fixed;
  z-index: 90;
  top: 88px;
  right: 24px;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 104px);
  padding: 24px;
  overflow-y: auto;
  color: var(--ink);
  background: rgba(255, 253, 251, 0.99);
  border: 2px solid var(--plum);
  border-radius: 18px;
  box-shadow: 0 24px 72px rgba(23, 18, 30, 0.28);
}

.display-panel[hidden] {
  display: none;
}

.display-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.display-panel-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  line-height: 1.2;
}

.panel-close {
  width: 44px;
  min-width: 44px;
  padding: 0;
  color: var(--plum-dark);
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 1.5rem;
  cursor: pointer;
}

.display-panel fieldset {
  min-width: 0;
  margin: 22px 0 0;
  padding: 0;
  border: 0;
}

.display-panel legend {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.choice-row button,
.toggle-grid button,
.reset-button,
.canvas-toolbar button {
  min-width: 44px;
  padding: 9px 12px;
  color: var(--plum-dark);
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.choice-row button[aria-pressed="true"],
.toggle-grid button[aria-pressed="true"] {
  color: white;
  background: var(--plum);
  border-color: var(--plum);
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 22px;
}

.toggle-grid button {
  min-height: 54px;
}

.reset-button {
  width: 100%;
  margin-top: 16px;
  border-color: var(--plum);
}

.display-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

.screen-guidance {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin: 0 0 18px;
  padding: 14px 16px;
  color: var(--ink);
  background: var(--plum-soft);
  border: 1px solid #c9bddc;
  border-radius: 14px;
}

.screen-guidance > span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: white;
  background: var(--plum);
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 800;
}

.screen-guidance h3 {
  margin: 1px 0 4px;
  font-size: 0.75rem;
}

.screen-guidance p {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

.canvas {
  overflow: visible;
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 10px;
  padding: 2px 2px 0;
}

.canvas-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.canvas-toolbar > div {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.canvas-toolbar button {
  padding-inline: 13px;
}

#zoomFitButton {
  min-width: 88px;
}

.canvas-viewport {
  position: relative;
  width: 100%;
  max-height: min(76vh, 900px);
  overflow: auto;
  overscroll-behavior: contain;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  scrollbar-gutter: stable both-edges;
  touch-action: pan-x pan-y pinch-zoom;
  cursor: grab;
}

.canvas-viewport.dragging {
  cursor: grabbing;
  user-select: none;
}

html[data-board-zoom="fit"] .canvas-viewport {
  cursor: default;
}

.canvas img {
  width: 100%;
  min-width: 0;
  max-width: none;
  border-radius: 0;
}

html[data-board-zoom="90"] .canvas img { width: 1296px; }
html[data-board-zoom="100"] .canvas img { width: 1440px; }
html[data-board-zoom="125"] .canvas img { width: 1800px; }
html[data-board-zoom="150"] .canvas img { width: 2160px; }
html[data-board-zoom="200"] .canvas img { width: 2880px; }

html[data-board-zoom]:not([data-board-zoom="fit"]) .canvas-viewport {
  min-height: min(70vh, 720px);
}

html[data-display-comfort="true"] body {
  letter-spacing: 0.12em;
  line-height: 1.5;
  word-spacing: 0.16em;
}

html[data-display-comfort="true"] .screen-link,
html[data-display-comfort="true"] .guide-card > div,
html[data-display-comfort="true"] .screen-guidance {
  padding-block: 16px;
}

html[data-display-contrast="true"] {
  --ink: #111111;
  --muted: #312b36;
  --muted-2: #49414f;
  --paper: #ffffff;
  --paper-2: #ffffff;
  --plum: #32156f;
  --plum-dark: #19093f;
  --plum-soft: #eee7ff;
  --line: #716779;
  --teal: #075878;
  --green: #145c38;
}

html[data-display-contrast="true"] body,
html[data-display-contrast="true"] .intro-card {
  background-image: none;
}

html[data-display-contrast="true"] .topbar,
html[data-display-contrast="true"] .page-footer {
  background: var(--plum-dark);
}

html[data-display-motion="true"] *,
html[data-display-motion="true"] *::before,
html[data-display-motion="true"] *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

html[data-ui-scale="150"] .app-shell,
html[data-ui-scale="200"] .app-shell {
  display: block;
}

html[data-ui-scale="150"] .sidebar,
html[data-ui-scale="200"] .sidebar {
  position: static;
  width: 100%;
  height: auto;
  max-height: none;
  border-right: 0;
  border-bottom: 1px solid var(--line);
}

html[data-ui-scale="150"] .screen-navigation,
html[data-ui-scale="200"] .screen-navigation {
  max-height: 22rem;
  overflow-y: auto;
}

html[data-ui-scale="150"] .viewer-header,
html[data-ui-scale="200"] .viewer-header,
html[data-ui-scale="150"] .topbar,
html[data-ui-scale="200"] .topbar {
  flex-wrap: wrap;
}

html[data-ui-scale="150"] .topbar,
html[data-ui-scale="200"] .topbar {
  height: auto;
  min-height: 78px;
  padding-block: 12px;
}

html[data-ui-scale="125"] .screen-link .label,
html[data-ui-scale="150"] .screen-link .label,
html[data-ui-scale="200"] .screen-link .label,
html[data-ui-scale="150"] .nav-button strong,
html[data-ui-scale="200"] .nav-button strong {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .topbar {
    height: auto;
    min-height: 72px;
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .intro-card {
    display: none;
  }

  .screen-navigation {
    max-height: 260px;
    padding-right: 4px;
    overflow-y: auto;
  }

  .offline-note {
    display: none;
  }

  .viewer {
    padding: 26px 14px 42px;
  }

  .display-panel {
    top: 12px;
    right: 12px;
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }
}

@media (max-width: 520px) {
  .brand small,
  .version {
    display: none;
  }

  .topbar-actions {
    width: 100%;
    gap: 8px;
  }

  .topbar-actions button {
    flex: 1;
  }

  .viewer-header,
  .canvas-toolbar,
  .page-footer {
    flex-direction: column;
  }

  .viewer-header > div,
  .display-panel-heading > div {
    width: 100%;
    min-width: 0;
  }

  .viewer-meta,
  .display-panel-heading h2,
  .display-panel .eyebrow {
    flex-wrap: wrap;
    overflow-wrap: anywhere;
  }

  .display-panel-heading {
    gap: 8px;
  }

  .viewer-tools,
  .canvas-toolbar > div {
    width: 100%;
  }

  .canvas-toolbar button {
    flex: 1;
  }

  .toggle-grid {
    grid-template-columns: 1fr;
  }

  .viewer-footer {
    grid-template-columns: 1fr;
  }

  .progress,
  .nav-button {
    grid-column: 1;
  }

  .progress { grid-row: 1; }
  .nav-button { grid-row: auto; }
  .nav-button.next { justify-content: flex-start; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --muted: #312b36;
    --muted-2: #49414f;
    --line: #716779;
  }

  button,
  input,
  select,
  .icon-button,
  .canvas-viewport {
    border-width: 2px;
  }
}

@media (forced-colors: active) {
  button,
  input,
  select,
  .icon-button,
  .screen-link,
  .screen-guidance,
  .canvas-viewport {
    border: 2px solid ButtonText;
  }

  .screen-link.active,
  .choice-row button[aria-pressed="true"],
  .toggle-grid button[aria-pressed="true"] {
    color: HighlightText;
    background: Highlight;
  }

  .canvas img {
    forced-color-adjust: none;
  }
}

@media print {
  .display-panel,
  .canvas-toolbar,
  .screen-guidance {
    display: none !important;
  }
}
