:root {
  --bg: #ffffff;
  --ink: #14161c;
  --muted: #7b808d;
  --soft: #a4a9b5;
  --line: #e7e8ed;
  --edge: #c4c8d2;
  --zone: #fafbfc;
  --accent: #2f5bff;
  --bad: #e5484d;
  --good: #13a06a;
  --licence-a: #eef3ff;
  --licence-b: #f7f3ec;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 12px;
}

/* ---- the panel ---- */
.kyc {
  position: relative;
  width: min(384px, calc(100vw - 24px));
  border-radius: 22px;
  background: #ffffff;
  padding: clamp(14px, 3.6vh, 22px) clamp(14px, 4vw, 20px) clamp(12px, 2.8vh, 18px);
  box-shadow:
    0 0 0 1px var(--line),
    0 1px 1px rgba(20, 22, 28, 0.04),
    0 12px 26px -12px rgba(20, 22, 28, 0.16),
    0 40px 70px -36px rgba(20, 22, 28, 0.22);
}
.kyc__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(120% 70% at 50% 0%, rgba(47, 91, 255, 0.07), transparent 60%);
  opacity: 0;
}

.kyc__brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mark { width: 22px; height: 22px; flex: none; }
.mark rect { fill: var(--ink); }
.mark path { fill: none; stroke: #ffffff; stroke-width: 2.1; stroke-linecap: round; }
.kyc__name { font-size: 13.5px; font-weight: 640; font-stretch: 104%; letter-spacing: -0.01em; }
.kyc__chip {
  margin-left: auto;
  font-size: 11px;
  font-weight: 520;
  color: var(--muted);
  padding: 4px 9px;
  border-radius: 999px;
  background: #f3f4f7;
  box-shadow: inset 0 0 0 1px #eceef2;
}

.kyc__title {
  margin-top: clamp(10px, 2.6vh, 16px);
  font-size: clamp(17px, 4.6vw, 20px);
  font-weight: 650;
  font-stretch: 96%;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.kyc__sub {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---- the two zones ---- */
.slots {
  margin-top: clamp(10px, 2.6vh, 16px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.col { min-width: 0; }

.slot {
  position: relative;
  display: block;
  height: clamp(88px, 23vh, 122px);
  border-radius: 14px;
  background: var(--zone);
  cursor: pointer;
  transition: background-color 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}
.slot__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.slot__dash {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.slot__dash rect {
  fill: none;
  stroke: var(--edge);
  stroke-width: 1.2;
  stroke-dasharray: 4.5 4;
  transition: stroke 0.25s ease, stroke-dasharray 0.25s ease;
}
.slot__focus {
  position: absolute;
  inset: -4px;
  border-radius: 18px;
  box-shadow: 0 0 0 3px rgba(47, 91, 255, 0.22);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.slot:has(.slot__input:focus-visible) .slot__focus { opacity: 1; }

.slot__empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  transition: opacity 0.25s ease;
}
.slot__icon {
  width: 28px;
  height: 20px;
  margin-bottom: 5px;
  fill: none;
  stroke: var(--soft);
  stroke-width: 1.3;
  stroke-linecap: round;
  transition: transform 0.45s cubic-bezier(0.34, 1.7, 0.5, 1), stroke 0.25s ease;
}
.slot__name { font-size: 13px; font-weight: 600; }
.slot__hint { font-size: 11.5px; color: var(--muted); }

@media (hover: hover) {
  .slot:hover { background: #f5f6f9; }
  .slot:hover .slot__dash rect { stroke: #9aa0ad; }
  .slot:hover .slot__icon { transform: translateY(-2px); stroke: var(--ink); }
  .msg__act:hover { color: var(--ink); background: #f1f2f5; }
  .go:not(:disabled):hover .go__fill { background: #23262f; }
}
/* the drawn pointer gives the same hover */
.slot.is-hot { background: #f5f6f9; }
.slot.is-hot .slot__dash rect { stroke: #9aa0ad; }
.slot.is-hot .slot__icon { transform: translateY(-2px); stroke: var(--ink); }

/* a file held over the zone */
.slot.is-over { background: rgba(47, 91, 255, 0.05); }
.slot.is-over .slot__dash rect { stroke: var(--accent); animation: march 0.6s linear infinite; }
.slot.is-over .slot__icon { transform: translateY(-3px) scale(1.06); stroke: var(--accent); }
@keyframes march { to { stroke-dashoffset: -8.5; } }

.slot.has-doc .slot__empty { opacity: 0; }
.slot.has-doc { background: #f6f7f9; }
.slot.has-doc .slot__dash rect { stroke: #d6d9e0; stroke-dasharray: 600 0; }
.slot.is-bad { background: rgba(229, 72, 77, 0.045); }
.slot.is-bad .slot__dash rect { stroke: var(--bad); stroke-dasharray: 600 0; }
.slot.is-good { background: rgba(19, 160, 106, 0.04); }
.slot.is-good .slot__dash rect { stroke: rgba(19, 160, 106, 0.55); stroke-dasharray: 600 0; }

/* ---- the licence in the zone ---- */
.slot__docbox {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.doc {
  position: relative;
  width: 70%;
  max-width: 126px;
  aspect-ratio: 1.586;
  opacity: 0;
}
.card {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  overflow: hidden;
  box-shadow:
    0 0 0 0.5px rgba(20, 22, 28, 0.12),
    0 1px 2px rgba(20, 22, 28, 0.08),
    0 8px 16px -8px rgba(20, 22, 28, 0.3);
}
.card--front { background: linear-gradient(140deg, var(--licence-a) 0%, var(--licence-b) 62%, #eef6f1 100%); }
.card--back { background: linear-gradient(160deg, #f6f7f9, #eceef3); }
.card.is-photo { background-size: cover; background-position: center; }
.card.is-photo > :not(.scan) { display: none; }

.c-band {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 17%;
  background: linear-gradient(90deg, var(--accent), #7d95ff);
}
.c-photo {
  position: absolute;
  left: 7%; top: 27%;
  width: 25%; height: 56%;
  border-radius: 3px;
  background: linear-gradient(170deg, #d8dde8, #aeb7c9);
}
.c-lines {
  position: absolute;
  left: 38%; top: 30%;
  width: 54%;
  display: grid;
  gap: 9%;
}
.c-lines i { display: block; height: 3px; border-radius: 2px; background: #cdd2dc; }
.c-lines i:nth-child(1) { width: 92%; background: #8f98ab; }
.c-lines i:nth-child(2) { width: 68%; }
.c-lines i:nth-child(3) { width: 80%; }
.c-lines i:nth-child(4) { width: 50%; }
.c-sign {
  position: absolute;
  left: 38%; bottom: 9%;
  width: 30%;
  fill: none;
  stroke: #3a4257;
  stroke-width: 1.1;
  stroke-linecap: round;
}
.c-holo {
  position: absolute;
  right: 7%; bottom: 10%;
  width: 17%; height: 22%;
  border-radius: 3px;
  background: conic-gradient(from 200deg, #c9f0ff, #e6d4ff, #ffe1ec, #d7ffe9, #c9f0ff);
  opacity: 0.9;
}
.c-code {
  position: absolute;
  left: 7%; bottom: 7%;
  width: 25%; height: 3px;
  border-radius: 2px;
  background: #c3c9d5;
}
.c-grid {
  position: absolute;
  left: 8%; right: 8%; top: 12%;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8% 7%;
}
.c-grid i { display: block; height: 7px; border-radius: 2px; background: #dde0e7; box-shadow: inset 0 0 0 1px #cfd3dc; }
.c-bar {
  position: absolute;
  left: 8%; right: 8%; bottom: 11%;
  height: 22%;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, #2a2e39 0 1px, transparent 1px 2.6px, #2a2e39 2.6px 4.4px, transparent 4.4px 5.4px, #2a2e39 5.4px 6px, transparent 6px 8px);
  opacity: 0.85;
}

.glare {
  position: absolute;
  left: 46%; top: 6%;
  width: 52%; height: 70%;
  border-radius: 50%;
  background:
    radial-gradient(closest-side, #ffffff, #ffffff 30%, rgba(255, 255, 255, 0.85) 52%, rgba(255, 255, 255, 0) 100%),
    radial-gradient(closest-side, rgba(255, 246, 220, 0) 62%, rgba(255, 238, 200, 0.55) 80%, rgba(255, 255, 255, 0) 100%);
  filter: blur(0.6px);
  opacity: 0;
  pointer-events: none;
}
.ring {
  position: absolute;
  left: 41%; top: -2%;
  width: 62%; height: 82%;
  overflow: visible;
  pointer-events: none;
}
.ring ellipse {
  fill: none;
  stroke: var(--bad);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}
.ring { opacity: 0; }

.scan {
  position: absolute;
  left: 0; right: 0;
  top: -34%;
  height: 34%;
  background: linear-gradient(to bottom, rgba(47, 91, 255, 0), rgba(47, 91, 255, 0.16) 75%, rgba(47, 91, 255, 0.34));
  border-bottom: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 6px rgba(47, 91, 255, 0.55);
  opacity: 0;
}

.corners {
  position: absolute;
  inset: -5px;
  pointer-events: none;
  opacity: 0;
  color: var(--accent);
  transition: color 0.25s ease;
}
.corners i {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 0 solid currentColor;
}
.corners i:nth-child(1) { left: 0; top: 0; border-left-width: 1.6px; border-top-width: 1.6px; border-top-left-radius: 4px; }
.corners i:nth-child(2) { right: 0; top: 0; border-right-width: 1.6px; border-top-width: 1.6px; border-top-right-radius: 4px; }
.corners i:nth-child(3) { left: 0; bottom: 0; border-left-width: 1.6px; border-bottom-width: 1.6px; border-bottom-left-radius: 4px; }
.corners i:nth-child(4) { right: 0; bottom: 0; border-right-width: 1.6px; border-bottom-width: 1.6px; border-bottom-right-radius: 4px; }
.slot.is-bad .corners { color: var(--bad); }
.slot.is-good .corners { color: var(--good); }

/* ---- the line under each zone ---- */
.msg {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 5px;
  min-height: 30px;
  margin-top: 7px;
  padding: 0 2px;
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--muted);
}
.msg__icon {
  flex: none;
  width: 13px;
  height: 13px;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: none;
}
.msg.is-bad, .msg.is-good { color: var(--ink); }
.msg.is-bad .msg__icon, .msg.is-good .msg__icon { display: block; }
.msg.is-bad .msg__icon { color: var(--bad); }
.msg.is-good .msg__icon { color: var(--good); }
.msg.is-busy .msg__text { color: var(--accent); }
.msg__text { min-width: 0; }
.msg__act {
  display: none;
  margin: -3px -4px 0 auto;
  padding: 3px 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.msg.is-bad .msg__act, .msg.is-good .msg__act { display: block; }
.msg.is-bad .msg__act { color: var(--bad); }
.msg__act:focus-visible { outline: 2px solid rgba(47, 91, 255, 0.5); outline-offset: 1px; }
.msg__act.is-hot { color: var(--ink); background: #f1f2f5; }

/* ---- continue ---- */
.go {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  margin-top: clamp(8px, 2vh, 12px);
  border: 0;
  border-radius: 13px;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: #ffffff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
.go:disabled { cursor: default; color: #9aa0ad; }
.go:focus-visible { outline: 3px solid rgba(47, 91, 255, 0.35); outline-offset: 2px; }
.go__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 -1px 0 rgba(0, 0, 0, 0.3);
  transition: background-color 0.3s ease;
}
.go:disabled .go__fill { background: #eff0f3; box-shadow: inset 0 0 0 1px #e6e8ec; }
.go.is-done .go__fill { background: var(--good); }
.go__label { position: relative; display: block; }
.go__spin, .go__tick {
  position: relative;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: none;
}
.go__spin circle { stroke-dasharray: 0.28 0.72; }
.go.is-busy .go__spin { display: block; }
.go.is-done .go__tick { display: block; }
.go__tick path { stroke-dasharray: 1 1; stroke-dashoffset: 1; }

.kyc__foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: clamp(8px, 1.8vh, 12px);
  font-size: 11px;
  color: var(--muted);
}
.kyc__foot svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.3; }

/* ---- the file held by the drawn pointer ---- */
.drag {
  position: fixed;
  left: 0;
  top: 0;
  width: 100px;
  aspect-ratio: 1.586;
  pointer-events: none;
  opacity: 0;
  z-index: 4;
}
.drag .card {
  box-shadow:
    0 0 0 0.5px rgba(20, 22, 28, 0.14),
    0 6px 12px -4px rgba(20, 22, 28, 0.22),
    0 22px 34px -14px rgba(20, 22, 28, 0.38);
}
.drag .glare { opacity: 1; }

.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  fill: #14161c;
  stroke: #ffffff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(20, 22, 28, 0.3));
  opacity: 0;
  z-index: 5;
}

@media (max-height: 470px) {
  .kyc__foot { display: none; }
  .kyc__sub { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .slot.is-over .slot__dash rect { animation: none; }
  .slot__icon { transition: none; }
}
