/* Styles are scoped to the catalog dialog; no changes to the host page. */
.cr-dialog {
  --cr-navy: #213142; --cr-panel: #fff; --cr-orange: #d94625; --cr-paper: #faf8f3;
  --cr-background: #f8f7f3; --cr-muted: #66727d; --cr-line: #d9dddc;
  position: fixed; inset: 0; margin: 0; padding: 0; border: 0; width: 100vw; max-width: none;
  height: 100dvh; max-height: none; color: var(--cr-navy); background: var(--cr-background);
  font-family: inherit; font-size: 14px; line-height: 1.5; overflow: hidden; color-scheme: light;
}
.cr-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.cr-dialog::backdrop { background: #f8f7f3f5; }
.cr-dialog *, .cr-dialog *::before, .cr-dialog *::after { box-sizing: border-box; }
.cr-dialog [hidden] { display: none !important; }
.cr-dialog button, .cr-dialog input, .cr-dialog select { font: inherit; }
.cr-dialog button, .cr-dialog summary, .cr-dialog a { -webkit-tap-highlight-color: transparent; }
.cr-dialog button { cursor: pointer; }
.cr-dialog button:disabled { opacity: .3; cursor: default; }
.cr-dialog button:focus-visible, .cr-dialog a:focus-visible, .cr-dialog summary:focus-visible, .cr-dialog select:focus-visible, .cr-dialog input:focus-visible, .cr-read-view:focus-visible { outline: 2px solid var(--cr-orange); outline-offset: 4px; }
.cr-dialog svg { flex-shrink: 0; }
.cr-dialog a { color: inherit; text-decoration: none; }
.cr-header { min-height: 90px; display: flex; align-items: center; gap: 30px; padding: 14px 28px; padding-top: max(14px, env(safe-area-inset-top)); border-bottom: 1px solid var(--cr-line); background: var(--cr-background); z-index: 30; }
.cr-heading { min-width: 0; }
.cr-eyebrow { display: block; color: var(--cr-muted); font-size: 10px; font-weight: 600; letter-spacing: .17em; margin-bottom: 5px; }
.cr-heading h2 { margin: 0; font: inherit; font-size: 18px; font-weight: 600; letter-spacing: -.02em; color: var(--cr-navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-switch { margin-left: auto; }
.cr-switch select { max-width: 260px; padding: 9px 32px 9px 14px; border: 1px solid var(--cr-line); border-radius: 6px; background: var(--cr-panel); color: var(--cr-navy); font-size: 12px; }
.cr-header-actions { display: flex; align-items: center; gap: 10px; }
.cr-icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 42px; height: 42px; padding: 0; border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--cr-navy); transition: background .15s, border-color .15s; }
.cr-icon:hover:not(:disabled) { background: #21314208; border-color: #aab2b6; }
.cr-close { border-color: var(--cr-line); margin-left: 5px; }
.cr-download { position: relative; }
.cr-download summary { display: flex; align-items: center; gap: 10px; list-style: none; padding: 11px 16px; border-radius: 5px; background: var(--cr-orange); color: white; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.cr-download summary::-webkit-details-marker { display: none; }
.cr-download summary:hover { background: #c83c1c; }
.cr-download-menu { position: absolute; right: 0; top: calc(100% + 12px); min-width: 230px; padding: 8px; background: white; color: var(--cr-navy); border: 1px solid var(--cr-line); border-radius: 8px; box-shadow: 0 15px 45px #2131421f; z-index: 50; }
.cr-download-link { display: flex; align-items: center; justify-content: space-between; gap: 32px; border-radius: 5px; padding: 13px 12px; }
.cr-download-link:hover { background: #f2f4f4; }
.cr-download-link strong { font-size: 13px; font-weight: 600; }
.cr-download-link span { font-size: 11px; opacity: .6; }
.cr-body { position: relative; min-height: 0; display: flex; overflow: hidden; background: radial-gradient(ellipse at 50% 44%, #fff 0%, #f5f4f0 65%, #efeee9 100%); }
.cr-content { min-width: 0; flex: 1; position: relative; overflow: hidden; }
.cr-stage { height: 100%; width: 100%; padding: clamp(18px, 3.5vh, 38px) clamp(16px, 3vw, 48px); }
.cr-book { width: 100%; height: 100%; }
.cr-book .stf__wrapper { height: 100%; width: 100%; }
.cr-page { background: var(--cr-paper); overflow: hidden; box-shadow: 0 7px 24px #21314220; }
.cr-page-image { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--cr-paper); user-select: none; -webkit-user-drag: none; }
.cr-page-error { display: none; }
.cr-page.has-error .cr-page-image { visibility: hidden; }
.cr-page.has-error .cr-page-error { display: flex; position: absolute; inset: 0; align-items: center; justify-content: center; flex-direction: column; gap: 15px; padding: 24px; color: var(--cr-navy); text-align: center; }
.cr-page-error p { font-size: 14px; }
.cr-page-error a { border: 1px solid #17263033; }
.cr-status { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 28px); z-index: 15; padding: 9px 16px; border: 1px solid #e7c7ae; border-radius: 6px; background: #fff6e9; color: #68412a; text-align: center; font-size: 12px; }
.cr-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; z-index: 20; background: var(--cr-background); font-size: 13px; color: var(--cr-muted); }
.cr-spinner { width: 32px; height: 32px; border: 2px solid var(--cr-line); border-top-color: var(--cr-orange); border-radius: 50%; animation: cr-spin .8s linear infinite; }
@keyframes cr-spin { to { transform: rotate(360deg); } }
.cr-toolbar { min-height: 80px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; padding: 12px 28px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: var(--cr-background); border-top: 1px solid var(--cr-line); z-index: 30; }
.cr-tools-left, .cr-tools-right { display: flex; align-items: center; gap: 20px; min-width: 0; }
.cr-tools-right { justify-content: flex-end; }
.cr-tool { display: flex; align-items: center; gap: 9px; color: #435461; background: transparent; border: 0; padding: 10px 0; white-space: nowrap; font-size: 12px !important; }
.cr-tool:hover, .cr-tool[aria-pressed="true"], .cr-tool[aria-expanded="true"] { color: var(--cr-orange); }
.cr-tool svg { width: 19px; height: 19px; }
.cr-pagination { display: flex; align-items: center; gap: 13px; }
.cr-pagination .cr-icon { border: 1px solid var(--cr-line); width: 42px; height: 42px; }
.cr-page-form { display: flex; align-items: center; gap: 8px; }
.cr-page-number { width: 48px; height: 38px; padding: 0 5px; border: 1px solid var(--cr-line); border-radius: 4px; background: white; color: var(--cr-navy); text-align: center; font-variant-numeric: tabular-nums; appearance: textfield; -moz-appearance: textfield; }
.cr-page-number::-webkit-inner-spin-button, .cr-page-number::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cr-page-total { color: var(--cr-muted); white-space: nowrap; font-size: 12px; min-width: 28px; }
.cr-hint { font-size: 11px; color: var(--cr-muted); text-align: right; }
.cr-thumbnails { width: 218px; flex-shrink: 0; overflow-y: auto; background: #f6f5f1; border-right: 1px solid var(--cr-line); scrollbar-color: #b1b9bd transparent; overscroll-behavior: contain; }
.cr-thumbnails-heading { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 10px 16px; color: var(--cr-navy); font-size: 11px; letter-spacing: .02em; }
.cr-thumbnails-heading .cr-icon { width: 32px; height: 32px; }
.cr-thumbnails-heading .cr-icon svg { width: 16px; }
.cr-thumbnail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 10px; padding: 6px 15px 22px; }
.cr-thumbnail { display: flex; flex-direction: column; align-items: center; padding: 4px; border: 1px solid transparent; border-radius: 3px; background: transparent; color: var(--cr-muted); }
.cr-thumbnail img { width: 100%; aspect-ratio: 148 / 210; object-fit: contain; background: var(--cr-paper); }
.cr-thumbnail span { margin-top: 6px; font-size: 11px; }
.cr-thumbnail:hover { background: #e9ebe7; }
.cr-thumbnail.is-current { border-color: var(--cr-orange); color: var(--cr-orange); }
.cr-read-view { width: 100%; height: 100%; padding: 16px; overflow: auto; overscroll-behavior: contain; scrollbar-color: #a3adb4 #f5f4f0; touch-action: pan-x pan-y; }
.cr-read-image { display: block; height: auto; max-width: none; margin: 0 auto; background: var(--cr-paper); box-shadow: 0 10px 38px #21314224; user-select: none; -webkit-user-drag: none; }
.cr-read-error { position: absolute; inset: 25% 20px auto; padding: 20px; background: var(--cr-panel); text-align: center; }
.cr-zoom-controls { display: flex; align-items: center; gap: 4px; }
.cr-zoom-value { min-width: 45px; font-size: 12px; color: var(--cr-navy); text-align: center; font-variant-numeric: tabular-nums; }
.cr-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; clip: rect(0,0,0,0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0; }
@media (max-width: 1000px) {
  .cr-header { gap: 18px; padding-left: 18px; padding-right: 18px; }
  .cr-switch { display: none; }
  .cr-header-actions { margin-left: auto; }
  .cr-hint { display: none; }
  .cr-toolbar { gap: 10px; padding-left: 18px; padding-right: 18px; }
  .cr-tools-left { gap: 14px; }
  .cr-tools-right { min-width: 0; }
}
@media (max-width: 700px) {
  .cr-header { min-height: 77px; padding: 12px 12px; padding-top: max(12px, env(safe-area-inset-top)); gap: 7px; }
  .cr-eyebrow { font-size: 8px; letter-spacing: .13em; margin-bottom: 4px; }
  .cr-heading h2 { font-size: 14px; }
  .cr-header-actions { gap: 4px; }
  .cr-download summary { padding: 10px; border-radius: 50%; }
  .cr-download summary span { display: none; }
  .cr-fullscreen { display: none; }
  .cr-close { margin: 0; }
  .cr-icon { width: 40px; height: 40px; }
  .cr-stage { padding: 14px 10px; }
  .cr-toolbar { min-height: 76px; grid-template-columns: auto 1fr; gap: 8px; padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .cr-tools-left { gap: 6px; }
  .cr-tool { width: 38px; height: 42px; justify-content: center; padding: 0; }
  .cr-tool span { display: none; }
  .cr-pagination { justify-content: flex-end; gap: 9px; }
  .cr-pagination .cr-icon { width: 40px; height: 40px; }
  .cr-tools-right { display: none; }
  .is-reading .cr-toolbar { grid-template-columns: auto 1fr; }
  .is-reading .cr-tools-right { display: flex; grid-column: 1/-1; justify-content: center; border-top: 1px solid var(--cr-line); padding-top: 3px; margin-top: 2px; }
  .is-reading .cr-tools-right .cr-icon { height: 32px; }
  .cr-page-number { width: 40px; }
  .cr-page-total { min-width: 24px; }
  .cr-thumbnails { position: absolute; left: 0; top: 0; bottom: 0; z-index: 25; width: 208px; box-shadow: 12px 0 30px #2131421f; }
  .cr-status { font-size: 11px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .cr-header { min-height: 58px; padding-top: 6px; padding-bottom: 6px; }
  .cr-eyebrow { display: none; }
  .cr-toolbar { min-height: 56px; padding-top: 6px; padding-bottom: 6px; }
  .cr-stage { padding-top: 8px; padding-bottom: 8px; }
  .is-reading .cr-tools-right { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cr-dialog *, .cr-dialog *::before, .cr-dialog *::after { animation-duration: .001ms !important; transition: none !important; scroll-behavior: auto !important; }
}
