/*
 * 123PassportPhoto photo tools - the shared workspace (tools/kit/pp-tool.js).
 *
 *   desktop   stage on the left, a settings card on the right with the
 *             download box at its foot
 *   phone     the photo stays pinned to the top of the screen while the
 *             settings scroll under it; a bar at the bottom of the screen
 *             holds Download, and its format chip opens the download box
 *             as a sheet
 *
 * Everything is prefixed pk- so it never meets Bootstrap 3 or main.css.
 * Logical properties (inline-start/end) keep the RTL locales mirrored.
 */
.pk-tool {
  --pk-ink: #17212e;
  --pk-muted: #5c6b7c;
  --pk-faint: #8a97a6;
  --pk-line: #dfe5ec;
  --pk-soft: #f3f6fa;
  --pk-card: #ffffff;
  --pk-brand: #2465b8;
  --pk-brand-soft: #e7f0fb;
  --pk-go: #138a43;
  --pk-go-dark: #0f7438;
  --pk-warn: #b45309;
  --pk-radius: 14px;
  --pk-shadow: 0 1px 2px rgba(23, 33, 46, .06), 0 6px 20px rgba(23, 33, 46, .06);
  --pk-stage-h: min(68vh, 620px);
  color: var(--pk-ink);
  font-size: 15px;
  line-height: 1.45;
  margin: 18px 0 8px;
}
.pk-tool *, .pk-tool *::before, .pk-tool *::after { box-sizing: border-box; }
.pk-tool button { font: inherit; }
.pk-tool [hidden] { display: none !important; }

/* ── Heading ─────────────────────────────────────────────────────────── */
.pk-crumbs { font-size: 13px; color: var(--pk-muted); margin: 0 0 6px; }
.pk-crumbs a { color: var(--pk-brand); }
.pk-crumbs span[aria-hidden] { margin: 0 6px; color: var(--pk-faint); }
.pk-title { font-size: 28px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
.pk-lead { color: var(--pk-muted); margin: 0 0 14px; max-width: 760px; }

.pk-steps { display: flex; gap: 6px; list-style: none; margin: 0 0 14px; padding: 0; flex-wrap: wrap; }
.pk-steps li {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 6px; border-radius: 999px;
  background: var(--pk-soft); color: var(--pk-muted); font-size: 13px; font-weight: 600;
}
.pk-steps li b {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; border: 1px solid var(--pk-line); font-size: 12px;
}
.pk-steps li.is-now { background: var(--pk-brand-soft); color: var(--pk-brand); }
.pk-steps li.is-now b { background: var(--pk-brand); border-color: var(--pk-brand); color: #fff; }
.pk-steps li.is-done b { background: var(--pk-go); border-color: var(--pk-go); color: #fff; }

/* ── Workspace ───────────────────────────────────────────────────────── */
.pk-work { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.pk-tool.pk-wide-panel .pk-work { grid-template-columns: minmax(0, 1fr) 380px; }
.pk-stage-col { position: sticky; top: 12px; min-width: 0; }

.pk-stage {
  position: relative; height: var(--pk-stage-h); min-height: 320px;
  border-radius: var(--pk-radius); overflow: hidden;
  border: 1px solid var(--pk-line);
  background-color: #eef2f7;
  background-image:
    linear-gradient(45deg, #e4e9f0 25%, transparent 25%, transparent 75%, #e4e9f0 75%),
    linear-gradient(45deg, #e4e9f0 25%, transparent 25%, transparent 75%, #e4e9f0 75%);
  background-size: 22px 22px; background-position: 0 0, 11px 11px;
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
}
.pk-view {
  display: none; max-width: 100%; max-height: 100%;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .16); background: transparent;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.pk-has-photo .pk-view { display: block; }
.pk-overlay { position: absolute; inset: 0; pointer-events: none; }
.pk-overlay > * { pointer-events: auto; }

/* Empty state: the whole stage is the drop target. */
.pk-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 24px; gap: 12px; background: rgba(255, 255, 255, .86); cursor: pointer;
}
.pk-has-photo .pk-empty { display: none; }
.pk-empty-icon {
  width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center;
  background: var(--pk-brand-soft); color: var(--pk-brand);
}
.pk-empty-icon svg { width: 34px; height: 34px; }
.pk-empty-title { font-size: 18px; font-weight: 700; margin: 0; }
.pk-empty-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.pk-empty-hint { color: var(--pk-faint); font-size: 13px; margin: 0; }
.pk-touch .pk-empty-hint { display: none; }
.pk-private { display: inline-flex; align-items: center; gap: 6px; color: var(--pk-muted); font-size: 12.5px; margin: 0; text-align: start; }
.pk-private svg { width: 14px; height: 14px; color: var(--pk-go); flex: none; }

.pk-samples { margin-top: 4px; }
.pk-samples-label { font-size: 12.5px; color: var(--pk-muted); margin: 0 0 8px; }
.pk-samples-row { display: flex; gap: 10px; justify-content: center; }
.pk-sample {
  width: 92px; height: 68px; padding: 0; border-radius: 10px; overflow: hidden; cursor: pointer;
  border: 2px solid #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .18); background: #dde3ea;
  transition: transform .15s, box-shadow .15s;
}
.pk-sample:hover, .pk-sample:focus-visible { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, .22); outline: none; }
.pk-sample img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Drag anywhere on the page */
.pk-dropping .pk-stage::after {
  content: attr(data-drop); position: absolute; inset: 10px; border-radius: 12px;
  border: 3px dashed var(--pk-brand); background: rgba(231, 240, 251, .92);
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--pk-brand); z-index: 6;
}

/* Floating bar over the photo */
.pk-stagebar {
  position: absolute; top: 10px; inset-inline: 10px; display: none;
  justify-content: space-between; gap: 8px; z-index: 4; pointer-events: none;
}
.pk-has-photo .pk-stagebar { display: flex; }
.pk-stagebar > div { display: flex; gap: 6px; pointer-events: auto; }
.pk-ibtn {
  min-width: 40px; height: 40px; padding: 0 10px; border-radius: 12px; border: 0;
  background: rgba(255, 255, 255, .94); color: var(--pk-ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.pk-ibtn svg { width: 20px; height: 20px; flex: none; }
.pk-ibtn:hover { background: #fff; }
.pk-ibtn:disabled { opacity: .4; cursor: default; }
.pk-ibtn:focus-visible, .pk-btn:focus-visible, .pk-chip:focus-visible, .pk-seg button:focus-visible, .pk-step:focus-visible {
  outline: 3px solid rgba(36, 101, 184, .45); outline-offset: 2px;
}
.pk-ibtn.is-on { background: var(--pk-ink); color: #fff; }

.pk-compare {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 4;
  display: none; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.pk-has-photo .pk-compare { display: inline-flex; }
.pk-badge {
  position: absolute; top: 58px; left: 50%; transform: translateX(-50%); z-index: 4;
  background: rgba(23, 33, 46, .82); color: #fff; font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; letter-spacing: .02em; display: none;
}
.pk-comparing .pk-badge { display: block; }

.pk-busy {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  flex-direction: column; gap: 10px; z-index: 5; background: rgba(255, 255, 255, .55); font-weight: 600; color: var(--pk-muted);
}
.pk-is-busy .pk-busy { display: flex; }
.pk-spin {
  width: 38px; height: 38px; border-radius: 50%;
  border: 4px solid rgba(36, 101, 184, .18); border-top-color: var(--pk-brand);
  animation: pk-spin .75s linear infinite;
}
@keyframes pk-spin { to { transform: rotate(360deg); } }

.pk-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--pk-muted); font-size: 12.5px; padding: 8px 4px 0; }
.pk-meta:empty { display: none; }
.pk-meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pk-ltr { direction: ltr; unicode-bidi: isolate; }

/* Several photos: the strip under the stage */
.pk-strip { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 4px; scrollbar-width: thin; }
.pk-strip-item { position: relative; flex: none; }
.pk-strip-pick {
  width: 64px; height: 64px; padding: 0; border-radius: 10px; overflow: hidden; border: 2px solid transparent;
  background: #e8edf3; cursor: pointer; display: block;
}
.pk-strip-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pk-strip-item.is-on .pk-strip-pick { border-color: var(--pk-brand); box-shadow: 0 0 0 2px var(--pk-brand-soft); }
.pk-strip-x {
  position: absolute; top: -6px; inset-inline-end: -6px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff;
  background: var(--pk-ink); color: #fff; font-size: 15px; line-height: 1; padding: 0; cursor: pointer; display: grid; place-items: center;
}
.pk-strip-add {
  flex: none; width: 64px; height: 64px; border-radius: 10px; border: 2px dashed #b9c4d1; background: #fff; color: var(--pk-brand);
  cursor: pointer; display: grid; place-items: center; padding: 0;
}
.pk-strip-add svg { width: 24px; height: 24px; }
.pk-strip-add:hover { border-color: var(--pk-brand); }

/* ── Settings card ───────────────────────────────────────────────────── */
.pk-panel {
  background: var(--pk-card); border: 1px solid var(--pk-line); border-radius: var(--pk-radius);
  box-shadow: var(--pk-shadow); overflow: hidden;
}
.pk-sec { padding: 16px 18px; border-bottom: 1px solid var(--pk-line); }
.pk-sec:last-child { border-bottom: 0; }
.pk-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; }
.pk-sec-title { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--pk-muted); margin: 0; }
.pk-link {
  border: 0; background: none; padding: 4px 2px; color: var(--pk-brand); font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.pk-link svg { width: 15px; height: 15px; }
.pk-link:disabled { color: var(--pk-faint); cursor: default; }
.pk-tool:not(.pk-has-photo) .pk-panel { opacity: .55; pointer-events: none; }
@media (max-width: 767px) { .pk-tool:not(.pk-has-photo) .pk-dl { display: none; } }

.pk-field { margin: 0 0 16px; }
.pk-field:last-child { margin-bottom: 0; }
.pk-field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 6px; }
.pk-field-head label, .pk-field-label { font-weight: 600; font-size: 14px; margin: 0; }
.pk-val {
  font-variant-numeric: tabular-nums; font-weight: 700; color: var(--pk-brand); font-size: 13.5px;
  background: var(--pk-brand-soft); padding: 1px 8px; border-radius: 999px; min-width: 46px; text-align: center;
}
.pk-hint { color: var(--pk-muted); font-size: 12.5px; margin: 6px 0 0; }
.pk-unit { color: var(--pk-faint); font-size: 12.5px; }
.pk-input {
  width: 100%; min-height: 42px; border: 1px solid var(--pk-line); border-radius: 10px; padding: 8px 12px;
  background: #fff; color: var(--pk-ink); font-size: 15px; box-shadow: none;
}
.pk-input:focus { outline: none; border-color: var(--pk-brand); box-shadow: 0 0 0 3px rgba(36, 101, 184, .18); }
select.pk-input { appearance: auto; }
.pk-row2 { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; }

/* Range with − / + */
.pk-range-row { display: flex; align-items: center; gap: 8px; }
.pk-step {
  width: 34px; height: 34px; flex: none; border-radius: 10px; border: 1px solid var(--pk-line);
  background: #fff; color: var(--pk-ink); font-size: 18px; line-height: 1; cursor: pointer; padding: 0;
  display: grid; place-items: center;
}
.pk-step:hover { border-color: var(--pk-brand); color: var(--pk-brand); }
.pk-step svg { width: 16px; height: 16px; }
.pk-tool input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; min-width: 0; height: 30px; margin: 0;
  background: transparent; cursor: pointer; --pk-a: 0%; --pk-b: 0%;
}
.pk-tool input[type=range]:focus { outline: none; }
.pk-tool input[type=range]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 6px;
  background: linear-gradient(to right, #d6dde6 var(--pk-a), var(--pk-brand) var(--pk-a), var(--pk-brand) var(--pk-b), #d6dde6 var(--pk-b));
}
[dir=rtl] .pk-tool input[type=range]::-webkit-slider-runnable-track {
  background: linear-gradient(to left, #d6dde6 var(--pk-a), var(--pk-brand) var(--pk-a), var(--pk-brand) var(--pk-b), #d6dde6 var(--pk-b));
}
.pk-tool input[type=range]::-moz-range-track { height: 6px; border-radius: 6px; background: #d6dde6; }
.pk-tool input[type=range]::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--pk-brand); }
.pk-tool input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%;
  background: #fff; border: 3px solid var(--pk-brand); box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.pk-tool input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--pk-brand);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.pk-tool input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(36, 101, 184, .3); }
.pk-range-ends { display: flex; justify-content: space-between; color: var(--pk-faint); font-size: 11.5px; margin: 2px 42px 0; }

/* Segmented choice */
.pk-seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--pk-soft); flex-wrap: wrap; }
.pk-seg button {
  flex: 1 1 0; min-width: 0; min-height: 38px; border: 0; border-radius: 9px; background: transparent;
  color: var(--pk-muted); font-weight: 600; font-size: 13.5px; cursor: pointer; padding: 6px 8px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.pk-seg button svg { width: 18px; height: 18px; flex: none; }
.pk-seg button[aria-pressed=true] { background: #fff; color: var(--pk-brand); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* Action buttons (rotate left / right ...) */
.pk-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.pk-actions .pk-btn { min-height: 48px; padding: 0 12px; font-size: 14px; white-space: normal; line-height: 1.2; }
.pk-actions .pk-btn[aria-pressed=true] { background: var(--pk-brand-soft); border-color: var(--pk-brand); color: var(--pk-brand); }

/* Colour */
.pk-swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pk-swatch {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; padding: 0; cursor: pointer;
  box-shadow: 0 0 0 1px var(--pk-line);
}
.pk-swatch[aria-pressed=true] { box-shadow: 0 0 0 2px var(--pk-ink); }
.pk-swatch-custom { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.pk-swatch-custom input { position: absolute; inset: -6px; width: 200%; height: 200%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

/* Switch */
.pk-switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; margin: 0; }
.pk-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pk-switch i { width: 44px; height: 26px; border-radius: 999px; background: #c9d2dd; position: relative; flex: none; transition: background .15s; }
.pk-switch i::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: inset-inline-start .15s; }
.pk-switch input:checked + i { background: var(--pk-brand); }
.pk-switch input:checked + i::after { inset-inline-start: 21px; }
.pk-switch input:focus-visible + i { box-shadow: 0 0 0 3px rgba(36, 101, 184, .35); }

/* Presets */
.pk-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.pk-chip {
  border: 1px solid var(--pk-line); background: #fff; border-radius: 999px; padding: 7px 14px; min-height: 36px;
  font-size: 13.5px; font-weight: 600; color: var(--pk-ink); cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
}
.pk-chip:hover { border-color: var(--pk-brand); }
.pk-chip[aria-pressed=true] { background: var(--pk-brand); border-color: var(--pk-brand); color: #fff; }
.pk-chip i { width: 14px; height: 14px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }

/* Buttons */
.pk-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px;
  border-radius: 12px; border: 1px solid transparent; font-weight: 700; font-size: 15px; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.pk-btn svg { width: 20px; height: 20px; flex: none; }
.pk-btn-primary { background: var(--pk-brand); color: #fff; }
.pk-btn-primary:hover { background: #1d559c; color: #fff; }
.pk-btn-go { background: var(--pk-go); color: #fff; }
.pk-btn-go:hover { background: var(--pk-go-dark); color: #fff; }
.pk-btn-ghost { background: #fff; color: var(--pk-ink); border-color: var(--pk-line); }
.pk-btn-ghost:hover { border-color: var(--pk-brand); color: var(--pk-brand); }
.pk-btn-block { width: 100%; }
.pk-btn:disabled { opacity: .5; cursor: default; }

/* Download box */
.pk-dl { background: #fbfcfe; }
.pk-dl-head { display: none; }
.pk-dl .pk-seg { margin: 0 0 12px; }
.pk-dl-info { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--pk-muted); margin: 10px 0 12px; }
.pk-dl-info b { color: var(--pk-ink); font-variant-numeric: tabular-nums; }
.pk-dl-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.pk-dl-btns .pk-btn-go { flex: 1; }
.pk-dl-quality { margin-top: 4px; }

/* Under the workspace: other tools */
.pk-more { margin: 26px 0 6px; }
.pk-more h2 { font-size: 17px; font-weight: 700; margin: 0 0 10px; }
.pk-more-row { display: flex; gap: 10px; flex-wrap: wrap; }
.pk-more a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 12px;
  border: 1px solid var(--pk-line); background: #fff; color: var(--pk-ink); font-weight: 600; font-size: 14px; text-decoration: none;
}
.pk-more a:hover { border-color: var(--pk-brand); color: var(--pk-brand); }
.pk-more img { width: 40px; height: 30px; border-radius: 6px; object-fit: cover; }

/* Toasts */
.pk-toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1060; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.pk-toast {
  background: #17212e; color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
}
.pk-toast.is-in { opacity: 1; transform: none; }
.pk-toast.is-bad { background: #9b1c1c; }

/* Phone dock and sheet: hidden on larger screens */
.pk-dock, .pk-scrim { display: none; }

/* ── Tablet ──────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
  .pk-work, .pk-tool.pk-wide-panel .pk-work { grid-template-columns: minmax(0, 1fr) 300px; }
}

/* ── Phone ───────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .pk-tool { margin-top: 6px; --pk-stage-h: min(44vh, 400px); }
  .pk-title { font-size: 23px; }
  .pk-lead { font-size: 14px; margin-bottom: 10px; }
  .pk-steps { display: none; }
  /* A block, not a one-column grid: a sticky grid item can only move inside
     its own grid row, which is exactly its own height. */
  .pk-work, .pk-tool.pk-wide-panel .pk-work { display: block; }
  .pk-panel { margin-top: 12px; }

  /* Before a photo: a tall, friendly drop card. */
  .pk-stage-col { position: static; }
  .pk-stage { height: auto; min-height: 380px; }
  .pk-empty { position: relative; inset: auto; min-height: 380px; width: 100%; background: rgba(255, 255, 255, .9); }
  .pk-empty-btns { flex-direction: column; width: 100%; max-width: 320px; }
  .pk-empty-btns .pk-btn { width: 100%; min-height: 52px; font-size: 16px; }
  .pk-samples-row { gap: 8px; }
  .pk-sample { width: 30vw; max-width: 104px; height: 74px; }

  /* With a photo: pinned to the top while the settings scroll under it. */
  .pk-has-photo .pk-stage-col {
    position: sticky; top: 0; z-index: 20; margin: 0 -15px; padding: 0;
    background: #fff; box-shadow: 0 6px 12px -8px rgba(0, 0, 0, .25);
  }
  .pk-has-photo .pk-stage { height: var(--pk-stage-h); min-height: 220px; border-radius: 0; border-width: 0 0 1px; }
  .pk-has-photo .pk-meta { padding: 6px 15px; }
  /* Several photos: the strip joins the pinned block, so the photo gives up
     some height and the name line goes (the strip shows which one is on). */
  .pk-has-photo .pk-stage-col:has(.pk-strip:not([hidden])) { --pk-stage-h: min(35vh, 320px); }
  .pk-stage-col:has(.pk-strip:not([hidden])) .pk-meta { display: none; }
  .pk-strip { padding: 6px 15px; gap: 6px; }
  .pk-strip-pick, .pk-strip-add { width: 46px; height: 46px; }
  .pk-ibtn { height: 38px; min-width: 38px; }
  .pk-ibtn .pk-lbl { display: none; }
  .pk-compare .pk-lbl { display: inline; }
  .pk-compare { bottom: 10px; }
  .pk-panel { border-radius: var(--pk-radius); box-shadow: none; }
  .pk-has-photo .pk-panel { margin-bottom: 86px; }
  .pk-sec { padding: 14px 14px; }
  .pk-step { width: 42px; height: 42px; border-radius: 12px; }
  .pk-tool input[type=range] { height: 42px; }
  .pk-tool input[type=range]::-webkit-slider-thumb { width: 28px; height: 28px; margin-top: -11px; }
  .pk-tool input[type=range]::-moz-range-thumb { width: 22px; height: 22px; }
  .pk-range-ends { margin: 0 50px; }
  .pk-seg button { min-height: 44px; font-size: 14px; }
  .pk-chip { min-height: 40px; padding: 8px 16px; font-size: 14px; }
  .pk-swatch { width: 40px; height: 40px; }
  .pk-tool input, .pk-tool select, .pk-tool textarea { font-size: 16px; }

  /* The download box becomes a bottom sheet. */
  .pk-dl {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1041; margin: 0;
    border-radius: 18px 18px 0 0; background: #fff; box-shadow: 0 -8px 30px rgba(0, 0, 0, .25);
    padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); border: 0;
    transform: translateY(105%); transition: transform .22s ease; visibility: hidden;
  }
  .pk-sheet-open .pk-dl { transform: none; visibility: visible; }
  .pk-dl-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; }
  .pk-dl-head::before { content: ""; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: #d6dde6; }
  .pk-dl .pk-sec-head { display: none; }
  .pk-scrim { position: fixed; inset: 0; z-index: 1040; background: rgba(15, 23, 32, .45); }
  .pk-sheet-open .pk-scrim { display: block; }

  .pk-has-photo .pk-dock {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .97);
    border-top: 1px solid var(--pk-line); box-shadow: 0 -4px 16px rgba(0, 0, 0, .08);
  }
  .pk-has-photo.pk-typing .pk-dock { display: none; }
  .pk-dock .pk-btn { min-height: 50px; }
  .pk-dock .pk-btn-go { flex: 1; font-size: 16px; }
  .pk-dock .pk-fmt { flex: none; padding: 0 12px; gap: 4px; font-size: 14px; }
  .pk-dock .pk-fmt small { color: var(--pk-muted); font-weight: 600; }
  .pk-toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .pk-more { margin-bottom: 90px; }
}

/* Very short landscape phones: keep some room for the settings. */
@media (max-width: 991px) and (max-height: 500px) and (orientation: landscape) {
  .pk-tool { --pk-stage-h: 58vh; }
}

@media (prefers-reduced-motion: reduce) {
  .pk-dl, .pk-toast, .pk-sample { transition: none; }
  .pk-spin { animation-duration: 2s; }
}

/* ── Crop frame (pp-frame.js) ────────────────────────────────────────── */
.pk-stage { overflow: hidden; }
.pk-frame {
  position: absolute; box-shadow: 0 0 0 9999px rgba(15, 23, 32, .55); outline: 2px solid #fff;
  cursor: move; touch-action: none; z-index: 2;
}
.pk-frame:focus-visible { outline: 3px solid #8ec5ff; }
.pk-frame.is-round { border-radius: 50%; }
.pk-frame.is-round .pk-frame-lines { border-radius: 50%; overflow: hidden; }
.pk-frame-lines { position: absolute; inset: 0; pointer-events: none; opacity: .55; }
.pk-frame.is-drag .pk-frame-lines { opacity: .9; }
.pk-frame-lines i { position: absolute; background: rgba(255, 255, 255, .85); box-shadow: 0 0 1px rgba(0, 0, 0, .6); }
.pk-frame-lines i.v { top: 0; bottom: 0; width: 1px; }
.pk-frame-lines i.h { left: 0; right: 0; height: 1px; }
.pk-h { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; touch-action: none; }
.pk-h::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .45); }
.pk-h-nw { left: 0; top: 0; cursor: nwse-resize; }   .pk-h-n { left: 50%; top: 0; cursor: ns-resize; }
.pk-h-ne { left: 100%; top: 0; cursor: nesw-resize; } .pk-h-e { left: 100%; top: 50%; cursor: ew-resize; }
.pk-h-se { left: 100%; top: 100%; cursor: nwse-resize; } .pk-h-s { left: 50%; top: 100%; cursor: ns-resize; }
.pk-h-sw { left: 0; top: 100%; cursor: nesw-resize; } .pk-h-w { left: 0; top: 50%; cursor: ew-resize; }
.pk-h-n::after, .pk-h-s::after { width: 22px; height: 6px; margin: -3px 0 0 -11px; border-radius: 3px; }
.pk-h-e::after, .pk-h-w::after { width: 6px; height: 22px; margin: -11px 0 0 -3px; border-radius: 3px; }
@media (hover: hover) { .pk-h { width: 28px; height: 28px; margin: -14px 0 0 -14px; } }

/* Aspect chips */
.pk-chipgrid { display: flex; flex-wrap: wrap; gap: 6px; }
.pk-chipgrid button {
  min-width: 52px; min-height: 38px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--pk-line); background: #fff;
  font-weight: 600; font-size: 13.5px; color: var(--pk-ink); cursor: pointer; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.pk-chipgrid button i { display: block; border: 2px solid currentColor; border-radius: 2px; opacity: .6; }
.pk-chipgrid button[aria-pressed=true] { background: var(--pk-brand); border-color: var(--pk-brand); color: #fff; }
@media (max-width: 767px) { .pk-chipgrid button { min-height: 46px; min-width: 58px; } }

/* ── The article under every tool (how to, features, FAQ) ───────────── */
.pk-article { max-width: 880px; margin: 36px 0 10px; color: #2b3644; font-size: 15.5px; line-height: 1.7; }
.pk-article h2 { font-size: 24px; font-weight: 700; line-height: 1.3; margin: 0 0 12px; color: #17212e; letter-spacing: -.01em; }
.pk-article h3 {
  font-size: 18px; font-weight: 700; margin: 34px 0 12px; color: #17212e; display: flex; align-items: center; gap: 10px;
}
.pk-article h3::before { content: ""; width: 4px; height: 20px; border-radius: 2px; background: #2465b8; flex: none; }
.pk-article p { margin: 0 0 12px; }
.pk-article a { color: #2465b8; }
.pk-howto { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 14px 0 6px; counter-reset: none; }
.pk-howto-step { background: #f6f8fb; border: 1px solid #e3e8ef; border-radius: 14px; padding: 16px 16px 14px; }
.pk-howto-num {
  width: 30px; height: 30px; border-radius: 10px; background: #2465b8; color: #fff; font-weight: 800; font-size: 14px;
  display: grid; place-items: center; margin: 0 0 10px;
}
.pk-howto-step strong { display: block; font-size: 15px; margin: 0 0 4px; color: #17212e; }
.pk-howto-step p { font-size: 14px; color: #5c6b7c; margin: 0; line-height: 1.55; }
.pk-features { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; }
.pk-features li { position: relative; padding-inline-start: 30px; }
.pk-features li::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 5px; width: 20px; height: 20px; border-radius: 50%;
  background: #e6f4ec url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23138a43' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.pk-features li strong { color: #17212e; }
.pk-faq { margin-top: 8px; }
.pk-faq .panel { border: 1px solid #e3e8ef; border-radius: 12px; box-shadow: none; margin-bottom: 8px; overflow: hidden; }
.pk-faq .panel + .panel { margin-top: 0; }
.pk-faq .panel-heading { padding: 0; background: #fff; border: 0; }
.pk-faq .panel-title { font-size: 15.5px; }
.pk-faq .panel-title a {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px;
  font-weight: 600; color: #17212e; text-decoration: none;
}
.pk-faq .panel-title a::after {
  content: ""; flex: none; width: 10px; height: 10px; border-right: 2px solid #8a97a6; border-bottom: 2px solid #8a97a6;
  transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s;
}
.pk-faq .panel-title a[aria-expanded=true] { color: #2465b8; }
.pk-faq .panel-title a[aria-expanded=true]::after { transform: rotate(-135deg) translate(-2px, -2px); border-color: #2465b8; }
.pk-faq .panel-body { border-top: 1px solid #eef2f6 !important; padding: 12px 18px 16px; color: #4a5767; font-size: 14.5px; line-height: 1.7; }
@media (max-width: 767px) {
  .pk-article { margin-top: 26px; font-size: 15px; }
  .pk-article h2 { font-size: 21px; }
  .pk-howto { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .pk-howto-step { display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 12px; padding: 12px 14px; }
  .pk-howto-num { grid-row: 1 / span 2; margin: 0; }
  .pk-howto-step > :not(.pk-howto-num) { grid-column: 2; }
  .pk-faq .panel-title a { padding: 14px; }
}
