
:root {
  --navy-950: #0A1826; --navy-900: #0E1E30; --navy-800: #1D3145; --navy: #003764;
  --blue: #00529E; --lb: #5EB2E3; --yellow: #FFD621; --red: #E5484D; --ok: #2FBF7F;
  --ink: #FFFFFF; --ink-2: #C9D6E2; --ink-3: #8FA3B6;
  --display: 'Jost', 'Futura', 'Avenir Next', 'Century Gothic', system-ui, sans-serif;
  --body: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --pad: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body.vi {
  background: radial-gradient(120% 60% at 50% 0%, #12314F 0%, var(--navy-950) 60%) fixed, var(--navy-950);
  color: var(--ink); font-family: var(--body); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
button { font: inherit; }

.vi-app { min-height: 100vh; min-height: 100dvh; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column;
  padding: calc(var(--safe-t) + 14px) var(--pad) calc(var(--safe-b) + 18px); }
.vi-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 18px; }
.vi-logo { height: 22px; width: auto; display: block; }
.vi-kicker { font-family: var(--display); font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--navy-950); background: var(--yellow); padding: 5px 9px; border-radius: 999px; white-space: nowrap; }

.vi-screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }
h1, h2 { font-family: var(--display); font-weight: 700; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 7.6vw, 2.25rem); line-height: 1.12; }
h2 { font-size: clamp(1.5rem, 6.4vw, 1.9rem); line-height: 1.15; }
.vi-name { color: var(--yellow); }
.vi-lead { color: var(--ink-2); font-size: 1.02rem; line-height: 1.5; margin: 12px 0 0; }
.vi-fine { color: var(--ink-3); font-size: .86rem; line-height: 1.45; margin: 10px 0 0; text-align: center; }


.vi-intro-copy { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 8px 0 24px; }
.vi-when { display: inline-flex; align-items: center; gap: 9px; align-self: flex-start; margin: 18px 0 0; padding: 9px 14px;
  border-radius: 12px; background: rgba(94,178,227,.12); border: 1px solid rgba(94,178,227,.28); font-weight: 600; font-size: 1.05rem; }
.vi-when svg { width: 18px; height: 18px; fill: none; stroke: var(--lb); stroke-width: 2; stroke-linecap: round; }
.vi-steps { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 10px; }
.vi-steps li { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: .98rem; }
.vi-steps b { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-family: var(--display);
  background: var(--navy-800); color: var(--ink); font-size: .85rem; }


.vi-actions { padding-top: 12px; }
.vi-btn { appearance: none; border: 0; width: 100%; min-height: 56px; border-radius: 14px; padding: 14px 18px; cursor: pointer;
  font-family: var(--display); font-weight: 700; font-size: 1.08rem; letter-spacing: .02em; display: inline-flex; align-items: center;
  justify-content: center; gap: 10px; -webkit-tap-highlight-color: transparent; transition: transform .12s ease, filter .12s ease; }
.vi-btn:active { transform: scale(.98); }
.vi-primary { background: var(--yellow); color: var(--navy-950); box-shadow: 0 10px 24px rgba(255,214,33,.22); }
.vi-ghost { background: rgba(255,255,255,.08); color: var(--ink); border: 1px solid rgba(255,255,255,.18); }
.vi-two { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
.vi-btn:focus-visible, .vi-rec-btn:focus-visible, .vi-prompter:focus-visible { outline: 3px solid var(--lb); outline-offset: 3px; }


.vi-app[data-state="REQUESTING_PERMISSION"] .vi-top, .vi-app[data-state="READY_TO_RECORD"] .vi-top,
.vi-app[data-state="COUNTDOWN"] .vi-top, .vi-app[data-state="RECORDING"] .vi-top,
.vi-app[data-state^="WAVE_"] .vi-top { display: none; }
.vi-stage { gap: 10px; }
.vi-context { margin: 0; font-size: .9rem; color: var(--ink-2); text-align: center; }
.vi-context b { color: var(--yellow); }
.vi-prompter { flex: none; max-height: 38vh; max-height: 38dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.12); border-radius: 14px; padding: 14px 16px;
  font-size: clamp(1.18rem, 5.3vw, 1.5rem); line-height: 1.38; font-weight: 600; color: #fff; scroll-behavior: smooth; }

.vi-prompter.vi-more { -webkit-mask-image: linear-gradient(#000 78%, transparent); mask-image: linear-gradient(#000 78%, transparent); }
@media (max-height: 700px) { .vi-prompter { font-size: clamp(1.06rem, 4.9vw, 1.35rem); line-height: 1.34; } }
.vi-cam { position: relative; flex: 1 1 auto; min-height: 180px; border-radius: 18px; overflow: hidden; background: #000;
  border: 2px solid rgba(255,255,255,.08); transition: border-color .2s ease, box-shadow .2s ease; }
.vi-cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.vi-cam-wait { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; color: var(--ink-3); font-size: .95rem; }
.vi-app:not([data-state="REQUESTING_PERMISSION"]) .vi-cam-wait { display: none; }
.vi-count { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-weight: 700;
  font-size: 6.5rem; color: #fff; text-shadow: 0 6px 30px rgba(0,0,0,.55); pointer-events: none; }
.vi-app[data-state="COUNTDOWN"] .vi-count, .vi-app[data-state="WAVE_COUNTDOWN"] .vi-count { background: rgba(0,0,0,.28); animation: vi-pop 1s ease infinite; }

.vi-app[data-state^="WAVE_"] .vi-prompter { visibility: hidden; }
.vi-wave { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); display: none; max-width: calc(100% - 24px);
  padding: 8px 16px; border-radius: 999px; background: rgba(0,0,0,.6); font-weight: 700; font-size: 1.02rem; text-align: center; white-space: nowrap; }
.vi-app[data-state^="WAVE_"] .vi-wave { display: block; }
.vi-app[data-state="WAVE_CAPTURE"] .vi-cam { border-color: var(--yellow); box-shadow: 0 0 0 4px rgba(255,214,33,.25); }
.vi-app[data-state="WAVE_TRANSITION"] .vi-wave { background: var(--yellow); color: var(--navy-950); }
@keyframes vi-pop { 0% { transform: scale(1.12); opacity: .6; } 25% { transform: scale(1); opacity: 1; } 100% { opacity: 1; } }
.vi-recbar { position: absolute; top: 10px; left: 10px; right: 10px; display: none; align-items: center; gap: 8px; padding: 7px 12px;
  border-radius: 999px; background: rgba(0,0,0,.55); font-weight: 700; font-size: .92rem; width: max-content; max-width: calc(100% - 20px); }
.vi-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: vi-blink 1s ease infinite; }
@keyframes vi-blink { 50% { opacity: .25; } }
.vi-rec-label { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; }
.vi-clock { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.vi-clock #vi-clock { color: #fff; }
.vi-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: rgba(255,255,255,.14); display: none; }
.vi-progress i { display: block; height: 100%; width: 0; background: var(--red); transition: width .1s linear; }
.vi-app[data-state="RECORDING"] .vi-cam { border-color: var(--red); box-shadow: 0 0 0 4px rgba(229,72,77,.25); }
.vi-app[data-state="RECORDING"] .vi-recbar { display: flex; }
.vi-app[data-state="RECORDING"] .vi-progress { display: block; }

.vi-stage-actions { display: flex; justify-content: center; align-items: center; min-height: 104px; padding-top: 4px; }
.vi-rec-btn, .vi-cancel, .vi-stop { display: none; }
.vi-app[data-state="READY_TO_RECORD"] .vi-rec-btn { display: flex; }
.vi-app[data-state="COUNTDOWN"] .vi-cancel, .vi-app[data-state="WAVE_COUNTDOWN"] .vi-cancel { display: inline-flex; max-width: 220px; }
.vi-app[data-state="RECORDING"] .vi-stop { display: inline-flex; max-width: 220px; }
.vi-app[data-state="REQUESTING_PERMISSION"] .vi-stage-actions::after { content: 'Waiting for camera permission…'; color: var(--ink-3); font-size: .92rem; }
.vi-rec-btn { appearance: none; border: 0; background: none; color: var(--ink); cursor: pointer; flex-direction: column; align-items: center;
  gap: 8px; padding: 0; -webkit-tap-highlight-color: transparent; }
.vi-rec-ring { width: 80px; height: 80px; border-radius: 50%; border: 5px solid #fff; display: grid; place-items: center; transition: transform .12s ease; }
.vi-rec-btn:active .vi-rec-ring { transform: scale(.94); }
.vi-rec-core { width: 58px; height: 58px; border-radius: 50%; background: var(--red); box-shadow: 0 0 24px rgba(229,72,77,.55); }
.vi-rec-text { font-family: var(--display); font-weight: 700; font-size: 1rem; letter-spacing: .03em; }
.vi-stop { background: #fff; color: var(--navy-950); }
.vi-stop:disabled { opacity: .45; }
.vi-stop-sq { width: 14px; height: 14px; border-radius: 3px; background: var(--red); }


.vi-review { gap: 14px; }
.vi-play-wrap { flex: 1 1 auto; min-height: 200px; border-radius: 18px; overflow: hidden; background: #000; position: relative; }
.vi-play-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.vi-review .vi-fine { margin: 0; }


.vi-upload { justify-content: center; align-items: center; text-align: center; gap: 6px; }
.vi-upbar { width: 100%; max-width: 360px; height: 12px; border-radius: 999px; background: rgba(255,255,255,.12); overflow: hidden; margin-top: 22px; }
.vi-upbar i { display: block; height: 100%; width: 0; background: var(--yellow); border-radius: 999px; transition: width .2s ease; }
.vi-app[data-state="FINISHING"] .vi-upbar i { width: 100% !important; animation: vi-shimmer 1.2s ease-in-out infinite; }
@keyframes vi-shimmer { 50% { opacity: .55; } }
.vi-uppct { font-family: var(--display); font-weight: 700; font-size: 2.6rem; margin: 14px 0 0; font-variant-numeric: tabular-nums; }
.vi-app[data-state="FINISHING"] .vi-uppct { visibility: hidden; }
.vi-stack { display: grid; gap: 10px; }


.vi-done, .vi-msg { justify-content: center; text-align: center; align-items: center; gap: 4px; }
.vi-done .vi-lead, .vi-msg .vi-lead { max-width: 30ch; }
.vi-check, .vi-msg-icon { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 16px; }
.vi-check { background: rgba(47,191,127,.16); border: 2px solid var(--ok); }
.vi-check svg { width: 38px; height: 38px; fill: none; stroke: var(--ok); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.vi-msg-icon { background: rgba(255,214,33,.12); border: 2px solid var(--yellow); color: var(--yellow); font-family: var(--display);
  font-weight: 700; font-size: 2rem; }
.vi-msg .vi-actions { width: 100%; margin-top: 18px; }
.vi-plain .vi-msg { flex: 1; }


@media (min-width: 700px) {
  .vi-app { padding-top: 24px; }
  .vi-cam { min-height: 220px; }
}

@media (orientation: landscape) and (max-height: 500px) {
  .vi-app { max-width: 900px; padding-top: calc(var(--safe-t) + 8px); padding-bottom: calc(var(--safe-b) + 8px); }
  .vi-stage { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px 12px; }
  .vi-context { grid-column: 1 / -1; }
  .vi-prompter { max-height: none; height: 100%; font-size: 1.02rem; }
  .vi-cam { min-height: 0; }
  .vi-stage-actions { grid-column: 1 / -1; min-height: 72px; padding-top: 0; }
  .vi-rec-btn { flex-direction: row; gap: 12px; }
  .vi-rec-ring { width: 60px; height: 60px; } .vi-rec-core { width: 42px; height: 42px; }
}
