/* The app: one card in the middle of the page, and the card is the only box. Inside it, the
   two legs share one surface split by a hairline, and settings are quiet rows. Pills, legs,
   token chips and the flip button come from base.css, shared with the landing page. */
:root { --err: #FF7A6E; --surface: #0B0D13; }

.app { position: relative; display: flex; flex-direction: column; align-items: center; min-height: calc(100svh - 140px); padding: clamp(40px, 8vh, 88px) 16px 72px; overflow: hidden; }
/* The shared smoke (fluid.js) sits behind the whole app too, a little dimmer than on the
   landing page so the card stays the focus. It fades in rather than popping on. */
.page-veil { --dim: .3; }
.fluid { animation: fluid-in 1.6s ease-out both; }
@keyframes fluid-in { from { opacity: 0; } }
.stage { position: relative; width: 100%; max-width: 460px; }

/* Tabs sit above the card as plain text; a soft thumb slides to the selected one. */
.tabs { position: relative; display: flex; gap: 2px; margin: 0 0 12px; }
.tabs.off { opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
.tabs button { position: relative; z-index: 1; border: 0; background: none; color: var(--ink-3); font: 500 15px var(--sans); letter-spacing: -.01em; padding: 8px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; transition: color .25s; }
.tabs button:hover { color: var(--ink-2); }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs-thumb { position: absolute; top: 0; bottom: 0; left: 0; width: var(--w, 0); transform: translateX(var(--x, 0)); border-radius: 999px; background: rgb(255 255 255 / .07); }
.tabs.ready .tabs-thumb { transition: transform .45s cubic-bezier(.22, 1, .36, 1), width .45s cubic-bezier(.22, 1, .36, 1); }

.card { position: relative; overflow: hidden; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 40px 80px -40px rgb(0 0 0 / .85); }
.view { display: flex; flex-direction: column; }
.view[hidden] { display: none; }

/* Legs without boxes of their own. */
.card .leg { padding: 20px 22px 18px; border: 0; border-radius: 0; background: none; }
.leg-amount.is-empty { color: var(--ink-3); }
.leg-foot.bad { color: var(--err); }
.leg-foot q { quotes: "“" "”"; color: var(--ink-2); }
.handle { text-transform: lowercase; }

/* The hairline between the legs, with the flip button sitting on it. */
.seam { position: relative; height: 1px; margin: 0 22px; background: var(--line); }
.seam .flip { position: absolute; left: 50%; top: 50%; margin: 0; width: 36px; height: 36px; transform: translate(-50%, -50%); border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); }
.seam .flip svg { width: 16px; height: 16px; }

.d-input::placeholder { color: var(--ink-3); font-family: var(--sans); }

/* Details: quiet rows under a hairline. A row shows its value until you tap it to edit. */
.details { margin: 0 22px; padding: 4px 0 8px; border-top: 1px solid var(--line); }
.drow { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 46px; }
.d-label { flex-shrink: 0; font-size: 13.5px; color: var(--ink-3); }
.d-label small { font-size: 12px; opacity: .8; }
.d-show { display: inline-flex; align-items: baseline; justify-content: flex-end; gap: 10px; min-width: 0; padding: 6px 0; border: 0; background: none; color: var(--ink); font: 400 13px var(--mono); cursor: pointer; }
.d-show span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-show small { flex-shrink: 0; font: 500 12.5px var(--sans); color: var(--ink-3); transition: color .15s; }
.d-show:hover small { color: var(--ink); }
.d-show.empty { color: var(--bolt); font: 500 13.5px var(--sans); }
.d-show.empty:hover { color: var(--bolt-hover); }
.d-input { flex: 1; min-width: 0; padding: 7px 0; background: none; border: 0; border-bottom: 1px solid var(--line-strong); outline: none; color: var(--ink); font: 400 13px var(--mono); text-align: right; caret-color: var(--bolt); }
.drow:not(.editing) .d-input, .drow.editing .d-show { display: none; }
.drow.bad .d-input { border-color: var(--err); }
.drow.bad .d-show span { color: var(--err); }
.d-note { margin: 2px 0 8px; font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }

.card .go { width: auto; margin: 4px 8px 8px; }
.err { margin: 4px 22px 16px; font-size: 13.5px; line-height: 1.45; color: var(--err); text-align: center; }
.tabs button:focus-visible, .d-show:focus-visible, .copy:focus-visible, .back:focus-visible { outline: 2px solid var(--bolt); outline-offset: 3px; }

.terms { margin: 18px 0 0; text-align: center; font: 400 12.5px var(--mono); color: var(--ink-3); }
.app-note { margin: 8px auto 0; max-width: 380px; text-align: center; font-size: 13.5px; line-height: 1.5; color: var(--ink-3); }

/* --- A swap in progress ------------------------------------------------------------- */
.sv { padding: 18px 22px 20px; }
.sv-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 28px; }
.back { display: inline-flex; align-items: center; gap: 6px; padding: 4px 2px; border: 0; background: none; color: var(--ink-2); font: 500 13.5px var(--sans); cursor: pointer; transition: color .15s; }
.back:hover { color: var(--ink); }
.back svg { width: 14px; height: 14px; }
.sv-clock { font: 400 12.5px var(--mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.sv-clock.soon { color: var(--bolt); }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 14px; }
.steps i { position: relative; height: 3px; border-radius: 3px; background: rgb(255 255 255 / .08); overflow: hidden; transition: background-color .4s; }
.steps i.done { background: rgb(255 255 255 / .8); }
.steps.complete i { background: var(--bolt); }
.steps i.now::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 45%; background: linear-gradient(90deg, transparent, rgb(255 255 255 / .9), transparent); animation: run 1.5s ease-in-out infinite; }
.steps i.bad { background: var(--err); }
@keyframes run { from { transform: translateX(-100%); } to { transform: translateX(230%); } }
.step-label { display: flex; justify-content: space-between; gap: 12px; margin: 10px 0 0; font-size: 13px; color: var(--ink-2); }
.step-label span:last-child { font: 400 12px var(--mono); color: var(--ink-3); }

.qr { width: 208px; margin: 24px auto 0; padding: 12px; border-radius: 18px; background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }

.sv-amount { margin: 20px 0 0; text-align: center; }
.sv-cap { display: block; font-size: 13px; color: var(--ink-3); }
.sv-cap.lit { color: var(--bolt); }
.sv-big { display: block; margin-top: 4px; font: 300 36px/1.15 var(--sans); letter-spacing: -.035em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sv-big small { font-size: 16px; letter-spacing: -.01em; color: var(--ink-3); }

/* Swap facts: the same quiet rows as the form, with a hairline only between rows. */
.sv-rows { margin: 16px 0 0; }
.sv-rows:empty { display: none; }
.sv-rows > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; }
.sv-rows > div + div { border-top: 1px solid var(--line); }
.sv-rows dt { flex-shrink: 0; font-size: 13.5px; color: var(--ink-3); }
.sv-rows dd { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; margin: 0; font: 400 13px var(--mono); color: var(--ink); }
.sv-rows code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: inherit; }
.sv-rows a { color: inherit; text-decoration: none; }
.sv-rows a:hover { color: var(--bolt); }
.copy { flex-shrink: 0; padding: 0; border: 0; background: none; color: var(--ink-3); font: 500 12.5px var(--sans); cursor: pointer; transition: color .15s; }
.copy:hover { color: var(--ink); }
.copy.done { color: var(--bolt); }

.sv-actions { display: grid; gap: 8px; margin-top: 18px; }
.sv-note { margin: 14px 8px 0; font-size: 13px; line-height: 1.5; color: var(--ink-3); text-align: center; }
.sv-note.bad { color: var(--err); }
.sv-wait { padding: 30px 0 4px; text-align: center; }

/* --- Footer --------------------------------------------------------------------------- */
.app-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; max-width: 1200px; margin: 0 auto; padding: 22px clamp(16px, 4vw, 32px); border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }
.app-foot nav { display: flex; gap: 20px; }
.app-foot a { color: var(--ink-2); text-decoration: none; }
.app-foot a:hover { color: var(--ink); }

@media (max-width: 520px) {
  .tabs button { padding: 8px 11px; font-size: 14px; }
  .card .leg { padding: 18px 18px 16px; }
  .seam, .details { margin-left: 18px; margin-right: 18px; }
  .sv { padding: 16px 18px 18px; }
  .sv-big { font-size: 30px; }
  .qr { width: 196px; }
  .app-foot { flex-direction: column; align-items: flex-start; }
}
