/* IRXC DAAP - public Send / Bridge pages. Same soft (neumorphic) look and
   colour tokens as IRXC Radar, sized for a phone first: these pages are
   opened mostly inside wallet apps' DApp browsers. */

/* Layers (Hesam 2026-11-03: "add depth, inner, outer, play with colors"):
   page --bg  <  card --surface  <  button --raised ;  input well --well sits
   below the card. --surface is the one hand-picked value per theme; the other
   layers are mixed from it, so changing --surface moves them all. */
:root {
    --bg: #e4e9f2;
    --surface: #dadde3;
    --raised: color-mix(in srgb, var(--surface), #fff 55%);
    --well: color-mix(in srgb, var(--surface), #1b2333 7%);
    --edge: rgba(255, 255, 255, .65);
    --ink: #3b4559;
    --ink-soft: #5d6575;
    --ink-faint: #8a93a6;
    --accent: #4f6bed;
    --accent-2: #7a5cf0;
    --accent-ink: #ffffff;
    --danger: #d64550;
    --ok: #16a06b;
    --warn: #c8871b;
    --gold: #f0b90b;
    /* card header colour per step */
    --h-net: #4f6bed;
    --h-to: #0f9bb5;
    --h-amount: #8b5cf6;
    --h-review: #16a06b;
    --sh-card: 9px 9px 20px #b8c0cd, -7px -7px 16px #ffffff;
    --sh-raise: 3px 3px 7px color-mix(in srgb, var(--surface), #000 18%), -3px -3px 7px color-mix(in srgb, var(--surface), #fff 80%);
    --sh-press: inset 3px 3px 7px color-mix(in srgb, var(--well), #000 16%), inset -3px -3px 7px color-mix(in srgb, var(--well), #fff 60%);
    --sh-glow: 0 8px 20px color-mix(in srgb, var(--accent) 38%, transparent);
    --r-lg: 20px;
    --r-md: 14px;
}

/* Dark = data-theme="dark" on <html>, set by theme.js (shared with the radar). */
:root[data-theme="dark"] {
    --bg: #262b36;
    --surface: #373e4e;
    --raised: color-mix(in srgb, var(--surface), #fff 8%);
    --well: color-mix(in srgb, var(--surface), #000 30%);
    --edge: rgba(255, 255, 255, .06);
    --ink: #e6eaf2;
    --ink-soft: #a3adbf;
    --ink-faint: #7a8496;
    --accent: #7b91ff;
    --accent-2: #a58bff;
    --accent-ink: #ffffff;
    --danger: #ff6b76;
    --ok: #4cc48c;
    --warn: #e3a53f;
    --h-net: #8098ff;
    --h-to: #48c8e0;
    --h-amount: #b18cff;
    --h-review: #4cc48c;
    --sh-card: 10px 10px 24px rgba(0, 0, 0, .45), -5px -5px 14px rgba(255, 255, 255, .035);
    --sh-raise: 3px 3px 8px rgba(0, 0, 0, .38), -2px -2px 6px rgba(255, 255, 255, .06);
    --sh-press: inset 3px 3px 8px rgba(0, 0, 0, .5), inset -2px -2px 6px rgba(255, 255, 255, .04);
    --sh-glow: 0 8px 22px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* Self-hosted font (served by daap/server.js) */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/plex-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/plex-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/plex-600.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/plex-700.woff2") format("woff2"); }

* { box-sizing: border-box; }
/* `hidden` must win over any display rule below (.seg, .flow are flex). */
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.45 'IBM Plex Sans', system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
button, input { font: inherit; color: inherit; }

/* ---------- chooser */
.home { max-width: 640px; margin: 8vh auto; padding: 0 16px; text-align: center; }
.home h1 { margin: 10px 0 4px; font-size: 28px; }
.home p { margin: 0 0 30px; color: var(--ink-soft); }
.coin {
    display: block; width: 76px; height: 76px; margin: 0 auto;
    border-radius: 19px; box-shadow: var(--sh-card);   /* = the icon's own 48/192 corner */
}
.home-btns { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; }
.home-btn {
    --hue: var(--h-net);
    flex: 1 1 240px; max-width: 290px; padding: 26px 18px 24px;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    border-radius: var(--r-lg); border: 1px solid var(--edge);
    background: linear-gradient(160deg, color-mix(in srgb, var(--surface), #fff 22%), var(--surface) 65%);
    box-shadow: var(--sh-card);
    color: var(--ink); text-decoration: none; font-size: 19px; font-weight: 700;
}
.home-btn + .home-btn { --hue: var(--h-amount); }
.home-btn small { font-size: 13px; font-weight: 400; color: var(--ink-soft); }
.home-ic {
    display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%;
    font-size: 38px; line-height: 1; color: var(--hue);
    background: var(--well); box-shadow: var(--sh-press);
}
.home-ic-logos { display: flex; width: auto; padding: 0 16px; border-radius: 38px; gap: 8px; font-size: 22px; }
.home-ic-logos img { width: 40px; height: 40px; }

/* ---------- app page */
.bar {
    position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    /* back | title | connect - the title stays centred whatever the sides hold */
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 16px 16px 0 16px;
}
.back { justify-self: start; font-size: 15px; font-weight: 600; text-decoration: none; color: var(--ink-soft); white-space: nowrap; }
.back:hover { color: var(--accent); }
.bar #connectBtn { justify-self: end; white-space: nowrap; }
.page-title { margin: 0; font-size: 20px; text-align: center; white-space: nowrap; }
@media (max-width: 520px) {
    .back { font-size: 22px; line-height: 1; padding: 0 4px; }
    .back-txt { display: none; }
    .page-title { font-size: 17px; }
}

.wrap { max-width: 520px; margin: 0 auto; padding: 10px 16px 40px; display: flex; flex-direction: column; gap: 18px; }
.card {
    --hue: var(--accent);
    border-radius: var(--r-lg); padding: 16px 16px 18px; border: 1px solid var(--edge);
    background: linear-gradient(160deg, color-mix(in srgb, var(--surface), #fff 16%), var(--surface) 55%);
    box-shadow: var(--sh-card);
}
#stepNet { --hue: var(--h-net); }
#stepTo { --hue: var(--h-to); }
#stepAmount { --hue: var(--h-amount); }
#stepReview, .status { --hue: var(--h-review); }
.card[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.card-h { display: flex; align-items: center; gap: 9px; font-weight: 700; margin-bottom: 12px; }
.card-h::before {
    content: ""; width: 5px; height: 18px; border-radius: 3px;
    background: linear-gradient(var(--hue), color-mix(in srgb, var(--hue) 45%, transparent));
}

.notice {
    border-radius: var(--r-md); padding: 12px 14px; font-weight: 600;
    background: var(--well); box-shadow: var(--sh-press);
}
.notice.bad { color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, var(--well)); }
.notice.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--well)); }
.notice [dir="rtl"] { margin-top: 4px; }

.btn {
    border: 0; cursor: pointer; border-radius: var(--r-md); padding: 12px 16px;
    background: var(--raised); box-shadow: var(--sh-raise); font-weight: 600;
}
.btn:disabled { cursor: not-allowed; opacity: .55; box-shadow: none; pointer-events: none; }
.btn-small { padding: 7px 12px; font-size: 13px; }
.btn-ghost { box-shadow: none; background: transparent; color: var(--accent); }
#connectBtn {
    background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink);
    box-shadow: var(--sh-glow); border-radius: 999px; padding: 8px 16px;
}
.btn-go {
    width: 100%; margin-top: 14px; padding: 15px; font-size: 17px; letter-spacing: .2px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink);
    box-shadow: var(--sh-glow);
}
/* Waiting state: clearly not pressable, still readable - no blur, no glow. */
.btn-go:disabled { opacity: 1; box-shadow: var(--sh-press); background: var(--well); color: var(--ink-faint); }

.seg { display: flex; gap: 8px; padding: 5px; border-radius: calc(var(--r-md) + 5px); background: var(--well); box-shadow: var(--sh-press); }
.seg button {
    flex: 1; border: 0; cursor: pointer; border-radius: var(--r-md); padding: 11px 8px;
    background: transparent; box-shadow: none; font-weight: 600; color: var(--ink-soft);
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.seg button:hover { color: var(--ink); }
.seg button img { width: 22px; height: 22px; }
.seg button.on { background: var(--raised); box-shadow: var(--sh-raise); color: var(--hue); }
.seg-sm { margin-bottom: 12px; }
.seg-sm button { padding: 9px 6px; font-size: 14px; }

.field {
    display: flex; align-items: center; gap: 8px; border-radius: var(--r-md);
    padding: 6px 8px 6px 14px; background: var(--well); box-shadow: var(--sh-press);
    outline: 2px solid transparent; transition: outline-color .15s;
}
.field:focus-within { outline-color: color-mix(in srgb, var(--hue) 55%, transparent); }
.field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 8px 0; font-size: 16px; }
.field input::placeholder { color: var(--ink-faint); }
.field.locked { background: color-mix(in srgb, var(--ok) 10%, var(--well)); }
.field.locked input { color: var(--ok); font-weight: 600; }
#toInput { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }
.unit { color: var(--ink-faint); font-weight: 600; }
#maxBtn { color: var(--hue); }

.hint { min-height: 20px; margin-top: 8px; font-size: 13.5px; color: var(--ink-soft); }
.hint.ok { color: var(--ok); }
.hint.bad { color: var(--danger); }
.hint.warn { color: var(--warn); }
.center { text-align: center; }

.bal { margin-top: 12px; display: flex; gap: 10px; }
.bal div { flex: 1; border-radius: var(--r-md); background: var(--well); box-shadow: var(--sh-press); padding: 8px 10px; font-size: 13px; color: var(--ink-soft); }
.bal b { display: block; font-size: 16px; color: var(--ink); }

#stepReview {
    background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 12%, var(--surface)), var(--surface) 70%);
    border-color: color-mix(in srgb, var(--accent) 22%, var(--edge));
}
.review { font-weight: 700; font-size: 18px; }
.fee { margin-top: 6px; font-size: 13.5px; color: var(--ink-soft); }

/* token moving from one chain to the other */
.flow { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.flow-end { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; width: 64px; }
.flow-end img { width: 34px; height: 34px; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .18)); }
.flow-track { position: relative; flex: 1; height: 8px; border-radius: 4px; background: var(--well); box-shadow: var(--sh-press); }
.flow-dot {
    /* A green arrow that travels from the source chain (left) to the
       destination (right) and fades out on arrival, then starts again. */
    position: absolute; top: -8px; left: 0; width: 34px; height: 22px;
    background: linear-gradient(90deg, transparent, var(--ok) 55%);
    clip-path: polygon(0 35%, 62% 35%, 62% 0, 100% 50%, 62% 100%, 62% 65%, 0 65%);
    animation: ride 1.8s ease-in infinite;
}
@keyframes ride {
    0%   { left: 0; opacity: 0; }
    15%  { opacity: 1; }
    75%  { opacity: 1; }
    100% { left: calc(100% - 34px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .flow-dot { animation: none; left: calc(50% - 17px); } }

/* status after signing */
.steps { display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; align-items: center; gap: 12px; color: var(--ink-faint); }
.step i {
    width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--well); box-shadow: var(--sh-press);
    display: grid; place-items: center; font-style: normal; font-size: 14px; font-weight: 700;
}
.step.done { color: var(--ink); }
.step.done i { color: var(--ok); background: var(--raised); box-shadow: var(--sh-raise); }
.step.now { color: var(--ink); font-weight: 600; }
.step.now i { color: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.step.bad { color: var(--danger); }
@keyframes pulse { 50% { transform: scale(1.15); } }
.status-msg { margin-top: 14px; font-size: 14px; color: var(--ink-soft); }
.links { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.links a { color: var(--accent); }
#againBtn { margin-top: 12px; width: 100%; }

.dlg { border: 1px solid var(--edge); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); padding: 20px; box-shadow: var(--sh-card); width: min(92vw, 360px); }
.dlg h3 { margin: 0 0 14px; }
.dlg .btn { display: block; width: 100%; margin-top: 10px; }
.dlg::backdrop { background: rgba(20, 24, 32, .45); }

/* Light/dark button (theme.js, shared with the radar). */
.theme-toggle {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 50;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: var(--raised);
    color: var(--ink);
    box-shadow: var(--sh-card);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}


/* Jelly press, same feel as the radar: every pressable thing lifts on hover,
   sinks and squashes a little on press, and springs back. One rule for all. */
.btn, .seg button, .home-btn, .theme-toggle {
    transition: transform .22s cubic-bezier(.34, 1.56, .64, 1), box-shadow .16s ease,
                background .16s ease, color .16s ease, opacity .16s ease;
}
.btn:hover:not(:disabled), .seg button:hover, .theme-toggle:hover { transform: translateY(-2px); }
.home-btn:hover { transform: translateY(-3px); }
.btn:active:not(:disabled), .seg button:active, .home-btn:active, .theme-toggle:active {
    transform: translateY(1px) scale(.97); box-shadow: var(--sh-press); transition-duration: .08s;
}
.btn-ghost:hover:not(:disabled) { transform: none; }
.btn-ghost:active:not(:disabled) { box-shadow: none; transform: scale(.95); }
@media (prefers-reduced-motion: reduce) {
    .btn, .seg button, .home-btn, .theme-toggle { transition: none; }
}
