:root {
  color-scheme: dark;
  --navy-900: #071422;
  --navy-800: #0b1f3a;
  --navy-700: #12294a;
  --navy-600: #1a3660;
  --line: rgba(255, 255, 255, 0.08);
  --gold: #e8bf5a;
  --gold-soft: #f4d793;
  --white: #f7fafc;
  --dim: #9fb1c9;
  --dim-2: #728aa8;
  --green: #22c55e;
  --green-dark: #16a34a;
  --red: #ff8a8a;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Outfit", var(--font-body);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--navy-900);
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(120% 100% at 50% 0%, var(--navy-700) 0%, var(--navy-900) 55%);
  color: var(--white);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 430px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.scroll-area {
  padding: 28px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero,
.steps,
.card,
.account,
.reqid,
.actions,
.fine {
  animation: fade-up 0.45s ease both;
}

section:nth-of-type(1) { animation-delay: 0.05s; }
section:nth-of-type(2) { animation-delay: 0.1s; }
section:nth-of-type(3) { animation-delay: 0.15s; }
section:nth-of-type(4) { animation-delay: 0.2s; }
.reqid,
.actions,
.fine { animation-delay: 0.25s; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .hero,
  .steps,
  .card,
  .account,
  .reqid,
  .actions,
  .fine,
  .loc-tile,
  .wa-btn,
  .secondary,
  .copy-btn {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Header ---------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding-bottom: 4px;
}

.logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-row img {
  width: 40px;
  height: 40px;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.06em;
  color: var(--white);
}

.tag {
  margin: 0;
  color: var(--dim);
  font-size: 13.5px;
  font-weight: 600;
}

.flags {
  font-size: 20px;
  line-height: 1;
  letter-spacing: 6px;
}

.pills {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  color: var(--dim);
  font-size: 12.5px;
  font-weight: 600;
}

.pills .pill {
  white-space: nowrap;
}

.pills .dot {
  color: var(--gold);
}

/* ---------- Steps ---------- */

.steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}

.step {
  display: flex;
  align-items: center;
  gap: 12px;
}

.step-no {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(232, 191, 90, 0.12);
  border: 1px solid rgba(232, 191, 90, 0.4);
  color: var(--gold-soft);
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
}

.step-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--white);
}

.step-desc {
  font-size: 12px;
  color: var(--dim-2);
  margin-top: 1px;
}

/* ---------- Cards ---------- */

.card,
.account {
  background: linear-gradient(180deg, var(--navy-700) 0%, var(--navy-800) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 18px 20px;
  box-shadow: var(--shadow);
}

.card h2,
.account h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--gold-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--dim);
  margin: 14px 0 6px;
}

label:first-of-type {
  margin-top: 0;
}

input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  padding: 13px 14px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

input::placeholder {
  color: var(--dim-2);
  font-weight: 500;
}

input:focus {
  border-color: var(--gold);
  background: rgba(232, 191, 90, 0.06);
}

.amount-wrap {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.amount-wrap:focus-within {
  border-color: var(--gold);
  background: rgba(232, 191, 90, 0.06);
}

.amount-wrap span {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  padding-right: 8px;
}

.amount-wrap input {
  border: none;
  background: transparent;
  padding: 12px 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
}

.amount-wrap input:focus {
  border: none;
  background: transparent;
}

.error {
  min-height: 16px;
  margin: 6px 2px 0;
  color: var(--red);
  font-size: 12.5px;
  font-weight: 600;
}

.result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.result .full {
  grid-column: 1 / -1;
}

.result .k {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim-2);
  margin-bottom: 4px;
}

.result .v {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
}

.result .v.big {
  font-size: 40px;
  line-height: 1.05;
  color: var(--gold);
  letter-spacing: 0.01em;
}

.hint {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--dim-2);
  line-height: 1.5;
}

/* ---------- Pickup tiles ---------- */

.locs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}

.loc-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  padding: 13px 12px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.loc-tile .dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
  background: var(--dim-2);
  transition: background 0.15s ease;
}

.loc-tile:active {
  transform: scale(0.98);
}

.loc-tile.selected {
  border-color: var(--gold);
  background: rgba(232, 191, 90, 0.1);
  color: var(--gold-soft);
}

.loc-tile.selected .dot {
  background: var(--gold);
}

/* ---------- Account card ---------- */

.account .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.account .row:last-of-type {
  border-bottom: none;
}

.account .row span {
  color: var(--dim);
  font-weight: 500;
  flex: none;
}

.account .row b {
  color: var(--white);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: right;
}

/* Tap the value itself to copy it — no separate icon control. */
.copy-value {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  max-width: 65%;
  padding: 4px 0;
  border: none;
  border-bottom: 1px dashed rgba(244, 215, 147, 0.4);
  background: transparent;
  color: var(--white);
  font-family: inherit;
  font-size: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: right;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.copy-value:hover,
.copy-value:focus-visible {
  color: var(--gold-soft);
  border-bottom-color: var(--gold);
}

.copy-value:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.copy-value:active {
  transform: scale(0.98);
}

.copy-value.is-copied {
  color: var(--green);
  border-bottom-color: var(--green);
}

.account .row.row-copied {
  background: rgba(34, 197, 94, 0.08);
}

.copy-btn {
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold-soft);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.copy-btn:active {
  transform: scale(0.98);
  background: rgba(232, 191, 90, 0.1);
}

.secure-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 2px 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--dim);
}

.secure-note svg {
  width: 15px;
  height: 15px;
  min-width: 15px;
  margin-top: 1px;
  fill: var(--gold);
}

/* ---------- Actions ---------- */

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reqid {
  text-align: center;
  margin: -6px 0 0;
  font-size: 12px;
  color: var(--dim-2);
  letter-spacing: 0.03em;
}

.reqid b {
  color: var(--dim);
}

.cta-hint {
  min-height: 14px;
  margin: 2px 4px 0;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--dim-2);
}

.wa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #29d366 0%, #1fb955 100%);
  color: #06210f;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(34, 197, 94, 0.28);
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.wa-btn:active {
  transform: scale(0.98);
}

.wa-btn[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.45;
  box-shadow: none;
}

.secondary {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.secondary:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.08);
}

.fine {
  margin: 4px 4px 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--dim-2);
  text-align: center;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 12px);
  background: var(--navy-600);
  border: 1px solid var(--line);
  color: var(--white);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Sticky mobile CTA ----------
   The app shell is pinned to the full viewport height. Its content
   scrolls in its own pane (.scroll-area); the CTA bar is a separate
   flex sibling below it, so it can never render on top of any card,
   hint, or footer text — regardless of viewport height or content
   length. */

@media (max-width: 520px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app {
    height: 100vh;
    height: 100dvh;
  }

  .scroll-area {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .actions {
    flex: none;
    z-index: 10;
    gap: 8px;
    padding: 10px 18px max(10px, env(safe-area-inset-bottom));
    background: var(--navy-900);
    border-top: 1px solid var(--line);
  }

  /* Trim vertical rhythm so the rate card (the core feature) fits
     above the CTA without scrolling on typical phones. */
  .scroll-area {
    padding-top: 20px;
    gap: 14px;
  }

  .hero {
    gap: 6px;
    padding-bottom: 0;
  }

  .steps {
    padding: 12px 16px;
    gap: 8px;
  }

  .card,
  .account {
    padding: 16px 16px 18px;
  }
}

/* Genuinely short screens (older/smaller phones): the "How it
   works" explainer is a nice-to-have, not the core feature — drop
   it so the rate card and its hint always fit without clipping. */
@media (max-width: 520px) and (max-height: 700px) {
  .steps {
    display: none;
  }
}
