/* Mobile image reading and knowledge cards share the existing visual tokens. */
.topbar__title { min-width: 0; }
.topbar__meta { max-width: 52%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zoomable-image { cursor: zoom-in; }
.zoomable-image:focus-visible { outline: 3px solid #b48024; outline-offset: 4px; }
.image-viewer { padding: 0; border: 0; margin: auto; background: #101b2c; color: #fff;
  width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; overflow: hidden; }
.image-viewer[open] { display: flex; flex-direction: column; }
.image-viewer::backdrop { background: #101b2cee; }
.image-viewer__head { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px; border-bottom: 1px solid #344258; }
.image-viewer__head h2 { font-size: 17px; margin: 0; }
.image-viewer button { border: 1px solid #56647b; border-radius: 9px; background: #23324a;
  color: #fff; cursor: pointer; min-width: 44px; min-height: 44px; padding: 6px 12px; font: inherit; }
.image-viewer button:disabled { opacity: .45; cursor: default; }
.image-viewer button:focus-visible { outline: 3px solid #f3ca78; outline-offset: 2px; }
.image-viewer__stage { flex: 1; min-height: 0; position: relative; overflow: hidden;
  touch-action: none; user-select: none; cursor: zoom-in; }
.image-viewer__stage.is-zoomed { cursor: grab; }
.image-viewer__stage.is-zoomed:active { cursor: grabbing; }
.image-viewer__stage img { position: absolute; left: 50%; top: 50%; max-width: none; max-height: none;
  transform-origin: center; background: white; pointer-events: none; will-change: transform; }
#viewer-message { position: absolute; inset: 40% 20px auto; text-align: center; color: #d1def0; }
.image-viewer__hint { margin: 10px 12px; text-align: center; font-size: 12px; color: #bccae0; }
.image-viewer__tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px;
  border-top: 1px solid #344258; padding: 12px 8px max(12px, env(safe-area-inset-bottom)); }
.image-viewer__tools output { font-size: 13px; min-width: 46px; text-align: center; }
.image-viewer__tools button { font-size: 13px; }
.knowledge-controls .card__title { font-size: 20px; line-height: 1.5; color: var(--ink); }
.knowledge-modules { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 16px; }
.knowledge-modules button { font: inherit; font-size: 13px; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; }
.knowledge-modules button[aria-pressed="true"] { background: var(--blue); color: white; border-color: var(--blue); }
.knowledge-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.knowledge-filters .field { display: block; margin: 0; min-width: 0; }
.knowledge-filters select { width: 100%; display: block; min-height: 44px; margin-top: 6px; }
.knowledge-search { display: block; margin-top: 14px; font-size: 13px; color: var(--ink-soft); }
.knowledge-search input { display: block; width: 100%; min-width: 0; min-height: 44px; margin-top: 6px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); font: inherit; font-size: 16px; }
.knowledge-filterline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 16px; font-size: 13px; color: var(--ink-soft); }
.knowledge-filterline select { padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: white; min-height: 40px; }
.knowledge-catalog { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.knowledge-catalog summary { cursor: pointer; font-size: 14px; color: var(--blue); }
#knowledge-list { display: grid; gap: 6px; max-height: 260px; overflow: auto; padding-top: 10px; }
#knowledge-list button { font: inherit; font-size: 14px; text-align: left; padding: 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; }
#knowledge-list button[aria-current="true"] { background: var(--blue-tint); border-color: var(--blue); }
.knowledge-reader { padding: 24px; scroll-margin-top: 72px; }
.knowledge-reader__meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12px;
  color: var(--ink-soft); line-height: 1.6; }
#knowledge-position { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.knowledge-reader h2 { font-size: 25px; line-height: 1.5; margin: 18px 0; letter-spacing: -.02em; }
.knowledge-reader h3 { font-size: 14px; margin: 24px 0 10px; color: var(--ink-soft); }
.knowledge-takeaway { border-left: 3px solid var(--blue); padding: 14px 16px; background: var(--blue-tint);
  border-radius: 0 8px 8px 0; font-size: 18px; line-height: 1.8; font-weight: 650; white-space: pre-line; overflow-wrap: anywhere; }
.knowledge-reader ul { padding-left: 22px; margin: 0; }
.knowledge-reader li { padding: 4px 0; line-height: 1.95; }
.knowledge-reader p:not(.knowledge-source) { line-height: 1.95; white-space: pre-line; overflow-wrap: anywhere; }
.knowledge-example { background: #f4f6f9; padding: 16px; border-radius: 10px; margin-top: 24px; }
.knowledge-example h3 { margin-top: 0; }
.knowledge-example p { margin: 0; }
.knowledge-source { font-size: 12px; color: var(--ink-faint); line-height: 1.75; border-top: 1px solid var(--line);
  margin-top: 24px; padding-top: 14px; }
.knowledge-reader .row { margin-top: 16px; }
.knowledge-reader button[aria-pressed="true"] { background: var(--blue-tint); border-color: var(--blue); color: var(--blue); }
.knowledge-empty { text-align: center; padding: 32px 20px; }
@media (max-width: 400px) {
  .knowledge-reader { padding: 20px; }
  .knowledge-reader h2 { font-size: 23px; }
  .knowledge-modules { gap: 6px; }
  .knowledge-modules button { padding: 8px 10px; }
  .image-viewer__tools { gap: 5px; }
}
