/* UX components: receipt printer, hold-to-confirm button, magnetic drop zone.  Pairs with extra/js/ux.js.
   Colours come from the site's own tokens (--mk-*, --accent) so they follow light/dark. */

/* ------------------------------------------------------------------ receipt printer */
.ux-rp { --rp-paper: #fffdf8; --rp-ink: #1d2430; --rp-sub: #6a7383; --rp-body: #1f2937; max-width: 340px; margin-inline: auto; position: relative; }
.dark .ux-rp { --rp-paper: #f6f3ea; }
.ux-rp-machine { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 12px 16px 22px; border-radius: 18px;
  background: linear-gradient(180deg, #2a3342, #1b2230); color: #e8edf5; box-shadow: 0 10px 26px rgb(10 20 40 / .28), inset 0 1px 0 rgb(255 255 255 / .08); }
.ux-rp-light { width: 9px; height: 9px; border-radius: 50%; background: #5b6577; flex: none; transition: background .3s, box-shadow .3s; }
.ux-rp[data-stage="processing"] .ux-rp-light { background: #f0b429; box-shadow: 0 0 10px #f0b429; animation: ux-blink 1s steps(2) infinite; }
.ux-rp[data-stage="printing"] .ux-rp-light { background: #4ea7ff; box-shadow: 0 0 10px #4ea7ff; animation: ux-blink .5s steps(2) infinite; }
.ux-rp[data-stage="complete"] .ux-rp-light { background: #2fcf84; box-shadow: 0 0 10px #2fcf84; }
.ux-rp-status { font-size: 13px; font-weight: 600; letter-spacing: .01em; min-height: 1.3em; }
.ux-rp-slot { position: absolute; inset-inline: 18px; bottom: 8px; height: 6px; border-radius: 6px; background: #0a0e16; box-shadow: inset 0 2px 3px rgb(0 0 0 / .6); }
.ux-rp-out { position: relative; z-index: 1; margin-top: -10px; margin-inline: 12px; overflow: hidden; padding-bottom: 18px; min-height: 40px; }
.ux-rp-paper { background: var(--rp-paper); color: var(--rp-ink); padding: 18px 18px 30px; transform: translateY(-101%); filter: drop-shadow(0 6px 10px rgb(10 20 40 / .16));
  background-image: linear-gradient(rgb(0 0 0 / .025), transparent 40px); font-variant-numeric: tabular-nums; }
.ux-rp[data-stage="printing"] .ux-rp-paper { transform: translateY(0); transition: transform 1.9s steps(24, end); }
.ux-rp[data-stage="complete"] .ux-rp-paper { transform: translateY(0); }
.ux-rp[data-stage="idle"] .ux-rp-paper, .ux-rp[data-stage="processing"] .ux-rp-paper { transform: translateY(-101%); }
.ux-rp-head { display: grid; justify-items: center; gap: 2px; text-align: center; margin-bottom: 10px; }
.ux-rp-head img { border-radius: 8px; margin-bottom: 2px; }
.ux-rp-head b { font-size: 16px; }
.ux-rp-head small { color: var(--rp-sub); font-size: 12px; }
.ux-rp-meta, .ux-rp-line, .ux-rp-total { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 2px 0; }
.ux-rp-meta span, .ux-rp-line span { color: var(--rp-sub); }
.ux-rp hr { border: 0; border-top: 1.5px dashed #c9c4b6; margin: 10px 0; }
.ux-rp-total { font-size: 15px; margin-top: 4px; } .ux-rp-total b { font-size: 17px; }
.ux-rp-bars { height: 34px; margin: 14px 0 6px; opacity: .8;
  background: repeating-linear-gradient(90deg, #1d2430 0 2px, transparent 2px 4px, #1d2430 4px 5px, transparent 5px 9px, #1d2430 9px 12px, transparent 12px 14px); }
.ux-rp-foot { text-align: center; font-size: 12px; color: var(--rp-sub); margin: 6px 0 0; line-height: 1.6; }
.ux-rp-replay { display: block; margin: 14px auto 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent, #0a7f69); background: none; border: 1px solid currentColor; border-radius: 999px; padding: 6px 16px; cursor: pointer; }
.ux-rp-replay:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
@keyframes ux-blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .ux-rp-paper, .ux-rp[data-stage="printing"] .ux-rp-paper { transition: none; } .ux-rp-light { animation: none !important; } }

/* ------------------------------------------------------------------ hold to confirm */
.ux-hold { position: relative; overflow: hidden; isolation: isolate; user-select: none; -webkit-user-select: none; touch-action: none; }
.ux-hold > span:not(.ux-hold-fill) { position: relative; z-index: 1; }
.ux-hold-fill { position: absolute; inset: 0; z-index: 0; background: color-mix(in srgb, #e5484d 38%, transparent); transform: scaleX(0); transform-origin: inline-start; pointer-events: none; }
html[dir="rtl"] .ux-hold-fill { transform-origin: right; }
.ux-hold.is-holding { border-color: #e5484d; }
.ux-hold.is-done { border-color: #2fcf84; } .ux-hold.is-done .ux-hold-fill { background: color-mix(in srgb, #2fcf84 34%, transparent); }
.ux-hold:focus-visible { outline: 2px solid var(--accent, #0a7f69); outline-offset: 2px; }
.ux-hold-hint { display: block; font-size: 12px; color: var(--mk-sub, #6a7383); margin-top: 6px; }

/* ------------------------------------------------------------------ magnetic drop zone */
.ux-drop { --mx: 50%; --my: 50%; --glow: 0; position: relative; display: grid; place-items: center; text-align: center; min-height: 112px; padding: 16px 18px; margin-top: 14px; cursor: pointer;
  border: 1.5px dashed var(--mk-line, #dfe4eb); border-radius: 16px; background: var(--mk-bg, #fff); color: var(--mk-ink, #1a1a1c); will-change: transform; transition: border-color .2s, background-color .2s; outline: 0; }
.ux-drop::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: var(--glow);
  background: radial-gradient(180px circle at var(--mx) var(--my), color-mix(in srgb, var(--accent, #0a7f69) 20%, transparent), transparent 70%); }
.ux-drop-body { position: relative; display: grid; gap: 4px; justify-items: center; }
.ux-drop-body b { font-size: 14.5px; }
.ux-drop-body small { color: var(--mk-sub, #6a7383); font-size: 12.5px; line-height: 1.6; }
.ux-drop-file { font-size: 13px; font-weight: 600; word-break: break-all; }
.ux-drop-act { display: flex; gap: 10px; margin-top: 4px; }
.ux-drop-act button { font: inherit; font-size: 12.5px; font-weight: 600; background: none; border: 0; padding: 2px 4px; cursor: pointer; color: var(--accent, #0a7f69); text-decoration: underline; text-underline-offset: 3px; }
.ux-drop-act button:last-child { color: #d03a3f; }
.ux-drop[data-ux="near"], .ux-drop[data-ux="over"] { border-color: var(--accent, #0a7f69); border-style: solid; }
.ux-drop[data-ux="over"] { background: color-mix(in srgb, var(--accent, #0a7f69) 7%, var(--mk-bg, #fff)); }
.ux-drop[data-ux="ready"] { border-style: solid; border-color: #2fcf84; cursor: default; }
.ux-drop[data-ux="error"] { border-color: #d03a3f; }
.ux-drop:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #0a7f69) 35%, transparent); }
.ux-drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ux-drop-note { font-size: 12px; color: var(--mk-sub, #6a7383); margin: 6px 2px 0; }
@media (prefers-reduced-motion: reduce) { .ux-drop { transition: none; transform: none !important; } }
