:root {
  --bg: #EEF2F7;
  --ink: #1D2433;
  --muted: #5B6478;
  --faint: #98A1B3;
  --soft: #F3F5F9;
  --soft-hover: #E8ECF2;
  --white: #FFFFFF;
  --green: #22B573;
  --green-hover: #1DA266;
  --green-deep: #128A55;
  --green-dark: #0F8A4F;
  --green-tint: #E3F6EC;
  --yellow: #FFD400;
  --blue: #2F7DE1;
  --red: #E5484D;

  --shadow: 0 1px 2px rgba(22, 32, 60, 0.08), 0 4px 12px rgba(22, 32, 60, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-green: 0 6px 16px -6px rgba(34, 181, 115, 0.7);

  --display: "Fredoka", "Plus Jakarta Sans", system-ui, sans-serif;
  --body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--bg);
  background-image: radial-gradient(rgba(29, 36, 51, 0.07) 1px, transparent 1.2px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }

button, input, select { font: inherit; color: inherit; }

/* ---------- Top bar ---------- */

.topbar {
  width: 100%;
  max-width: 720px;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 8px 8px 18px;
  background: var(--white);
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand-icon { font-size: 24px; line-height: 1; }
.brand-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.01em;
}
.stats {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green-deep);
  white-space: nowrap;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}
.paid { white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip {
  height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--soft);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.banner {
  margin: 14px 0 18px;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--green-dark);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

/* ---------- Card ---------- */

.card {
  width: 100%;
  max-width: 520px;
  padding: 28px;
  background: var(--white);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.steps {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: background 0.25s, color 0.25s;
}
.step span {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--white);
  font-size: 11px;
  font-weight: 700;
}
.step.is-active { background: var(--green); color: #fff; }
.step.is-active span { color: var(--green-deep); }
.step.is-done { background: var(--green-tint); color: var(--green-deep); }
.step.is-done span { background: var(--green); color: #fff; }

h1 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.hl {
  padding: 0 0.08em;
  background: linear-gradient(transparent 58%, var(--yellow) 58%, var(--yellow) 90%, transparent 90%);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.lede { margin: 0 0 24px; color: var(--muted); font-size: 15px; }

.section { animation: rise 0.35s ease both; }

/* ---------- Form fields ---------- */

.label {
  display: block;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
}
.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.label-row .label { margin: 0; }

.field { position: relative; margin-bottom: 18px; }
.field:has(+ .hint) { margin-bottom: 8px; }

.input {
  width: 100%;
  height: 54px;
  padding: 0 18px;
  border: 2px solid transparent;
  border-radius: 16px;
  background: var(--soft);
  font-size: 16px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--faint); font-weight: 500; }
.input:hover { background: var(--soft-hover); }
.input:focus {
  background: var(--white);
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(34, 181, 115, 0.15);
}
.input.is-invalid {
  background: var(--white);
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(229, 72, 77, 0.12);
}
.has-prefix .input { padding-left: 38px; }
.prefix {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 700;
  pointer-events: none;
}
.digits { font-variant-numeric: tabular-nums; letter-spacing: 0.06em; }
.mono { font-family: var(--mono); font-size: 14px; font-weight: 500; }

.select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 44px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235B6478' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
}
.select:invalid { color: var(--faint); font-weight: 500; }
.select option { color: var(--ink); font-weight: 500; }

.hint { margin: 0 0 18px; font-size: 12px; color: var(--muted); }
.hint.is-error { color: var(--red); font-weight: 600; }

/* ---------- Buttons ---------- */

.btn {
  width: 100%;
  height: 56px;
  padding: 0 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.995); }
.btn:focus-visible,
.link-btn:focus-visible,
.icon-btn:focus-visible,
.unmute:focus-visible {
  outline: 3px solid rgba(47, 125, 225, 0.45);
  outline-offset: 2px;
}
.btn-primary { background: var(--green); color: #fff; box-shadow: var(--shadow-green); }
.btn-primary:hover:not(:disabled) { background: var(--green-hover); }
.btn-primary:disabled { background: #CDD5E1; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: var(--white); color: var(--ink); box-shadow: var(--shadow); }
.btn-ghost:hover { background: var(--soft); }
.btn-send { margin-top: 4px; }

/* ---------- Wallet / balance ---------- */

.wallet {
  position: relative;
  overflow: hidden;
  padding: 18px 20px 20px;
  border-radius: 22px;
  background: linear-gradient(140deg, #0F8A4F 0%, #22B573 100%);
  color: #fff;
  box-shadow: var(--shadow-green);
}
.wallet::before,
.wallet::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.wallet::before { right: -60px; top: -70px; width: 190px; height: 190px; background: rgba(255, 255, 255, 0.09); }
.wallet::after { left: -40px; bottom: -80px; width: 150px; height: 150px; background: rgba(255, 212, 0, 0.14); }
.wallet > * { position: relative; z-index: 1; }

.wallet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
.player {
  max-width: 75%;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-btn {
  padding: 4px;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover { color: #fff; }

.log {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}
.log li { display: flex; align-items: center; gap: 10px; animation: rise 0.25s ease both; }
.log li::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}
.log li.is-loading::before {
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
.log li.is-done { color: rgba(255, 255, 255, 0.85); }
.log li.is-done::before {
  content: "✓";
  display: grid;
  place-items: center;
  background: var(--yellow);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}
.progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--yellow);
  transition: width 0.45s ease;
}

.balance { display: flex; flex-direction: column; gap: 2px; animation: rise 0.35s ease both; }
.balance-label { font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.82); }
.balance-amount {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(28px, 8vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.balance-short {
  align-self: flex-start;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

#step-payout { margin-top: 24px; }

.net {
  padding: 3px 10px;
  border-radius: 999px;
  background: #FFE9E9;
  color: #C4232B;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.estimate {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--green-tint);
  color: var(--green-deep);
  font-size: 14px;
}
.estimate strong { font-weight: 800; font-variant-numeric: tabular-nums; }
.estimate span { color: var(--muted); font-size: 12px; font-weight: 600; }

/* ---------- Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 32, 0.62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fade 0.2s ease both;
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  background: var(--white);
  border-radius: 28px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.45);
  animation: pop 0.4s cubic-bezier(0.2, 1.2, 0.3, 1) both;
}
.modal-head { display: flex; align-items: center; gap: 12px; padding: 4px 4px 0; }
.tick {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  box-shadow: var(--shadow-green);
}
.modal-titles { flex: 1; min-width: 0; }
.modal-titles h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.15;
}
.modal-titles p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-btn {
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--soft);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.icon-btn:hover { background: var(--soft-hover); }

.video-frame {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  border-radius: 18px;
  overflow: hidden;
  background: #0B0F17;
}
.video-frame video {
  display: block;
  width: 100%;
  max-height: min(64vh, 640px);
  object-fit: contain;
  cursor: pointer;
}
.unmute {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
}
.video-missing {
  margin: 0;
  padding: 48px 24px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  text-align: center;
}
.video-missing code { color: var(--yellow); font-family: var(--mono); }

.modal-note {
  margin: -2px 0 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  animation: fade 0.4s ease 0.8s both;
}

/* ---------- Motion ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 181, 115, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(34, 181, 115, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 181, 115, 0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Small screens ---------- */

@media (max-width: 560px) {
  .paid { display: none; }
  .card { padding: 22px 18px; border-radius: 24px; }
  h1 { font-size: 28px; }
}
@media (max-width: 360px) {
  .chip { display: none; }
}
