/*!
 * 123PhotoTool theme: the look of the sister site ChangeBackground (its
 * Remove Background workspace), on every page.
 *
 *   a cool grey page under a soft rainbow wash (123PhotoTool's own, not CB's
 *     beige), white rounded cards with a soft shadow below them
 *   before a photo, only a frosted upload card under the title (CB's flow);
 *     with one, the photo on a dark rounded stage and the panel beside it
 *   the controls in a white panel, 360px, beside the photo; compact controls:
 *     a segmented tab track, 34px slider rows with a dark knob, 36px fields,
 *     32px pill buttons, a blue download button
 *   "Continue with" under the panel: a list of the other tools
 *   a white header, a near-black footer under a brand-gradient line
 *
 * Loaded last by head-ui.inc.php (after pt-ui, pt-app and pt-content), so a
 * rule here wins a tie with any of them. CB's sizes are copied in px: this
 * theme's root font is 20px, CB's 16px. The layout's moving parts stay in
 * pt-ui.css; this file is the look.
 */
:root {
  --cb-ink: #16181d;
  --cb-text: #3d434b;
  --cb-muted: #626973;
  /* A cool grey page, not CB's warm beige: 123PhotoTool's own. */
  --cb-bg: #f2f4f8;
  --cb-line: #e1e5ec;
  --cb-ghost: #cbd2dc;
  --cb-btn-line: #d3d9e2;
  --cb-hover-bg: #e6eaf1;
  --cb-pink: #d81878;
  --cb-cta: #0f70e6;
  --cb-cta-hover: #0b5fc6;
  --cb-stage: #2b2e34;
  /* The logo's colours (red, orange, green, blue, violet), softened. */
  --cb-brand: linear-gradient(90deg, #e8344a, #f29a1d 30%, #58b83a 56%, #1479e0 80%, #9b3fe6);
  --cb-shadow: 0 24px 50px -30px rgba(22, 24, 29, 0.4);
  --cb-shadow-stage: 0 34px 70px -30px rgba(0, 0, 0, 0.55);
  --cb-raised: 0 2px 8px -2px rgba(22, 24, 29, 0.25);
  --cb-ring: 0 0 0 2px #fff, 0 0 0 4px var(--cb-ink);
  --cb-focus: 0 0 0 3px rgba(15, 112, 230, 0.28);
  --cb-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --cb-panel-w: 360px;

  /* The theme's colours and font (style.css threads these through). */
  --bs-primary: #0f70e6;
  --bs-primary-rgb: 15, 112, 230;
  /* Links one step darker: #0f70e6 on the page colour is 4.3:1. */
  --bs-link-color: #0b5fc6;
  --bs-link-color-rgb: 11, 95, 198;
  --bs-link-hover-color: #094fa6;
  --bs-link-hover-color-rgb: 9, 79, 166;
  --bs-body-color: #3d434b;
  --bs-heading-color: #16181d;
  --bs-navy: #16181d;
  --bs-font-sans-serif: var(--cb-font);
  --bs-body-font-family: var(--cb-font);

  /* pt-ui.css, pt-app.css */
  --pt-line: #e1e5ec;
  --pt-surface: #f2f4f8;
  --pt-ink: #16181d;
  --pt-muted: #626973;
  --pt-accent: #0f70e6;
  --pt-accent-soft: rgba(15, 112, 230, 0.06);
  --pt-app-accent: #0f70e6;
  --pt-app-accent-soft: rgba(15, 112, 230, 0.24);
}
@media (min-width: 768px) and (max-width: 991.98px) {
  :root { --cb-panel-w: 320px; }
}

/* ── Type ─────────────────────────────────────────────────────────────────
   The system face, as CB. The script fonts stay for the locales the system
   face may not cover well (style.css's locale block, without Manrope). */
:lang(ja) {
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic UI", Meiryo, "Noto Sans JP", sans-serif;
}
:lang(ko) {
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic",
    "Noto Sans KR", sans-serif;
}
:lang(zh-Hans) {
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
:lang(zh-Hant) {
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei",
    "Noto Sans TC", sans-serif;
}
:lang(ar) {
  --bs-body-font-family: system-ui, -apple-system, "SF Arabic", "Segoe UI", Tahoma,
    "Noto Sans Arabic", sans-serif;
}
/* Windows' system face has no Devanagari or Thai: name the ones it falls to. */
:lang(hi) {
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", "Nirmala UI", "Kohinoor Devanagari",
    "Noto Sans Devanagari", sans-serif;
}
:lang(th) {
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", "Leelawadee UI", Thonburi,
    "Noto Sans Thai", sans-serif;
}
body { background-color: var(--cb-bg); }
h1, h2 { letter-spacing: -0.02em; }
/* Headings in CB's ink: style.css paints h1–h6 #343f52 directly, past
   --bs-heading-color. Dark sections keep theirs (.text-inverse h2 is more
   specific). */
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--bs-heading-color); }
.text-dark { color: var(--cb-ink) !important; }
/* Sandbox's muted #aab0bc is 2.2:1 on white; CB's is 5.5:1. */
.text-muted { color: var(--cb-muted) !important; }
/* Spacing between letters breaks Arabic joins and crowds CJK. */
:is(:lang(ar), :lang(ja), :lang(ko), :lang(zh-Hans), :lang(zh-Hant), :lang(hi), :lang(th)) :is(h1, h2) { letter-spacing: 0; }

/* The page sections sit on the page colour; cards carry the white. */
section.wrapper:is(.bg-light, .bg-white, .bg-gray) { background-color: transparent !important; }

/* ── Header and footer ───────────────────────────────────────────────── */
header.wrapper.bg-soft-primary {
  background-color: rgba(255, 255, 255, 0.96) !important;
  border-bottom: 1px solid #e6e9ef;
}
.navbar.navbar-stick:not(.navbar-dark) { border-bottom: 1px solid #e6e9ef; box-shadow: none !important; }
.navbar .navbar-nav .nav-link { color: var(--cb-text); }
.navbar .navbar-nav .nav-link:hover,
.navbar .navbar-nav .show > .nav-link { color: var(--cb-ink); }
/* Feedback: CB's outline pill (its "Sign up"). */
.navbar .navbar-other .btn-primary {
  --bs-btn-color: var(--cb-ink);
  --bs-btn-bg: #fff;
  --bs-btn-border-color: var(--cb-ghost);
  --bs-btn-hover-color: var(--cb-ink);
  --bs-btn-hover-bg: #fff;
  --bs-btn-hover-border-color: var(--cb-ink);
  --bs-btn-active-color: var(--cb-ink);
  --bs-btn-active-bg: #fff;
  --bs-btn-active-border-color: var(--cb-ink);
  border-width: 1.5px;
  box-shadow: none;
}
.navbar .navbar-other .btn-primary:hover { color: var(--cb-ink); background-color: #fff; border-color: var(--cb-ink); }

footer.bg-dark {
  background-color: #16181d !important;
  border-top: 4px solid transparent;
  border-image: var(--cb-brand) 1;
}

/* ── Buttons and fields, everywhere ──────────────────────────────────── */
.btn-primary {
  --bs-btn-hover-bg: var(--cb-cta-hover);
  --bs-btn-hover-border-color: var(--cb-cta-hover);
  --bs-btn-active-bg: var(--cb-cta-hover);
  --bs-btn-active-border-color: var(--cb-cta-hover);
}
.btn-primary:hover { background-color: var(--cb-cta-hover); border-color: var(--cb-cta-hover); }
/* Save is CB's blue download button, not a green one. */
.btn-success {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--cb-cta);
  --bs-btn-border-color: var(--cb-cta);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--cb-cta-hover);
  --bs-btn-hover-border-color: var(--cb-cta-hover);
  --bs-btn-focus-shadow-rgb: 15, 112, 230;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--cb-cta-hover);
  --bs-btn-active-border-color: var(--cb-cta-hover);
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--cb-cta);
  --bs-btn-disabled-border-color: var(--cb-cta);
}
.btn-success:hover { color: #fff; background-color: var(--cb-cta-hover); border-color: var(--cb-cta-hover); }
/* Ghost: white, a warm grey line, the ink line on hover. Every outline
   colour but danger is a ghost (Flip, Rotate, Invert, Restore, Add Color):
   CB has no blue, green or orange outlines. */
.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-success,
.btn-outline-info,
.btn-outline-warning,
.btn-outline-dark {
  --bs-btn-color: var(--cb-ink);
  --bs-btn-bg: #fff;
  --bs-btn-border-color: var(--cb-btn-line);
  --bs-btn-hover-color: var(--cb-ink);
  --bs-btn-hover-bg: #fff;
  --bs-btn-hover-border-color: var(--cb-ink);
  --bs-btn-focus-shadow-rgb: 15, 112, 230;
  --bs-btn-active-color: var(--cb-ink);
  --bs-btn-active-bg: #fff;
  --bs-btn-active-border-color: var(--cb-ink);
  --bs-btn-disabled-color: var(--cb-muted);
  --bs-btn-disabled-bg: #fff;
  --bs-btn-disabled-border-color: var(--cb-line);
}
:is(.btn-outline-secondary, .btn-outline-primary, .btn-outline-success, .btn-outline-info, .btn-outline-warning, .btn-outline-dark):is(.active, [aria-pressed="true"]) { box-shadow: inset 0 0 0 1px var(--cb-ink); }
.btn-check:checked + :is(.btn-outline-secondary, .btn-outline-primary, .btn-outline-success, .btn-outline-info, .btn-outline-warning, .btn-outline-dark) { color: var(--cb-ink); background-color: #fff; border-color: var(--cb-ink); box-shadow: inset 0 0 0 1px var(--cb-ink); }

.form-control,
.form-select {
  color: var(--cb-ink);
  border-color: var(--cb-line);
  box-shadow: none;
}
.form-control:focus,
.form-select:focus { border-color: rgba(15, 112, 230, 0.55); box-shadow: var(--cb-focus); }
.form-check-input:checked { background-color: var(--cb-cta); border-color: var(--cb-cta); }
.form-check-input:focus { border-color: rgba(15, 112, 230, 0.55); box-shadow: var(--cb-focus); }

/* Sliders: an 8px track and a 16px dark knob (CB's custom-range). */
.form-range { height: 20px; }
.form-range::-webkit-slider-runnable-track { height: 8px; background-color: var(--cb-line); box-shadow: none; }
.form-range::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -4px; background-color: var(--cb-ink); box-shadow: none; }
.form-range::-webkit-slider-thumb:active { background-color: #000; }
.form-range::-moz-range-track { height: 8px; background-color: var(--cb-line); box-shadow: none; }
.form-range::-moz-range-thumb { width: 16px; height: 16px; background-color: var(--cb-ink); border: 0; box-shadow: none; }
.form-range::-moz-range-thumb:active { background-color: #000; }
.form-range:focus::-webkit-slider-thumb { box-shadow: 0 0 0 1px #fff, 0 0 0 4px rgba(216, 24, 120, 0.3); }
.form-range:focus::-moz-range-thumb { box-shadow: 0 0 0 1px #fff, 0 0 0 4px rgba(216, 24, 120, 0.3); }
@media (pointer: coarse) {
  .form-range { height: 28px; }
  .form-range::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -7px; }
  .form-range::-moz-range-thumb { width: 22px; height: 22px; }
}

/* ── The tool: a title, then the photo and the panel on the page ────────
   The old white card around both goes; each is a card of its own. */
.pt-tool.card {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.pt-tool > h1,
.pt-tool > .pt-tool-title {
  font-size: clamp(28px, 18px + 1.6vw, 42px);
  font-weight: 800;
  color: var(--cb-ink);
  line-height: 1.12;
  margin-top: 12px;
}
.pt-tool > h1 + p.small { font-size: 14px; font-weight: 500; color: var(--cb-text) !important; }

/* Behind the top of a tool page and the home page: the logo's rainbow as a
   soft wash from the top edge (CB has pastel blobs over graph paper). */
/* The info pages' title band (About, Contact, the legal texts) too, in
   place of its pale blue. */
section.wrapper.bg-soft-primary:has(> .pti-hero) { background-color: transparent !important; }
/* flow-root: a first row's top margin (the Drawing Editor's mt-8) stays
   inside, or the section and its wash start 40px under the header. */
section.wrapper:is(:has(.pt-tool), :has(#popular-tools), :has(> .pti-hero)) { position: relative; isolation: isolate; display: flow-root; }
section.wrapper:is(:has(.pt-tool), :has(#popular-tools), :has(> .pti-hero))::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  left: 0;
  right: 0;
  height: min(720px, 100%);
  pointer-events: none;
}
section.wrapper:is(:has(.pt-tool), :has(#popular-tools), :has(> .pti-hero))::before {
  background: linear-gradient(100deg,
    rgba(255, 59, 48, 0.16), rgba(255, 165, 0, 0.15) 20%, rgba(255, 221, 0, 0.13) 38%,
    rgba(52, 199, 89, 0.13) 56%, rgba(0, 116, 217, 0.16) 76%, rgba(212, 0, 255, 0.14));
  -webkit-mask-image: linear-gradient(to bottom, #000, rgba(0, 0, 0, 0.45) 38%, transparent 82%);
  mask-image: linear-gradient(to bottom, #000, rgba(0, 0, 0, 0.45) 38%, transparent 82%);
}

/* The photo and the panel: the photo takes what the 360px panel leaves
   (minmax(0, 1fr): a bare 1fr grows to its widest canvas). Grid columns
   follow the page direction, so RTL mirrors. "Continue with" (.pt-next)
   sits under the panel, the photo beside both. */
@media (min-width: 768px) {
  .pt-tool > .row:has(> .pt-tool-panel):has(> .pt-tool-stage) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) var(--cb-panel-w);
    align-items: start;
    gap: 16px 20px;
    margin: 0;
    --bs-gutter-x: 0;
    --bs-gutter-y: 0;
  }
  .pt-tool > .row:has(> .pt-tool-panel):has(> .pt-tool-stage) > * {
    width: auto !important;
    max-width: none !important;
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
    margin-top: 0 !important;
  }
  .pt-tool > .row:has(> .pt-tool-panel):has(> .pt-tool-stage) > :not(.pt-tool-panel, .pt-tool-stage, .pt-next) { grid-column: 1 / -1; }
  .pt-tool > .row:has(> .pt-tool-panel):has(> .pt-tool-stage) > .pt-tool-stage { grid-column: 1; grid-row: 1; }
  .pt-tool > .row:has(> .pt-tool-panel):has(> .pt-tool-stage) > .pt-tool-panel { grid-column: 2; grid-row: 1; }
  .pt-tool > .row:has(> .pt-next):has(> .pt-tool-stage) > .pt-tool-stage { grid-row: 1 / span 2; }
  .pt-tool > .row:has(> .pt-tool-panel):has(> .pt-tool-stage) > .pt-next { grid-column: 2; grid-row: 2; }
}
/* Phones: no gutter, so a panel that stays on the page (Base64, Barcode,
   Gradient...) lines up with the photo box instead of running to the
   screen's edges, where its round corners met the glass. */
@media (max-width: 767.98px) {
  .pt-tool > .row:has(> .pt-tool-panel):has(> .pt-tool-stage) { --bs-gutter-x: 0; margin-left: 0; margin-right: 0; }
}
/* Tablet portrait stacks them (pt-ui.css): one column. */
@media (min-width: 768px) and (max-width: 991.98px) and (orientation: portrait) {
  .pt-tool > .row:has(> .pt-tool-panel):has(> .pt-tool-stage) { grid-template-columns: minmax(0, 1fr); }
  .pt-tool > .row:has(> .pt-tool-panel):has(> .pt-tool-stage) > :is(.pt-tool-stage, .pt-tool-panel, .pt-next) { grid-column: 1 !important; grid-row: auto !important; }
}

/* ── The workspace fills the window (pt-app.js sets .pt-ws-fit) ──────────
   Side by side, the photo box and the panel take the window's height: the
   panel scrolls inside itself (its Save bar pinned to its foot, below), the
   photo box takes what its own toolbars leave (--pt-ws-h). */
@media (min-width: 768px) {
  .pt-tool.pt-ws-fit .pt-tool-stage { position: relative; top: auto; }
  .pt-tool.pt-ws-fit > .row > .pt-tool-panel {
    max-height: var(--pt-panel-max, none);
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #c6ccd5 transparent;
    /* A field reached with Tab stops above the pinned bar. */
    scroll-padding-bottom: 88px;
  }
}
/* Back to top would sit over the panel's foot: not while the workspace is
   in view (pt-app.js). */
@media (min-width: 768px) {
  html.pt-ws-inview .progress-wrap { opacity: 0 !important; visibility: hidden !important; }
}
/* The copy of the Save bar (pt-app.js): it takes no room in the panel and
   sits over the panel's foot while the real bar is scrolled out of view. */
.pt-pin { display: none; }
@media (min-width: 768px) {
  .pt-tool.pt-ws-fit .pt-pin.pt-pin-on:not(.pt-pin-empty) {
    display: block;
    position: sticky;
    bottom: 0;
    z-index: 5;
    flex: none;
    align-self: stretch;
    width: auto !important;
    height: 0;
    margin: 0 !important;
    padding: 0 !important;
  }
  .pt-pin-bar {
    position: absolute;
    left: -16px;
    right: -16px;
    bottom: -16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px 16px;
    background: #fff;
    border-top: 1px solid var(--cb-line);
    box-shadow: 0 -18px 24px -20px rgba(22, 24, 29, 0.4);
  }
  .pt-pin-bar > .btn { min-width: 0; max-width: 100%; margin: 0 !important; white-space: normal; flex: 1 0 auto; }
  .pt-pin-bar > .btn-success { width: auto; flex: 1000 1 auto; }
}

/* ── A phone: the tools whose panel stays on the page (pt-app.js) ─────────
   A short preview (.pt-dock) stays at the top while the settings scroll
   under it, the site header out of its way; the Save bar is pinned to the
   screen's foot while the real one is out of view. */
@media (max-width: 767.98px) {
  .pt-tool.pt-dock > .row > .pt-tool-stage { position: sticky; top: 8px; z-index: 6; }
  .pt-tool.pt-docked > .row > .pt-tool-stage::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -8px -20px -10px;
    background: rgba(242, 244, 248, 0.94);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 20px -16px rgba(22, 24, 29, 0.45);
    pointer-events: none;
  }
  /* A tall photo box docks its top part only (pt-app.js: the picture and
     its bar, not the upload card under them): the rest is cut off, and the
     settings show through where it was. */
  .pt-tool.pt-docked > .row > .pt-tool-stage { clip-path: inset(-12px -24px var(--pt-dock-cut, 0px) -24px); }
  /* Its lower edge: a shadow over the settings scrolling under it. */
  .pt-tool.pt-docked > .row::after {
    content: "";
    position: fixed;
    z-index: 5;
    top: calc(8px + var(--pt-dock-h, 0px));
    left: 0;
    right: 0;
    height: 16px;
    background: linear-gradient(rgba(22, 24, 29, 0.16), rgba(22, 24, 29, 0));
    pointer-events: none;
  }
  html.pt-dock-on .navbar-clone { visibility: hidden !important; opacity: 0 !important; }
  /* A field brought into view stops under the docked preview. */
  html:has(.pt-tool.pt-dock) { scroll-padding-top: calc(var(--pt-dock-h, 0px) + 28px); }
  .pt-tool .pt-pin.pt-pin-phone.pt-pin-on:not(.pt-pin-empty) {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1025;
    width: auto !important;
    margin: 0 !important;
  }
  .pt-pin-phone .pt-pin-bar {
    display: flex;
    gap: 8px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--cb-line);
    box-shadow: 0 -12px 24px -18px rgba(22, 24, 29, 0.4);
  }
  .pt-pin-phone .pt-pin-bar > .btn { flex: 1 1 0; min-width: 0; min-height: 48px; margin: 0 !important; white-space: normal; line-height: 1.2; }
  .pt-pin-phone .pt-pin-bar > .btn-success { flex-grow: 1.6; }
  html.pt-pin-shown .progress-wrap { opacity: 0 !important; visibility: hidden !important; }
}

/* ── The photo box ───────────────────────────────────────────────────────
   A tool that makes its picture (QR code, gradient, colours): a white card.
   A photo tool (an app page with an empty state): CB's frosted upload card
   until a photo is in, then the dark stage (.pt-app-loaded, from pt-app.js).
   A page that works without a photo (.pt-tool-ready: Color Picker) and the
   pages with no app shell (colour tools, QR) keep the white card. */
.pt-tool .pt-tool-viewport {
  border: 0 !important;
  border-radius: 22px !important;
  background: #fff !important;
  box-shadow: var(--cb-shadow) !important;
}
.pt-tool.pt-tool-app:not(.pt-tool-ready) .pt-tool-viewport:not(.pt-app-loaded):has(.pt-tool-empty) {
  isolation: isolate;
  background: rgba(255, 255, 255, 0.55) !important;
  outline: 1px solid rgba(255, 255, 255, 0.9);
  outline-offset: -1px;
  box-shadow: 0 24px 60px -28px rgba(22, 24, 29, 0.35) !important;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.pt-tool.pt-tool-app:not(.pt-tool-ready) .pt-tool-viewport:not(.pt-app-loaded):has(.pt-tool-empty)::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 14px;
  border: 1.5px dashed rgba(22, 24, 29, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  pointer-events: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.pt-tool.pt-tool-app:not(.pt-tool-ready) .pt-tool-viewport:not(.pt-app-loaded):has(.pt-tool-empty):hover::before { border-color: var(--cb-pink); background: #fff; }
.pt-tool .pt-tool-viewport.pt-app-loaded {
  background: var(--cb-stage) !important;
  outline: 0;
  box-shadow: var(--cb-shadow-stage) !important;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.pt-tool .pt-tool-viewport.pt-app-loaded::before { display: none; }
@media (max-width: 767.98px) {
  .pt-tool .pt-tool-viewport { border-radius: 18px !important; }
  .pt-tool.pt-tool-app:not(.pt-tool-ready) .pt-tool-viewport:not(.pt-app-loaded):has(.pt-tool-empty)::before { inset: 10px; border-radius: 14px; }
}

/* The empty state: CB's blue pill, the samples under it. */
.pt-tool .pt-tool-empty-upload {
  gap: 9px;
  min-height: 0;
  padding: 12px 28px !important;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  border: 3px solid transparent !important;
  border-radius: 999px !important;
  box-shadow: 0 10px 24px -10px rgba(15, 112, 230, 0.6);
  transition: transform 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.pt-tool .pt-tool-empty-upload:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -10px rgba(15, 112, 230, 0.65);
}
.pt-tool .pt-tool-empty-upload .bi,
.pt-tool .pt-tool-empty-upload svg { margin: 0 !important; }
.pt-tool .pt-tool-empty p { font-size: 15px !important; font-weight: 600; color: var(--cb-ink) !important; }
.pt-tool .pt-tool-empty .sample-thumbnails { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.pt-tool .pt-tool-empty .sample-thumbnail {
  flex: none;
  width: 64px !important;
  height: 64px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  border: 0 !important;
  border-radius: 14px !important;
  background: #ddd;
  box-shadow: 0 6px 14px -6px rgba(22, 24, 29, 0.45) !important;
  cursor: pointer;
  transition: transform 0.15s;
}
.pt-tool .pt-tool-empty .sample-thumbnail img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border: 0 !important;
  border-radius: 0 !important;
}
.pt-tool .pt-tool-empty .sample-thumbnail:hover { transform: translateY(-2px) scale(1.05); }
.pt-tool .pt-tool-empty .sample-thumbnail:focus-visible { outline: 3px solid var(--cb-pink); outline-offset: 2px; }
/* The panel's drop / paste note, copied in by pt-app.js. */
.pt-tool .pt-tool-empty-hint { margin: 2px 0 0; font-size: 14px; line-height: 1.45; color: var(--cb-muted); text-align: center; }
@media (max-width: 767.98px) {
  .pt-tool .pt-tool-empty-hint { display: none; }
}

/* ── Before a photo: only the upload card (CB's flow) ─────────────────────
   Until the tool has a photo (.pt-app-loaded) and while its empty state
   shows, the title and one centred upload card are the whole tool: no
   panel, no toolbars, no "Continue with". The panel comes with the photo,
   and pt-app.js has the tool refit to the narrower photo box then.
   App pages only (pt-app.js marks their photo); .pt-tool-ready opts out a
   tool that works without a photo. An error stays (a photo too big for the
   tool, a file that would not open): most pages wrap .pt-tool-status in a
   div, and with no photo in, the editor never opens to say it. */
.pt-tool.pt-tool-app:not(.pt-tool-ready):has(.pt-tool-viewport:not(.pt-app-loaded) .pt-tool-empty:not(.d-none, .hidden, [hidden], [style*="display: none"], [style*="display:none"])) .pt-tool-panel,
.pt-tool.pt-tool-app:not(.pt-tool-ready):has(.pt-tool-viewport:not(.pt-app-loaded) .pt-tool-empty:not(.d-none, .hidden, [hidden], [style*="display: none"], [style*="display:none"])) .pt-next,
.pt-tool.pt-tool-app:not(.pt-tool-ready):has(.pt-tool-viewport:not(.pt-app-loaded) .pt-tool-empty:not(.d-none, .hidden, [hidden], [style*="display: none"], [style*="display:none"])) .pt-tool-stage > :not(.pt-tool-viewport, :has(.pt-tool-viewport), .pt-tool-status, :has(.pt-tool-status.text-danger)) {
  display: none !important;
}
.pt-tool.pt-tool-app:not(.pt-tool-ready):has(.pt-tool-viewport:not(.pt-app-loaded) .pt-tool-empty:not(.d-none, .hidden, [hidden], [style*="display: none"], [style*="display:none"])) > :is(h1, .pt-tool-title) {
  margin-top: 20px;
  margin-bottom: 28px !important;
  font-size: clamp(30px, 18px + 2.6vw, 56px);
  line-height: 1.08;
}
@media (min-width: 768px) {
  .pt-tool.pt-tool-app:not(.pt-tool-ready):has(.pt-tool-viewport:not(.pt-app-loaded) .pt-tool-empty:not(.d-none, .hidden, [hidden], [style*="display: none"], [style*="display:none"])) > .row {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .pt-tool.pt-tool-app:not(.pt-tool-ready):has(.pt-tool-viewport:not(.pt-app-loaded) .pt-tool-empty:not(.d-none, .hidden, [hidden], [style*="display: none"], [style*="display:none"])) > .row > .pt-tool-stage {
    position: static;
    grid-column: 1 !important;
    grid-row: auto !important;
    justify-self: center;
    width: 100% !important;
    max-width: 640px !important;
  }
  .pt-tool.pt-tool-app:not(.pt-tool-ready):has(.pt-tool-viewport:not(.pt-app-loaded) .pt-tool-empty:not(.d-none, .hidden, [hidden], [style*="display: none"], [style*="display:none"])) .pt-tool-viewport {
    height: auto !important;
    min-height: 330px !important;
    padding: 52px 36px 44px !important;
    border-radius: 24px !important;
  }
  .pt-tool.pt-tool-app:not(.pt-tool-ready):has(.pt-tool-viewport:not(.pt-app-loaded) .pt-tool-empty:not(.d-none, .hidden, [hidden], [style*="display: none"], [style*="display:none"])) .pt-tool-viewport::before { border-radius: 18px; }
  /* Half the pages lay their empty card over the photo box (absolute,
     centred), so a card taller than the 330px box stuck out of the dashed
     line: the Upload button above it, the samples below. While the card is
     the whole tool it joins the flow instead, and the box grows to hold it.
     The box's other children share its one grid cell, so Crop's empty canvas
     still sits under the card. */
  .pt-tool.pt-tool-app:not(.pt-tool-ready):has(.pt-tool-viewport:not(.pt-app-loaded) .pt-tool-empty:not(.d-none, .hidden, [hidden], [style*="display: none"], [style*="display:none"])) .pt-tool-viewport {
    display: grid !important;
    grid-template: auto / minmax(0, 1fr);
    align-content: center;
  }
  .pt-tool.pt-tool-app:not(.pt-tool-ready):has(.pt-tool-viewport:not(.pt-app-loaded) .pt-tool-empty:not(.d-none, .hidden, [hidden], [style*="display: none"], [style*="display:none"])) .pt-tool-viewport > * { grid-area: 1 / 1; }
  .pt-tool.pt-tool-app:not(.pt-tool-ready):has(.pt-tool-viewport:not(.pt-app-loaded) .pt-tool-empty:not(.d-none, .hidden, [hidden], [style*="display: none"], [style*="display:none"])) .pt-tool-viewport > .pt-tool-empty {
    position: relative !important;
    inset: auto !important;
    transform: none !important;
    width: auto !important;
    height: auto !important;
    max-width: 100%;
  }
  /* The samples on one line under the button and the note, their label
     before them ("No image? Try one of these:"). The app pages' upload card
     only: the colour tools' upload strip under their preview (.cs-foot,
     .gr-foot...) stays the one compact row its page lays out. */
  .pt-tool.pt-tool-app .pt-tool-viewport:not(.pt-app-loaded) .pt-tool-empty:has(.sample-thumbnails) {
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: center;
    column-gap: 14px;
  }
  .pt-tool.pt-tool-app .pt-tool-viewport:not(.pt-app-loaded) .pt-tool-empty:has(.sample-thumbnails) > * { grid-column: 1 / -1; justify-self: center; }
  .pt-tool.pt-tool-app .pt-tool-viewport:not(.pt-app-loaded) .pt-tool-empty:has(.sample-thumbnails) > :is(.sample-thumbnails, p:has(+ .sample-thumbnails), p:has(+ p.d-md-none + .sample-thumbnails)) {
    grid-column: auto;
    margin: 30px 0 0 !important;
  }
  .pt-tool.pt-tool-app .pt-tool-viewport:not(.pt-app-loaded) .pt-tool-empty:has(.sample-thumbnails) > .pt-tool-empty-upload { margin-bottom: 14px !important; }
}

/* The compare button over the photo: CB's round dark button. */
.pt-vbar-btn {
  width: 40px;
  height: 40px;
  color: #fff;
  border: 0;
  border-radius: 50%;
  background: rgba(22, 24, 29, 0.72);
  box-shadow: none;
}
.pt-vbar-btn:hover { color: #fff; background: rgba(22, 24, 29, 0.86); }
.pt-vbar-btn.pressed { color: var(--cb-ink); background: #fff; }
.pt-compare-label { background: rgba(22, 24, 29, 0.78); font-size: 13px; padding: 6px 14px; }
.pt-drop { background: rgba(216, 24, 120, 0.06); }
.pt-drop-card { border: 3px dashed var(--cb-pink); border-radius: 22px; color: var(--cb-ink); }

/* Toolbars under the photo (zoom, undo): CB's dark pill. */
@media (min-width: 768px) {
  .pt-tool .pt-tool-deskbar {
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(22, 24, 29, 0.86);
  }
  .pt-tool .pt-tool-deskbar .btn {
    min-height: 36px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    border: 0;
    border-radius: 999px;
    background: transparent;
  }
  .pt-tool .pt-tool-deskbar .btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); }
  /* Text on the bar itself (Watermark's zoom %): its page colored it for a white bar. */
  .pt-tool .pt-tool-deskbar > span { color: #fff; }
  .pt-tool .pt-tool-deskbar .btn:disabled { opacity: 0.35; }
  /* The editors' zoom bar (−, slider, +, preset). */
  .pt-tool-stage .zoom-controls {
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(22, 24, 29, 0.86);
  }
  .pt-tool-stage .zoom-controls .btn {
    min-height: 32px;
    color: #fff;
    border: 0;
    border-radius: 999px;
    background: transparent;
    box-shadow: none;
  }
  .pt-tool-stage .zoom-controls .btn:hover:not(:disabled),
  .pt-tool-stage .zoom-controls .btn[aria-expanded="true"] { color: #fff; background: rgba(255, 255, 255, 0.16); }
  .pt-tool-stage .zoom-controls .zoom-btn { width: 32px; height: 32px; font-size: 17px; font-weight: 600; }
  .pt-tool-stage .zoom-controls .zoom-preset-btn { min-width: 70px; height: 32px; padding: 0 12px; font-size: 13px; font-weight: 600; background: rgba(255, 255, 255, 0.1); }
  .pt-tool-stage .zoom-controls .zoom-slider { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.28); }
  .pt-tool-stage .zoom-controls .zoom-slider::-webkit-slider-thumb { width: 14px; height: 14px; background: #fff; }
  .pt-tool-stage .zoom-controls .zoom-slider::-moz-range-thumb { width: 14px; height: 14px; background: #fff; }
  .pt-tool-stage .zoom-preset-menu { overflow: hidden; padding: 4px; border: 0; border-radius: 12px; box-shadow: 0 12px 30px -10px rgba(22, 24, 29, 0.35); }
  .pt-tool-stage .zoom-preset-item { border-radius: 8px; font-size: 13px; text-align: start; }
}
/* A canvas's own 1px frame was for a white box; on the dark stage it is a
   grey line round the photo. */
.pt-tool .pt-tool-viewport.pt-app-loaded canvas[style*="border"] { border-color: transparent !important; }

/* ── The panel ───────────────────────────────────────────────────────── */
.pt-tool .pt-tool-panel {
  background: #fff;
  border-radius: 22px;
  box-shadow: var(--cb-shadow);
}
@media (min-width: 768px) {
  .pt-tool .pt-tool-panel { padding: 16px !important; }
}
@media (max-width: 767.98px) {
  .pt-tool .pt-tool-panel { padding: 14px !important; border-radius: 18px; }
}

/* Upload: the drop box becomes one row, a ghost pill and the drop/paste
   note; the photo box is the big way in. */
@media (min-width: 768px) {
  .pt-tool .pt-tool-upload {
    flex-direction: row !important;
    flex-wrap: wrap;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px 12px;
    width: 100% !important;
    margin: 0 0 14px !important;
    padding: 0 0 14px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--cb-line) !important;
    border-radius: 0 !important;
    background: none !important;
  }
  .pt-tool .pt-tool-upload:hover { border-color: var(--cb-line) !important; }
  .pt-tool .pt-tool-upload .btn {
    flex: none;
    gap: 6px;
    min-height: 38px !important;
    margin: 0 !important;
    padding: 6px 16px !important;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--cb-ink) !important;
    border: 1.5px solid var(--cb-ghost) !important;
    border-radius: 999px !important;
    background: #fff !important;
    box-shadow: none !important;
  }
  .pt-tool .pt-tool-upload .btn:hover { border-color: var(--cb-ink) !important; }
  .pt-tool .pt-tool-upload .btn svg { width: 16px; height: 16px; margin: 0 !important; }
  .pt-tool .pt-tool-upload p {
    flex: 1 1 140px;
    margin: 0 !important;
    font-size: 12px !important;
    line-height: 1.35;
    text-align: start !important;
    color: var(--cb-muted) !important;
  }
  /* Once a photo is in, the row is the button alone: the drop and paste note
     was for the first photo, and in long languages it took four lines the
     panel needs to fit the screen. */
  .pt-tool:has(.pt-tool-viewport.pt-app-loaded) .pt-tool-upload p { display: none !important; }
}

/* A slider's value is muted, as CB's are, on every width: 15 old panels mark
   it .text-primary, whose !important blue beat the rule below. */
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) .form-label > span.text-primary:is([id$="-value"], [id$="Value"]) { color: var(--cb-muted) !important; }

/* Compact controls (desktop; phones keep their 16px fields and 44px taps). */
@media (min-width: 768px) {
  /* pt-ui.css's one-line sliders: 34px rows 4px apart, the name in a 84px+
     column (it wraps rather than CB's ellipsis: de, ru), the value 40px+. */
  .pt-tool-panel {
    --pt-sl-cols: minmax(84px, 30%) minmax(0, 1fr) minmax(40px, max-content);
    --pt-sl-cgap: 10px;
    --pt-sl-h: 34px;
    --pt-sl-gap: 4px;
  }
  .pt-tool-panel .form-label { font-size: 13.6px; font-weight: 600; color: var(--cb-text); }
  /* A name kept on one line by an inline style ran into its slider. */
  .pt-tool-panel .form-label[style*="nowrap"] { white-space: normal !important; }
  .pt-tool-panel .form-label > span[id$="-value"],
  .pt-tool-panel [id$="-value"].fw-bold { font-size: 13.6px; font-weight: 600; color: var(--cb-muted); }
  .pt-tool-panel .form-range { height: 20px; }
  .pt-tool-panel .form-select,
  .pt-tool-panel .form-control {
    min-height: 36px;
    padding-top: 6px;
    padding-bottom: 6px;
    font-size: 14px;
    line-height: 1.4;
    border-radius: 10px;
  }
  /* :where() keeps this at a class's weight, so a page's own inset for an
     icon inside the field (.cn-search, .bc-search) still wins. */
  :where(.pt-tool-panel) .form-control { padding-left: 10px; padding-right: 10px; }
  .pt-tool-panel .form-select { padding-left: 12px; }
  .pt-tool-panel .input-group-text { padding: 6px 10px; font-size: 13px; border-color: var(--cb-line); background: var(--cb-bg); }
  .pt-tool-panel .input-group > :not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
  .pt-tool-panel .input-group > :not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
  .pt-tool-panel .btn {
    --bs-btn-font-size: 14px;
    --bs-btn-padding-y: 6px;
    --bs-btn-padding-x: 14px;
    --bs-btn-line-height: 1.4;
    --bs-btn-border-width: 1px;
    --bs-btn-border-radius: 10px;
  }
  .pt-tool-panel .btn-sm {
    --bs-btn-font-size: 13px;
    --bs-btn-padding-y: 5px;
    --bs-btn-padding-x: 12px;
    --bs-btn-border-radius: 999px;
    min-height: 32px;
    font-weight: 700;
  }
  /* A button holding a picture (a filter preview) keeps square corners. */
  .pt-tool-panel .btn-sm:has(img, canvas, .filter-thumb) { --bs-btn-border-radius: 12px; }
  .pt-tool-panel .btn-link { --bs-btn-font-size: 13px; font-weight: 600; color: var(--cb-ink); }
  .pt-tool-panel .btn-link:hover { color: var(--cb-cta); }
  .pt-tool-panel hr { margin: 12px 0 !important; border-color: var(--cb-line); opacity: 1; }
  .pt-tool-panel .small,
  .pt-tool-panel small,
  .pt-tool-panel .form-text { font-size: 12.5px; }
  /* Checkboxes: a 16px box. Switches keep their own width and offset. */
  .pt-tool-panel .form-check { min-height: 0; margin-bottom: 6px; }
  .pt-tool-panel .form-check:not(.form-switch) { padding-inline-start: 26px; }
  .pt-tool-panel .form-check:not(.form-switch) .form-check-input { width: 16px; height: 16px; margin-top: 2px; margin-inline-start: -26px; }
  .pt-tool-panel .form-check-label { font-size: 13.6px; font-weight: 500; line-height: 1.45; color: var(--cb-text); }
  .pt-tool-panel .form-check-label.small { font-size: 12.5px; }
}

/* Panels written for a 16px root: here 1rem is 20px, so their rem sizes
   came out over the theme's (a 0.8rem note at 16px, a 0.95rem heading at
   19px). On a desktop they take the sizes above: a heading as a .form-label,
   a note or a field's caption as .small, a value as a slider's. Phones keep
   their own sizes. */
@media (min-width: 768px) {
  .pt-tool-panel :is(h5, h6, .au-head, .pcs-head, .property-label, .dexp-samples-title, .h2s-samples-label) {
    font-size: 13.6px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--cb-text);
  }
  .pt-tool-panel :is(.cs-help, .exif-hint, .gif-hint),
  .pcs-editor #pcs-style p.small { font-size: 12.5px; line-height: 1.45; }
  .pt-tool-panel :is(.pcs-mini, .h2s-dim, .dexp-sample-name) { font-size: 12.5px; }
  .pt-tool-panel .h2s-unit { font-size: 13px; }
  .pt-tool-panel .pcs-li-name { font-size: 14px; }
  .pt-tool-panel :is(.pl-slider-head, .cs-slider-head) output,
  .pt-tool-panel span.fw-bold.position-absolute.translate-middle { font-size: 13.6px; font-weight: 600; color: var(--cb-muted); }
  .pcs-editor #pcs-style .form-control-sm { font-size: 14px; }
  .pcs-editor #pcs-style .btn-sm { font-size: 13px; }
}

/* Tabs: CB's segmented track, the open one white and raised. */
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) :is(.nav-tabs, .nav-pills) {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  margin-bottom: 12px !important;
  padding: 4px;
  border: 0;
  border-radius: 14px;
  background: var(--cb-bg);
}
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) :is(.nav-tabs, .nav-pills) > .nav-item { flex: 1 1 0; min-width: 0; }
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) :is(.nav-tabs, .nav-pills) .nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-height: 36px;
  margin: 0;
  padding: 7px 6px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  color: var(--cb-text);
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) :is(.nav-tabs, .nav-pills) .nav-link:hover { color: var(--cb-ink); }
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) :is(.nav-tabs, .nav-pills) .nav-link.active {
  color: var(--cb-ink);
  background: #fff;
  box-shadow: var(--cb-raised);
}

/* Segmented choices: the same track (CB .cb-seg). Plain toolbars, groups
   with no pressed state, stay ghost buttons. */
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) :is(.pt-cseg, .ca-seg, .cc-modes, .fav-mode, .fav-seg, .pfp-seg, .meme-seg, .tb-seg, .pf-seg, .bf-seg, .cbg-seg, .gif-seg, .bgk-seg, .rc-seg, .exif-tabs, .qr-tabs, .qr-seg, .fav-tabs),
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) .btn-group:has(> .btn-check, > .btn.active, > .btn[aria-pressed]) {
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 0;
  border-radius: 14px;
  background: var(--cb-bg);
}
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) :is(.pt-cseg, .ca-seg, .cc-modes, .fav-mode, .fav-seg, .pfp-seg, .meme-seg, .tb-seg, .pf-seg, .bf-seg, .cbg-seg, .gif-seg, .bgk-seg, .rc-seg, .exif-tabs, .qr-tabs, .qr-seg, .fav-tabs) > :is(button, .btn, label),
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) .btn-group:has(> .btn-check, > .btn.active, > .btn[aria-pressed]) > .btn {
  /* Each as wide as its label (a group sized to its buttons, as Resize's
     Constrain, split evenly squeezed the longest); a full-width track
     shares out the rest. */
  flex: 1 1 auto;
  min-height: 36px;
  margin: 0 !important;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--cb-text);
  border: 0 !important;
  border-radius: 10px !important;
  background: transparent;
  box-shadow: none;
}
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) :is(.pt-cseg, .ca-seg, .cc-modes, .fav-mode, .fav-seg, .pfp-seg, .meme-seg, .tb-seg, .pf-seg, .bf-seg, .cbg-seg, .gif-seg, .bgk-seg, .rc-seg, .exif-tabs, .qr-tabs, .qr-seg, .fav-tabs) > :is(button, .btn, label):hover,
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) .btn-group:has(> .btn-check, > .btn.active, > .btn[aria-pressed]) > .btn:hover { color: var(--cb-ink); background: transparent; }
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) :is(.pt-cseg, .ca-seg, .cc-modes, .fav-mode, .fav-seg, .pfp-seg, .meme-seg, .tb-seg, .pf-seg, .bf-seg, .cbg-seg, .gif-seg, .bgk-seg, .rc-seg, .exif-tabs, .qr-tabs, .qr-seg, .fav-tabs) > :is(.active, [aria-pressed="true"], [aria-checked="true"], [aria-selected="true"]),
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) .btn-group:has(> .btn-check, > .btn.active, > .btn[aria-pressed]) > :is(.btn.active, .btn[aria-pressed="true"]),
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) .btn-group > .btn-check:checked + .btn,
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) :is(.pt-cseg, .ca-seg, .cc-modes, .fav-mode, .fav-seg, .pfp-seg, .meme-seg, .tb-seg, .pf-seg, .bf-seg, .cbg-seg, .gif-seg, .bgk-seg, .rc-seg, .exif-tabs, .qr-tabs, .qr-seg, .fav-tabs) > .btn-check:checked + .btn {
  color: var(--cb-ink) !important;
  background: #fff !important;
  box-shadow: var(--cb-raised) !important;
}

/* Chips (CB .bg-cat): beige pills, the chosen one ink. */
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) :is(.gif-pill, .bgk-pill, .de-chip, .cn-chip, .h2s-chip, .rl-chip, .exif-chip, .bc-cat, .au-skymode, .rmbg-bg-tab-btn, .qr-type) {
  padding: 4px 12px;
  font-size: 12.8px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--cb-text);
  border: 0;
  border-radius: 999px;
  background: var(--cb-bg);
}
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) :is(.gif-pill, .bgk-pill, .de-chip, .cn-chip, .h2s-chip, .rl-chip, .exif-chip, .bc-cat, .au-skymode, .rmbg-bg-tab-btn, .qr-type):hover { color: var(--cb-ink); background: var(--cb-hover-bg); }
:is(.pt-tool-panel, .pt-app-panels, .pt-app-sheet) :is(.gif-pill, .bgk-pill, .de-chip, .cn-chip, .h2s-chip, .rl-chip, .exif-chip, .bc-cat, .au-skymode, .rmbg-bg-tab-btn, .qr-type):is(.active, [aria-pressed="true"], [aria-checked="true"]) { color: #fff; background: var(--cb-ink); }

/* In the phone editor: finger-sized. */
:is(.pt-app-panels, .pt-app-sheet) :is(.pt-cseg, .ca-seg, .cc-modes, .fav-mode, .fav-seg, .pfp-seg, .meme-seg, .tb-seg, .pf-seg, .bf-seg, .cbg-seg, .gif-seg, .bgk-seg, .rc-seg, .exif-tabs, .qr-tabs, .qr-seg, .fav-tabs) > :is(button, .btn, label),
:is(.pt-app-panels, .pt-app-sheet) .btn-group:has(> .btn-check, > .btn.active, > .btn[aria-pressed]) > .btn,
:is(.pt-app-panels, .pt-app-sheet) :is(.nav-tabs, .nav-pills) .nav-link { min-height: 40px; }
:is(.pt-app-panels, .pt-app-sheet) :is(.gif-pill, .bgk-pill, .de-chip, .cn-chip, .h2s-chip, .rl-chip, .exif-chip, .bc-cat, .au-skymode, .rmbg-bg-tab-btn, .qr-type) { min-height: 34px; }

/* The chosen swatch or tile: CB's double ring. */
:is(.pt-cswatch, .cp-swatch, .pcs-swatch, .pfp-swatch, .fav-swatch, .gif-swatch, .meme-swatch, .cn-swatch, .bgk-swatch, .rc-swatch, .cbg-swatch, .st-swatch, .rmbg-swatch, .rl-swatch, .pf-swatch, .cl-swatch, .color-swatch, .gr-preset, .cc-sample, .cl-tpl):is(.active, .on, .is-on, [aria-pressed="true"], [aria-checked="true"]) {
  /* White, not the page's blue: inside the ink ring a blue border made a
     second, different ring. */
  border-color: #fff !important;
  box-shadow: var(--cb-ring) !important;
}

/* Save: CB's download buttons. */
.pt-tool .pt-tool-save {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--cb-line);
}
.pt-tool .pt-tool-save .btn-success,
.pt-tool .pt-tool-savebar .btn-success,
.pt-tool .pt-pin-bar .btn-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  font-size: 16px;
  font-weight: 700;
  border-width: 0;
  border-radius: 16px;
}
.pt-tool .pt-tool-save .btn-success:not(.pt-saving)::before,
.pt-tool .pt-tool-savebar .btn-success:not(.pt-saving)::before,
.pt-tool .pt-pin-bar .btn-success:not(.pt-saving)::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z'/%3E%3Cpath d='M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z'/%3E%3Cpath d='M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* The theme draws the icon: a page's own icon in its Save button (Stretch's
   trailing one) would make two. */
.pt-tool .pt-tool-save .btn-success > :is(svg, i),
.pt-tool .pt-tool-savebar .btn-success > :is(svg, i),
.pt-tool .pt-pin-bar .btn-success > :is(svg, i) { display: none; }
.pt-tool .pt-tool-savebar > .btn:not(.btn-success),
.pt-tool .pt-pin-bar > .btn:not(.btn-success) {
  min-height: 48px;
  font-size: 15px;
  font-weight: 700;
  color: var(--cb-ink);
  border: 1.5px solid var(--cb-ghost);
  border-radius: 16px;
  background: #fff;
}
.pt-tool :is(.pt-tool-savebar, .pt-pin-bar) > .btn:not(.btn-success):hover { border-color: var(--cb-ink); }
.btn.pt-saving::after { border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }

/* ── Messages (pt-toast.js) and the question box (pt-confirm.js) ─────────
   White cards in CB's ink, the kind shown by the icon's colour and a bar
   on the leading edge, not Bootstrap's pastel fills. Both scripts add their
   own style later in the head, so these carry one more selector. */
html #pt-toast-stack .alert {
  border: 1px solid var(--cb-line);
  border-inline-start: 4px solid var(--pt-toast-c, var(--cb-cta));
  border-radius: 14px;
  background: #fff;
  color: var(--cb-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: 0 18px 40px -20px rgba(22, 24, 29, 0.45);
}
html #pt-toast-stack .alert .uil { color: var(--pt-toast-c, var(--cb-cta)); font-size: 1.15em; }
html #pt-toast-stack .alert-success { --pt-toast-c: #157a3c; }
html #pt-toast-stack .alert-danger { --pt-toast-c: #d63939; }
html #pt-toast-stack .alert-warning { --pt-toast-c: #b54708; }
html #pt-toast-stack .alert-info { --pt-toast-c: var(--cb-cta); }
html #pt-toast-stack .alert .btn-close { opacity: 0.45; }
html .modal.pt-confirm .modal-content { border: 0; border-radius: 22px; box-shadow: var(--cb-shadow-stage); }
html .modal.pt-confirm .pt-confirm-title { font-weight: 800; color: var(--cb-ink); }
html .modal.pt-confirm .pt-confirm-msg { color: var(--cb-text); }
html .modal.pt-confirm .modal-footer > .btn { border-radius: 14px; font-weight: 700; }
html .modal.pt-confirm .pt-confirm-cancel { color: var(--cb-ink); background: #fff; border: 1.5px solid var(--cb-ghost); }
html .modal.pt-confirm .pt-confirm-cancel:hover { border-color: var(--cb-ink); }

/* ── Continue editing in (inc/continue-to.inc.php) ───────────────────────
   One button under the panel (under the photo on a phone), shown once there
   is a photo to pass on: the first tools' icons, the label, how many. It
   opens every tool in a dialog: a grid of app icons, centred on a desktop,
   a sheet from the bottom on a phone. */
.pt-next {
  display: none;
  padding: 0 !important;   /* over the grid's column reset */
}
.pt-tool:has(.pt-tool-viewport.pt-app-loaded) .pt-next,
.pt-next.pt-next-always { display: block; }
.pt-next-open {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 8px 14px 8px 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-align: start;
  color: var(--cb-ink);
  border: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--cb-shadow), 0 1px 3px rgba(22, 24, 29, 0.08);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.pt-next-open:hover { transform: translateY(-1px); box-shadow: 0 18px 34px -20px rgba(22, 24, 29, 0.45), 0 1px 3px rgba(22, 24, 29, 0.08); }
.pt-next-open:focus-visible { outline: 2px solid var(--cb-pink); outline-offset: 2px; }
.pt-next-peek { display: inline-flex; flex: none; }
.pt-next-peek > svg {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 0 0 2px #fff;
}
.pt-next-peek > svg + svg { margin-inline-start: -9px; }
.pt-next-open-label { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.pt-next-count {
  flex: none;
  min-width: 24px;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  color: var(--cb-muted);
  border-radius: 999px;
  background: var(--cb-bg);
  font-variant-numeric: tabular-nums;
}
.pt-next .pt-next-arrow { flex: none; width: 14px; height: 14px; color: var(--cb-muted); }
[dir="rtl"] .pt-next .pt-next-arrow { transform: scaleX(-1); }

/* The dialog (showModal: over the page and the header). */
.pt-next-dialog {
  width: min(760px, calc(100vw - 32px));
  max-width: none;
  max-height: min(86vh, 760px);
  padding: 0;
  overflow: hidden;
  color: var(--cb-ink);
  border: 0;
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--cb-shadow-stage);
}
.pt-next-dialog[open] { display: flex; flex-direction: column; animation: pt-next-in 0.18s ease-out; }
.pt-next-dialog::backdrop { background: rgba(22, 24, 29, 0.48); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
@keyframes pt-next-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
.pt-next-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  padding: 18px 18px 12px 22px;
}
:is(.pt-next, .pt-find-dialog) .pt-next-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 20px !important;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--cb-ink);
}
.pt-next-close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--cb-ink);
  border: 0;
  border-radius: 50%;
  background: var(--cb-bg);
  cursor: pointer;
}
.pt-next-close:hover { background: var(--cb-hover-bg); }
.pt-next-close:focus-visible { outline: 2px solid var(--cb-pink); outline-offset: 2px; }
.pt-next-close > svg { width: 18px; height: 18px; }
:is(.pt-next, .pt-find-dialog) .pt-next-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
}
:is(.pt-next, .pt-find-dialog) .pt-next-list[hidden], .pt-next-recent[hidden], .pt-next-none[hidden] { display: none !important; }
:is(.pt-next, .pt-find-dialog) .pt-next-list > * { width: auto; min-width: 0; max-width: none; padding: 0; margin: 0; }
/* The tools scroll under the title and the search box. */
.pt-next-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 4px 22px 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* The search over every tool the photo can go to (assets/js/pt-next.js). */
.pt-next-find {
  position: relative;
  flex: none;
  margin: 0 22px 12px;
}
.pt-next-find-icon {
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  color: var(--cb-muted);
  pointer-events: none;
}
:is(.pt-next, .pt-find-dialog) .pt-next-search {
  display: block;
  width: 100%;
  height: 46px;
  margin: 0;
  padding: 0 14px;
  padding-inline-start: 42px;
  font: inherit;
  font-size: 16px;   /* under 16px, iOS zooms the page on focus */
  color: var(--cb-ink);
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: var(--cb-bg);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
:is(.pt-next, .pt-find-dialog) .pt-next-search::placeholder { color: var(--cb-muted); opacity: 1; }
:is(.pt-next, .pt-find-dialog) .pt-next-search:focus { border-color: var(--cb-cta, #0f70e6); background: #fff; }
.pt-next-recent { margin: 0 0 18px; }
.pt-next-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
}
:is(.pt-next, .pt-find-dialog) .pt-next-subtitle {
  margin: 0;
  font-size: 13px !important;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cb-muted);
}
.pt-next-forget {
  flex: none;
  min-height: 32px;
  padding: 4px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--cb-muted);
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}
.pt-next-forget:hover { color: var(--cb-ink); background: var(--cb-bg); }
.pt-next-forget:focus-visible { outline: 2px solid var(--cb-pink); outline-offset: 2px; }
.pt-next-none { margin: 18px 0 8px; font-size: 14px; text-align: center; color: var(--cb-muted); }
:is(.pt-next .pt-next-dialog, .pt-find-dialog) :is(.continue-to-btn, .pt-next-pick) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  height: 100%;
  min-height: 108px;
  margin: 0;
  padding: 16px 8px 12px;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  color: var(--cb-ink);
  border: 0;
  border-radius: 16px;
  background: var(--cb-bg);
  box-shadow: none;
  cursor: pointer;
  transition: transform 0.15s, background-color 0.15s, box-shadow 0.15s;
}
:is(.pt-next .pt-next-dialog, .pt-find-dialog) :is(.continue-to-btn, .pt-next-pick):hover { background: #fff; transform: translateY(-2px); box-shadow: 0 14px 28px -16px rgba(22, 24, 29, 0.45), 0 0 0 1px var(--cb-line); }
:is(.pt-next .pt-next-dialog, .pt-find-dialog) :is(.continue-to-btn, .pt-next-pick):focus-visible { outline: 2px solid var(--cb-pink); outline-offset: 2px; }
:is(.pt-next .pt-next-dialog, .pt-find-dialog) :is(.continue-to-btn, .pt-next-pick) > :is(svg, img) { flex: none; width: 44px; height: 44px; margin: 0; }
:is(.pt-next .pt-next-dialog, .pt-find-dialog) :is(.continue-to-btn, .pt-next-pick) > span { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
/* On its own under an editor (Drawing Editor). */
.pt-next-wide { max-width: 460px; margin: 0 auto; }
@media (max-width: 767.98px) {
  .pt-next { margin-top: 1rem; }
  /* A sheet from the bottom, as a phone app opens one. */
  .pt-next-dialog {
    width: 100%;
    max-height: 86dvh;
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .pt-next-dialog[open] { animation: pt-next-up 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
  @keyframes pt-next-up { from { transform: translateY(100%); } }
  .pt-next-head { position: relative; padding: 22px 14px 10px 18px; }
  .pt-next-head::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 2px;
    background: #d5dae2;
  }
  :is(.pt-next, .pt-find-dialog) .pt-next-title { font-size: 18px !important; }
  :is(.pt-next, .pt-find-dialog) .pt-next-list { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
  .pt-next-body { padding: 2px 14px 18px; }
  .pt-next-find { margin: 0 14px 10px; }
  :is(.pt-next .pt-next-dialog, .pt-find-dialog) :is(.continue-to-btn, .pt-next-pick) { min-height: 96px; padding: 12px 6px 10px; font-size: 12.5px; }
  :is(.pt-next .pt-next-dialog, .pt-find-dialog) :is(.continue-to-btn, .pt-next-pick) > :is(svg, img) { width: 42px; height: 42px; }
}
/* "No tools found" above the tools still shown under it. */
.pt-next-body { display: flex; flex-direction: column; }
.pt-next-none { order: -1; }
/* Six of the page's own tools on a phone (the search finds the rest). */
@media (max-width: 767.98px) {
  .pt-next .pt-next-main > .col-12:nth-child(n+7) { display: none; }
}

/* The header's tool search (inc/tool-search.inc.php): the magnifier in the
   menu bar, and its dialog, the Continue popup's twin. */
.pt-find-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  margin-inline-end: 6px;
  color: var(--cb-ink, #16181d);
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.15s;
}
.pt-find-open:hover { background: var(--cb-bg, #f5f4f2); }
.pt-find-open:focus-visible { outline: 2px solid var(--cb-pink, #d81878); outline-offset: 2px; }
.pt-find-open > svg { width: 20px; height: 20px; }
/* A crowded desktop header (style.css, pt-nav-tight): the button and the
   space around its neighbours narrower, so it takes no more room than it
   needs and does not push the menu onto a second row (English at 1280px). */
.navbar.pt-nav-tight .pt-find-open { width: 32px; height: 32px; margin-inline-end: 0; }
.navbar.pt-nav-tight .navbar-other .navbar-nav > .nav-item + .nav-item { margin-inline-start: 10px !important; margin-inline-end: 0 !important; }
.navbar.pt-nav-tight .navbar-other .btn.rounded-pill { padding-inline: 12px; }
/* The theme's buttons animate everything (transition: all): the padding
   above would still be easing when the fit is measured, and the menu would
   go to a second row it does not need. */
.navbar .navbar-other .btn.rounded-pill { transition-property: color, background-color, border-color, box-shadow, transform; }
@media (max-width: 991.98px) {
  .pt-find-open { width: 44px; height: 44px; margin-inline-end: 2px; }
}
.pt-find-dialog .pt-next-popular[hidden] { display: none !important; }
.pt-find-dialog a.pt-next-pick,
.pt-find-dialog a.pt-next-pick:hover,
.pt-find-dialog a.pt-next-pick:focus { color: var(--cb-ink); text-decoration: none; }
@media (max-width: 767.98px) {
  .pt-find-dialog .pt-next-main > .pt-next-pick:nth-child(n+10) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pt-next-dialog[open] { animation: none; }
  .pt-next-open, :is(.pt-next .pt-next-dialog, .pt-find-dialog) :is(.continue-to-btn, .pt-next-pick) { transition: none; }
}
