/* ============================================================
   Palette
   ink       #0C0F16   canvas
   panel     #131826   cards
   line      #232B3D   borders
   text      #E9ECF4   primary text
   muted     #8B94A8   secondary text
   gold      #F0B429   accent (actions, active states)
   teal      #2DD4A7   success
   red       #F2555A   errors / danger
   ============================================================ */

:root {
  --ink:   #0C0F16;
  --panel: #131826;
  --line:  #232B3D;
  --text:  #E9ECF4;
  --muted: #8B94A8;
  --gold:  #F0B429;
  --teal:  #2DD4A7;
  --red:   #F2555A;

  --font-display: "Space Grotesk", sans-serif;
  --font-body:    "Inter", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", monospace;

  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
}

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

header, main, footer { position: relative; z-index: 1; }

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }

/* ---------- header ---------- */

.top {
  max-width: 1040px;
  margin: 0 auto;
  padding: 22px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
}

.brand-logo {
  height: 64px;
  width: auto;
  object-fit: contain;
}

.top-nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 24px;
  font-size: 14px;
}
.top-nav a:hover { color: var(--text); }

/* ---------- hero ---------- */

main { max-width: 1040px; margin: 0 auto; padding: 0 20px 80px; }

.screen { padding-top: 34px; }

.hero-line {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.08;
  text-align: center;
}

.hero-sub {
  text-align: center;
  color: var(--muted);
  margin: 12px 0 34px;
}

/* ---------- the ticket ---------- */

.ticket {
  max-width: 480px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: visible;
  position: relative;
}

.ticket-half { padding: 22px 22px 18px; }

.row-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 10px;
}

.limits, .rate-line { text-transform: none; letter-spacing: 0; font-family: var(--font-mono); font-size: 12px; }

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

.amount {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 500;
}
.amount::placeholder { color: #3A4258; }

.ccy-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 8px 12px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.ccy-btn:hover { border-color: var(--gold); }
.ccy-logo { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; }
.chev { color: var(--muted); font-size: 11px; }

.ccy-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}
.ccy-net {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  background: var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* perforated divider — the signature */

.perforation {
  height: 0;
  border-top: 2px dashed var(--line);
  position: relative;
  margin: 0 14px;
}
.perforation::before,
.perforation::after {
  content: "";
  position: absolute;
  top: -11px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  border: 1px solid var(--line);
}
.perforation::before { left: -26px; clip-path: inset(0 0 0 50%); border-left: none; }
.perforation::after  { right: -26px; clip-path: inset(0 50% 0 0); border-right: none; }

.flip {
  position: absolute;
  left: 50%;
  top: -17px;
  transform: translateX(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--gold);
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.15s;
}
.flip:hover { border-color: var(--gold); transform: translateX(-50%) rotate(180deg); }

/* foot of ticket */

.ticket-foot { padding: 4px 22px 22px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 18px; }

.rate-type { display: flex; gap: 8px; margin-bottom: 16px; }

.rate-pill {
  flex: 1;
  padding: 9px 0;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.rate-pill.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(240, 180, 41, 0.07);
}

.pill-fee {
  display: inline-block;
  margin-left: 5px;
  font-size: 11px;
  opacity: 0.7;
}

.addr-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.addr-label span { color: var(--text); }

.addr-input {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  margin-bottom: 12px;
}
.addr-input:focus { border-color: var(--gold); }

.cta {
  width: 100%;
  padding: 15px 0;
  border: none;
  border-radius: 11px;
  background: var(--gold);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: filter 0.15s;
}
.cta:hover:not(:disabled) { filter: brightness(1.08); }
.cta:disabled { opacity: 0.35; cursor: not-allowed; }
.cta.small { width: auto; padding: 11px 18px; font-size: 14px; }
.cta.ghost { background: none; border: 1px solid var(--line); color: var(--text); }

.error { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- currency modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.72);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 20px;
}

.modal-panel {
  width: 100%;
  max-width: 420px;
  max-height: 70vh;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ccy-search {
  border: none;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--text);
  padding: 16px 18px;
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
}

.ccy-list { list-style: none; overflow-y: auto; }

.ccy-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  cursor: pointer;
}
.ccy-item:hover, .ccy-item.focused { background: rgba(240, 180, 41, 0.07); }
.ccy-item img { width: 26px; height: 26px; border-radius: 50%; }
.ccy-item .n { font-size: 14px; }
.ccy-item .net { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; }
.ccy-item.disabled { opacity: 0.35; pointer-events: none; }

/* ---------- order screen ---------- */

.order-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 760px;
  margin: 0 auto 26px;
}

.order-eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }

.order-id { font-family: var(--font-mono); font-size: 30px; letter-spacing: 0.06em; }

.order-timer {
  font-family: var(--font-mono);
  font-size: 24px;
  color: var(--gold);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
}
.order-timer.expired { color: var(--red); }

.order-grid {
  max-width: 760px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 26px;
}

.deposit-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.deposit-title { font-size: 15px; margin-bottom: 16px; }
.deposit-title strong { color: var(--gold); }

.qr-wrap img {
  width: 180px;
  height: 180px;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}

.copy-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.addr { font-size: 12px; word-break: break-all; color: var(--text); }

.tag-label { font-size: 12px; color: var(--muted); }

.copy-btn {
  border: 1px solid var(--line);
  background: none;
  color: var(--gold);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}
.copy-btn:hover { border-color: var(--gold); }

.deposit-note { font-size: 12px; color: var(--muted); margin-top: 16px; text-align: left; }

/* status rail */

.rail { list-style: none; position: relative; padding-left: 4px; }

.rail-step {
  display: flex;
  gap: 14px;
  padding-bottom: 26px;
  position: relative;
}
.rail-step:last-child { padding-bottom: 0; }

.rail-step::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 20px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.rail-step:last-child::before { display: none; }

.dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--ink);
  flex-shrink: 0;
  margin-top: 2px;
  z-index: 1;
}

.rail-step.active .dot { border-color: var(--gold); background: var(--gold); box-shadow: 0 0 0 4px rgba(240,180,41,0.15); }
.rail-step.done .dot { border-color: var(--teal); background: var(--teal); }
.rail-step.done::before { background: var(--teal); }

.rail-step b { display: block; font-size: 14px; }
.rail-step small { color: var(--muted); font-size: 12px; }
.rail-step.active b { color: var(--gold); }
.rail-step.done b { color: var(--teal); }

/* emergency */

.emergency {
  max-width: 760px;
  margin: 26px auto 0;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 22px;
  background: rgba(242, 85, 90, 0.05);
}
.emergency h3 { font-family: var(--font-display); margin-bottom: 6px; }
.emergency p { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.emergency-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

.order-actions { max-width: 760px; margin: 30px auto 0; text-align: center; }
.ghost-link { color: var(--muted); font-size: 14px; }
.ghost-link:hover { color: var(--text); }

/* ---------- info sections ---------- */

.info { max-width: 760px; margin: 90px auto 0; }

.info h2 {
  font-family: var(--font-display);
  font-size: 26px;
  margin-bottom: 22px;
}

.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.how-grid b { display: block; margin-bottom: 6px; font-family: var(--font-display); }
.how-grid p { color: var(--muted); font-size: 14px; }

details {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}
summary { cursor: pointer; font-weight: 500; }
details p { color: var(--muted); font-size: 14px; padding-top: 10px; }

/* ---------- footer ---------- */

.foot {
  max-width: 1040px;
  margin: 0 auto;
  padding: 26px 20px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
}

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  /* header */
  .top { padding: 14px 16px; }
  .brand-logo { height: 60px; }
  .top-nav a { margin-left: 14px; font-size: 13px; }

  /* hero */
  main { padding: 0 14px 60px; }
  .screen { padding-top: 22px; }

  /* ticket */
  .ticket-half { padding: 16px 16px 14px; }
  .ticket-foot { padding: 14px 16px 18px; }
  .amount { font-size: 22px; }
  .ccy-btn { padding: 7px 10px; font-size: 14px; }

  /* order screen */
  .order-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .order-grid { grid-template-columns: 1fr; }
  .order-id { font-size: 22px; }
  .order-timer { font-size: 20px; align-self: flex-start; }

  /* info */
  .how-grid { grid-template-columns: 1fr; }
  .info { margin-top: 60px; }

  /* footer */
  .foot { flex-direction: column; gap: 6px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
