/* ==========================================================================
   Customer download page.
   Non-technical audience, often on the phone with a technician. One task per
   screen, large touch targets, no jargon.
   ========================================================================== */

:root {
  --accent: #4f7cff;
  --accent-fg: #fff;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

:root,
:root[data-theme="light"] {
  --bg: #f5f6f9;
  --surface: #fff;
  --surface-2: #f1f3f7;
  --border: #e3e6ec;
  --border-strong: #ccd2dc;
  --text: #10131a;
  --text-2: #545c6b;
  --text-3: #838b99;
  --danger: #c02626;
  --danger-bg: #fdecec;
  --ok: #14864a;
  --shadow: 0 24px 60px -20px rgb(16 19 26 / 0.22);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d12;
    --surface: #14171f;
    --surface-2: #1b1f29;
    --border: #262b36;
    --border-strong: #3a4150;
    --text: #eef1f6;
    --text-2: #a8b1c1;
    --text-3: #737c8c;
    --danger: #ff6b6b;
    --danger-bg: #2c1618;
    --ok: #45d483;
    --shadow: 0 24px 60px -20px rgb(0 0 0 / 0.7);
  }
}
:root[data-theme="dark"] {
  --bg: #0b0d12;
  --surface: #14171f;
  --surface-2: #1b1f29;
  --border: #262b36;
  --border-strong: #3a4150;
  --text: #eef1f6;
  --text-2: #a8b1c1;
  --text-3: #737c8c;
  --danger: #ff6b6b;
  --danger-bg: #2c1618;
  --ok: #45d483;
  --shadow: 0 24px 60px -20px rgb(0 0 0 / 0.7);
}

* , *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 500px at 50% -15%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  display: grid;
  place-items: center;
  padding: 24px;
}

[hidden] { display: none !important; }

.wrap { width: min(100%, 460px); display: grid; gap: 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 32px;
  box-shadow: var(--shadow);
}

.step {
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
  animation: rise 0.3s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

h1 { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.3; }
.lede { margin: 0; color: var(--text-2); font-size: 14.5px; line-height: 1.55; max-width: 34ch; }
strong { font-weight: 620; color: var(--text); }

/* Logo / status marks ---------------------------------------------------- */
.mark {
  width: 54px; height: 54px;
  border-radius: 15px;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000));
  color: var(--accent-fg);
  display: grid; place-items: center;
  font-weight: 700; font-size: 21px;
  overflow: hidden;
  margin-bottom: 4px;
}
.mark img { width: 100%; height: 100%; object-fit: contain; }
.mark.warn { background: linear-gradient(140deg, #f0a33c, #d97706); }

.tick {
  width: 54px; height: 54px; border-radius: 50%;
  background: color-mix(in srgb, var(--ok) 15%, transparent);
  color: var(--ok);
  display: grid; place-items: center;
  margin-bottom: 4px;
  animation: pop 0.4s var(--ease) both;
}
.tick svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } }

/* Code entry ------------------------------------------------------------- */
form { display: grid; gap: 16px; justify-items: center; width: 100%; margin-top: 6px; }

.code-boxes { display: flex; align-items: center; gap: 6px; }
.code-boxes input {
  width: 40px; height: 54px;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
  -moz-appearance: textfield;
}
.code-boxes input::-webkit-outer-spin-button,
.code-boxes input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.code-boxes input:hover { border-color: var(--border-strong); }
.code-boxes input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.code-boxes input.filled { border-color: var(--border-strong); background: var(--surface); }
.code-sep { width: 10px; height: 2px; background: var(--border-strong); border-radius: 2px; }

.code-boxes.shake { animation: shake 0.4s var(--ease); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

/* Buttons ---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-fg);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s var(--ease), transform 0.06s var(--ease), opacity 0.15s var(--ease);
}
.btn:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }

/* Messages --------------------------------------------------------------- */
.error {
  margin: 0;
  width: 100%;
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 13.5px;
  line-height: 1.45;
}
.detected { margin: 4px 0 0; color: var(--text-3); font-size: 12.5px; }

/* Instructions ----------------------------------------------------------- */
.steps {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: s;
  display: grid;
  gap: 10px;
  width: 100%;
  text-align: left;
}
.steps li {
  counter-increment: s;
  position: relative;
  padding-left: 34px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
}
.steps li::before {
  content: counter(s);
  position: absolute; left: 0; top: -1px;
  width: 23px; height: 23px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 650;
  display: grid; place-items: center;
}

/* Manual picker ---------------------------------------------------------- */
.wrong { width: 100%; margin-top: 4px; }
.wrong summary {
  cursor: pointer;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
  list-style: none;
  padding: 8px;
  border-radius: 8px;
  transition: color 0.15s var(--ease);
}
.wrong summary::-webkit-details-marker { display: none; }
.wrong summary:hover { color: var(--text); }
.choices { display: grid; gap: 7px; margin-top: 10px; }
.choices a {
  display: block;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 520;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.choices a:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* Identity confirmation --------------------------------------------------- */
.shield {
  width: 58px; height: 58px;
  display: grid; place-items: center;
  color: var(--accent);
  margin-bottom: 2px;
}
.shield svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.shield .tick-path { stroke-width: 2.2; }

.details {
  width: 100%;
  margin: 6px 0 0;
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  text-align: left;
}
.details .row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  padding: 13px 15px;
  background: var(--surface-2);
  align-items: baseline;
}
.details dt { margin: 0; color: var(--text-3); font-size: 12.5px; font-weight: 550; }
.details dd { margin: 0; font-size: 14.5px; font-weight: 560; word-break: break-word; }

.warn-note {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.5;
  max-width: 36ch;
}

.actions { display: grid; gap: 9px; width: 100%; margin-top: 4px; }

.btn.danger-ghost {
  background: transparent;
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 32%, transparent);
}
.btn.danger-ghost:hover { background: var(--danger-bg); }

/* Animated result icons --------------------------------------------------- */
.result { width: 76px; height: 76px; margin-bottom: 2px; }
.result svg { width: 100%; height: 100%; fill: none; }

.result-ring {
  stroke-width: 2.4;
  stroke-dasharray: 152;
  stroke-dashoffset: 152;
  animation: draw-ring 0.55s var(--ease) forwards;
}
@keyframes draw-ring { to { stroke-dashoffset: 0; } }

/* Success: ring draws, then the tick strokes in, then a soft pulse. */
.result.ok { color: var(--ok); }
.result.ok .result-ring { stroke: currentColor; }
.result.ok .result-glyph {
  stroke: currentColor;
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw-tick 0.4s var(--ease) 0.45s forwards;
}
@keyframes draw-tick { to { stroke-dashoffset: 0; } }

.result.ok::after {
  content: '';
  display: block;
  margin-top: -76px;
  width: 76px; height: 76px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0;
  animation: pulse 0.85s var(--ease) 0.5s;
}
@keyframes pulse {
  0% { opacity: 0.22; transform: scale(0.85); }
  100% { opacity: 0; transform: scale(1.5); }
}

/* Denied: ring draws, face fades in, then the whole thing shakes once. */
.result.bad { color: var(--danger); animation: sad-shake 0.5s var(--ease) 0.6s; }
.result.bad .result-ring { stroke: currentColor; }
.result.bad .result-glyph { opacity: 0; animation: fade-in 0.35s var(--ease) 0.45s forwards; }
.result.bad .eye { fill: currentColor; stroke: none; }
.result.bad .frown {
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  fill: none;
}
@keyframes fade-in { to { opacity: 1; } }
@keyframes sad-shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-6deg); }
  75% { transform: rotate(6deg); }
}

/* Contact card ------------------------------------------------------------ */
.contact-card {
  width: 100%;
  margin-top: 2px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  display: grid;
  gap: 5px;
  text-align: left;
  font-size: 13.5px;
}
.contact-card .label { color: var(--text-3); font-size: 12px; }
.contact-card a { color: var(--accent); text-decoration: none; font-weight: 550; }
.contact-card a:hover { text-decoration: underline; }

.lede.muted { color: var(--text-3); font-size: 13.5px; }

/* Footer ----------------------------------------------------------------- */
.foot {
  display: grid;
  gap: 3px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 460px) {
  .card { padding: 32px 18px; border-radius: 16px; }
  .code-boxes input { width: 34px; height: 46px; font-size: 18px; border-radius: 9px; }
  .code-boxes { gap: 4px; }
  .code-sep { width: 6px; }
  .details .row { grid-template-columns: 76px 1fr; gap: 8px; padding: 11px 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
