/* tk.css — the GPU tool kit (passport photo, upscaler, restorer, object remover, vocal
   remover). Loaded after explore.css + tools.css on pages with body.pg-tk.

   One palette, six named roles, so every state of every control is drawn from the same
   few colours:
     --tk-primary    the one action that moves the job forward (paper on near-black)
     --tk-secondary  supporting text and secondary actions
     --tk-accent     the signal: progress, focus, "this is live"
     --tk-bg         page ground
     --tk-surface    panels, wells, the stage
     --tk-text       body copy
   Every control is designed in all its states: rest, hover, pressed, focus, loading,
   disabled. Motion respects prefers-reduced-motion. */

.pg-tk {
  --tk-primary: #F1EDE4;
  --tk-on-primary: #0B0A09;
  --tk-secondary: #A8A196;
  --tk-accent: #FF4A1C;
  --tk-accent-soft: rgba(255, 74, 28, .14);
  --tk-bg: #0B0A09;
  --tk-surface: #12100F;
  --tk-surface-2: #1A1816;
  --tk-text: #F1EDE4;
  --tk-mute: #6F6A61;
  --tk-line: rgba(241, 237, 228, .13);
  --tk-line-2: rgba(241, 237, 228, .3);
  --tk-ok: #22A587;
  --tk-r: 2px;
  --tk-e: cubic-bezier(.19, 1, .22, 1);
  --tk-spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* ───────────────────────────── layout ───────────────────────────── */
.tk-stage { padding: clamp(18px, 2.4vw, 34px) 0 0; }
.tk-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: clamp(16px, 2vw, 28px); align-items: start; }
.tk-shell.solo { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 960px) { .tk-shell { grid-template-columns: minmax(0, 1fr); } }
.tk-panel { background: var(--tk-surface); border: 1px solid var(--tk-line); border-radius: var(--tk-r); padding: clamp(16px, 1.8vw, 24px); display: flex; flex-direction: column; gap: 18px; }
.tk-panel h2 { margin: 0; font: 800 26px/.95 var(--f); font-stretch: 62%; text-transform: uppercase; letter-spacing: -.005em; }
.tk-lab { display: block; margin: 0 0 9px; font: 500 11px/1.3 var(--m); letter-spacing: .12em; text-transform: uppercase; color: var(--tk-secondary); }
.tk-lab b { color: var(--tk-text); font-weight: 500; }
.tk-note { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--tk-secondary); }
.tk-note a { color: var(--tk-text); text-decoration: underline; text-underline-offset: 3px; }
.tk-rule { height: 1px; background: var(--tk-line); border: 0; margin: 2px 0; }

/* steps: where the visitor is in the job */
.tk-steps { display: flex; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; counter-reset: s; }
.tk-steps li { flex: 1; display: flex; flex-direction: column; gap: 8px; font: 500 11px/1.2 var(--m); letter-spacing: .1em; text-transform: uppercase; color: var(--tk-mute); counter-increment: s; transition: color .4s; }
.tk-steps li::before { content: ""; height: 2px; background: var(--tk-line); border-radius: 2px; transition: background .5s var(--tk-e); }
.tk-steps li span::before { content: "0" counter(s) " "; color: inherit; opacity: .7; }
.tk-steps li.on { color: var(--tk-text); }
.tk-steps li.on::before { background: var(--tk-accent); }
.tk-steps li.done { color: var(--tk-secondary); }
.tk-steps li.done::before { background: var(--tk-primary); }

/* ───────────────────────────── drop zone ───────────────────────────── */
.tk-drop {
  position: relative; display: grid; place-items: center; min-height: clamp(300px, 46vh, 520px); padding: 28px;
  border: 1px dashed var(--tk-line-2); border-radius: var(--tk-r); background: var(--tk-surface); cursor: pointer;
  overflow: hidden; isolation: isolate; text-align: center; transition: border-color .35s, background-color .35s, transform .5s var(--tk-e);
  outline: none;
}
/* the dot grid behind the prompt; a wave runs across it on hover and while dragging */
.tk-drop::before {
  content: ""; position: absolute; inset: -40px; z-index: -1;
  background-image: radial-gradient(circle, var(--tk-line-2) 1.2px, transparent 1.6px);
  background-size: 22px 22px; opacity: .55;
  -webkit-mask-image: radial-gradient(60% 60% at 50% 50%, #000 0%, transparent 100%);
  mask-image: radial-gradient(60% 60% at 50% 50%, #000 0%, transparent 100%);
  transition: opacity .4s;
}
.tk-drop::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), var(--tk-accent-soft), transparent 42%);
  transition: opacity .4s;
}
.tk-drop:hover { border-color: var(--tk-secondary); }
.tk-drop:hover::after { opacity: 1; }
.tk-drop:focus-visible { border-style: solid; border-color: var(--tk-accent); box-shadow: 0 0 0 3px var(--tk-accent-soft); }
.tk-drop.over { border-style: solid; border-color: var(--tk-accent); background: #15110F; transform: scale(.995); }
.tk-drop.over::before { opacity: 1; background-image: radial-gradient(circle, var(--tk-accent) 1.3px, transparent 1.7px); animation: tk-drift 1.6s linear infinite; }
.tk-drop.over::after { opacity: 1; }
@keyframes tk-drift { to { background-position: 22px 22px; } }
.tk-drop-in { display: flex; flex-direction: column; align-items: center; gap: 14px; pointer-events: none; }
.tk-drop-ico { position: relative; width: 64px; height: 64px; display: grid; place-items: center; border: 1px solid var(--tk-line-2); border-radius: 50%; background: var(--tk-bg); transition: transform .6s var(--tk-spring), border-color .3s, background .3s; }
.tk-drop-ico::before { content: "\2191"; font: 500 26px/1 var(--f); color: var(--tk-text); }
.tk-drop:hover .tk-drop-ico, .tk-drop.over .tk-drop-ico { transform: translateY(-6px); border-color: var(--tk-accent); }
.tk-drop.over .tk-drop-ico { background: var(--tk-accent); }
.tk-drop.over .tk-drop-ico::before { color: var(--tk-on-primary); }
.tk-drop h3 { margin: 0; font: 800 clamp(30px, 3.6vw, 48px)/.9 var(--f); font-stretch: 62%; text-transform: uppercase; }
.tk-drop p { margin: 0; color: var(--tk-secondary); font-size: 14.5px; }
.tk-drop p kbd { font: 500 11px/1 var(--m); padding: 3px 6px; border: 1px solid var(--tk-line-2); border-radius: 2px; color: var(--tk-text); }
.tk-drop .tk-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.tk-drop .tk-chips span { font: 500 10.5px/1 var(--m); letter-spacing: .1em; text-transform: uppercase; color: var(--tk-mute); border: 1px solid var(--tk-line); padding: 5px 7px; border-radius: 2px; }
.tk-drop.busy { pointer-events: none; }

/* sample images under the drop zone: one tap tries the tool */
.tk-samples { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.tk-samples > span { font: 500 11px/1 var(--m); letter-spacing: .1em; text-transform: uppercase; color: var(--tk-mute); }
.tk-samples button { width: 52px; height: 52px; padding: 0; border: 1px solid var(--tk-line); border-radius: 2px; background: var(--tk-surface-2) center/cover no-repeat; cursor: pointer; transition: transform .4s var(--tk-spring), border-color .2s; }
.tk-samples button:hover { transform: translateY(-3px); border-color: var(--tk-line-2); }
.tk-samples button:active { transform: translateY(0) scale(.96); }
.tk-samples button:focus-visible { outline: 2px solid var(--tk-accent); outline-offset: 2px; }

/* ───────────────────────────── buttons ───────────────────────────── */
.tk-btn {
  --bg: var(--tk-primary); --fg: var(--tk-on-primary); --bd: var(--tk-primary);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 22px;
  border: 1px solid var(--bd); border-radius: var(--tk-r); background: var(--bg); color: var(--fg); cursor: pointer; overflow: hidden; isolation: isolate;
  font: 800 13.5px/1 var(--f); letter-spacing: .09em; text-transform: uppercase; text-decoration: none; white-space: nowrap;
  transition: transform .35s var(--tk-e), background-color .25s, color .25s, border-color .25s, opacity .25s;
  -webkit-tap-highlight-color: transparent;
}
.tk-btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--tk-accent); transform: translateY(101%); transition: transform .45s var(--tk-e); }
.tk-btn:hover::before { transform: none; }
.tk-btn:active { transform: scale(.97); }
.tk-btn:focus-visible { outline: 2px solid var(--tk-accent); outline-offset: 3px; }
.tk-btn .arw { display: inline-block; font-weight: 500; font-size: 18px; transition: transform .45s var(--tk-e); }
.tk-btn:hover .arw { transform: translateX(4px); }
.tk-btn.block { width: 100%; justify-content: space-between; }
.tk-btn.sec { --bg: transparent; --fg: var(--tk-text); --bd: var(--tk-line-2); }
.tk-btn.sec::before { background: var(--tk-surface-2); }
.tk-btn.sec:hover { border-color: var(--tk-secondary); }
.tk-btn.ghost { --bg: transparent; --fg: var(--tk-secondary); --bd: transparent; min-height: 40px; padding: 0 6px; font-weight: 600; letter-spacing: .06em; }
.tk-btn.ghost::before { display: none; }
.tk-btn.ghost:hover { --fg: var(--tk-text); }
.tk-btn.sm { min-height: 40px; padding: 0 14px; font-size: 12px; }
.tk-btn[disabled], .tk-btn[aria-disabled="true"] { opacity: .36; cursor: not-allowed; transform: none; }
.tk-btn[disabled]::before, .tk-btn[aria-disabled="true"]::before { display: none; }
/* loading: the label stays, a three-dot pulse replaces the arrow */
.tk-btn.is-loading, .tk-btn.is-loading[disabled] { pointer-events: none; opacity: 1; cursor: progress; }
.tk-btn.is-loading::before { display: block; transform: none; background: var(--tk-surface-2); }
.tk-btn.is-loading { --fg: var(--tk-text); border-color: var(--tk-line-2); }
.tk-btn.is-loading .arw { display: none; }
.tk-btn.is-loading::after { content: ""; width: 22px; height: 6px; background:
    radial-gradient(circle, currentColor 2.4px, transparent 2.8px) 0 50% / 8px 6px repeat-x; animation: tk-bounce 1s steps(3) infinite; }
@keyframes tk-bounce { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 -10% 0 0); } }

/* segmented choice */
.tk-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: relative; padding: 3px; border: 1px solid var(--tk-line-2); border-radius: var(--tk-r); background: var(--tk-bg); }
.tk-seg button { position: relative; z-index: 1; min-height: 40px; padding: 0 10px; border: 0; background: none; color: var(--tk-secondary); cursor: pointer; font: 700 12px/1 var(--f); letter-spacing: .08em; text-transform: uppercase; border-radius: 1px; transition: color .3s; }
.tk-seg button small { display: block; margin-top: 3px; font: 400 10px/1 var(--m); letter-spacing: .04em; text-transform: none; opacity: .8; }
.tk-seg button:hover { color: var(--tk-text); }
.tk-seg button[aria-pressed="true"] { color: var(--tk-on-primary); }
.tk-seg button:focus-visible { outline: 2px solid var(--tk-accent); outline-offset: 1px; }
.tk-seg i { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px; background: var(--tk-primary); border-radius: 1px; transition: transform .5s var(--tk-e), width .5s var(--tk-e); }

/* range */
.tk-range { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.tk-range output { font: 500 12px/1 var(--m); color: var(--tk-text); min-width: 4ch; text-align: right; }
.tk-range input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; cursor: pointer; }
.tk-range input[type=range]::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(90deg, var(--tk-accent) var(--v, 50%), var(--tk-line-2) var(--v, 50%)); }
.tk-range input[type=range]::-moz-range-track { height: 2px; background: var(--tk-line-2); }
.tk-range input[type=range]::-moz-range-progress { height: 2px; background: var(--tk-accent); }
.tk-range input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -8px; border-radius: 50%; background: var(--tk-primary); border: 3px solid var(--tk-bg); box-shadow: 0 0 0 1px var(--tk-line-2); transition: transform .3s var(--tk-spring); }
.tk-range input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--tk-primary); border: 3px solid var(--tk-bg); }
.tk-range input[type=range]:active::-webkit-slider-thumb { transform: scale(1.25); }
.tk-range input[type=range]:focus-visible { outline: none; }
.tk-range input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--tk-accent); }

/* select */
.tk-select { position: relative; }
.tk-select select { width: 100%; min-height: 48px; padding: 0 40px 0 14px; appearance: none; -webkit-appearance: none; border: 1px solid var(--tk-line-2); border-radius: var(--tk-r); background: var(--tk-bg); color: var(--tk-text); font: 600 15px/1 var(--f); cursor: pointer; transition: border-color .2s; }
.tk-select::after { content: "\2193"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--tk-secondary); font: 500 16px/1 var(--f); }
.tk-select select:hover { border-color: var(--tk-secondary); }
.tk-select select:focus-visible { outline: none; border-color: var(--tk-accent); box-shadow: 0 0 0 3px var(--tk-accent-soft); }

/* colour swatches */
.tk-swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.tk-swatches button { position: relative; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--tk-line-2); cursor: pointer; transition: transform .4s var(--tk-spring); }
.tk-swatches button::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--tk-accent); opacity: 0; transform: scale(.85); transition: opacity .25s, transform .4s var(--tk-spring); }
.tk-swatches button:hover { transform: scale(1.06); }
.tk-swatches button[aria-pressed="true"]::after { opacity: 1; transform: none; }
.tk-swatches button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--tk-accent-soft); }

/* ───────────────────────────── liquid fill loader ───────────────────────────── */
/* A vessel that fills as the job goes. Two wave layers drift in opposite directions; the
   level is --p (0..1). Real upload progress drives it first, then an eased estimate of
   the GPU time, then it brims to 100% when the result lands. */
.tk-liquid { position: relative; display: grid; place-items: center; gap: 16px; text-align: center; }
.tk-vessel { --p: 0; position: relative; width: clamp(150px, 18vw, 200px); aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: var(--tk-surface-2); box-shadow: inset 0 0 0 1px var(--tk-line-2), 0 30px 80px -40px var(--tk-accent); isolation: isolate; }
.tk-vessel::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; border: 1px solid rgba(241, 237, 228, .08); pointer-events: none; z-index: 3; }
.tk-water { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; transform: translateY(calc((1 - var(--p)) * 100%)); transition: transform .9s var(--tk-e); z-index: 1; }
.tk-water svg { position: absolute; left: 0; top: -14px; width: 200%; height: 28px; display: block; }
.tk-water .w1 { fill: var(--tk-accent); animation: tk-wave 2.6s linear infinite; }
.tk-water .w2 { fill: #C93A15; opacity: .9; animation: tk-wave 3.8s linear infinite reverse; top: -10px; }
.tk-water::before { content: ""; position: absolute; inset: 13px 0 0; background: linear-gradient(180deg, var(--tk-accent), #B8330F); }
@keyframes tk-wave { to { transform: translateX(-50%); } }
.tk-vessel b { position: relative; z-index: 4; display: flex; align-items: center; justify-content: center; gap: 1px; height: 100%; font: 800 clamp(40px, 4.6vw, 56px)/1 var(--f); font-stretch: 70%; font-variant-numeric: tabular-nums; color: var(--tk-text); mix-blend-mode: difference; }
.tk-vessel b small { font-size: .42em; position: relative; top: -.55em; margin-left: 1px; }
/* bubbles rise through the liquid */
.tk-vessel i { position: absolute; z-index: 2; bottom: -10px; width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .35); animation: tk-bubble 3s ease-in infinite; }
.tk-vessel i:nth-of-type(2) { left: 30%; animation-delay: .8s; width: 4px; height: 4px; }
.tk-vessel i:nth-of-type(3) { left: 62%; animation-delay: 1.7s; }
.tk-vessel i:nth-of-type(4) { left: 78%; animation-delay: 2.3s; width: 3px; height: 3px; }
.tk-vessel i:nth-of-type(1) { left: 44%; }
@keyframes tk-bubble { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(calc(-1 * var(--p) * 190px)); opacity: 0; } }
.tk-vessel.brim { animation: tk-brim .7s var(--tk-spring); }
@keyframes tk-brim { 40% { transform: scale(1.06); } }
.tk-liquid-say { display: grid; gap: 6px; }
.tk-liquid-say strong { font: 800 22px/1 var(--f); font-stretch: 70%; text-transform: uppercase; letter-spacing: .01em; }
.tk-liquid-say span { font: 500 11.5px/1.4 var(--m); letter-spacing: .08em; text-transform: uppercase; color: var(--tk-secondary); min-height: 1.4em; }
.tk-liquid-say .tk-cancel { justify-self: center; margin-top: 4px; }

/* ───────────────────────────── dot grid wave loader ───────────────────────────── */
/* For the moments with no number to show: waiting for a GPU, warming a model. A 9x9 grid
   of dots; a wave runs corner to corner (the delay is the dot's row + column). It also
   lies over the photo being worked on, so the picture itself looks "in progress". */
.tk-dots { --n: 9; --gap: 10px; --dot: 4px; display: grid; grid-template-columns: repeat(var(--n), var(--dot)); gap: var(--gap); }
.tk-dots i { width: var(--dot); height: var(--dot); border-radius: 50%; background: var(--tk-primary); opacity: .18; animation: tk-dotwave 1.6s var(--tk-e) infinite; animation-delay: calc(var(--d) * 70ms); }
@keyframes tk-dotwave { 0%, 100% { opacity: .16; transform: scale(.7); } 35% { opacity: 1; transform: scale(1.6); background: var(--tk-accent); } 60% { opacity: .45; transform: scale(1); } }
.tk-scan { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(11, 10, 9, .55); backdrop-filter: saturate(.4) blur(1px); -webkit-backdrop-filter: saturate(.4) blur(1px); z-index: 4; transition: opacity .5s; }
.tk-scan .tk-dots { --n: 14; --gap: 18px; --dot: 3px; }
.tk-scan.out { opacity: 0; pointer-events: none; }

/* ───────────────────────────── work area ───────────────────────────── */
.tk-work { position: relative; display: grid; place-items: center; min-height: clamp(300px, 52vh, 620px); background:
    linear-gradient(45deg, #151312 25%, transparent 25%, transparent 75%, #151312 75%) 0 0 / 24px 24px,
    linear-gradient(45deg, #151312 25%, transparent 25%, transparent 75%, #151312 75%) 12px 12px / 24px 24px, var(--tk-surface);
  border: 1px solid var(--tk-line); border-radius: var(--tk-r); overflow: hidden; }
.tk-work > img, .tk-work > canvas { max-width: 100%; max-height: clamp(300px, 70vh, 820px); display: block; }
.tk-work .tk-liquid { position: absolute; inset: 0; background: rgba(11, 10, 9, .78); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 6; animation: tk-fade .4s; }
@keyframes tk-fade { from { opacity: 0; } }
.tk-error { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid rgba(255, 74, 28, .45); background: rgba(255, 74, 28, .07); border-radius: var(--tk-r); color: var(--tk-text); font-size: 14px; line-height: 1.5; animation: tk-shake .45s; }
.tk-error::before { content: "!"; flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--tk-accent); color: var(--tk-on-primary); font: 800 13px/1 var(--f); }
.tk-error a { color: var(--tk-text); text-decoration: underline; }
@keyframes tk-shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

/* ───────────────────────────── before / after ───────────────────────────── */
/* The box takes the picture's own shape (set from the result's size in tk.js), so the
   before and after layers are always the same size and line up pixel for pixel. */
.tk-compare { --pos: 50%; --ar: 1; position: relative; aspect-ratio: var(--ar); width: min(100%, calc(var(--maxh, 74vh) * var(--ar))); margin-inline: auto; overflow: hidden; border-radius: var(--tk-r); user-select: none; -webkit-user-select: none; touch-action: pan-y; cursor: ew-resize; background: var(--tk-surface); }
.tk-compare img { display: block; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.tk-compare .tk-after, .tk-compare .tk-before { position: absolute; inset: 0; }
.tk-compare .tk-before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.tk-compare .tk-before img { image-rendering: auto; }
.tk-compare.pixel .tk-before img { image-rendering: pixelated; }
.tk-handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 0; z-index: 3; }
.tk-handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: var(--tk-primary); box-shadow: 0 0 0 1px rgba(0, 0, 0, .25), 0 0 24px rgba(0, 0, 0, .5); }
.tk-knob { position: absolute; top: 50%; left: 0; width: 48px; height: 48px; transform: translate(-50%, -50%); border-radius: 50%; border: 0; background: var(--tk-primary); color: var(--tk-on-primary); display: grid; place-items: center; cursor: ew-resize; box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .7); transition: transform .4s var(--tk-spring), background .2s; font: 600 15px/1 var(--f); letter-spacing: -2px; }
.tk-knob::before { content: "\2039\2003\203A"; white-space: pre; }
.tk-compare:hover .tk-knob, .tk-compare.drag .tk-knob { transform: translate(-50%, -50%) scale(1.08); }
.tk-compare.drag .tk-knob { background: var(--tk-accent); color: var(--tk-text); }
.tk-knob:focus-visible { outline: 3px solid var(--tk-accent); outline-offset: 3px; }
.tk-tag { position: absolute; top: 14px; z-index: 2; padding: 7px 10px; background: rgba(11, 10, 9, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-radius: var(--tk-r); font: 500 10.5px/1 var(--m); letter-spacing: .14em; text-transform: uppercase; color: var(--tk-text); transition: opacity .3s; }
.tk-tag.l { left: 14px; } .tk-tag.r { right: 14px; }
.tk-tag { max-width: calc(50% - 24px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-tag.r::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--tk-accent); vertical-align: 1px; }
.tk-compare.reveal .tk-knob { animation: tk-nudge 1.8s var(--tk-e) .4s; }
/* zoom lens: hold the pointer still to see pixels side by side */
.tk-zoom { position: absolute; z-index: 5; width: 168px; height: 168px; border-radius: 50%; border: 2px solid var(--tk-primary); box-shadow: 0 20px 50px -10px #000; pointer-events: none; opacity: 0; transform: scale(.6); transition: opacity .2s, transform .35s var(--tk-spring); background-repeat: no-repeat; background-color: var(--tk-surface); }
.tk-zoom.on { opacity: 1; transform: none; }

/* stats under a result: before -> after */
.tk-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--tk-line); border-bottom: 1px solid var(--tk-line); }
.tk-stats div { padding: 12px 0; }
.tk-stats div + div { padding-left: 14px; border-left: 1px solid var(--tk-line); }
.tk-stats b { display: block; font: 800 22px/1 var(--f); font-stretch: 70%; font-variant-numeric: tabular-nums; }
.tk-stats span { display: block; margin-top: 6px; font: 500 10px/1.3 var(--m); letter-spacing: .1em; text-transform: uppercase; color: var(--tk-mute); }

/* the result's actions: one primary, the rest quiet */
.tk-actions { display: grid; gap: 10px; }
.tk-actions .row { display: flex; gap: 8px; flex-wrap: wrap; }
.tk-actions .row > * { flex: 1; }

/* price line on the panel */
.tk-price { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font: 500 12px/1.3 var(--m); letter-spacing: .06em; text-transform: uppercase; color: var(--tk-secondary); }
.tk-price b { color: var(--tk-text); font-weight: 500; }

/* reveal on entry */
.tk-in { animation: tk-rise .7s var(--tk-e) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes tk-rise { from { opacity: 0; transform: translateY(14px); } }
[hidden] { display: none !important; }

/* ───────────────────────────── audio ───────────────────────────── */
.tk-track { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--tk-line); border-radius: var(--tk-r); background: var(--tk-bg); }
.tk-track + .tk-track { margin-top: 10px; }
.tk-play { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--tk-primary); color: var(--tk-on-primary); cursor: pointer; display: grid; place-items: center; transition: transform .35s var(--tk-spring), background .2s; }
.tk-play::before { content: ""; border-left: 12px solid currentColor; border-top: 7.5px solid transparent; border-bottom: 7.5px solid transparent; margin-left: 3px; }
.tk-play.on::before { border: 0; width: 12px; height: 14px; margin: 0; background: linear-gradient(90deg, currentColor 4px, transparent 4px 8px, currentColor 8px); }
.tk-play:hover { transform: scale(1.06); }
.tk-play:active { transform: scale(.94); }
.tk-play:focus-visible { outline: 2px solid var(--tk-accent); outline-offset: 3px; }
.tk-wave { position: relative; height: 56px; cursor: pointer; }
.tk-wave canvas { width: 100%; height: 100%; display: block; }
.tk-track-meta { display: grid; justify-items: end; gap: 6px; }
.tk-track-meta b { font: 800 16px/1 var(--f); font-stretch: 70%; text-transform: uppercase; }
.tk-track-meta span { font: 500 11px/1 var(--m); color: var(--tk-mute); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .tk-track { grid-template-columns: auto minmax(0, 1fr); }
  .tk-track-meta { grid-column: 1 / -1; grid-row: 2; display: flex; justify-content: space-between; }
}

/* ───────────────────────────── object remover canvas ───────────────────────────── */
.tk-paint { position: relative; touch-action: none; cursor: none; max-width: 100%; }
.tk-paint canvas { display: block; max-width: 100%; height: auto; }
.tk-paint .mask { position: absolute; inset: 0; width: 100%; height: 100%; mix-blend-mode: normal; opacity: .62; }
.tk-brush { position: absolute; z-index: 5; border: 2px solid var(--tk-primary); border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); pointer-events: none; transform: translate(-50%, -50%); transition: width .15s, height .15s; }
.tk-toolrow { display: flex; gap: 8px; }
.tk-toolrow .tk-btn { flex: 1; }

/* ───────────────────────────── passport editor ───────────────────────────── */
.tk-pp { position: relative; display: grid; place-items: center; width: 100%; padding: clamp(14px, 3vw, 36px); }
.tk-pp-frame { position: relative; box-shadow: 0 30px 70px -30px #000; background: #fff; touch-action: none; cursor: grab; }
.tk-pp-frame.drag { cursor: grabbing; }
.tk-pp-frame canvas { display: block; width: 100%; height: 100%; }
.tk-guides { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s; }
.tk-pp-frame:hover .tk-guides, .tk-pp-frame.drag .tk-guides, .tk-guides.on { opacity: 1; }
.tk-guides .tk-g-band { position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(255, 74, 28, .9); border-bottom: 1px dashed rgba(255, 74, 28, .9); background: rgba(255, 74, 28, .06); }
.tk-guides .tk-g-eye { position: absolute; left: 6%; right: 6%; border-top: 1px dashed rgba(34, 165, 135, .95); }
.tk-guides .tk-g-mid { position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px dashed rgba(34, 165, 135, .6); }
.tk-guides .tk-g-lab { position: absolute; right: 4px; font: 500 9px/1 var(--m); letter-spacing: .06em; text-transform: uppercase; color: #FF4A1C; background: rgba(255, 255, 255, .85); padding: 2px 3px; }
.tk-pp-dims { margin-top: 14px; font: 500 11px/1 var(--m); letter-spacing: .1em; text-transform: uppercase; color: var(--tk-secondary); text-align: center; }
.tk-check { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.tk-check li { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; color: var(--tk-secondary); line-height: 1.45; }
.tk-check li::before { content: ""; flex: none; margin-top: 4px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--tk-mute); }
.tk-check li.ok { color: var(--tk-text); }
.tk-check li.ok::before { border-color: var(--tk-ok); background: var(--tk-ok); }
.tk-check li.warn::before { border-color: var(--tk-accent); }

@media (max-width: 760px) {
  .tk-drop { min-height: 300px; }
  .tk-stats b { font-size: 18px; }
  .tk-knob { width: 42px; height: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  .tk-water .w1, .tk-water .w2, .tk-vessel i, .tk-dots i, .tk-drop.over::before, .tk-btn.is-loading::after { animation: none !important; }
  .tk-dots i { opacity: .5; }
  .tk-in, .tk-error, .tk-compare.reveal .tk-knob { animation: none; }
}

/* "why" strip under the tool: four short claims, each with a rule that draws in */
.tk-why { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(18px, 2.4vw, 40px); padding-top: clamp(24px, 3vw, 44px); }
.tk-why-i { position: relative; padding-top: 18px; }
.tk-why-i::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--tk-line-2); transform-origin: 0 50%; transform: scaleX(0); transition: transform 1.1s var(--tk-e); }
.tk-why-i::after { content: ""; position: absolute; top: -3px; left: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--tk-accent); transform: scale(0); transition: transform .6s var(--tk-spring) .5s; }
.in .tk-why-i::before, .tk-why.in .tk-why-i::before { transform: none; }
.in .tk-why-i::after, .tk-why.in .tk-why-i::after { transform: none; }
.tk-why-i:nth-child(2)::before { transition-delay: .12s; } .tk-why-i:nth-child(3)::before { transition-delay: .24s; } .tk-why-i:nth-child(4)::before { transition-delay: .36s; }
.tk-why-i b { display: block; font: 800 clamp(22px, 2vw, 28px)/.95 var(--f); font-stretch: 66%; text-transform: uppercase; }
.tk-why-i p { margin: 10px 0 0; color: var(--tk-secondary); font-size: 14.5px; line-height: 1.55; max-width: 34ch; }
@media (max-width: 900px) { .tk-why { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .tk-why { grid-template-columns: minmax(0, 1fr); } }
@media (hover: none) { .tk-drop p kbd { display: none; } }
