/* Component styles — nav, theme picker, action menu, gallery, buttons, forms. */

/* ===========================================================
   `hidden` must always win. Components like .pic-btn set an explicit
   `display`, which has the same specificity as the UA `[hidden]{display:none}`
   rule and beats it on source order — so hidden buttons/rows would stay
   visible. This reset guarantees the attribute hides the element.
   =========================================================== */
[hidden] {
  display: none !important;
}

/* ===========================================================
   Focus ring — :focus-visible for keyboard navigation
   =========================================================== */
:focus-visible {
  outline: 2px solid var(--pic-focus-ring);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ===========================================================
   Nav bar buttons
   =========================================================== */
.pic-nav__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: var(--pic-font-xs);
  font-weight: 500;
  color: var(--pic-subtle);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--pic-radius-md);
  cursor: pointer;
  transition: background var(--pic-transition-fast),
    color var(--pic-transition-fast), border-color var(--pic-transition-fast);
  white-space: nowrap;
}

.pic-nav__btn:hover:not(:disabled) {
  background: var(--pic-input-bg);
  color: var(--pic-text);
}

/* The active nav item gets NO highlight — a coloured/bold Home/Help/Developer
   distracts, and Home (which can open an external site in some editions) would
   mislead. is-active is kept for logic but given no special styling. */

.pic-nav__btn--locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.pic-nav__btn--locked:hover {
  background: transparent !important;
  color: var(--pic-subtle) !important;
}

.pic-nav__icon {
  flex-shrink: 0;
}

.pic-nav__count {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--pic-muted);
  margin-left: 2px;
}

.pic-nav__count:empty {
  display: none;
}

/* When images are loaded, gallery nav button promotes */
body.has-images .pic-nav__btn[data-view="gallery"] {
  background: var(--pic-accent);
  color: var(--pic-accent-text);
  font-weight: 600;
}

body.has-images .pic-nav__btn[data-view="gallery"] .pic-nav__count {
  color: var(--pic-accent-text);
  opacity: 0.8;
}

/* ===========================================================
   Inline theme picker (circles)
   =========================================================== */
.pic-theme-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: var(--pic-space-md);
}

.pic-theme-picker__label {
  font-size: 0.72rem;
  color: var(--pic-subtle);
  font-weight: 500;
  margin-right: 4px;
}

.pic-theme-picker__btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--pic-header-border);
  background: var(--pic-surface);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.pic-theme-picker__btn:hover {
  transform: scale(1.15);
  border-color: var(--pic-accent);
}

.pic-theme-picker__btn.is-active {
  border-color: var(--pic-accent);
  box-shadow: 0 0 8px var(--pic-glow);
}

/* ===========================================================
   Action menu (home screen buttons)
   =========================================================== */
.pic-action-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}

/* Basic / Advanced tabs on the home action menu (visual grouping). */
.pic-home-tabs {
  display: flex;
  gap: 4px;
  width: 100%;
  padding: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-md);
}
.pic-home-tab {
  flex: 1;
  padding: 9px 12px;
  font: inherit;
  font-weight: 600;
  font-size: var(--pic-font-sm);
  color: var(--pic-subtle);
  background: transparent;
  border: 0;
  border-radius: var(--pic-radius-sm);
  cursor: pointer;
  transition: background var(--pic-transition-fast), color var(--pic-transition-fast);
}
.pic-home-tab.is-active {
  background: var(--pic-accent);
  /* Theme-aware contrasting text (dark-on-accent) — plain #fff failed WCAG AA
     against the lighter accents. Matches the accent buttons/badges. */
  color: var(--pic-accent-text);
}
.pic-home-tab:not(.is-active):hover,
.pic-home-tab:not(.is-active):focus-visible {
  color: var(--pic-text);
  background: rgba(255, 255, 255, 0.07);
}
/* Locked Advanced tab (free build) — small "Paid" badge appended by app-shell. */
.pic-home-tab__badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 0.68em;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 999px;
  background: var(--pic-accent);
  color: var(--pic-accent-text);
  vertical-align: middle;
}
.pic-home-tab.is-active .pic-home-tab__badge {
  background: var(--pic-accent-text);
  color: var(--pic-accent);
}

/* Footer "Share this free tool" button (free build only; hidden otherwise). */
.pic-share-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  margin: 0 auto 12px;
  padding: 8px 18px;
  font: inherit;
  font-weight: 600;
  font-size: var(--pic-font-sm);
  color: var(--pic-accent);
  background: transparent;
  border: 2px solid var(--pic-accent);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--pic-transition-fast), color var(--pic-transition-fast);
}
.pic-share-btn:hover,
.pic-share-btn:focus-visible {
  background: var(--pic-accent);
  color: var(--pic-accent-text);
  outline: none;
}

/* Upsell modal — free build, shown when the locked Advanced tab is clicked. */
.pic-upsell-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--pic-overlay-bg);
}
.pic-upsell-overlay.is-open {
  display: flex;
}
.pic-upsell {
  position: relative;
  width: min(92vw, 460px);
  background: var(--pic-surface);
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-lg);
  padding: 1.75rem 1.75rem 1.5rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  text-align: center;
}
.pic-upsell__title {
  margin: 0 0 0.6rem;
  font-size: 1.3rem;
  color: var(--pic-text);
}
.pic-upsell__body {
  margin: 0 0 1.25rem;
  color: var(--pic-subtle);
  line-height: 1.55;
  font-size: var(--pic-font-sm);
}
.pic-upsell__actions {
  display: flex;
  justify-content: center;
}
.pic-upsell__actions .is-disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: default;
}
.pic-upsell__close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  background: none;
  border: 0;
  color: var(--pic-subtle);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.pic-upsell__close:hover,
.pic-upsell__close:focus-visible {
  color: var(--pic-text);
  outline: none;
}

/* "Your gallery is ready" dialog — portable export delivery choice. */
.pic-ready-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--pic-overlay-bg);
}
.pic-ready-overlay.is-open {
  display: flex;
}
.pic-ready {
  position: relative;
  width: min(92vw, 440px);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--pic-surface);
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-lg);
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  text-align: center;
}
.pic-ready__title {
  margin: 0 0 0.4rem;
  font-size: 1.3rem;
  color: var(--pic-text);
}
.pic-ready__hint {
  margin: 0 0 1.25rem;
  color: var(--pic-subtle);
  font-size: var(--pic-font-sm);
}
.pic-ready__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pic-ready__actions .pic-btn {
  width: 100%;
  flex-direction: column;
  line-height: 1.2;
}
.pic-ready__actions .pic-btn small {
  font-weight: 400;
  font-size: 0.72em;
  opacity: 0.85;
}
.pic-ready__status {
  margin: 0.85rem 0 0;
  min-height: 1.1em;
  color: var(--pic-accent);
  font-size: var(--pic-font-sm);
  line-height: 1.4;
}
.pic-ready__status:empty {
  margin: 0;
}
.pic-ready__tip {
  margin: 1rem 0 0;
  padding: 0.85rem 0.9rem;
  text-align: left;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-md);
}
.pic-ready__tip-head {
  margin: 0 0 0.35rem;
  font-weight: 600;
  font-size: var(--pic-font-sm);
  color: var(--pic-text);
}
.pic-ready__tip-body {
  margin: 0;
  color: var(--pic-subtle);
  font-size: var(--pic-font-xs);
  line-height: 1.5;
}
.pic-ready__more {
  margin: 0.6rem 0 0;
}
.pic-ready__more summary {
  cursor: pointer;
  color: var(--pic-accent);
  font-size: var(--pic-font-xs);
}
.pic-ready__more-body {
  margin: 0.5rem 0 0;
  color: var(--pic-subtle);
  font-size: var(--pic-font-xs);
  line-height: 1.5;
}
.pic-ready__more-body ul {
  margin: 0.4rem 0;
  padding-left: 1.1rem;
}
.pic-ready__more-body li {
  margin: 0.2rem 0;
}
.pic-ready__hide {
  margin-top: 0.7rem;
  font-size: var(--pic-font-xs);
}
.pic-ready code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 4px;
  border-radius: 4px;
}
.pic-ready__footer {
  margin-top: 1.1rem;
}
.pic-ready__footer .pic-btn {
  width: 100%;
}
.pic-ready__close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  background: none;
  border: 0;
  color: var(--pic-subtle);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.pic-ready__close:hover,
.pic-ready__close:focus-visible {
  color: var(--pic-text);
  outline: none;
}
.pic-home-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.pic-home-panel[hidden] {
  display: none;
}

/* Separates the "look at your photos" group (View Gallery / View Images) from
   the create-and-export tasks below it. */
.pic-home-divider {
  height: 1px;
  margin: 6px 4px;
  background: var(--pic-border);
}

/* Standalone "Delete all" — sits below the formats line, above the footer,
   matching the action-card width so it reads as a separate danger action. */
.pic-home__danger {
  width: 100%;
  max-width: 320px;
  margin: var(--pic-space-md) auto 0;
}

.pic-action-menu__btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 18px;
  background: var(--pic-surface);
  border: 1px solid var(--pic-header-border);
  border-radius: var(--pic-radius-md);
  color: var(--pic-text);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.12s;
  text-align: left;
  position: relative;
}

/* "Paid" + padlock badge on locked Advanced-tab tools (free build). */
.pic-action-menu__paid {
  position: absolute;
  top: 8px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--pic-accent);
  color: var(--pic-accent-text, #fff);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
/* Locked cards stay clearly readable (you can see what you'd get) but the icon is
   gently dimmed to read as "locked". They remain tappable → upsell. */
.pic-action-menu__btn.is-paid .pic-action-menu__icon {
  opacity: 0.7;
}
.pic-action-menu__btn.is-paid {
  cursor: pointer;
  padding-right: 62px; /* clear the absolute "Paid" badge so text doesn't run under it */
}

.pic-action-menu__btn:hover:not(:disabled) {
  border-color: var(--pic-accent);
  box-shadow: 0 0 8px var(--pic-glow);
  transform: translateY(-1px);
}

.pic-action-menu__btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

/* Import button — primary accent style */
.pic-action-menu__btn[data-action="import"] {
  background: var(--pic-accent);
  color: var(--pic-accent-text);
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 4px 16px var(--pic-glow);
}

.pic-action-menu__btn[data-action="import"]:hover {
  box-shadow: 0 6px 20px var(--pic-glow);
}

.pic-action-menu__btn[data-action="import"] .pic-action-menu__icon {
  stroke: var(--pic-accent-text);
}

/* Destructive action (Delete all imported images) — sits a little apart from
   the task cards above and reads as a danger action. */
.pic-action-menu__btn--danger {
  margin-top: var(--pic-space-md);
  color: var(--pic-error);
}

.pic-action-menu__btn--danger .pic-action-menu__icon {
  stroke: var(--pic-error);
}

.pic-action-menu__btn--danger:hover:not(:disabled) {
  border-color: var(--pic-error);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.28);
}

/* Locked/disabled state */
.pic-action-menu__btn--locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.pic-action-menu__btn--locked:hover {
  transform: none !important;
  background: var(--pic-surface) !important;
  border-color: var(--pic-header-border) !important;
  box-shadow: none !important;
}

.pic-action-menu__icon {
  flex-shrink: 0;
  stroke: currentColor;
}

.pic-action-menu__hint {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--pic-muted);
  margin-top: 2px;
}

.pic-action-menu__count {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--pic-subtle);
}

.pic-action-menu__count:empty {
  display: none;
}

/* The "Import images to unlock" hint belongs only on a LOCKED card; once images
   are present the card is unlocked and its description (__sub) shows instead. */
.pic-action-menu__btn:not(.pic-action-menu__btn--locked) .pic-action-menu__hint {
  display: none;
}

/* ── Wider home menu on desktop / laptop ──────────────────────
   Mobile and small tablets keep the compact single-column layout above; from a
   laptop width up, the centred column and the action cards grow so the home
   screen fills more of a large display and the card text stops wrapping. */
@media (min-width: 1024px) {
  /* Content column is a touch wider than the 550px menu so the promotional area
     (support button + advert) can reach its 650px cap while the cards stay 550. */
  .pic-home__content { max-width: 680px; }
  .pic-action-menu { max-width: 550px; }
  .pic-home__danger { max-width: 550px; }
  /* Support button now sits inside the Core Tasks column, so match the cards. */
  .pic-support-btn { max-width: 550px; }
  .pic-action-menu__btn { padding: 15px 22px; font-size: 1rem; }
  .pic-action-menu__sub,
  .pic-action-menu__hint {
    margin-left: auto;
    text-align: right;
    padding-left: 18px;
  }
}
/*
@media (min-width: 1440px) {
  .pic-home__content { max-width: 760px; }
  .pic-action-menu { max-width: 760px; }
}
*/

/* State shift after images imported: demote Import, promote Gallery */
body.has-images .pic-action-menu__btn[data-action="import"] {
  background: var(--pic-surface);
  color: var(--pic-text);
  border-color: var(--pic-header-border);
  font-weight: 500;
  box-shadow: none;
}

body.has-images
  .pic-action-menu__btn[data-action="import"]
  .pic-action-menu__icon {
  stroke: currentColor;
}

body.has-images .pic-action-menu__btn[data-action="gallery"] {
  background: var(--pic-accent);
  color: var(--pic-accent-text);
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 4px 16px var(--pic-glow);
}

body.has-images
  .pic-action-menu__btn[data-action="gallery"]
  .pic-action-menu__icon {
  stroke: var(--pic-accent-text);
}

body.has-images
  .pic-action-menu__btn[data-action="gallery"]
  .pic-action-menu__count {
  color: var(--pic-accent-text);
  opacity: 0.8;
}

/* ===========================================================
   Gallery panel — header elements
   =========================================================== */
.pic-gallery__title {
  color: var(--pic-text);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pic-gallery__count {
  color: var(--pic-subtle);
  font-size: var(--pic-font-sm);
  flex: 1;
}

.pic-gallery__close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--pic-radius-sm);
  color: var(--pic-subtle);
  width: 32px;
  height: 32px;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  transition: background var(--pic-transition-fast),
    color var(--pic-transition-fast);
}

.pic-gallery__close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: var(--pic-text);
}

.pic-gallery__add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: var(--pic-radius-sm);
  color: #3b82f6;
  padding: 8px 12px;
  font-family: inherit;
  font-size: var(--pic-font-sm);
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--pic-transition-fast),
    border-color var(--pic-transition-fast), color var(--pic-transition-fast);
}

.pic-gallery__add:hover {
  background: rgba(59, 130, 246, 0.32);
  border-color: rgba(59, 130, 246, 0.55);
  color: #e0f2fe;
}

.pic-gallery__add-icon {
  flex-shrink: 0;
}

/* ===========================================================
   Gallery cards
   =========================================================== */
.pic-gallery__item {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  transition: border-color 0.15s, background 0.15s;
}

.pic-gallery__item:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.pic-gallery__thumb-wrap {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 80%;
  overflow: hidden;
  background: var(--pic-surface);
  border-radius: 9px 9px 0 0;
}

.pic-gallery__thumb-img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  cursor: pointer;
  transition: filter var(--pic-transition-fast),
    transform var(--pic-transition-fast);
}

.pic-gallery__thumb-img:hover,
.pic-gallery__thumb-img:focus-visible {
  filter: brightness(1.05);
  transform: scale(1.015);
}

.pic-gallery__item-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 2px;
}

.pic-gallery__item-num {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 700;
}

.pic-gallery__item-name {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pic-gallery__item-actions {
  display: flex;
  gap: 4px;
  padding: 4px 6px 6px;
}

.pic-gallery__item-actions button {
  flex: 1;
  padding: 7px 0;
  border: none;
  border-radius: var(--pic-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--pic-font-sm);
  transition: filter var(--pic-transition-fast);
}

.pic-gallery__item-actions button:hover {
  filter: brightness(1.3);
}

/* View / lightbox — blue */
.pic-gallery__item-actions button[data-gallery-action="view"] {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}

/* Rename — amber */
.pic-gallery__item-actions button[data-gallery-action="rename"] {
  background: rgba(245, 158, 11, 0.25);
  color: #fcd34d;
}

/* Delete — red */
.pic-gallery__item-actions button[data-gallery-action="delete"] {
  background: rgba(220, 38, 38, 0.22);
  color: #fca5a5;
}

.pic-gallery__item-actions button[data-gallery-action="delete"]:hover {
  filter: brightness(1.5);
}

/* Gallery — selection checkbox on card */
.pic-gallery__select {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 20px;
  height: 20px;
  accent-color: var(--pic-accent);
  cursor: pointer;
  z-index: 2;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.pic-gallery__select:hover,
.pic-gallery__select:checked {
  opacity: 1;
}

.pic-gallery__item.is-selected {
  border-color: var(--pic-accent);
  background: rgba(96, 165, 250, 0.08);
}

/* Gallery — toolbar (select all, export buttons) */
.pic-gallery__toolbar {
  display: flex;
  align-items: center;
  gap: var(--pic-space-sm);
  padding: 0 0 var(--pic-space-sm);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.pic-gallery__select-all-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--pic-font-xs);
  color: var(--pic-subtle);
  cursor: pointer;
}

.pic-gallery__select-all {
  width: 16px;
  height: 16px;
  accent-color: var(--pic-accent);
}

.pic-gallery__select-count {
  font-size: var(--pic-font-xs);
  color: var(--pic-accent);
  font-weight: 600;
}

.pic-gallery__select-count:empty {
  display: none;
}

.pic-gallery__export-sel,
.pic-gallery__export-all {
  margin-left: auto;
}

.pic-gallery__export-sel {
  margin-left: auto;
}

.pic-gallery__export-all {
  margin-left: 0;
}

/* Gallery — item dimensions */
.pic-gallery__item-dims {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.3);
  padding: 0 8px 2px;
}

/* More specific than .pic-input (which also matches this element and is
   declared later) so these overrides actually win. width:auto + box-sizing lets
   the flex column stretch the input to fill the card MINUS its margins;
   .pic-input's width:100% would add the side margins on top and overflow. */
.pic-gallery__item .pic-gallery__item-alt {
  box-sizing: border-box;
  width: auto;
  margin: 4px 8px 6px;
  padding: 6px 8px;
  font-size: 0.78rem;
  line-height: 1.2;
}

.pic-gallery__item-alt::placeholder {
  font-style: italic;
  opacity: 0.7;
}

/* Gallery — Clear All button */
.pic-gallery__clear {
  padding: 8px 12px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--pic-radius-sm);
  color: var(--pic-subtle);
  font-family: inherit;
  font-size: var(--pic-font-sm);
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--pic-transition-fast),
    border-color var(--pic-transition-fast), color var(--pic-transition-fast);
}

.pic-gallery__clear:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.18);
  border-color: rgba(220, 38, 38, 0.55);
  color: #fca5a5;
}

.pic-gallery__clear:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Secondary close at the bottom of the gallery modal — a reliably reachable
   close on mobile, where the top-right × can be hard to hit. */
.pic-gallery__close-bottom {
  flex-shrink: 0;
  align-self: center;
}

/* ===========================================================
   Export panel — header + close
   =========================================================== */
.pic-export__title,
.pic-settings__title {
  color: var(--pic-text);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: 1;
}

.pic-export__close,
.pic-settings__close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--pic-radius-sm);
  color: var(--pic-subtle);
  width: 32px;
  height: 32px;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  transition: background var(--pic-transition-fast),
    color var(--pic-transition-fast);
}

.pic-export__close:hover,
.pic-settings__close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: var(--pic-text);
}

/* ===========================================================
   Rename modal — header, body, footer
   =========================================================== */
.pic-rename__header {
  display: flex;
  align-items: center;
  gap: var(--pic-space-sm);
}

.pic-rename__title {
  color: var(--pic-text);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: 1;
}

.pic-rename__close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--pic-radius-sm);
  color: var(--pic-subtle);
  width: 32px;
  height: 32px;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  transition: background var(--pic-transition-fast),
    color var(--pic-transition-fast);
}

.pic-rename__close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: var(--pic-text);
}

.pic-rename__body {
  display: flex;
  flex-direction: column;
  gap: var(--pic-space-xs);
}

.pic-rename__input {
  font-size: var(--pic-font-base);
}

.pic-rename__hint {
  font-size: var(--pic-font-xs);
  color: var(--pic-muted);
  min-height: 1.2em;
}

.pic-rename__footer {
  display: flex;
  gap: var(--pic-space-sm);
  justify-content: flex-end;
}

/* ===========================================================
   Confirm modal
   =========================================================== */
.pic-confirm__header {
  display: flex;
  align-items: center;
}

.pic-confirm__title {
  color: var(--pic-text);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pic-confirm__body {
  display: flex;
  flex-direction: column;
  gap: var(--pic-space-xs);
}

.pic-confirm__message {
  font-size: var(--pic-font-sm);
  color: var(--pic-text);
  line-height: 1.5;
  word-break: break-word;
}

.pic-confirm__hint {
  font-size: var(--pic-font-xs);
  color: var(--pic-muted);
}

.pic-confirm__footer {
  display: flex;
  gap: var(--pic-space-sm);
  justify-content: flex-end;
}

/* ===========================================================
   Buttons — base + variants (used inside overlays)
   =========================================================== */
.pic-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--pic-space-sm);
  padding: 9px 20px;
  font-family: inherit;
  font-size: var(--pic-font-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  border-radius: var(--pic-radius-md);
  cursor: pointer;
  border: 1px solid var(--pic-border);
  background: var(--pic-input-bg);
  color: var(--pic-btn-text);
  transition: background var(--pic-transition-fast),
    border-color var(--pic-transition-fast), transform 0.1s ease;
  user-select: none;
}

.pic-btn:hover:not(:disabled) {
  border-color: var(--pic-accent);
  box-shadow: 0 0 8px var(--pic-glow);
}

.pic-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.pic-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pic-btn--primary {
  background: var(--pic-accent);
  color: var(--pic-accent-text);
  border-color: transparent;
  box-shadow: 0 4px 16px var(--pic-glow);
}

.pic-btn--primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px var(--pic-glow);
  transform: translateY(-1px);
}

.pic-btn--danger {
  background: #dc2626;
  color: #fff;
  border-color: transparent;
}

.pic-btn--danger:hover:not(:disabled) {
  background: #ef4444;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.35);
}

.pic-btn--small {
  padding: 6px 14px;
  font-size: var(--pic-font-xs);
}

.pic-btn--large {
  padding: 14px 32px;
  font-size: var(--pic-font-base);
  border-radius: var(--pic-radius-lg);
  width: 100%;
}

/* ===========================================================
   Form controls — select, input, checkbox, label
   =========================================================== */
.pic-label {
  font-size: var(--pic-font-sm);
  font-weight: 600;
  color: var(--pic-text);
  letter-spacing: 0.02em;
}

.pic-select,
.pic-input {
  width: 100%;
  padding: 10px 14px;
  font-family: inherit;
  font-size: var(--pic-font-sm);
  color: var(--pic-text);
  background: var(--pic-input-bg);
  border: 1px solid var(--pic-input-border);
  border-radius: var(--pic-radius-sm);
  transition: border-color var(--pic-transition-fast);
}

.pic-select:focus,
.pic-input:focus {
  border-color: var(--pic-accent);
}

.pic-select:disabled,
.pic-input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Native dropdown popup options. The select's translucent background gives the
   popup low-contrast text in dark themes, so force opaque, themed colours on
   the options themselves (honoured by Chrome/Edge/Firefox). */
.pic-select option,
.pic-input option {
  background-color: var(--pic-surface);
  color: var(--pic-text);
}

.pic-checkbox {
  display: flex;
  align-items: center;
  gap: var(--pic-space-sm);
  font-size: var(--pic-font-sm);
  color: var(--pic-text);
  cursor: pointer;
}

.pic-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--pic-accent);
}

/* ===========================================================
   Advanced settings (collapsible inside export overlay)
   =========================================================== */
.pic-advanced {
  border-top: 1px solid var(--pic-border);
  padding-top: var(--pic-space-sm);
}

.pic-advanced__toggle {
  align-self: flex-start;
  background: var(--pic-input-bg);
  border: 1px solid var(--pic-border);
  color: var(--pic-text);
  font-family: inherit;
  font-size: var(--pic-font-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--pic-radius-md);
  transition: background var(--pic-transition-fast),
    border-color var(--pic-transition-fast),
    color var(--pic-transition-fast);
}

.pic-advanced__toggle:hover,
.pic-advanced__toggle:focus-visible {
  border-color: var(--pic-accent);
  color: var(--pic-accent);
}

.pic-advanced__toggle[aria-expanded="true"] {
  border-color: var(--pic-accent);
  color: var(--pic-accent);
  background: rgba(96, 165, 250, 0.08);
}

.pic-advanced__panel {
  display: flex;
  flex-direction: column;
  gap: var(--pic-space-sm);
  padding-top: var(--pic-space-sm);
}

.pic-advanced__panel[hidden] {
  display: none;
}

.pic-advanced__row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pic-range-wrap {
  display: flex;
  align-items: center;
  gap: var(--pic-space-sm);
}

.pic-range {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--pic-input-bg);
  border-radius: 2px;
  outline: none;
}

.pic-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--pic-accent);
  cursor: pointer;
  border: none;
}

.pic-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--pic-accent);
  cursor: pointer;
  border: none;
}

.pic-range__value {
  font-size: var(--pic-font-xs);
  color: var(--pic-accent);
  font-weight: 600;
  min-width: 2.5em;
  text-align: right;
}

.pic-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pic-space-sm);
}

.pic-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--pic-font-sm);
  color: var(--pic-text);
  cursor: pointer;
}

.pic-radio input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--pic-accent);
}

.pic-advanced__dim-input {
  max-width: 160px;
}

.pic-advanced__reset {
  background: none;
  border: none;
  color: var(--pic-muted);
  font-family: inherit;
  font-size: var(--pic-font-xs);
  cursor: pointer;
  padding: 2px 0;
  text-align: left;
  text-decoration: underline;
  transition: color var(--pic-transition-fast);
}

.pic-advanced__reset:hover {
  color: var(--pic-text);
}

.pic-help {
  color: var(--pic-muted);
  font-size: var(--pic-font-xs);
  margin: var(--pic-space-xs) 0 0;
}

/* ===========================================================
   Settings sub-section (e.g. Watermark) inside Settings panel
   =========================================================== */
.pic-advanced__section {
  display: flex;
  flex-direction: column;
  gap: var(--pic-space-sm);
  padding-top: var(--pic-space-md);
  margin-top: var(--pic-space-sm);
  border-top: 1px solid var(--pic-border);
}

.pic-advanced__section-title {
  margin: 0;
  font-size: var(--pic-font-sm);
  font-weight: 600;
  color: var(--pic-text);
  letter-spacing: 0.02em;
}

.pic-wm-custom {
  display: flex;
  align-items: center;
  gap: var(--pic-space-sm);
  flex-wrap: wrap;
}

.pic-wm-custom__file {
  font-size: var(--pic-font-xs);
  color: var(--pic-muted);
}

.pic-wm-custom__name {
  color: var(--pic-muted);
  font-size: var(--pic-font-xs);
  font-style: italic;
}

/* Border / matte-frame controls: the native colour swatch. Sized to line up
   with the other inputs; the rest of the rows reuse .pic-advanced__row,
   .pic-checkbox, .pic-range-wrap and .pic-input. */
/* Prose textarea (landing-page SEO intro): proportional font, vertical resize. */
textarea.pic-textarea--prose {
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  min-height: 4.5rem;
}

.pic-border-color {
  width: 48px;
  height: 32px;
  padding: 2px;
  background: var(--pic-input-bg);
  border: 1px solid var(--pic-input-border);
  border-radius: var(--pic-radius-md);
  cursor: pointer;
}

.pic-border-color:focus-visible {
  outline: 2px solid var(--pic-accent);
  outline-offset: 2px;
}

.pic-html-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--pic-space-md);
}

.pic-html-split > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (max-width: 640px) {
  .pic-html-split {
    grid-template-columns: 1fr;
  }
}

/* ===========================================================
   Editor (used inside .pic-editor-overlay)
   =========================================================== */
.pic-editor__title {
  font-size: var(--pic-font-base);
  font-weight: 600;
  color: var(--pic-text);
  flex-shrink: 0;
}

.pic-editor__filename {
  flex: 1 1 0;
  color: var(--pic-muted);
  font-size: var(--pic-font-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Live image / crop size readout in the header. */
.pic-editor__dims {
  flex-shrink: 0;
  color: var(--pic-subtle);
  font-size: var(--pic-font-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pic-editor__group-label {
  margin: 0;
  flex-shrink: 0;
}

/* Enhance group: Sharpen / Reduce grain dropdowns + Auto-enhance */
.pic-editor__group--enhance {
  display: flex;
  align-items: center;
  gap: var(--pic-space-sm);
  flex-wrap: wrap;
}
.pic-editor__select-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--pic-font-xs);
  color: var(--pic-subtle);
  white-space: nowrap;
}
.pic-editor__select-hint {
  color: var(--pic-muted);
}
select.pic-editor__select {
  width: auto;
  padding: 4px 8px;
  font-size: var(--pic-font-xs);
}

/* Social / custom output-size group: dropdown + (when Custom) W × H inputs. */
.pic-editor__group--social {
  display: flex;
  align-items: center;
  gap: var(--pic-space-sm);
  flex-wrap: wrap;
}
.pic-editor__social-custom {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pic-editor__social-custom[hidden] {
  display: none;
}
input.pic-editor__num {
  width: 5rem;
  padding: 4px 8px;
  font-size: var(--pic-font-xs);
}
.pic-editor__num-x {
  color: var(--pic-muted);
}

.pic-editor__btn {
  background: var(--pic-input-bg);
  border: 1px solid var(--pic-border);
  color: var(--pic-text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--pic-radius-md);
  min-width: 38px;
  transition: background var(--pic-transition-fast),
    border-color var(--pic-transition-fast),
    color var(--pic-transition-fast);
}

.pic-editor__btn:hover,
.pic-editor__btn:focus-visible {
  border-color: var(--pic-accent);
  color: var(--pic-accent);
}

.pic-editor__chip {
  background: transparent;
  border: 1px solid var(--pic-border);
  color: var(--pic-muted);
  font-family: inherit;
  font-size: var(--pic-font-xs);
  font-weight: 500;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: var(--pic-radius-md);
  transition: background var(--pic-transition-fast),
    border-color var(--pic-transition-fast),
    color var(--pic-transition-fast);
}

.pic-editor__chip:hover,
.pic-editor__chip:focus-visible {
  color: var(--pic-text);
  border-color: var(--pic-accent);
}

.pic-editor__chip.is-active {
  background: rgba(96, 165, 250, 0.12);
  border-color: var(--pic-accent);
  color: var(--pic-accent);
}

.pic-editor__chip--reset {
  margin-left: var(--pic-space-sm);
  color: var(--pic-muted);
}

.pic-editor__hint {
  color: var(--pic-muted);
  font-size: var(--pic-font-sm);
  margin: 0;
}

/* "?" help button + pop-up (keeps instructions off the image area, esp. on phones) */
.pic-editor__info {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--pic-border);
  background: var(--pic-input-bg);
  color: var(--pic-text);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}
.pic-editor__info:hover,
.pic-editor__info:focus-visible {
  border-color: var(--pic-accent);
  color: var(--pic-accent);
}
.pic-editor__help-pop {
  position: absolute;
  top: 46px;
  right: var(--pic-space-md);
  z-index: 6;
  max-width: min(360px, 86vw);
  padding: var(--pic-space-sm) var(--pic-space-md);
  background: var(--pic-surface, var(--pic-panel-bg));
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.pic-editor__help-pop[hidden] {
  display: none;
}

/* Phones: hand the image as much height as possible. Hide the long export-sharpen
   note (an edge explainer) and let the action buttons fill the footer row. */
@media (max-width: 640px) {
  .pic-editor__group--enhance > .pic-editor__select-hint {
    display: none;
  }
  .pic-editor__actions {
    flex: 1 1 auto;
  }
  .pic-editor__actions .pic-btn {
    flex: 1 1 auto;
  }
}

.pic-editor__crop-box {
  position: absolute;
  border: 1px solid var(--pic-accent);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  cursor: move;
  box-sizing: border-box;
  pointer-events: auto;
}

.pic-editor__crop-box::before,
.pic-editor__crop-box::after {
  content: "";
  position: absolute;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.25);
}

/* Rule-of-thirds guides */
.pic-editor__crop-box::before {
  left: 33.33%;
  right: 33.33%;
  top: 0;
  bottom: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  border-right: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
}

.pic-editor__crop-box::after {
  top: 33.33%;
  bottom: 33.33%;
  left: 0;
  right: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
}

.pic-editor__handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--pic-accent);
  border: 2px solid #fff;
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: auto;
  z-index: 1;
}

/* Corner handles */
.pic-editor__handle--nw { top: -7px; left: -7px; cursor: nwse-resize; }
.pic-editor__handle--ne { top: -7px; right: -7px; cursor: nesw-resize; }
.pic-editor__handle--se { bottom: -7px; right: -7px; cursor: nwse-resize; }
.pic-editor__handle--sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
/* Edge handles */
.pic-editor__handle--n { top: -7px; left: 50%; margin-left: -7px; cursor: ns-resize; }
.pic-editor__handle--s { bottom: -7px; left: 50%; margin-left: -7px; cursor: ns-resize; }
.pic-editor__handle--w { top: 50%; left: -7px; margin-top: -7px; cursor: ew-resize; }
.pic-editor__handle--e { top: 50%; right: -7px; margin-top: -7px; cursor: ew-resize; }

.pic-editor__close {
  /* Reuse lightbox close style — defined further down */
}

/* ===========================================================
   Help overlay — tab strip, content typography, home subtext
   =========================================================== */
.pic-help__title {
  margin: 0;
  font-size: var(--pic-font-lg);
  font-weight: 600;
  color: var(--pic-text);
}

.pic-help__close {
  background: none;
  border: none;
  color: var(--pic-text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--pic-radius-sm);
  transition: background var(--pic-transition-fast);
}

.pic-help__close:hover,
.pic-help__close:focus-visible {
  background: rgba(255, 255, 255, 0.1);
}

.pic-help__tab {
  background: transparent;
  border: none;
  color: var(--pic-muted);
  font-family: inherit;
  font-size: var(--pic-font-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  padding: 12px 18px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--pic-transition-fast),
    border-color var(--pic-transition-fast);
}

.pic-help__tab:hover,
.pic-help__tab:focus-visible {
  color: var(--pic-text);
}

.pic-help__tab.is-active {
  color: var(--pic-accent);
  border-bottom-color: var(--pic-accent);
}

.pic-help__pane {
  color: var(--pic-text);
  line-height: 1.6;
  font-size: var(--pic-font-base);
}

.pic-help__pane h3 {
  margin: var(--pic-space-xl) 0 var(--pic-space-sm);
  font-size: var(--pic-font-lg);
  font-weight: 600;
  color: var(--pic-text);
}

.pic-help__pane h3:first-child {
  margin-top: 0;
}

.pic-help__pane h4 {
  margin: var(--pic-space-lg) 0 var(--pic-space-xs);
  font-size: var(--pic-font-base);
  font-weight: 600;
  color: var(--pic-accent);
}

.pic-help__pane p,
.pic-help__pane ul,
.pic-help__pane ol {
  margin: 0 0 var(--pic-space-md);
  color: var(--pic-text);
}

.pic-help__pane ul,
.pic-help__pane ol {
  padding-left: var(--pic-space-lg);
}

.pic-help__pane li {
  margin-bottom: var(--pic-space-xs);
}

.pic-help__pane strong {
  color: var(--pic-text);
  font-weight: 600;
}

.pic-help__pane code {
  background: var(--pic-input-bg);
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-sm);
  padding: 1px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  color: var(--pic-text);
}

.pic-help__pane pre {
  background: var(--pic-input-bg);
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-md);
  padding: var(--pic-space-md);
  overflow-x: auto;
  margin: 0 0 var(--pic-space-md);
}

.pic-help__pane pre code {
  background: transparent;
  border: none;
  padding: 0;
  font-size: var(--pic-font-xs);
  line-height: 1.5;
  color: var(--pic-text);
}

.pic-help__pane a {
  color: var(--pic-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pic-help__pane a:hover,
.pic-help__pane a:focus-visible {
  color: var(--pic-text);
}

.pic-help__pane .pic-help__lead {
  font-size: var(--pic-font-lg);
  color: var(--pic-muted);
  margin-bottom: var(--pic-space-lg);
}

/* Advanced disclosure (e.g. fine-tune quality sliders under the simple preset).
   Styled as a clear, tappable button (not fine print) so it isn't missed. */
.pic-advanced-disclosure {
  margin-top: var(--pic-space-sm);
}
.pic-advanced-disclosure > summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--pic-space-xs);
  padding: 7px 12px;
  font-size: var(--pic-font-sm);
  font-weight: 600;
  color: var(--pic-accent);
  background: var(--pic-input-bg);
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-sm);
  user-select: none;
  list-style: none; /* hide default triangle (Firefox) */
}
.pic-advanced-disclosure > summary::-webkit-details-marker {
  display: none; /* hide default triangle (WebKit) */
}
.pic-advanced-disclosure > summary::before {
  content: "\25B8"; /* ▸ rotates to ▾ when open */
  display: inline-block;
  font-size: 0.9em;
  transition: transform 0.15s ease;
}
.pic-advanced-disclosure[open] > summary::before {
  transform: rotate(90deg);
}
.pic-advanced-disclosure[open] > summary {
  margin-bottom: var(--pic-space-sm);
}
.pic-advanced-disclosure > summary:hover,
.pic-advanced-disclosure > summary:focus-visible {
  border-color: var(--pic-accent);
}
@media (prefers-reduced-motion: reduce) {
  .pic-advanced-disclosure > summary::before {
    transition: none;
  }
}

/* Always-visible Sharpen toggle — set apart from the rows around it. */
.pic-sharpen-row {
  margin-top: var(--pic-space-md);
  margin-bottom: var(--pic-space-lg);
}
.pic-sharpen-row__hint {
  font-size: var(--pic-font-xs);
  color: var(--pic-muted);
  margin-left: 26px; /* align under the label text, past the checkbox */
}

.pic-field-hint {
  font-size: var(--pic-font-xs);
  color: var(--pic-muted);
  line-height: 1.4;
  margin: 0;
}

/* Inline warning note (e.g. "busy background" in Remove-the-background). */
.pic-field-warn {
  font-size: var(--pic-font-sm);
  line-height: 1.45;
  margin: 0 0 var(--pic-space-sm);
  padding: var(--pic-space-sm) var(--pic-space-md);
  border-radius: var(--pic-radius-sm);
  border: 1px solid rgba(234, 179, 8, 0.45);
  background: rgba(234, 179, 8, 0.12);
  color: var(--pic-text);
}
.pic-field-warn[hidden] { display: none; }

/* Stronger caution note — for areas that publish raw user code/HTML. */
.pic-field-caution {
  font-size: var(--pic-font-xs);
  color: var(--pic-warning);
  font-weight: 600;
  line-height: 1.4;
  margin: var(--pic-space-xs) 0 0;
  padding-left: var(--pic-space-sm);
  border-left: 2px solid var(--pic-warning);
}

.pic-feature-block__body {
  display: flex;
  flex-direction: column;
  gap: var(--pic-space-sm);
  padding: var(--pic-space-sm) 0 var(--pic-space-xs);
}

.pic-feature-block__code {
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  font-size: 0.8rem;
  resize: vertical;
  min-height: 80px;
}

/* New home-button sub-text */
.pic-action-menu__sub {
  display: block;
  font-size: var(--pic-font-xs);
  font-weight: 400;
  color: var(--pic-muted);
  margin-top: 2px;
  line-height: 1.3;
}

.pic-action-menu__btn--locked .pic-action-menu__sub {
  display: none;
}

/* ===========================================================
   Lightbox (used inside .pic-lightbox-overlay)
   =========================================================== */
.pic-lightbox__title {
  flex: 1 1 0;
  font-size: var(--pic-font-base);
  color: var(--pic-text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pic-lightbox__counter {
  color: var(--pic-muted);
  font-size: var(--pic-font-sm);
  flex-shrink: 0;
}

.pic-lightbox__close {
  background: none;
  border: none;
  color: var(--pic-text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--pic-radius-sm);
  transition: background var(--pic-transition-fast);
}

.pic-lightbox__meta {
  display: flex;
  align-items: center;
  gap: var(--pic-space-sm);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.pic-lightbox__alt-label {
  flex-shrink: 0;
  margin: 0;
}

.pic-lightbox__alt-input {
  flex: 1 1 0;
}

/* Unified small chip button used in the lightbox meta row
   (Show metadata toggle, Estimate size, Compare) */
.pic-lightbox__chip {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--pic-border);
  color: var(--pic-muted);
  font-family: inherit;
  font-size: var(--pic-font-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--pic-radius-md);
  line-height: 1.2;
  transition: background var(--pic-transition-fast),
    border-color var(--pic-transition-fast),
    color var(--pic-transition-fast);
}

.pic-lightbox__chip:hover:not(:disabled),
.pic-lightbox__chip:focus-visible {
  color: var(--pic-accent);
  border-color: var(--pic-accent);
}

.pic-lightbox__chip:disabled {
  opacity: 0.6;
  cursor: wait;
}

.pic-lightbox__chip[aria-expanded="true"],
.pic-lightbox__chip.is-active {
  color: var(--pic-accent);
  border-color: var(--pic-accent);
  background: rgba(96, 165, 250, 0.08);
}

/* Original-file-size chip in the lightbox header */
.pic-lightbox__size-chip {
  flex-shrink: 0;
  font-size: var(--pic-font-xs);
  color: var(--pic-muted);
  padding: 3px 8px;
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-sm);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.pic-lightbox__size-chip strong {
  color: var(--pic-text);
  font-weight: 600;
}

.pic-lightbox__size-label {
  margin-right: 5px;
  color: var(--pic-muted);
  font-weight: 400;
}

.pic-lightbox__size-result {
  color: var(--pic-text);
  font-weight: 500;
  font-size: var(--pic-font-xs);
  white-space: nowrap;
}

.pic-lightbox__size-result .pic-saved {
  color: var(--pic-accent);
  font-weight: 600;
}

.pic-lightbox__size-result .pic-grown {
  color: var(--pic-warning);
  font-weight: 600;
}

.pic-lightbox__meta-panel {
  display: flex;
  flex-direction: column;
  gap: var(--pic-space-sm);
  padding: var(--pic-space-md);
  max-height: 35vh;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

/* Without this, the panel's flex layout shrinks short children (like the
   hint paragraph) toward zero height when total content exceeds the
   panel's max-height. We want overflow → scroll, not children → squashed. */
.pic-lightbox__meta-panel > * {
  flex-shrink: 0;
}

.pic-lightbox__meta-panel[hidden] {
  display: none;
}

.pic-lightbox__meta-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pic-lightbox__meta-row--split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--pic-space-md);
}

.pic-lightbox__meta-row--split > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (max-width: 640px) {
  .pic-lightbox__meta-row--split {
    grid-template-columns: 1fr;
  }
}

.pic-lightbox__close:hover,
.pic-lightbox__close:focus-visible {
  background: rgba(255, 255, 255, 0.1);
}

.pic-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--pic-text);
  font-size: 2.2rem;
  line-height: 1;
  width: 48px;
  height: 64px;
  border-radius: var(--pic-radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--pic-transition-fast),
    border-color var(--pic-transition-fast);
}

.pic-lightbox__nav:hover,
.pic-lightbox__nav:focus-visible {
  background: rgba(0, 0, 0, 0.8);
  border-color: var(--pic-accent);
}

.pic-lightbox__nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pic-lightbox__nav--prev {
  left: var(--pic-space-sm);
}

.pic-lightbox__nav--next {
  right: var(--pic-space-sm);
}

/* Print: show only the lightbox image, hide everything else */
@media print {
  body * {
    visibility: hidden;
  }
  /* Never print the editor or help — they're transient state. */
  .pic-editor-overlay,
  .pic-help-overlay {
    display: none !important;
  }
  .pic-lightbox-overlay.is-open,
  .pic-lightbox-overlay.is-open * {
    visibility: visible;
  }
  .pic-lightbox-overlay.is-open {
    position: fixed;
    inset: 0;
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .pic-lightbox-overlay.is-open .pic-lightbox {
    background: #fff;
    border: none;
    box-shadow: none;
    width: 100%;
    height: 100%;
    padding: 0;
  }
  .pic-lightbox-overlay.is-open .pic-lightbox__header,
  .pic-lightbox-overlay.is-open .pic-lightbox__meta,
  .pic-lightbox-overlay.is-open .pic-lightbox__toolbar,
  .pic-lightbox-overlay.is-open .pic-lightbox__nav {
    display: none;
  }
  .pic-lightbox-overlay.is-open .pic-lightbox__stage {
    width: 100%;
    height: 100%;
  }
  .pic-lightbox-overlay.is-open .pic-lightbox__image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
  }
}

/* ── Lightbox: view mode vs edit mode ─────────────────────────
   The pure viewer ("View Images") and the editor ("Edit Images") share one
   modal. In view mode, hide the editor chrome (alt/metadata, size chip, Edit,
   Export); in edit mode, hide the view-only buttons (Play jigsaw, Print).
   Delete and the image/nav/close stay in both. The two-class selector beats the
   elements' single-class base display, so no !important is needed. */
.pic-lightbox-overlay--view .pic-lb-edit-only { display: none; }
.pic-lightbox-overlay:not(.pic-lightbox-overlay--view) .pic-lb-view-only { display: none; }

/* ===========================================================
   Mobile lightbox (phones)
   The lightbox has no other desktop→mobile reflow; without this the toolbar
   clips its leftmost button (Edit) off-screen and the bottom controls hide
   behind the browser UI. Placed in components.css (loads after layout.css) so
   these win over the base rules without needing extra selector specificity.
   =========================================================== */
@media (max-width: 480px) {
  .pic-lightbox {
    width: 100vw;
    height: 94vh;
    height: 94dvh; /* dynamic viewport: keep the toolbar on-screen above browser UI */
    padding: var(--pic-space-sm);
  }
  .pic-lightbox__header {
    flex-wrap: wrap;
  }
  /* Keep the Alt field usable; the metadata / size chips wrap below it instead
     of crushing it to a few characters. */
  .pic-lightbox__alt-input {
    flex: 1 1 140px;
    min-width: 140px;
  }
  /* Every action button reachable: wrap (so Edit isn't clipped off the left)
     and let them share the row width evenly. */
  .pic-lightbox__toolbar {
    flex-wrap: wrap;
    justify-content: center;
  }
  .pic-lightbox__toolbar .pic-btn {
    flex: 1 1 auto;
  }
}

/* ===========================================================
   Loading spinner (used inside .pic-loading-overlay)
   =========================================================== */
.pic-loading__spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--pic-accent);
  border-radius: 50%;
  animation: pic-spin 0.8s linear infinite;
}

@keyframes pic-spin {
  to {
    transform: rotate(360deg);
  }
}

.pic-loading__text {
  color: var(--pic-text);
  font-size: var(--pic-font-base);
  margin: 0;
  min-height: 1.4em;
}

@media (prefers-reduced-motion: reduce) {
  .pic-loading__spinner {
    animation: none;
    border-color: var(--pic-accent);
  }
}

/* ===========================================================
   Export progress + save-to-folder button
   =========================================================== */
.pic-export__save-btn {
  border: 1px solid var(--pic-border);
  width: 100%;
}

/* Two export types (picture gallery / social media), each with its own
   ZIP + Save-to-folder buttons. */
.pic-export__type {
  margin-top: var(--pic-space-md);
  padding-top: var(--pic-space-md);
  border-top: 1px solid var(--pic-border);
}

.pic-export__type-title {
  margin: 0 0 var(--pic-space-xs);
  font-size: var(--pic-font-base);
  font-weight: 600;
  color: var(--pic-text);
}

.pic-export__type-hint {
  margin: 0 0 var(--pic-space-sm);
  font-size: var(--pic-font-xs);
  color: var(--pic-muted);
}

.pic-export__type-actions {
  display: flex;
  flex-direction: column;
  gap: var(--pic-space-sm);
}

/* Export Pictures: summary + adjust link */
.pic-export__intro {
  margin: 0;
  color: var(--pic-muted);
  font-size: var(--pic-font-sm);
}

.pic-export__summary {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px var(--pic-space-md);
  margin: 0;
  padding: var(--pic-space-md);
  background: var(--pic-input-bg);
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-md);
}

.pic-export__summary dt {
  color: var(--pic-muted);
  font-size: var(--pic-font-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pic-export__summary dd {
  margin: 0;
  color: var(--pic-text);
  font-size: var(--pic-font-sm);
}

.pic-export__adjust {
  background: none;
  border: none;
  color: var(--pic-accent);
  font-family: inherit;
  font-size: var(--pic-font-sm);
  cursor: pointer;
  padding: var(--pic-space-sm) 0 0;
  text-align: center;
  width: 100%;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--pic-transition-fast);
}

.pic-export__adjust:hover,
.pic-export__adjust:focus-visible {
  color: var(--pic-text);
}

/* Per-image selection grid in Export Pictures */
.pic-export__select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pic-space-md);
}

.pic-export__select-count {
  color: var(--pic-muted);
  font-size: var(--pic-font-xs);
}

.pic-export__select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: var(--pic-space-sm);
  max-height: 38vh;
  overflow-y: auto;
  padding: var(--pic-space-sm);
  background: var(--pic-input-bg);
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-md);
  scrollbar-gutter: stable;
}

.pic-export__tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--pic-radius-sm);
  cursor: pointer;
  transition: border-color var(--pic-transition-fast),
    background var(--pic-transition-fast);
}

.pic-export__tile:hover {
  background: rgba(255, 255, 255, 0.04);
}

.pic-export__tile:has(.pic-export__tile-cb:checked) {
  border-color: var(--pic-accent);
  background: rgba(96, 165, 250, 0.08);
}

.pic-export__tile-cb {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1;
  width: 18px;
  height: 18px;
  accent-color: var(--pic-accent);
  cursor: pointer;
}

.pic-export__tile-img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--pic-radius-sm);
  background: rgba(0, 0, 0, 0.25);
}

.pic-export__tile-name {
  font-size: var(--pic-font-xs);
  color: var(--pic-muted);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hero ("lead image") picker — only rendered in the gallery tool. The star
   marks which image is used as the big hero image and the landing-page cover.
   Sits top-right so it never overlaps the select checkbox (top-left). */
.pic-export__tile-hero {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  cursor: pointer;
  transition: color var(--pic-transition), border-color var(--pic-transition);
}
.pic-export__tile-hero:hover,
.pic-export__tile-hero:focus-visible {
  color: #ffd54a;
  border-color: var(--pic-accent);
  outline: none;
}
.pic-export__tile-hero.is-hero {
  color: #ffd54a;
  border-color: #ffd54a;
  background: rgba(0, 0, 0, 0.65);
}

/* Settings overlay footer: Reset on the left, Done on the right */
.pic-settings__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pic-space-md);
  padding-top: var(--pic-space-sm);
  border-top: 1px solid var(--pic-border);
  margin-top: var(--pic-space-sm);
}

.pic-settings__done {
  min-width: 120px;
}

.pic-export__progress {
  font-size: var(--pic-font-xs);
  color: var(--pic-accent);
  text-align: center;
  min-height: 1.2em;
}

/* Install (PWA) button — shown only when the browser offers an install prompt */
.pic-install-btn {
  margin-top: var(--pic-space-sm);
}
.pic-install-btn[hidden] {
  display: none;
}

/* ===========================================================
   Saved setups (export profiles) bar
   =========================================================== */
.pic-profile-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--pic-space-sm);
  padding: var(--pic-space-sm) var(--pic-space-md);
  margin-bottom: var(--pic-space-md);
  background: var(--pic-input-bg);
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-sm);
}

.pic-profile-bar__label {
  font-size: var(--pic-font-sm);
  font-weight: 600;
  color: var(--pic-subtle);
}

.pic-profile-bar__select {
  flex: 1 1 140px;
  min-width: 120px;
}

.pic-profile-bar__name {
  flex: 1 1 140px;
  min-width: 120px;
}

/* ===========================================================
   First-run onboarding
   =========================================================== */
.pic-onboarding__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--pic-space-md);
}

.pic-onboarding__icon {
  color: var(--pic-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pic-onboarding__title {
  color: var(--pic-text);
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.01em;
}

.pic-onboarding__text {
  color: var(--pic-subtle);
  font-size: var(--pic-font-sm);
  line-height: 1.5;
  margin: 0;
  max-width: 34ch;
}

.pic-onboarding__sample {
  background: none;
  border: none;
  color: var(--pic-accent);
  font-size: var(--pic-font-sm);
  cursor: pointer;
  padding: var(--pic-space-xs);
  text-decoration: underline;
}

.pic-onboarding__sample[hidden] {
  display: none;
}

.pic-onboarding__sample:hover {
  color: var(--pic-text);
}

.pic-onboarding__dots {
  display: flex;
  justify-content: center;
  gap: var(--pic-space-sm);
}

.pic-onboarding__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pic-border);
  transition: background var(--pic-transition-fast);
}

.pic-onboarding__dot.is-active {
  background: var(--pic-accent);
}

.pic-onboarding__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pic-space-md);
}

.pic-onboarding__nav {
  display: flex;
  gap: var(--pic-space-sm);
}

.pic-onboarding__back[hidden] {
  display: none;
}

/* ===========================================================
   Quick export options modal (Gallery library)
   =========================================================== */
.pic-export-options__header {
  display: flex;
  align-items: center;
  gap: var(--pic-space-sm);
}

.pic-export-options__title {
  color: var(--pic-text);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: 1;
}

.pic-export-options__close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--pic-radius-sm);
  color: var(--pic-subtle);
  width: 32px;
  height: 32px;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.pic-export-options__close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: var(--pic-text);
}

.pic-export-options__body {
  display: flex;
  flex-direction: column;
  gap: var(--pic-space-md);
}

.pic-export-options__row {
  display: flex;
  flex-direction: column;
  gap: var(--pic-space-xs);
}

.pic-export-options__hint {
  font-size: var(--pic-font-xs);
  color: var(--pic-muted);
  line-height: 1.4;
  margin: 0;
  padding-top: var(--pic-space-sm);
  border-top: 1px solid var(--pic-border);
}

.pic-export-options__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--pic-space-sm);
}

/* ===========================================================
   Export complete summary modal
   =========================================================== */
.pic-export-result__header {
  display: flex;
  align-items: center;
  gap: var(--pic-space-sm);
}

.pic-export-result__title {
  color: var(--pic-text);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: 1;
}

.pic-export-result__close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--pic-radius-sm);
  color: var(--pic-subtle);
  width: 32px;
  height: 32px;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.pic-export-result__close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: var(--pic-text);
}

.pic-export-result__body {
  display: flex;
  flex-direction: column;
  gap: var(--pic-space-md);
  overflow-y: auto;
}

.pic-export-result__status {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--pic-success, #4ade80);
}

.pic-export-result__status.is-partial {
  color: var(--pic-warning, #fbbf24);
}

.pic-export-result__list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--pic-space-xs) var(--pic-space-md);
  margin: 0;
}

.pic-export-result__list dt {
  font-weight: 600;
  color: var(--pic-subtle);
}

.pic-export-result__list dd {
  margin: 0;
  color: var(--pic-text);
  overflow-wrap: anywhere;
}

.pic-export-result__names {
  font-size: var(--pic-font-sm);
}

.pic-export-result__names summary {
  cursor: pointer;
  color: var(--pic-subtle);
}

.pic-export-result__names ul {
  margin: var(--pic-space-sm) 0 0;
  padding-left: var(--pic-space-lg);
  color: var(--pic-text);
}

.pic-export-result__names li {
  overflow-wrap: anywhere;
}

.pic-export-result__note {
  margin: 0;
  font-size: var(--pic-font-xs);
  color: var(--pic-muted);
  line-height: 1.4;
  padding-top: var(--pic-space-sm);
  border-top: 1px solid var(--pic-border);
}

.pic-export-result__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--pic-space-sm);
}

/* ===========================================================
   Batch rename modal (after import)
   =========================================================== */
.pic-batch-rename__header {
  display: flex;
  align-items: center;
  gap: var(--pic-space-sm);
}

.pic-batch-rename__title {
  color: var(--pic-text);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: 1;
}

.pic-batch-rename__close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--pic-radius-sm);
  color: var(--pic-subtle);
  width: 32px;
  height: 32px;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  transition: background var(--pic-transition-fast),
    color var(--pic-transition-fast);
}

.pic-batch-rename__close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: var(--pic-text);
}

.pic-batch-rename__hint {
  font-size: var(--pic-font-xs);
  color: var(--pic-muted);
  line-height: 1.4;
}

.pic-batch-rename__base-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pic-batch-rename__base-controls {
  display: flex;
  gap: var(--pic-space-sm);
}

.pic-batch-rename__base-input {
  flex: 1;
}

.pic-batch-rename__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: 45vh;
  padding: 4px 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.pic-batch-rename__list::-webkit-scrollbar {
  width: 6px;
}
.pic-batch-rename__list::-webkit-scrollbar-track {
  background: transparent;
}
.pic-batch-rename__list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.pic-batch-rename__row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pic-batch-rename__thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: var(--pic-radius-sm);
  flex-shrink: 0;
  background: var(--pic-surface);
}

.pic-batch-rename__detail {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pic-batch-rename__name {
  font-size: var(--pic-font-sm);
  padding: 6px 10px;
}

.pic-batch-rename__orig {
  font-size: 0.68rem;
  color: var(--pic-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pic-batch-rename__footer {
  display: flex;
  gap: var(--pic-space-sm);
  justify-content: flex-end;
}

/* ===========================================================
   Toast notifications
   =========================================================== */
.pic-toast {
  padding: 10px 20px;
  background: var(--pic-panel-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--pic-border);
  border-radius: 20px;
  font-size: var(--pic-font-sm);
  color: var(--pic-text);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.pic-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.pic-toast--error {
  border-color: var(--pic-error);
}

.pic-toast--success {
  border-color: var(--pic-success);
}

.pic-toast--warning {
  border-color: var(--pic-warning);
}

.pic-toast--info {
  border-color: var(--pic-accent);
}

.pic-support-banner {
  display: block;
  max-width: min(620px, 92vw);
  margin: 12px auto;
  padding: 12px 16px;
  color: var(--pic-text);
  background: var(--pic-panel-bg);
  border: 1px solid var(--pic-border);
  border-radius: 14px;
  font-size: var(--pic-font-sm);
  line-height: 1.4;
  text-align: center;
}

.pic-support-banner--warning {
  border-color: var(--pic-warning);
}

.pic-support-banner--info {
  border-color: var(--pic-accent);
}

/* ===========================================================
   Reduced motion — respect OS accessibility setting
   =========================================================== */
@media (prefers-reduced-motion: reduce) {
  .pic-skip-link,
  .pic-btn,
  .pic-nav__btn,
  .pic-theme-picker__btn,
  .pic-action-menu__btn,
  .pic-gallery-overlay,
  .pic-export-overlay,
  .pic-batch-rename-overlay,
  .pic-gallery__item,
  .pic-gallery__close,
  .pic-gallery__add,
  .pic-gallery__item-actions button,
  .pic-export__close,
  .pic-toast,
  .pic-select,
  .pic-input {
    transition: none;
  }

  .pic-drop-overlay__content {
    animation: none;
  }
}

/* ── Montage tool ───────────────────────────────────────────── */
.pic-montage__controls {
  display: flex;
  flex-direction: column;
  gap: var(--pic-space-sm);
  margin: var(--pic-space-sm) 0;
}

.pic-montage__templates {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pic-space-sm);
}

.pic-montage__tpl {
  padding: 6px 12px;
  font: inherit;
  font-size: var(--pic-font-xs);
  color: var(--pic-text);
  background: var(--pic-surface);
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-sm);
  cursor: pointer;
}

.pic-montage__tpl:hover,
.pic-montage__tpl:focus-visible {
  border-color: var(--pic-accent);
}

.pic-montage__tpl.is-active {
  background: var(--pic-accent);
  color: var(--pic-accent-text);
  border-color: var(--pic-accent);
}

.pic-montage__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  padding: var(--pic-space-md);
  margin: var(--pic-space-sm) 0;
  background: repeating-conic-gradient(
      var(--pic-border) 0% 25%,
      transparent 0% 50%
    )
    50% / 20px 20px;
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-md);
}

.pic-montage__canvas {
  max-width: 100%;
  height: auto;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  touch-action: none; /* let pointer drags reframe a photo, not scroll the page */
  cursor: grab;
}

.pic-montage__canvas:active {
  cursor: grabbing;
}

.pic-montage__color {
  width: 48px;
  height: 32px;
  padding: 2px;
  background: var(--pic-surface);
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-sm);
  cursor: pointer;
}

/* ── Quick tools (Fit to a shape / Trim edges / Add background) ── */
/* Small group label between the montage card and the quick-tool cards. */
.pic-action-menu__group {
  margin: 8px 2px 2px;
  font-size: var(--pic-font-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pic-subtle);
}

.pic-quicktool__options {
  display: flex;
  flex-direction: column;
  gap: var(--pic-space-sm);
  margin: var(--pic-space-sm) 0;
}

/* ── Support-the-developer button (Amazon Associate) — all editions ──
   A deliberately distinct, understated bronze/gold so it stands apart from the
   blue primary, the neutral cards and the red danger button — without being
   flashy. Matches the action cards' width (320px → 550px on desktop). */
.pic-support-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  font-size: var(--pic-font-sm);
  text-align: center;
  text-decoration: none;
  color: #f3e7d2;
  background: linear-gradient(180deg, #4a3a22, #382b18);
  border: 1px solid #705626;
  border-radius: var(--pic-radius-md);
  transition: background var(--pic-transition-fast),
    border-color var(--pic-transition-fast);
}

.pic-support-btn:hover,
.pic-support-btn:focus-visible {
  background: linear-gradient(180deg, #5a4729, #43331d);
  border-color: #97703a;
}

.pic-support-btn__icon {
  flex-shrink: 0;
  color: #e0b35e; /* soft gold cart — a subtle accent against the cream text */
}

/* ── Make a slideshow video tool ────────────────────────────── */
.pic-video__step {
  display: flex;
  flex-direction: column;
  gap: var(--pic-space-sm);
  margin-bottom: var(--pic-space-sm);
}

.pic-video__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: var(--pic-space-md);
  margin: var(--pic-space-sm) 0;
  background: repeating-conic-gradient(
      var(--pic-border) 0% 25%,
      transparent 0% 50%
    )
    50% / 20px 20px;
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-md);
}

.pic-video__canvas {
  max-width: 100%;
  height: auto;
  background: #0f172a;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.pic-video__footer {
  display: flex;
  align-items: center;
  gap: var(--pic-space-sm);
  margin-top: var(--pic-space-md);
  padding-top: var(--pic-space-md);
  border-top: 1px solid var(--pic-border);
}

.pic-video__footer-spacer {
  flex: 1;
}

/* Make a PDF book */
.pic-book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pic-space-sm);
  margin: var(--pic-space-sm) 0;
}
.pic-book-filmstrip {
  display: flex;
  gap: var(--pic-space-sm);
  overflow-x: auto;
  padding: var(--pic-space-sm) 2px;
  margin-bottom: var(--pic-space-sm);
}
.pic-book-thumb {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-sm);
  background: var(--pic-surface, #fff);
}
.pic-book-thumb.is-active {
  border-color: var(--pic-accent, #2563eb);
  box-shadow: 0 0 0 2px var(--pic-accent, #2563eb);
}
.pic-book-thumb canvas {
  display: block;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.pic-book-thumb__num {
  position: absolute;
  top: 6px;
  left: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.pic-book-thumb__ctrls {
  display: flex;
  gap: 3px;
}
.pic-book-mini {
  width: 26px;
  min-height: 24px;
  border: 1px solid var(--pic-border);
  border-radius: 4px;
  background: var(--pic-surface-2, #f1f5f9);
  color: var(--pic-text, #0f172a);
  font-size: 12px;
  cursor: pointer;
}
.pic-book-mini:disabled { opacity: 0.35; cursor: default; }
.pic-book-thumb--add {
  align-self: stretch;
  min-width: 72px;
  border-style: dashed;
  color: var(--pic-text-muted, #64748b);
  font-weight: 600;
  cursor: pointer;
}
.pic-book-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pic-book-pool__item {
  position: relative;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  line-height: 0;
}
.pic-book-pool__item.is-on { border-color: var(--pic-accent, #2563eb); }
.pic-book-pool__item canvas { border-radius: 4px; }
.pic-book-pool__badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--pic-accent, #2563eb);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.pic-book__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: var(--pic-space-md);
  margin: var(--pic-space-sm) 0;
  background: repeating-conic-gradient(var(--pic-border) 0% 25%, transparent 0% 50%) 50% / 20px 20px;
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-md);
}
.pic-book__canvas {
  max-width: 100%;
  height: auto;
  border-radius: 3px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.3);
}

/* Hide / blur parts: interactive stage + action buttons */
.pic-redact__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: var(--pic-space-md);
  margin: var(--pic-space-sm) 0;
  background: repeating-conic-gradient(var(--pic-border) 0% 25%, transparent 0% 50%) 50% / 20px 20px;
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-md);
  touch-action: none; /* let pointer-drag draw boxes without scrolling */
}
.pic-redact__canvas {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  touch-action: none;
}
.pic-redact-actions {
  display: flex;
  gap: var(--pic-space-sm);
  flex-wrap: wrap;
}

/* Quote / text card: background swatch chips */
.pic-card-swatch {
  width: 38px;
  min-width: 38px;
  height: 32px;
  padding: 0;
  border-radius: var(--pic-radius-sm);
}
.pic-card-swatch.is-active {
  outline: 2px solid var(--pic-accent, #2563eb);
  outline-offset: 1px;
}

/* ── Quote / text card: roomy desktop layout (preview beside controls) ── */
.pic-card-settings {
  max-width: min(1400px, 96vw);
  width: min(1400px, 96vw);
}
.pic-card__stage {
  position: relative; /* anchor the inline text editor */
}
/* One DOM works for both. Mobile: plain column (DOM order Setup → Card → Text) so
   the Card can be position:sticky against the scrolling modal. Desktop: switch to a
   grid with the Card on the left and Setup over Text on the right.
   (Sticky needs a column here - a 1-row grid cell collapses to the item height and
   leaves no travel for sticky.) */
.pic-card-layout {
  display: flex;
  flex-direction: column;
  gap: var(--pic-space-md);
}
.pic-card-setup { grid-area: setup; }
.pic-card-left { grid-area: preview; min-width: 0; }
.pic-card-text { grid-area: text; }
.pic-card-controls {
  display: flex;
  flex-direction: column;
  gap: var(--pic-space-md);
  min-width: 0;
}
/* Make the menus easier to read: bigger, higher-contrast chips + labels. */
.pic-card-controls .pic-label {
  font-size: var(--pic-font-sm);
  font-weight: 600;
}
.pic-card-controls .pic-montage__tpl {
  font-size: var(--pic-font-sm);
  padding: 8px 14px;
}
.pic-card-controls .pic-card-swatch {
  width: 44px;
  min-width: 44px;
  height: 38px;
}
.pic-card-controls .pic-input {
  max-width: 320px;
}

/* Info "?" button + the how-to pop-up (keeps the top tidy). */
.pic-card-info {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--pic-border);
  background: var(--pic-surface);
  color: var(--pic-text);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.pic-card-info:hover { border-color: var(--pic-accent); }
.pic-card-help-pop {
  margin: 0 0 var(--pic-space-md);
  padding: var(--pic-space-sm) var(--pic-space-md);
  background: var(--pic-surface);
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-md);
  font-size: var(--pic-font-sm);
}
.pic-card-help-pop[hidden] { display: none; }

/* Mobile: pin the card so editing the text below keeps it in view (no scroll dance). */
@media (max-width: 899px) {
  .pic-card-left {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--pic-panel-bg);
    padding-bottom: var(--pic-space-xs);
    box-shadow: 0 8px 12px -10px rgba(0, 0, 0, 0.6);
  }
  .pic-card-setup,
  .pic-card-text {
    background: var(--pic-surface);
    border: 1px solid var(--pic-border);
    border-radius: var(--pic-radius-md);
    padding: var(--pic-space-sm) var(--pic-space-md);
  }
}

/* Desktop: Card on the left (sticky), Setup over Text on the right - two panels. */
@media (min-width: 900px) {
  .pic-card-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    grid-template-areas:
      "preview setup"
      "preview text";
    align-items: start;
  }
  .pic-card-left {
    position: sticky;
    top: 0;
  }
  .pic-card-setup,
  .pic-card-text {
    background: var(--pic-surface);
    border: 1px solid var(--pic-border);
    border-radius: var(--pic-radius-md);
    padding: var(--pic-space-md);
  }
  /* Keep the Save / Close bar reachable without scrolling to the very bottom. */
  .pic-card-foot {
    position: sticky;
    bottom: 0;
    background: var(--pic-panel-bg);
    padding-top: var(--pic-space-sm);
    margin-top: 0;
  }
}

/* Inline "double-click to edit" text editor, overlaid on the card. */
.pic-card-editor {
  position: absolute;
  z-index: 5;
  margin: 0;
  padding: 6px 8px;
  box-sizing: border-box;
  border: 2px solid var(--pic-accent, #2563eb);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.62);
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  resize: none;
  overflow: hidden;
  outline: none;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}

/* ── Advert / invitation maker: 3-panel editor layout ─────────────────
   Mobile: column (Setup → sticky Advert → Words/Selected/Extras), same
   pattern as the card maker. Desktop 900px+: advert left, controls right.
   Wide 1280px+: Setup | Advert | Words three-up. */
.pic-advert-settings {
  max-width: min(1500px, 96vw);
  width: min(1500px, 96vw);
}
.pic-advert__stage {
  position: relative; /* anchor the inline text editor + selection hint */
}
.pic-advert-layout {
  display: flex;
  flex-direction: column;
  gap: var(--pic-space-md);
}
.pic-advert-setup { grid-area: setup; }
.pic-advert-left { grid-area: preview; min-width: 0; }
.pic-advert-side { grid-area: side; }
.pic-advert-controls {
  display: flex;
  flex-direction: column;
  gap: var(--pic-space-md);
  min-width: 0;
}
.pic-advert-controls .pic-label {
  font-size: var(--pic-font-sm);
  font-weight: 600;
}
.pic-advert-controls .pic-montage__tpl {
  font-size: var(--pic-font-sm);
  padding: 8px 14px;
}
.pic-advert-controls .pic-input {
  max-width: 320px;
}
/* Template picker chips: a mini live-rendered canvas + label per template. */
.pic-advert-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
}
.pic-advert-thumb canvas {
  display: block;
  border-radius: 4px;
  pointer-events: none;
}
/* Palette swatch: three-band preview of primary / paper / accent. */
.pic-advert-palette {
  width: 44px;
  min-width: 44px;
  height: 38px;
  padding: 0;
  border-radius: var(--pic-radius-sm);
}
.pic-advert-palette.is-active {
  outline: 2px solid var(--pic-accent, #2563eb);
  outline-offset: 1px;
}
/* Keep the photo pickers compact inside the setup column. */
.pic-advert-setup .pic-export__select-grid {
  max-height: 220px;
  overflow-y: auto;
}
@media (max-width: 899px) {
  .pic-advert-left {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--pic-panel-bg);
    padding-bottom: var(--pic-space-xs);
    box-shadow: 0 8px 12px -10px rgba(0, 0, 0, 0.6);
  }
  .pic-advert-setup,
  .pic-advert-side {
    background: var(--pic-surface);
    border: 1px solid var(--pic-border);
    border-radius: var(--pic-radius-md);
    padding: var(--pic-space-md);
  }
}
@media (min-width: 900px) {
  .pic-advert-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    grid-template-areas:
      "preview setup"
      "preview side";
    align-items: start;
  }
  .pic-advert-left {
    position: sticky;
    top: 0;
  }
  .pic-advert-setup,
  .pic-advert-side {
    background: var(--pic-surface);
    border: 1px solid var(--pic-border);
    border-radius: var(--pic-radius-md);
    padding: var(--pic-space-md);
  }
  .pic-advert-foot {
    position: sticky;
    bottom: 0;
    background: var(--pic-panel-bg);
    padding-top: var(--pic-space-sm);
    margin-top: 0;
  }
}
@media (min-width: 1280px) {
  .pic-advert-layout {
    grid-template-columns: 340px minmax(0, 1fr) 360px;
    grid-template-areas: "setup preview side";
  }
}

/* Make a grid / carousel: preview stage */
.pic-grid__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: var(--pic-space-md);
  margin: var(--pic-space-sm) 0;
  background: repeating-conic-gradient(
      var(--pic-border) 0% 25%,
      transparent 0% 50%
    )
    50% / 20px 20px;
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-md);
}
.pic-grid__canvas {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

/* Brand quick-tool: logo upload control */
.pic-qt-logo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--pic-space-sm);
}
.pic-qt-logo__status {
  font-size: 0.9em;
  color: var(--pic-text-muted, #64748b);
}

.pic-video__selnote {
  margin-top: var(--pic-space-sm);
}
.pic-field-hint.is-warn {
  color: var(--pic-warning, #b45309);
  font-weight: 600;
}

/* Reorder strip ("Put them in order" step) - number-driven */
.pic-video__reorder {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pic-space-sm);
  max-height: 50vh;
  overflow-y: auto;
  padding: var(--pic-space-xs);
}
.pic-video__rtile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-sm);
  background: var(--pic-surface, #fff);
}
.pic-video__rnum {
  position: absolute;
  top: 7px;
  left: 7px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  background: var(--pic-accent, #2563eb);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.pic-video__rthumb {
  width: 96px;
  height: 96px;
  border-radius: 4px;
  display: block;
}
.pic-video__rinput {
  width: 96px;
  height: 34px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-sm);
  background: var(--pic-bg, #fff);
  color: var(--pic-text, #0f172a);
}
.pic-video__rinput:focus-visible {
  outline: 2px solid var(--pic-accent, #2563eb);
  outline-offset: 1px;
}
.pic-video__apply {
  margin-top: var(--pic-space-md);
}

/* ── Free-edition advert slot (filled by src/util/pic-ads.js) ── */
/* A min-height is reserved up front so the page doesn't shift (CLS) when the ad
   arrives. If AdSense returns no ad, pic-ads.js collapses the slot (hidden) so
   there's no empty "Advertisement" box. */
.pic-ad-slot {
  /* width:100% + align-self:stretch are REQUIRED: the home column is a centred
     flex (align-items:center), so without them an empty slot collapses to ~0
     width and AdSense reports availableWidth=0 and serves no ad. The 650px cap
     (matched by the home column on desktop) gives the ad more room than the
     menu cards without going full width. Responsive: width:100% up to the cap. */
  width: 100%;
  align-self: stretch;
  max-width: 650px;
  margin: var(--pic-space-md) auto;
  /* A framed panel with side padding so the advert is clearly separated from the
     app UI and never sits against the screen edge. The padding (plus the page's
     own gutter) leaves a safe, non-tappable scroll lane beside the ad on touch
     devices - required so users don't mis-click while scrolling (AdSense policy). */
  padding: var(--pic-space-sm) var(--pic-space-md) var(--pic-space-md);
  background: rgba(127, 127, 127, 0.05);
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-md);
  min-height: 100px;
  text-align: center;
  contain: layout;
}

/* Phones: cap the whole advert area at 340px (a standard mobile ad size) so it
   never fills the screen, and keep a scroll lane beside it. The cap + the page
   gutter centre it with clear space on both sides. */
@media (max-width: 480px) {
  .pic-ad-slot {
    max-width: 340px;
    padding-left: 20px;
    padding-right: 20px;
  }
}

.pic-ad-slot .promo-label {
  margin-bottom: 4px;
  font-size: var(--pic-font-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pic-subtle);
}

.pic-ad-slot ins.adsbygoogle {
  display: block;
  max-width: 100%; /* never let the ad iframe spill past the framed panel */
}

/* Installed (standalone) app: the slot shows a Pro-upsell card instead of an ad. */
.pic-ad-slot--house {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.pic-ad-house__title {
  color: var(--pic-text);
  font-size: var(--pic-font-base);
}
.pic-ad-house__sub {
  margin: 0;
  color: var(--pic-muted);
  font-size: var(--pic-font-sm);
  max-width: 38ch;
}
.pic-ad-house__cta {
  margin-top: 6px;
}
.pic-ad-house__link {
  color: var(--pic-accent);
  font-size: var(--pic-font-sm);
  text-decoration: none;
}
.pic-ad-house__link:hover {
  text-decoration: underline;
}

/* ===========================================================
   Size-preset help ("Which size do I need?") — the "?" button
   next to the Size preset label, and its modal.
   =========================================================== */
.pic-size-help-btn {
  margin-left: var(--pic-space-xs);
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--pic-border);
  border-radius: 50%;
  background: var(--pic-surface);
  color: var(--pic-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
}
.pic-size-help-btn:hover,
.pic-size-help-btn:focus-visible {
  color: var(--pic-accent);
  border-color: var(--pic-accent);
}

.pic-size-help-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pic-space-md);
  background: rgba(0, 0, 0, 0.55);
}
.pic-size-help {
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--pic-space-lg);
  border: 1px solid var(--pic-border);
  border-radius: var(--pic-radius-lg);
  background: var(--pic-bg);
  color: var(--pic-text);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}
.pic-size-help__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--pic-space-sm);
}
.pic-size-help__title {
  margin: 0;
  font-size: var(--pic-font-lg);
}
.pic-size-help__close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--pic-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.pic-size-help__close:hover,
.pic-size-help__close:focus-visible {
  color: var(--pic-text-hover);
}
.pic-size-help__lead,
.pic-size-help__foot {
  margin: 0 0 var(--pic-space-md);
  color: var(--pic-muted);
  font-size: var(--pic-font-sm);
}
.pic-size-help__foot {
  margin: var(--pic-space-md) 0 0;
}
.pic-size-help__group {
  margin: var(--pic-space-md) 0 var(--pic-space-xs);
  font-size: var(--pic-font-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pic-accent);
}
.pic-size-help__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.pic-size-help__item {
  padding: var(--pic-space-sm) 0;
  border-bottom: 1px solid var(--pic-border);
}
.pic-size-help__item:last-child {
  border-bottom: none;
}
.pic-size-help__px {
  color: var(--pic-muted);
  font-size: var(--pic-font-sm);
}
.pic-size-help__note {
  margin-top: 2px;
  color: var(--pic-muted);
  font-size: var(--pic-font-sm);
}
