/* Pocket media uses shared Lantern tokens, including all alternate skins. */
body.lantern #composer .composer-pill {
  display:flex; align-items:flex-end; flex:1; min-width:0; gap:.125rem;
  border:1px solid var(--outline); border-radius:1.6rem;
  background:var(--lantern-bubble-in); color:var(--lantern-bubble-in-ink);
}
body.lantern .composer-pill #draft {
  border:0; border-radius:.75rem; padding-inline:.25rem; background:transparent;
}
body.lantern #pocket #composer .composer-pill > button {
  color:inherit; border:0; border-radius:50%; padding-inline:0; min-width:var(--kit-target);
}
body.lantern .composer-pill #sticker-drawer { font-size:1.5rem; }
body.lantern #pocket #composer > button[type=submit] {
  width:var(--kit-target); height:var(--kit-target); padding:0; border:0; border-radius:50%;
  font-size:0; display:grid; place-items:center; background:var(--lamp,var(--lantern-lamp));
}
body.lantern #pocket #composer > button[type=submit]::before { content:'↑'; content:'↑' / ''; font-size:1.45rem; line-height:1; }

body.lantern #pending-attachments:not([hidden]) {
  display:flex; align-items:flex-start; gap:8px; padding:4px 0; max-height:none;
  overflow-x:auto; overscroll-behavior-inline:contain;
}
#pending-attachments::after {
  content:attr(data-cap); position:sticky; right:0; align-self:center; flex:none;
  margin-inline-start:auto; padding:4px 6px; border-radius:8px; white-space:nowrap;
  font-size:.75rem; background:var(--surfaceContainerHigh); color:var(--onSurfaceVariant);
}
body.lantern #pending-attachments .staged-tile {
  display:grid; gap:2px; position:relative; flex:0 0 64px; min-width:0;
  padding:0; background:none; text-align:center;
}
.staged-art {
  display:grid; place-items:center; width:64px; height:64px; overflow:hidden;
  border:1px solid var(--outline); border-radius:10px; background:var(--surfaceContainerHigh);
  font-size:.8rem; color:var(--onSurfaceVariant);
}
.staged-art :is(img,video) { display:block; width:100%; height:100%; object-fit:cover; }
.staged-name,.staged-error { font-size:.7rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.staged-error { color:var(--onSurfaceVariant); }
body.lantern #composer #pending-attachments .staged-remove {
  position:absolute; inset:0 0 auto auto; margin:2px; padding:0;
  min-width:26px; width:26px; min-height:26px; height:26px; border-radius:50%;
  background:var(--surfaceContainer); color:var(--onSurface); border:1px solid var(--outline);
}

.sticker-popover {
  position:fixed; z-index:30; width:420px; display:flex; flex-direction:column;
  isolation:isolate; overflow:hidden; border:1px solid var(--outline); border-radius:18px;
  color:var(--onSurface); background:var(--surfaceContainer); box-shadow:0 12px 38px #0006;
}
.sticker-popover-toolbar,.sticker-popover-tabs,.sticker-pack-rail { display:flex; gap:4px; align-items:center; }
.sticker-popover-toolbar { justify-content:space-between; padding:8px 10px 4px; }
.sticker-popover-tabs,.sticker-pack-rail { flex:1; flex-wrap:wrap; }
.sticker-popover button,.sticker-popover summary {
  min-height:36px; padding:4px 8px; border:1px solid var(--outline); border-radius:10px;
  color:var(--onSurface); background:var(--surfaceContainerLow); box-shadow:none;
}
.sticker-popover [aria-pressed=true] { background:var(--secondaryContainer); border-color:var(--primary); }
.sticker-popover :is(button,input,summary):focus-visible { outline:2px solid var(--primary); outline-offset:-2px; }
.sticker-pack-menu summary { display:grid; place-items:center; cursor:pointer; list-style:none; }
.sticker-pack-menu summary::-webkit-details-marker { display:none; }
.sticker-pack-menu button { position:absolute; z-index:2; top:46px; right:10px; background:var(--surfaceContainerHigh); }
.sticker-popover-scroll { min-height:0; overflow:auto; overscroll-behavior:contain; scrollbar-width:thin; }
.sticker-popover-filters {
  position:sticky; top:0; z-index:1; padding:4px 10px 8px; background:var(--surfaceContainer);
}
.sticker-popover input { width:100%; margin:0 0 8px; padding:6px 10px; border-radius:10px; }
.sticker-popover .sticker-drawer-grid {
  display:grid; grid-template-columns:repeat(auto-fill,72px); grid-auto-rows:minmax(44px,auto);
  justify-content:center; align-content:start; gap:8px; padding:0 8px 10px; height:auto; min-height:104px; overflow:visible;
}
.sticker-popover .sticker-drawer-grid button.sticker-tile {
  width:72px; height:72px; min-height:0; padding:0; overflow:hidden;
  border-color:transparent; background:none; touch-action:pan-y;
  -webkit-touch-callout:none; -webkit-user-select:none; user-select:none;
}
.sticker-popover .sticker-tile:hover,.sticker-popover .sticker-tile:focus-visible { background:var(--surfaceContainerHigh); }
.sticker-popover .sticker-tile img { width:100%; height:100%; object-fit:contain; }
.sticker-popover .sticker-art-missing { font-size:.75rem; }
.sticker-grid-note { grid-column:1 / -1; margin:0; }
.sticker-emoji { font-size:1.5rem; }
.sticker-tile-preview:not([hidden]) {
  display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; align-content:center;
  position:absolute; inset:0; z-index:3; overflow:auto; padding:12px;
  background:var(--surfaceContainerHigh); text-align:center;
}
.sticker-tile-preview :is(img,strong) { grid-column:1 / -1; justify-self:center; }
.sticker-tile-preview img { width:100%; height:clamp(72px,20vh,180px); object-fit:contain; }

#messages .media-album { width:min(100%,410px); min-width:0; }
.album-caption { margin-block-end:6px; }
.album-visuals:not([hidden]) { display:grid; gap:3px; grid-template-columns:repeat(2,minmax(0,1fr)); }
.album-visuals[data-count="1"] { grid-template-columns:minmax(0,1fr); }
#pocket #messages .media-album .album-tile {
  position:relative; display:block; width:100%; min-width:0; min-height:0; aspect-ratio:1;
  overflow:hidden; border:0; border-radius:8px; padding:0; background:var(--surfaceContainerHigh); box-shadow:none;
}
#pocket #messages .media-album .album-visuals[data-count="1"] .album-tile { aspect-ratio:4/3; }
#pocket #messages .media-album .album-visuals[data-count="3"] .album-tile:first-child { grid-column:span 2; aspect-ratio:2/1; }
.album-visuals:is([data-count="5"],[data-count="6"],[data-count="7"],[data-count="8"],[data-count="9"],[data-count="10"]) {
  grid-template-columns:repeat(6,minmax(0,1fr));
}
.album-visuals:is([data-count="5"],[data-count="6"],[data-count="7"],[data-count="8"],[data-count="9"],[data-count="10"]) .album-tile { grid-column:span 2; }
.album-visuals:is([data-count="5"],[data-count="8"]) .album-tile:nth-child(-n+2),
.album-visuals:is([data-count="6"],[data-count="9"]) .album-tile:nth-child(-n+3),
.album-visuals:is([data-count="7"],[data-count="10"]) .album-tile:nth-child(-n+4) { grid-column:span 3; }
#pocket #messages .media-album .album-visuals:is([data-count="6"],[data-count="9"]) .album-tile:first-child { grid-column:span 6; aspect-ratio:2/1; }
.album-art { display:block; width:100%; height:100%; object-fit:cover; }
.album-files:not([hidden]) { display:grid; gap:4px; margin-block-start:4px; }
.album-file {
  display:flex; align-items:center; justify-content:space-between; gap:8px; min-height:2rem;
  padding:2px 6px; border-radius:8px; color:var(--onSurface); background:var(--surfaceContainer);
}
#pocket #messages .album-file button {
  min-width:0; min-height:28px; padding:2px 6px; border:0; border-radius:6px;
  justify-content:flex-start; text-align:start; overflow-wrap:anywhere;
}
.album-file button:disabled { opacity:1; }
.album-footer { display:flex; flex-wrap:wrap; align-items:center; gap:6px; min-height:34px; margin-block-start:4px; }
.album-footer .album-status { flex:1; }
.album-footer .album-status:empty { display:none; }
#pocket #messages .album-footer :is(button,summary) { min-height:32px; }
#messages .queued-send .text, #messages .queued-send .album-caption { opacity:1; }
.pending-clock { display:inline-block; font-size:.9rem; line-height:1; }
#messages .pending-transfer-actions:not([open]) > summary:not(:focus-visible) {
  position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap;
}
.album-chrome { width:100%; }
.album-chrome > summary { cursor:pointer; font-size:.8rem; line-height:32px; }
.album-chrome-item { padding:6px 0; border-top:1px solid var(--outline); }
.album-progress:not([hidden]) {
  display:grid; place-items:center; flex:none; width:21px; height:21px; border-radius:50%;
  border:2px solid var(--outline); background:var(--surfaceContainer); color:var(--onSurface); font-size:.75rem;
}
.album-tile .album-progress { position:absolute; inset:5px 5px auto auto; }
.tile-pending-ring[data-state=pending] { border-top-color:var(--primary); animation:album-spin .9s linear infinite; }
.album-progress[data-state=staged] { border-color:var(--primary); }
.album-progress[data-state=error] { border-color:var(--error); }
@keyframes album-spin { to { transform:rotate(1turn); } }
@media(prefers-reduced-motion:reduce) { .tile-pending-ring[data-state=pending] { animation:none; } }

body.lantern .album-lightbox[open] {
  width:min(95vw,800px); max-height:90dvh; overflow:auto; padding:8px;
  border:1px solid var(--outline); border-radius:14px; margin:auto;
}
.album-lightbox::backdrop { background:#000a; }
.album-lightbox-art { display:grid; place-items:center; background:var(--surfaceContainerLowest); border-radius:10px; overflow:hidden; }
.album-lightbox-art :is(img,video) { display:block; max-width:100%; max-height:calc(90dvh - 90px); object-fit:contain; }
.album-lightbox-controls { display:flex; align-items:center; gap:4px; }
.album-lightbox-controls button { flex:none; min-width:44px; min-height:44px; }
.album-lightbox-label { flex:1; min-width:0; text-align:center; overflow-wrap:anywhere; }
