.photo-overlay {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  box-sizing: border-box; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  color: var(--pt-text); background: var(--pt-overlay, rgba(4,6,4,.76)); font-family: var(--pager-ui-font); text-align: left;
}
.photo-overlay[hidden], .photo-overlay [hidden] { display: none !important; }
.photo-overlay *, .photo-overlay *::before, .photo-overlay *::after { box-sizing: border-box; }
.photo-panel {
  display: flex; flex-direction: column; width: min(100%, 420px); min-height: 0;
  max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  padding: 12px 20px 20px; border: 1px solid var(--pt-line); border-radius: var(--pager-ui-panel-radius);
  color: var(--pt-text); background: var(--pt-surface); box-shadow: 0 18px 60px #0004;
}
.photo-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex: none; margin-bottom: 16px; }
.photo-header h2 { min-width: 0; margin: 0; font: var(--pager-ui-title-weight) var(--pager-ui-title-size)/1.3 var(--pager-ui-font); letter-spacing: 0; text-align: left; }
.photo-overlay button { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.photo-overlay button:disabled { opacity: .4; cursor: default; }
.photo-overlay :is(button, textarea, .photo-viewer-stage):focus-visible { outline: 2px solid var(--pt-accent); outline-offset: 2px; }
.photo-icon-button { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; color: var(--pt-muted); background: transparent; font-size: 24px; line-height: 1; }
.photo-icon-button:not(:disabled):active { background: var(--pt-surface-alt); }
.photo-editor-content { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.photo-status { margin: 0 0 8px; font-size: var(--pager-ui-note-size); line-height: 1.45; color: var(--pt-muted); }
.photo-progress { display: block; width: 100%; height: 5px; margin: 0 0 16px; accent-color: var(--pt-accent); }
.photo-compose-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.photo-compose-grid[data-count="1"] { grid-template-columns: minmax(0, 1fr); }
.photo-compose-item { position: relative; min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--pt-line); border-radius: 14px; background: var(--pt-surface-alt); }
.photo-compose-preview { display: block; width: 100%; max-height: 100px; aspect-ratio: 3 / 2; margin: 0; padding: 0; border: 0; background: transparent; }
.photo-compose-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-compose-grid[data-count="1"] .photo-compose-preview { max-height: none; aspect-ratio: 4 / 3; }
.photo-compose-grid[data-count="1"] .photo-compose-preview img { object-fit: contain; }
.photo-compose-number { position: absolute; top: 8px; left: 8px; display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 8px; color: #fff; background: #10140fc9; font-size: 12px; line-height: 1; pointer-events: none; }
.photo-compose-remove { position: absolute; top: 2px; right: 2px; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; color: #fff; background: #10140fc9; font-size: 24px; line-height: 1; }
.photo-compose-order { display: grid; grid-template-columns: 1fr 1fr; }
.photo-order-button { min-height: 44px; padding: 0; border: 0; color: var(--pt-text); background: transparent; font-size: 20px; }
.photo-order-button + .photo-order-button { border-left: 1px solid var(--pt-line); }
.photo-add { width: 100%; margin: 16px 0 24px; }
.photo-add[hidden] ~ .photo-caption-label { margin-top: 24px; }
.photo-caption-label { display: block; margin: 0 0 8px; font-size: var(--pager-ui-label-size); line-height: 1.3; font-weight: var(--pager-ui-title-weight); }
.photo-caption { display: block; width: 100%; min-height: 80px; max-height: 160px; padding: 12px; resize: vertical; border: 1px solid var(--pt-line); border-radius: var(--pager-ui-control-radius); color: var(--pt-text); background: var(--pt-surface-alt); font: 400 16px/1.45 var(--pager-ui-font); }
.photo-caption::placeholder { color: var(--pt-muted); opacity: 1; }
.photo-caption-count { margin: 6px 0 0; text-align: right; color: var(--pt-muted); font-size: var(--pager-ui-note-size); line-height: 1.45; font-variant-numeric: tabular-nums; }
.photo-error { margin: 16px 0 0; padding: 10px 12px; border-radius: 12px; color: var(--pt-text); background: var(--pager-error-bg-v4, var(--pt-surface-alt)); font-size: var(--pager-ui-note-size); line-height: 1.45; overflow-wrap: anywhere; }
.photo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: none; margin-top: 24px; }
.photo-primary, .photo-secondary { min-height: var(--pager-ui-control-height); padding: 12px; border: 0; border-radius: var(--pager-ui-control-radius); font: var(--pager-ui-title-weight) var(--pager-ui-label-size)/1.3 var(--pager-ui-font); }
.photo-primary { color: var(--pt-on-accent); background: var(--pt-accent); }
html[data-pager-theme="light"] .photo-primary { background: var(--pt-accent-soft); }
.photo-secondary { color: var(--pt-text); background: var(--pt-surface-alt); }
/* Pager chrome around PhotoSwipe's native slide, pan and zoom engine. */
.photo-viewer.pswp { --pswp-root-z-index: 91; --pswp-bg: var(--pt-bg); --pswp-placeholder-bg: var(--pt-surface-alt); --pswp-icon-color: var(--pt-text); --pswp-error-text-color: var(--pt-muted); color: var(--pt-text); font-family: var(--pager-ui-font); }
.photo-viewer [hidden] { display: none !important; }
.photo-viewer .pswp__top-bar { display: grid; grid-template-columns: 44px 1fr 44px; grid-template-rows: 44px; align-items: center; height: calc(68px + env(safe-area-inset-top)); padding: calc(12px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left)); }
.photo-viewer .pswp__button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; margin: 0; border: 0; border-radius: 50%; color: var(--pt-text); background: color-mix(in srgb, var(--pt-bg) 78%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); opacity: 1; font-family: var(--pager-ui-font); }
.photo-viewer .pswp__button .pswp__icn { position: static; display: block; width: 22px; height: 22px; margin: 0; color: currentColor; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transform: none; }
.photo-viewer .pswp__button:not(:disabled):active { background: var(--pt-surface-alt); }
.photo-viewer .pswp__button:disabled { opacity: .3; }
.photo-viewer .pswp__button:focus-visible, .photo-viewer .photo-viewer-order-button:focus-visible { outline: 2px solid var(--pt-accent); outline-offset: 2px; }
.photo-viewer .photo-viewer-close { grid-column: 1; grid-row: 1; }
.photo-viewer .photo-viewer-close,
.photo-viewer .photo-viewer-close:not(:disabled):active { background: transparent; border-radius: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
.photo-viewer .photo-viewer-close .pswp__icn { width: 23px; height: 23px; }
.photo-viewer .photo-viewer-save { grid-column: 3; grid-row: 1; }
.photo-viewer .photo-viewer-position { grid-column: 2; grid-row: 1; justify-self: center; padding: 7px 12px; border-radius: 20px; color: var(--pt-muted); background: color-mix(in srgb, var(--pt-bg) 70%, transparent); font-size: 13px; line-height: 1.4; font-variant-numeric: tabular-nums; pointer-events: none; }
.photo-viewer .pswp__button--arrow { position: absolute; top: calc(50% - 22px); margin-top: 0; box-shadow: 0 2px 14px #0001; }
.photo-viewer .pswp__button--arrow--prev { left: max(16px, env(safe-area-inset-left)); }
.photo-viewer .pswp__button--arrow--next { right: max(16px, env(safe-area-inset-right)); }
.photo-viewer.pswp--one-slide .pswp__button--arrow, .photo-viewer .pswp__button--arrow:disabled { display: none; }
.photo-viewer .photo-viewer-footer { position: absolute; z-index: 10; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 720px); padding: 14px max(20px, env(safe-area-inset-left)) calc(18px + env(safe-area-inset-bottom)); min-height: 32px; pointer-events: none; }
.photo-viewer .photo-viewer-caption { max-height: 18dvh; overflow-y: auto; overscroll-behavior: contain; margin: 0; color: var(--pt-text); font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-width: none; pointer-events: auto; }
.photo-viewer .photo-viewer-caption::-webkit-scrollbar { display: none; }
.photo-viewer .photo-viewer-order { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; color: var(--pt-muted); font-size: 12px; pointer-events: none; }
.photo-viewer .photo-viewer-order > span { margin-right: 5px; }
.photo-viewer .photo-viewer-order-button { min-height: 44px; padding: 7px 10px; border: 0; border-radius: 11px; color: var(--pt-accent); background: var(--pt-surface-alt); font-family: var(--pager-ui-font); font-size: 13px; pointer-events: auto; }
.photo-viewer .photo-viewer-order-button:disabled { opacity: .4; }
.photo-viewer .photo-viewer-notice { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; color: var(--pt-text); background: var(--pager-error-bg-v4, var(--pt-surface-alt)); font-size: 13px; line-height: 1.45; pointer-events: auto; }
.photo-viewer .pswp__error-msg { padding: 24px; text-align: center; line-height: 1.5; }
@media (max-width: 600px) {
  .photo-viewer .pswp__button--arrow:not(:focus-visible) { width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); clip-path: inset(50%); }
}
/* Message rendering can use these classes with root-owned click handlers. */
.conversation-bubble-v2.conversation-album-bubble-v1 { padding: 5px 5px 7px; }
.conversation-album-bubble-v1 .conversation-meta-v2 { padding-right: 7px; padding-left: 7px; }
.photo-message { width: min(280px, calc(100vw - 92px)); max-width: 100%; }
.photo-message-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; min-height: 96px; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 12px; background: var(--pt-surface-alt); }
.photo-message-grid[data-count="1"] { grid-template-columns: minmax(0, 1fr); }
.photo-message-grid[data-count="2"] { aspect-ratio: 2; }
.photo-message-grid:is([data-count="3"], [data-count="4"]) { aspect-ratio: 1; grid-template-rows: repeat(2, minmax(0, 1fr)); }
.photo-message-grid:is([data-count="5"], [data-count="6"]) { aspect-ratio: 2 / 3; grid-template-rows: repeat(3, minmax(0, 1fr)); }
.photo-message-grid:not(:has(.photo-message-tile)) { display: flex; align-items: center; justify-content: center; padding: 16px; color: var(--pt-muted); font-size: var(--pager-ui-note-size); line-height: 1.45; text-align: center; }
.photo-message-grid[data-count="3"] > :first-child { grid-row: span 2; }
.photo-message-grid[data-count="5"] > :first-child { grid-column: span 2; aspect-ratio: 2; }
.photo-message-tile { display: block; min-width: 0; min-height: 0; width: 100%; height: 100%; overflow: hidden; padding: 0; border: 0; background: var(--pt-surface-alt); cursor: pointer; }
.photo-message-tile:focus-visible { outline: 2px solid var(--pt-accent); outline-offset: -3px; }
.photo-message-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-message-grid[data-count="1"] .photo-message-tile img { object-fit: contain; }
.photo-message-caption { margin: 8px 7px 2px; font-size: var(--pager-ui-body-size); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.photo-message-caption:empty { display: none; }
#photoDraftMountV2 { grid-column: 1 / -1; min-width: 0; }
#photoDraftMountV2:not(:has(.photo-inline:not([hidden]))) { display: none; }
.photo-inline {
  position: relative; width: 100%; min-width: 0; padding: 0 0 3px; text-align: left;
  color: var(--pt-text); font-family: var(--pager-ui-font);
}
.photo-inline[hidden], .photo-inline [hidden] { display: none !important; }
.photo-inline *, .photo-inline *::before, .photo-inline *::after { box-sizing: border-box; }
.photo-inline button { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.photo-inline button:disabled { opacity: .4; cursor: default; }
.photo-inline .photo-compose-preview:disabled { opacity: 1; }
.photo-inline[data-state="sending"] :is(.photo-quality-toggle, .photo-password-toggle):disabled { opacity: .75; }
.photo-inline[data-state="sending"] :is(.photo-compose-remove, .photo-add) { visibility: hidden; }
.photo-inline button:focus-visible { outline: 2px solid var(--pt-accent); outline-offset: 2px; }
.photo-inline .photo-compose-grid {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 5px 3px 2px;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
}
.photo-inline .photo-compose-grid::-webkit-scrollbar { display: none; }
.photo-inline .photo-compose-item { flex: 0 0 64px; width: 64px; height: 64px; overflow: visible; border: 0; border-radius: 11px; }
.photo-inline .photo-compose-pending { background: var(--pt-surface-alt); }
.photo-inline .photo-compose-preview,
.photo-inline .photo-compose-grid[data-count="1"] .photo-compose-preview { width: 64px; height: 64px; max-height: 64px; aspect-ratio: 1; overflow: hidden; border-radius: 11px; }
.photo-inline .photo-compose-grid[data-count="1"] .photo-compose-preview img { object-fit: cover; }
.photo-inline .photo-compose-number { top: auto; bottom: 4px; left: 4px; min-width: 17px; height: 17px; padding: 0 3px; border-radius: 5px; font-size: 10px; }
.photo-inline .photo-compose-remove {
  top: -3px; right: -3px; width: 32px; height: 32px; display: flex; justify-content: flex-end; align-items: flex-start;
  padding: 4px 7px 0 0; z-index: 1; border: 0; color: #fff; background: transparent; font-size: 20px;
}
.photo-inline .photo-compose-remove::before {
  content: ''; position: absolute; z-index: -1; top: 2px; right: 2px; width: 24px; height: 24px;
  border: 2px solid var(--pt-bg); border-radius: 50%; background: #25301feb;
}
.photo-inline .photo-add { flex: 0 0 46px; width: 46px; height: 64px; min-height: 44px; margin: 0; padding: 0; border-radius: 11px; color: var(--pt-accent); font-size: 28px; font-weight: 400; }
.photo-inline-tools { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; }
.photo-quality-toggle, .photo-password-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 3px; border: 0; border-radius: 8px; background: transparent; color: var(--pt-muted); font-size: 13px; line-height: 1.3; white-space: nowrap; }
.photo-quality-toggle[aria-pressed="true"], .photo-password-toggle[aria-pressed="true"] { color: var(--pt-accent); }
.photo-quality-toggle:not(:disabled):active, .photo-password-toggle:not(:disabled):active { background: var(--pt-surface-alt); }
.photo-inline-summary { margin-right: auto; color: var(--pt-muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.photo-lock-icon { display: block; flex: none; width: 16px; height: 16px; }
.photo-password-dialog { z-index: 92; }
.photo-password-panel { overflow-y: auto; }
.photo-message-locked { box-sizing: border-box; width: 210px; max-width: 100%; min-height: 64px; padding: 12px; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.photo-message-locked .photo-lock-icon { width: 28px; height: 28px; opacity: .8; }
.photo-message-locked-copy { display: grid; gap: 3px; min-width: 0; }
.photo-message-locked-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.photo-message-locked-detail { font-size: 13px; font-weight: 400; line-height: 1.35; opacity: .7; }
.photo-message-locked:focus-visible { outline: 2px solid var(--pt-accent); outline-offset: -3px; border-radius: 15px; }
.photo-password-panel .photo-header { margin-bottom: 8px; }
.photo-password-lead { margin: 0 0 20px; color: var(--pt-muted); font-size: 14px; line-height: 1.5; }
.photo-password-field { display: flex; align-items: center; min-height: 52px; border: 1px solid var(--pt-line); border-radius: var(--pager-ui-control-radius); background: var(--pt-surface-alt); }
.photo-password-field:focus-within { border-color: var(--pt-accent); }
.photo-password-input { width: 100%; min-width: 0; min-height: 50px; padding: 12px 0 12px 14px; border: 0; outline: none; border-radius: inherit; color: var(--pt-text); background: transparent; font: 400 16px/1.4 var(--pager-ui-font); }
.photo-password-input::placeholder { color: var(--pt-muted); opacity: 1; }
.photo-password-show { align-self: stretch; flex: none; min-width: 76px; padding: 0 10px; border: 0; border-radius: inherit; color: var(--pt-muted); background: transparent; font-size: 12px; }
.photo-password-actions { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; }
.photo-password-link { min-height: 44px; padding: 6px 2px; border: 0; border-radius: 8px; color: var(--pt-accent); background: transparent; font-size: 13px; line-height: 1.4; }
.photo-password-note { margin: 16px 0 20px; color: var(--pt-muted); font-size: 13px; line-height: 1.5; }
.photo-password-apply { width: 100%; margin-top: 20px; flex: none; }
.photo-password-note:not([hidden]) + .photo-password-apply { margin-top: 0; }
.photo-password-remove { display: block; width: 100%; margin-top: 4px; color: var(--pt-muted); }
.photo-password-error { margin-top: 12px; }
.photo-inline .photo-status { position: absolute; inset: 0; display: flex; align-items: center; margin: 0; padding: 0 3px; font-size: 13px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.photo-inline[data-state="preparing"] .photo-status { right: 44px; }
.photo-inline[data-state="preparing"] .photo-inline-tools > :is(.photo-quality-toggle, .photo-inline-summary, .photo-password-toggle) { visibility: hidden; }
.photo-prepare-cancel { position: absolute; right: 0; top: 0; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--pt-muted); font-size: 24px; line-height: 1; }
.photo-inline .photo-progress { margin: 0 0 8px; height: 3px; }
.photo-inline .photo-error { margin: 0 0 8px; padding: 9px 11px; font-size: 13px; }
@media (max-width: 350px) {
  .photo-panel { padding-right: 16px; padding-left: 16px; }
  .photo-compose-grid { gap: 8px; }

}
