/* Flux UPI payment simulator (AWS console palette) — sized for a projector: large type, high contrast. */

:root {
  /* AWS console palette: Squid Ink navy surfaces, Smile orange accent, console blue for info. */
  --bg:        #0f1b2a;
  --bg-2:      #16212f;
  --surface:   #192534;
  --surface-2: #232f3e;
  --line:      #414d5c;
  --text:      #f2f3f3;
  --muted:     #a4adb8;
  --accent:    #ff9900;
  --accent-2:  #ffb84d;
  --on-accent: #0f1b2a;
  --info:      #539fe5;
  --ok:        #29ad32;
  --ok-dim:    #0e2e14;
  --warn:      #e0ca57;
  --bad:       #eb6f6f;
  --bad-dim:   #3a1416;
  --radius:    12px;
  --shadow:    0 18px 48px rgba(0,0,0,.45);
  --font: "Amazon Ember", "Helvetica Neue", Roboto, Arial, sans-serif;
  --mono: Monaco, Menlo, Consolas, "Courier Prime", Courier, "Courier New", monospace;
}

* { box-sizing: border-box; }

/* Any author `display` beats the UA stylesheet's [hidden]{display:none}, so an element
   with both (e.g. .qrbox__overlay, which is display:grid) stays painted while marked
   hidden. Settle it once here rather than per-component. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(900px 500px at 12% -8%,  rgba(255,153,0,.10), transparent 60%),
    radial-gradient(800px 460px at 92% 0%,   rgba(83,159,229,.10), transparent 60%);
  background-attachment: fixed;
}

h1 { font-size: 1.9rem; margin: 0 0 .25rem; letter-spacing: -.02em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; letter-spacing: -.01em; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ───────────────────────────────── topbar ───────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1.6rem;
  border-bottom: 1px solid var(--line);
  background: #232f3e;
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 650;
  font-size: 1.05rem;
  letter-spacing: -.01em;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  font-weight: 800;
  color: var(--on-accent);
}

.topbar__right { display: flex; align-items: center; gap: .75rem; }

.pill {
  font-size: .78rem;
  font-family: var(--mono);
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--bg-2);
  padding: .3rem .7rem;
  border-radius: 999px;
  white-space: nowrap;
}
.pill[data-state="bad"]  { color: var(--bad); border-color: var(--bad); }
.pill[data-state="good"] { color: var(--ok);  border-color: #1d5c22; }

/* ───────────────────────────────── buttons ──────────────────────────────── */
.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: .6rem 1.05rem;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text);
  transition: transform .06s ease, filter .15s ease, background .15s ease;
}
.btn:hover:not(:disabled)  { filter: brightness(1.15); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(255,153,0,.22);
}
.btn--ghost  { background: transparent; border-color: var(--line); color: var(--muted); }
.btn--danger { background: transparent; border-color: #6b2a2a; color: var(--bad); }
.btn--lg     { padding: .85rem 1.2rem; font-size: 1.02rem; width: 100%; }
.btn--block  { width: 100%; }

/* ───────────────────────────────── layout ───────────────────────────────── */
.view { padding: 2rem 1.6rem 3rem; }
.view[hidden] { display: none; }

.view--store {
  display: grid;
  grid-template-columns: minmax(0,1fr) 340px;
  gap: 2rem;
  max-width: 1280px;
  margin: 0 auto;
  align-items: start;
}

.store__head { margin-bottom: 1.4rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  transition: border-color .15s ease, transform .1s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }

.card__emoji { font-size: 2.1rem; line-height: 1; margin-bottom: .35rem; }
.card__name  { font-weight: 640; }
.card__desc  { color: var(--muted); font-size: .85rem; min-height: 2.4em; }
.card__foot  { display: flex; align-items: center; justify-content: space-between; margin-top: .6rem; }
.card__price { font-weight: 700; font-size: 1.12rem; }

/* cart */
.cart {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem;
  position: sticky;
  top: 5rem;
}
.cart__lines { display: flex; flex-direction: column; gap: .55rem; margin-bottom: .9rem; }
.cart__empty { margin: .2rem 0 .4rem; }

.cart__line {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: .6rem;
  align-items: center;
  font-size: .92rem;
}
.cart__line button {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0 .2rem;
}
.cart__line button:hover { color: var(--bad); }
.cart__qty { color: var(--muted); font-variant-numeric: tabular-nums; }

.cart__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: .9rem;
  margin-bottom: 1rem;
  border-top: 1px solid var(--line);
  font-size: 1.05rem;
}
.cart__total strong { font-size: 1.5rem; letter-spacing: -.02em; }

/* ───────────────────────────────── stage ───────────────────────────────── */
.view--stage { max-width: 1280px; margin: 0 auto; }

.stage {
  display: grid;
  grid-template-columns: minmax(0,1fr) 330px;
  gap: 2.4rem;
  align-items: start;
  margin-bottom: 2rem;
}

.panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.panel__tag {
  position: absolute;
  top: -.72rem;
  left: 1.2rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .12rem .7rem;
  font-size: .74rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel__tag--loose {
  position: static;
  display: inline-block;
  margin: 0 auto .8rem;
  text-transform: uppercase;
}

/* checkout */
.checkout__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 1.1rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}
.checkout__payee  { font-weight: 660; font-size: 1.12rem; }
.checkout__amount { font-size: 2.1rem; font-weight: 720; letter-spacing: -.03em; }

/* 316 = 292px of usable space + 12px padding each side. The 292 must stay in step
   with the fitPx passed to QR.toSvg, which picks a whole-pixel module size to fit it. */
.qrbox {
  position: relative;
  width: 316px;
  max-width: 100%;
  margin: 0 auto;
  aspect-ratio: 1;
  background: #fff;
  border-radius: 14px;
  padding: 12px;
  display: grid;
  place-items: center;
}
.qrbox__inner { width: 100%; height: 100%; display: grid; place-items: center; }

/* Never stretch the symbol — it is already sized to a whole number of pixels per
   module, and scaling it here would reintroduce the antialiasing this avoids. */
.qrbox__inner svg {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}

.qrbox__overlay {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1rem;
  background: rgba(15,27,42,.90);
  color: var(--text);
  font-weight: 600;
}

.checkout__scanhint { text-align: center; margin: .9rem 0 1.1rem; }

.checkout__status {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .8rem 1rem;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-weight: 560;
}
.checkout__status .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 0 rgba(255,153,0,.5);
  animation: pulse 1.6s infinite;
  flex: none;
}
.checkout__status[data-state="success"] { border-color: #1d5c22; background: var(--ok-dim); }
.checkout__status[data-state="success"] .dot { background: var(--ok); animation: none; }
.checkout__status[data-state="failed"]  { border-color: #6b2a2a; background: var(--bad-dim); }
.checkout__status[data-state="failed"] .dot { background: var(--bad); animation: none; }
.checkout__timer {
  margin-left: auto;
  font-family: var(--mono);
  font-size: .88rem;
  color: var(--muted);
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0   rgba(255,153,0,.5); }
  70%  { box-shadow: 0 0 0 9px rgba(255,153,0,0); }
  100% { box-shadow: 0 0 0 0   rgba(255,153,0,0); }
}

/* wire inspector */
.wire { margin-top: 1.1rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.wire summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.wire summary:hover { color: var(--text); }
.wire__label {
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--muted);
  margin: .8rem 0 .3rem;
  word-break: break-all;
}
.wire pre {
  margin: 0;
  padding: .7rem .8rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1.45;
  color: var(--muted);
  max-height: 190px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ───────────────────────────────── phone ───────────────────────────────── */
.phone-wrap { display: flex; flex-direction: column; align-items: center; }

/* Height tracks the viewport so the action buttons at the bottom of the screen stay
   reachable without scrolling. The floor is set by the tallest screen's content — the
   review screen needs roughly 470px (preview + account + note + two buttons) — so
   anything less clips a button. The ceiling stops it looking stretched on a tall
   monitor. */
.phone {
  position: relative;
  width: 300px;
  height: clamp(520px, calc(100vh - 140px), 680px);
  background: #0a1420;
  border: 9px solid #232f3e;
  border-radius: 42px;
  box-shadow: var(--shadow), inset 0 0 0 1px #000;
  overflow: hidden;
  flex: none;
}
.phone__notch {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 122px; height: 22px;
  background: #232f3e;
  border-radius: 0 0 14px 14px;
  z-index: 3;
}
.phone__screen {
  position: absolute;
  inset: 0;
  padding: 2.1rem 1.05rem 1.05rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Safety valve: if a screen's content ever exceeds the phone, scroll inside the device
   rather than clipping a button off the bottom edge. Invisible when it isn't needed. */
.pscreen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  animation: fade .22s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.pscreen__title { font-weight: 640; font-size: 1rem; margin: .3rem 0 .9rem; }

/* scanner */
.scanner {
  position: relative;
  flex: 1;
  border-radius: 16px;
  background: #0f1b2a;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-bottom: 1rem;
}
.scanner__frame {
  width: 168px; height: 168px;
  border-radius: 14px;
  box-shadow: 0 0 0 2px var(--accent-2);
  position: relative;
}
.scanner__frame::after {
  content: "";
  position: absolute;
  left: 6px; right: 6px; top: 8px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-2), transparent);
  animation: sweep 2s ease-in-out infinite;
}
@keyframes sweep {
  0%, 100% { transform: translateY(0); opacity: .35; }
  50%      { transform: translateY(150px); opacity: 1; }
}
.scanner__hint { position: absolute; bottom: .9rem; color: var(--muted); font-size: .78rem; }

/* Nothing to scan yet — hold the sweep still so it doesn't imply activity. */
.scanner--idle .scanner__frame { box-shadow: 0 0 0 2px var(--line); }
.scanner--idle .scanner__frame::after { animation: none; opacity: .15; }

/* review */
.preview {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  text-align: center;
  margin-bottom: .9rem;
}
.preview__to     { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.preview__name   { font-weight: 660; font-size: 1.05rem; margin: .25rem 0 .1rem; }
.preview__vpa    { color: var(--muted); font-size: .8rem; font-family: var(--mono); word-break: break-all; }
.preview__amount { font-size: 2.15rem; font-weight: 720; letter-spacing: -.03em; margin: .7rem 0 0; }
.preview__note   { color: var(--muted); font-size: .78rem; }

.acct {
  display: flex;
  align-items: center;
  gap: .65rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .65rem .8rem;
  margin-bottom: .9rem;
}
.acct__logo {
  width: 32px; height: 32px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: #232f3e; color: var(--accent); font-weight: 700; font-size: .72rem;
}
.acct__meta { font-size: .8rem; line-height: 1.35; }
.acct__bank { font-weight: 600; }

.pspacer { flex: 1; }
.pactions { display: flex; flex-direction: column; gap: .5rem; }

.pnote {
  font-size: .74rem;
  line-height: 1.4;
  color: var(--warn);
  background: rgba(255,153,0,.08);
  border: 1px solid rgba(255,153,0,.3);
  border-radius: 9px;
  padding: .5rem .6rem;
  margin-bottom: .6rem;
}

/* pin */
.pin { text-align: center; }
.pin__dots { display: flex; justify-content: center; gap: .8rem; margin: 1.2rem 0 1.6rem; }
.pin__dot {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--line);
  transition: background .12s ease, border-color .12s ease, transform .12s ease;
}
.pin__dot[data-filled="1"] {
  background: var(--accent-2);
  border-color: var(--accent-2);
  transform: scale(1.12);
}
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.keypad button {
  font: inherit;
  font-size: 1.32rem;
  font-weight: 560;
  padding: .55rem 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.keypad button:active { background: var(--surface-2); transform: translateY(1px); }
.keypad button.ghost { border-color: transparent; background: none; color: var(--muted); font-size: 1rem; }

/* phone result */
.presult { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .55rem; }
.presult__icon {
  width: 74px; height: 74px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 2.3rem;
  margin-bottom: .3rem;
  animation: pop .3s cubic-bezier(.2,1.4,.4,1);
}
.presult__icon[data-kind="ok"]  { background: var(--ok-dim);  color: var(--ok);  }
.presult__icon[data-kind="bad"] { background: var(--bad-dim); color: var(--bad); }
.presult__title { font-weight: 680; font-size: 1.15rem; }
.presult__code {
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .25rem .55rem;
}
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ───────────────────────────────── flow ────────────────────────────────── */
.flow {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem 1.5rem 1.5rem;
}
.flow__head {
  display: flex;
  align-items: baseline;
  gap: .9rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}
.flow__title { font-weight: 660; font-size: 1.05rem; }

.flow__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: .4rem;
  overflow-x: auto;
}

.hop { position: relative; text-align: center; padding-top: 1.6rem; min-width: 104px; }

/* connector */
.hop::before {
  content: "";
  position: absolute;
  top: .62rem;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--line);
  transition: background .3s ease;
}
.hop:first-child::before { display: none; }
.hop[data-state="done"]::before,
.hop[data-state="active"]::before { background: var(--accent); }
.hop[data-state="failed"]::before { background: var(--bad); }

.hop__bead {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 21px; height: 21px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--bg-2);
  display: grid;
  place-items: center;
  font-size: .68rem;
  font-weight: 700;
  color: transparent;
  transition: all .25s ease;
}
.hop[data-state="active"] .hop__bead {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 0 0 0 rgba(255,153,0,.55);
  animation: pulseAccent 1.3s infinite;
}
.hop[data-state="done"] .hop__bead {
  border-color: var(--ok);
  background: var(--ok);
  color: #04160c;
}
.hop[data-state="failed"] .hop__bead {
  border-color: var(--bad);
  background: var(--bad);
  color: #fff;
}
@keyframes pulseAccent {
  0%   { box-shadow: 0 0 0 0    rgba(255,153,0,.55); }
  70%  { box-shadow: 0 0 0 11px rgba(255,153,0,0); }
  100% { box-shadow: 0 0 0 0    rgba(255,153,0,0); }
}

.hop__label {
  font-size: .82rem;
  font-weight: 560;
  color: var(--muted);
  line-height: 1.3;
  transition: color .25s ease;
  padding: 0 .2rem;
}
.hop[data-state="done"] .hop__label,
.hop[data-state="active"] .hop__label { color: var(--text); }
.hop[data-state="failed"] .hop__label { color: var(--bad); }

.hop__actor { font-size: .7rem; color: #7d8998; margin-top: .18rem; }
.hop__ms    { font-family: var(--mono); font-size: .66rem; color: #687078; margin-top: .1rem; min-height: 1em; }

/* Hops we infer from the status API rather than observe directly. */
.hop[data-inferred="1"] .hop__label::after {
  content: "*";
  color: #687078;
  margin-left: 2px;
}

/* ─────────────────────────────── receipt ──────────────────────────────── */
.view--receipt { display: grid; place-items: center; min-height: 70vh; }
.receipt {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2.4rem;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}
.receipt__tick {
  width: 72px; height: 72px; margin: 0 auto 1.1rem;
  border-radius: 50%;
  background: var(--ok-dim);
  color: var(--ok);
  font-size: 2.3rem;
  display: grid; place-items: center;
  animation: pop .35s cubic-bezier(.2,1.4,.4,1);
}
.receipt__rows {
  margin: 1.6rem 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .55rem 1.1rem;
  text-align: left;
  font-size: .88rem;
}
.receipt__rows dt { color: var(--muted); }
.receipt__rows dd {
  margin: 0;
  font-family: var(--mono);
  font-size: .8rem;
  word-break: break-all;
}
.receipt__actions { margin-top: 1.8rem; }

/* ─────────────────────────────── misc ─────────────────────────────────── */
.spinner {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.18);
  border-top-color: var(--accent-2);
  animation: spin .8s linear infinite;
}
.spinner--dark { border-color: rgba(0,0,0,.12); border-top-color: var(--accent); }
.spinner--sm { width: 17px; height: 17px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  transform: translateX(-50%);
  background: var(--bad-dim);
  border: 1px solid var(--bad);
  color: #ffd7de;
  padding: .8rem 1.1rem;
  border-radius: 12px;
  max-width: min(720px, 92vw);
  font-size: .88rem;
  z-index: 60;
  box-shadow: var(--shadow);
}
.toast[hidden] { display: none; }
.toast strong { color: #fff; }

@media (max-width: 1080px) {
  .view--store, .stage { grid-template-columns: 1fr; }
  .cart { position: static; }
  .phone-wrap { margin-top: 1rem; }
}
