/**
 * Shared styles for the StudyKit media tools.
 *
 * The nine media pages are deliberately one class, not nine, with the differences
 * carried by markup and a per-tool script. Two things follow from that.
 *
 * First, colour is expressed only through the custom properties on
 * .sk-media-page. Dark mode is therefore a single rule that re-points six
 * variables instead of a dozen per-selector overrides, which is what makes it
 * safe to add a ninth tool later: a new component inherits a correct dark
 * palette simply by using var(--sk-*) like everything else, and cannot be
 * forgotten in a dark block the way an extra selector can.
 *
 * Second, the accent splits into three roles rather than one. On a light panel
 * the brand purple works as a button background with white text, but the same
 * colour as link text on a dark surface fails contrast, and white on the
 * darkened button fails too. --sk-accent is text on a surface, --sk-on-accent
 * is text on a button, and they are set independently per scheme.
 */

.sk-media-page {
  --sk-ink: #28323a;
  --sk-muted: #5c6871;
  --sk-accent: #68438b;
  --sk-accent-strong: #452b61;
  --sk-on-accent: #ffffff;
  --sk-accent-bg: #68438b;
  --sk-line: #dfe3e8;
  --sk-surface: #ffffff;
  --sk-soft: #f7f5fa;
  --sk-ok: #1f6b45;
  --sk-warn: #8a5a12;
  --sk-error: #a6324a;
  --sk-shadow: 0 1px 2px rgba(20, 24, 30, 0.06), 0 6px 18px rgba(20, 24, 30, 0.05);

  max-width: 1140px;
  margin: 0 auto;
  padding: 30px 20px 60px;
  color: var(--sk-ink);
  line-height: 1.65;
  font-family: inherit;
}

.sk-media-page * {
  box-sizing: border-box;
}

/* One rule re-themes the entire family. Anything using var(--sk-*) follows
   automatically; a hard-coded hex would opt out and fail the colour audit. */
html[data-sk-scheme="dark"] .sk-media-page {
  --sk-ink: #e9edf2;
  --sk-muted: #aab5c1;
  --sk-accent: #c79bf0;
  --sk-accent-strong: #e6cbf8;
  --sk-on-accent: #1a1220;
  --sk-accent-bg: #a679dd;
  --sk-line: #333d48;
  --sk-surface: #222a33;
  --sk-soft: #1a2028;
  --sk-ok: #6fd6a2;
  --sk-warn: #e8bd6a;
  --sk-error: #ff9db2;
  --sk-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.28);
}

.sk-media-page h1,
.sk-media-page h2,
.sk-media-page h3 {
  color: var(--sk-accent-strong);
}

.sk-media-page a {
  color: var(--sk-accent);
}

.sk-media-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 22px;
  align-items: start;
  margin-top: 24px;
}

.sk-media-layout[data-stack="true"] {
  grid-template-columns: minmax(0, 1fr);
}

.sk-media-panel {
  padding: 24px;
  border: 1px solid var(--sk-line);
  border-radius: 20px;
  background: var(--sk-surface);
  box-shadow: var(--sk-shadow);
}

.sk-media-panel > h2 {
  margin: 0 0 10px;
  font-size: 1.35rem;
}

.sk-media-lead {
  margin: 0 0 18px;
  color: var(--sk-muted);
  font-size: 0.93rem;
}

/* Drop zone doubles as the file input's button, so it carries the button
   styling and the hover affordance. */
.sk-media-drop {
  display: block;
  padding: 26px 20px;
  border: 2px dashed var(--sk-line);
  border-radius: 16px;
  background: var(--sk-soft);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sk-media-drop:hover,
.sk-media-drop:focus-visible,
.sk-media-drop[data-drag="true"] {
  border-color: var(--sk-accent);
  background: var(--sk-surface);
}

.sk-media-drop:focus-visible {
  outline: 3px solid var(--sk-accent);
  outline-offset: 2px;
}

.sk-media-drop strong {
  display: block;
  color: var(--sk-accent-strong);
  font-size: 1.02rem;
}

.sk-media-drop span {
  display: block;
  margin-top: 6px;
  color: var(--sk-muted);
  font-size: 0.9rem;
}

.sk-media-drop small {
  display: block;
  margin-top: 8px;
  color: var(--sk-muted);
  font-size: 0.8rem;
}

.sk-media-file {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid var(--sk-line);
  border-radius: 12px;
  background: var(--sk-soft);
  font-size: 0.86rem;
}

.sk-media-file strong {
  color: var(--sk-ink);
  word-break: break-all;
}

.sk-media-file span {
  color: var(--sk-muted);
}

.sk-media-controls {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.sk-media-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}

.sk-media-target {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.sk-media-target input {
  flex: 1 1 auto;
  min-width: 0;
}

.sk-media-target select {
  flex: 0 0 auto;
  width: auto;
  min-width: 80px;
}

.sk-media-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: -4px;
}

.sk-media-field {
  display: block;
}

.sk-media-field > span {
  display: block;
  margin-bottom: 6px;
  color: var(--sk-ink);
  font-size: 0.86rem;
  font-weight: 700;
}

.sk-media-field small {
  display: block;
  margin-top: 5px;
  color: var(--sk-muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.sk-media-page select,
.sk-media-page input[type="text"],
.sk-media-page input[type="number"] {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--sk-line);
  border-radius: 11px;
  background: var(--sk-surface);
  color: var(--sk-ink);
  font: inherit;
  font-size: 0.92rem;
}

/* A native colour field paints its own background and ignores the one set
   here, which leaves a white box sitting in a dark panel. Turning the native
   appearance off makes the padding around the swatch use --sk-surface, so the
   control follows the scheme while the swatch still shows the chosen colour. */
.sk-media-page input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  padding: 4px;
  border: 1px solid var(--sk-line);
  border-radius: 11px;
  background: var(--sk-surface);
  cursor: pointer;
}

.sk-media-page input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.sk-media-page input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 7px;
}

.sk-media-page input[type="range"] {
  width: 100%;
  accent-color: var(--sk-accent-bg);
}

.sk-media-range {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sk-media-range output {
  min-width: 62px;
  padding: 4px 8px;
  border: 1px solid var(--sk-line);
  border-radius: 9px;
  background: var(--sk-soft);
  color: var(--sk-ink);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.sk-media-check {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  color: var(--sk-muted);
  font-size: 0.86rem;
}

.sk-media-check input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  flex: 0 0 auto;
  accent-color: var(--sk-accent-bg);
}

.sk-media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.sk-media-button {
  min-height: 44px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--sk-accent-bg);
  color: var(--sk-on-accent) !important;
  font: 800 0.9rem inherit;
  text-decoration: none !important;
  cursor: pointer;
}

.sk-media-button:hover:not(:disabled) {
  filter: brightness(1.08);
}

.sk-media-button.secondary {
  border-color: var(--sk-line);
  background: var(--sk-surface);
  color: var(--sk-accent-strong) !important;
}

.sk-media-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.sk-media-page :focus-visible {
  outline: 3px solid var(--sk-accent);
  outline-offset: 2px;
}

.sk-media-status {
  min-height: 24px;
  margin: 16px 0 0;
  color: var(--sk-muted);
  font-size: 0.9rem;
}

.sk-media-status[data-state="ok"] {
  color: var(--sk-ok);
  font-weight: 700;
}

.sk-media-status[data-state="warn"] {
  color: var(--sk-warn);
  font-weight: 700;
}

.sk-media-status[data-state="error"] {
  color: var(--sk-error);
  font-weight: 700;
}

.sk-media-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  padding: 14px;
  border: 1px solid var(--sk-line);
  border-radius: 16px;
  background: var(--sk-soft);
  /* Checkerboard makes a transparent PNG visibly transparent instead of
     looking like an empty white box, which matters for watermark and redaction
     output where alpha is the point. */
  background-image:
    linear-gradient(45deg, rgba(128, 128, 128, 0.14) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(128, 128, 128, 0.14) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(128, 128, 128, 0.14) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(128, 128, 128, 0.14) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.sk-media-stage canvas,
.sk-media-stage img,
.sk-media-stage video {
  display: block;
  max-width: 100%;
  max-height: 560px;
  height: auto;
  border-radius: 8px;
}

/* The picked background colour, shown beside the cut-out. A colour swatch needs
   two borders to be readable on a light stage: one light inside a dark one,
   because a white swatch on a near-white card would otherwise vanish. */
.sk-media-key {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 0;
  color: var(--sk-muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.sk-media-swatch {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 1px solid var(--sk-line);
  border-radius: 8px;
  background: transparent;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7) inset;
}

.sk-media-empty {
  margin: 0;
  color: var(--sk-muted);
  font-style: italic;
  text-align: center;
}

/* Side-by-side before/after. The compare tools need to see the difference, and
   stacking the two on narrow screens keeps both usable. */
.sk-media-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.sk-media-compare figure {
  margin: 0;
}

.sk-media-compare figcaption {
  margin-bottom: 6px;
  color: var(--sk-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.sk-media-compare .sk-media-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 170px;
  padding: 8px;
  border: 1px solid var(--sk-line);
  border-radius: 12px;
  background: var(--sk-soft);
  background-image: none;
}

.sk-media-compare canvas {
  max-height: 400px;
}

/* The paint canvas takes pointer drags, so it must not also scroll the page on
   touch, and it needs to advertise that it is a target rather than an image. */
.sk-media-stage canvas[data-paint="true"] {
  touch-action: none;
  cursor: crosshair;
  max-height: 520px;
}

.sk-media-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.sk-media-stat {
  flex: 1 1 120px;
  padding: 12px 14px;
  border: 1px solid var(--sk-line);
  border-radius: 12px;
  background: var(--sk-soft);
}

.sk-media-stat b {
  display: block;
  color: var(--sk-ink);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.sk-media-stat span {
  color: var(--sk-muted);
  font-size: 0.78rem;
}

.sk-media-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sk-media-chip {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--sk-line);
  border-radius: 999px;
  background: var(--sk-surface);
  color: var(--sk-ink) !important;
  font: 700 0.83rem inherit;
  cursor: pointer;
}

.sk-media-chip[aria-pressed="true"] {
  border-color: var(--sk-accent-bg);
  background: var(--sk-accent-bg);
  color: var(--sk-on-accent) !important;
}

.sk-media-text {
  width: 100%;
  min-height: 190px;
  padding: 12px;
  border: 1px solid var(--sk-line);
  border-radius: 12px;
  background: var(--sk-surface);
  color: var(--sk-ink);
  font: 0.9rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
}

.sk-media-note {
  margin-top: 24px;
  padding: 18px 20px;
  border-left: 4px solid var(--sk-accent);
  border-radius: 8px;
  background: var(--sk-soft);
  color: var(--sk-muted);
  font-size: 0.92rem;
}

.sk-media-note strong {
  color: var(--sk-ink);
}

.sk-media-guide {
  margin-top: 34px;
}

.sk-media-guide h2 {
  font-size: 1.45rem;
}

.sk-media-guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.sk-media-guide article {
  padding: 20px;
  border: 1px solid var(--sk-line);
  border-radius: 16px;
  background: var(--sk-surface);
}

.sk-media-guide h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.sk-media-guide p {
  margin: 0;
  color: var(--sk-muted);
  font-size: 0.93rem;
}

.sk-media-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 18px;
  margin-top: 30px;
}

/* Screen recorder only. The pulse is the single signal that recording is live,
   so it is animation-based and also carries text, rather than colour alone. */
.sk-media-rec-indicator {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--sk-error);
  font-size: 0.9rem;
  font-weight: 700;
}

.sk-media-rec-indicator::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: currentColor;
  animation: sk-media-pulse 1.1s ease-in-out infinite;
}

@keyframes sk-media-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
  .sk-media-rec-indicator::before {
    animation: none;
  }
  .sk-media-page * {
    scroll-behavior: auto;
  }
}

.sk-media-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

@media (max-width: 860px) {
  .sk-media-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .sk-media-guide-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------------------------------------------------------------------------
   Background Remover: the refine brush.

   The panel is hidden until an image is loaded, because the controls do
   nothing without one and an empty panel reads as a broken tool rather than an
   inactive one.
   --------------------------------------------------------------------------- */

.sk-bg-refine {
  margin-top: 20px;
  padding: 18px 20px;
  border: 1px solid var(--sk-line, #2a3238);
  border-radius: 14px;
  background: var(--sk-surface-2, #161b20);
}

.sk-bg-refine h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
}

.sk-bg-refine-lead {
  margin: 0 0 14px;
  font-size: .92rem;
  color: var(--sk-text-dim, #9aa5ad);
}

.sk-bg-brush-tools {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--sk-line, #2a3238);
}

/* Hidden until the brush checkbox is ticked, so the panel does not offer a
   mode and a size for a brush that cannot be seen. */
.sk-bg-refine:not(.is-on) .sk-bg-brush-tools {
  opacity: .45;
}

.sk-bg-brush-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.sk-bg-brush-mode {
  flex: 1 1 180px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--sk-line, #2a3238);
  border-radius: 10px;
  background: transparent;
  color: var(--sk-text, #e7ecf0);
  font: inherit;
  font-size: .92rem;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}

.sk-bg-brush-mode:hover {
  border-color: var(--sk-accent, #4f9dd8);
}

/* aria-pressed carries the state, so the visual and the accessibility tree
   cannot disagree. */
.sk-bg-brush-mode[aria-pressed="true"] {
  border-color: var(--sk-accent, #4f9dd8);
  background: color-mix(in srgb, var(--sk-accent, #4f9dd8) 18%, transparent);
  font-weight: 600;
}

.sk-bg-brush-mode:focus-visible {
  outline: 2px solid var(--sk-accent, #4f9dd8);
  outline-offset: 2px;
}

.sk-bg-brush-help {
  margin: 12px 0 0;
  font-size: .86rem;
  color: var(--sk-text-dim, #9aa5ad);
}

/* The cursor follows the mode, so it is obvious before the first stroke
   whether a drag will remove or restore. */
#sk-bgremove-canvas.is-brushing[data-brush="background"] {
  cursor: crosshair;
}

#sk-bgremove-canvas.is-brushing[data-brush="subject"] {
  cursor: cell;
}

/* A brush drag must not select the text under the pointer, and must not scroll
   the page on a touch screen, or painting a correction becomes impossible on
   a phone. */
#sk-bgremove-canvas.is-brushing {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

@media (max-width: 520px) {
  .sk-bg-brush-mode {
    flex-basis: 100%;
  }
}

/* ==========================================================================
   PDF Merge
   --------------------------------------------------------------------------
   The file list is the whole interface of this tool, so the rules below are
   about making the order of a list obvious and movable rather than decorative.

   Two decisions worth recording:

   1. The order number is shown, not implied by position alone. A merge that
      sorts the inputs silently produces a plausible looking document that is
      wrong, and nothing in the result would reveal it.

   2. The row is a grid rather than a flex line, so the name, the buttons and
      the order number stay in the same columns whatever the length of the file
      name. With a flex row a long name pushes the controls off the edge on a
      phone, which is exactly when somebody is most likely to be reordering.

   Colours come only from the --sk-* properties on .sk-media-page, so dark mode
   is inherited rather than re-declared here.
   ========================================================================== */

.sk-pdfmerge-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sk-pdfmerge-item {
  /* Six columns for the six children the script appends: handle, order, name,
     and the three controls. With four columns the controls wrap onto a second
     line under every file, which reads as a separate row rather than as the
     controls for the file above. */
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--sk-line);
  border-radius: 12px;
  background: var(--sk-surface);
}

.sk-pdfmerge-handle {
  color: var(--sk-muted);
  font-size: 0.95rem;
  line-height: 1;
  cursor: grab;
}

.sk-pdfmerge-order {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--sk-soft);
  color: var(--sk-ink);
  font: 800 0.8rem inherit;
}

/* The name is the part that can be arbitrarily long, so it is the only column
   allowed to shrink and it is allowed to wrap. */
.sk-pdfmerge-text {
  min-width: 0;
  line-height: 1.35;
}

.sk-pdfmerge-name {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 700;
  font-size: 0.92rem;
}

.sk-pdfmerge-meta {
  display: block;
  margin-top: 2px;
  color: var(--sk-muted);
  font-size: 0.8rem;
}

.sk-pdfmerge-move,
.sk-pdfmerge-remove {
  min-width: 34px;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--sk-line);
  border-radius: 10px;
  background: var(--sk-soft);
  color: var(--sk-ink);
  font: 800 0.85rem inherit;
  line-height: 1;
  cursor: pointer;
}

.sk-pdfmerge-move:hover,
.sk-pdfmerge-remove:hover {
  border-color: var(--sk-accent);
  color: var(--sk-accent-strong);
}

.sk-pdfmerge-move:disabled {
  opacity: 0.4;
  cursor: default;
}

.sk-pdfmerge-move:focus-visible,
.sk-pdfmerge-remove:focus-visible {
  outline: 2px solid var(--sk-accent);
  outline-offset: 2px;
}

/* On a narrow screen the controls move to a second line under the name, so the
   name keeps the full width instead of being squeezed to an ellipsis. Auto
   placement fills the first three children into row one and the three controls
   into row two, which is why nothing is positioned explicitly here. */
@media (max-width: 560px) {
  .sk-pdfmerge-item {
    grid-template-columns: auto auto minmax(0, 1fr);
    row-gap: 8px;
  }

  .sk-pdfmerge-move,
  .sk-pdfmerge-remove {
    justify-self: end;
  }
}

.sk-pdfmerge-total {
  margin-top: 12px;
  color: var(--sk-muted);
  font-size: 0.88rem;
}

.sk-pdfmerge-result {
  margin-top: 20px;
  padding: 16px 18px;
  border: 1px solid var(--sk-ok);
  border-radius: 14px;
  background: var(--sk-soft);
}

.sk-pdfmerge-result strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.98rem;
}

.sk-pdfmerge-result span {
  display: block;
  margin-top: 3px;
  color: var(--sk-muted);
  font-size: 0.86rem;
}

/* ------------------------------------------------------------- Split PDF -- */
/* Colours come from the variables above, so this component is correct in dark
   mode without a single extra selector. */

.sk-pdfsplit-modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.sk-pdfsplit-mode {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--sk-line);
  border-radius: 14px;
  background: var(--sk-surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sk-pdfsplit-mode:hover { border-color: var(--sk-accent); }

.sk-pdfsplit-mode input { margin-right: 8px; accent-color: var(--sk-accent); }

.sk-pdfsplit-mode strong {
  color: var(--sk-ink);
  font-size: 0.95rem;
  font-weight: 700;
}

.sk-pdfsplit-mode span {
  display: block;
  margin-top: 4px;
  padding-left: 24px;
  color: var(--sk-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.sk-pdfsplit-mode:has(input:checked) {
  border-color: var(--sk-accent);
  background: var(--sk-soft);
}

.sk-pdfsplit-range { margin: 0 0 18px; }

.sk-pdfsplit-range input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 9px 13px;
  border: 1px solid var(--sk-line);
  border-radius: 12px;
  background: var(--sk-surface);
  color: var(--sk-ink);
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
}

.sk-pdfsplit-range input[type="text"]:focus-visible {
  outline: 2px solid var(--sk-accent);
  outline-offset: 1px;
}

.sk-pdfsplit-rangenote {
  margin: 7px 0 0;
  min-height: 1.2em;
  color: var(--sk-muted);
  font-size: 0.82rem;
}

.sk-pdfsplit-rangenote[data-state="error"] { color: var(--sk-error); font-weight: 700; }

/* ------------------------------------------------------------ page picker -- */

.sk-pdfsplit-picker { margin: 0 0 18px; }

.sk-pdfsplit-pickerhead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 18px;
  margin-bottom: 12px;
}

.sk-pdfsplit-pickerhead h3 { margin: 0; font-size: 1rem; color: var(--sk-ink); }

.sk-pdfsplit-pager { margin: 0; color: var(--sk-muted); font-size: 0.86rem; }

.sk-pdfsplit-pickbuttons { display: flex; gap: 8px; margin-left: auto; }

.sk-pdfsplit-pickbuttons button {
  min-height: 34px;
  padding: 5px 12px;
  border: 1px solid var(--sk-line);
  border-radius: 9px;
  background: var(--sk-surface);
  color: var(--sk-ink);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.sk-pdfsplit-pickbuttons button:hover { border-color: var(--sk-accent); color: var(--sk-accent); }
.sk-pdfsplit-pickbuttons button:focus-visible { outline: 2px solid var(--sk-accent); outline-offset: 1px; }

.sk-pdfsplit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--sk-line);
  border-radius: 14px;
  background: var(--sk-soft);
}

.sk-pdfsplit-page {
  display: block;
  cursor: pointer;
  text-align: center;
}

.sk-pdfsplit-page input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* A plain paper-shaped tile with the page number on it. No thumbnails: drawing
   every page to a canvas is slow on a long document and is not needed to pick
   page numbers, which is the only decision this screen asks for. */
.sk-pdfsplit-face {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--sk-line);
  border-radius: 8px;
  background: var(--sk-surface);
  color: var(--sk-muted);
  font-size: 1.05rem;
  font-weight: 700;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.sk-pdfsplit-page:hover .sk-pdfsplit-face { border-color: var(--sk-accent); }

.sk-pdfsplit-page input:checked + .sk-pdfsplit-face {
  border-color: var(--sk-accent);
  background: var(--sk-accent);
  color: var(--sk-on-accent);
}

.sk-pdfsplit-page input:focus-visible + .sk-pdfsplit-face {
  outline: 2px solid var(--sk-accent);
  outline-offset: 2px;
}

.sk-pdfsplit-pagemeta {
  display: block;
  margin-top: 4px;
  color: var(--sk-muted);
  font-size: 0.72rem;
}

/* ----------------------------------------------------------------- output -- */

.sk-pdfsplit-results { margin: 22px 0 0; }

.sk-pdfsplit-results h3 { margin: 0 0 10px; font-size: 1rem; color: var(--sk-ink); }

.sk-pdfsplit-resultlist {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sk-pdfsplit-file {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 11px 15px;
  border: 1px solid var(--sk-line);
  border-radius: 11px;
  background: var(--sk-surface);
}

.sk-pdfsplit-file strong { color: var(--sk-ink); font-size: 0.92rem; word-break: break-all; }
.sk-pdfsplit-file span { color: var(--sk-muted); font-size: 0.82rem; }

@media (max-width: 560px) {
  .sk-pdfsplit-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); max-height: 320px; }
  .sk-pdfsplit-pickbuttons { margin-left: 0; }
}

/* ------------------------------------------------------------- PDF result -- */
/* Shared by the PDF editor and PDF to EPUB pages. The border uses --sk-ok
   because the box only appears after a file has been built successfully. */

.sk-pdf-result {
  margin-top: 20px;
  padding: 16px 18px;
  border: 1px solid var(--sk-ok);
  border-radius: 14px;
  background: var(--sk-soft);
}

.sk-pdf-result strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.98rem;
}

.sk-pdf-result span {
  display: block;
  margin-top: 3px;
  color: var(--sk-muted);
  font-size: 0.86rem;
}

/* ------------------------------------------------------------- PDF editor -- */
/* Hex colours are deliberately absent: the paper stays white because that is
   what a PDF page is, while the card, controls and text follow the site tokens
   so dark mode needs no separate selectors. */

.sk-pdfedit-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 0;
}

.sk-pdfedit-count {
  margin: 0;
  color: var(--sk-muted);
  font-size: 0.88rem;
}

.sk-pdfedit-toolbar .sk-media-actions {
  margin-top: 0;
}

.sk-pdfedit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.sk-pdfedit-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--sk-line);
  border-radius: 14px;
  background: var(--sk-surface);
}

.sk-pdfedit-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 170px;
  padding: 6px;
  border: 1px solid var(--sk-line);
  border-radius: 9px;
  background: #ffffff;
  overflow: hidden;
}

.sk-pdfedit-preview canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.sk-pdfedit-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--sk-accent-bg);
  color: var(--sk-on-accent);
  font: 800 0.75rem/24px inherit;
  text-align: center;
}

.sk-pdfedit-meta {
  color: var(--sk-muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.sk-pdfedit-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: auto;
}

.sk-pdfedit-actions button {
  min-height: 34px;
  padding: 0 4px;
  border: 1px solid var(--sk-line);
  border-radius: 9px;
  background: var(--sk-soft);
  color: var(--sk-ink);
  font: 800 0.82rem inherit;
  line-height: 1;
  cursor: pointer;
}

.sk-pdfedit-actions button:hover:not(:disabled) {
  border-color: var(--sk-accent);
  color: var(--sk-accent-strong);
}

.sk-pdfedit-actions button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.sk-pdfedit-actions button:focus-visible {
  outline: 2px solid var(--sk-accent);
  outline-offset: 1px;
}

@media (max-width: 560px) {
  .sk-pdfedit-grid {
    grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
    gap: 10px;
  }

  .sk-pdfedit-preview {
    min-height: 140px;
  }
}

/* Dragging a row. The handle says grab, so the row it belongs to has to look grabbed while it
   is in the air, and the row under the pointer has to show where the file will land - without
   that marker a drop is a guess, and the list is the thing that decides the document's order. */
.sk-pdfmerge-item[data-dragging] {
  opacity: 0.55;
}

.sk-pdfmerge-item[data-dragging] .sk-pdfmerge-handle {
  cursor: grabbing;
}

.sk-pdfmerge-item[data-drop] {
  border-color: var(--sk-accent);
}

.sk-pdfmerge-item[data-drop="before"] {
  box-shadow: 0 -3px 0 0 var(--sk-accent);
}

.sk-pdfmerge-item[data-drop="after"] {
  box-shadow: 0 3px 0 0 var(--sk-accent);
}
