/*
 * Zenotta UI kit — shared styles.
 * Each skin redefines the variables on :root to get its own identity.
 */
:root {
  --z-bg: #EDF0F2;
  --z-surface: #FFFFFF;
  --z-surface-2: #F5F7F8;
  --z-ink: #16202E;
  --z-muted: #5B6878;
  --z-line: #D5DBE1;
  --z-accent: #0A8F86;
  --z-accent-ink: #FFFFFF;
  --z-mining: #E8A317;
  --z-ok: #1F9D57;
  --z-bad: #C8364B;
  --z-radius: 14px;
  --z-radius-sm: 8px;
  --z-shadow: 0 18px 50px -20px rgba(22, 32, 46, .45);
  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Instrument Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--z-bg); color: var(--z-ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--z-accent); outline-offset: 2px; }
.z-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- base elements ---------- */
.zbtn {
  appearance: none; border: 0; cursor: pointer;
  background: var(--z-accent); color: var(--z-accent-ink);
  font-weight: 600; padding: .72em 1.15em; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  transition: transform .12s ease, filter .12s ease;
}
.zbtn:hover { filter: brightness(1.06); }
.zbtn:active { transform: scale(.97); }
.zbtn[disabled] { opacity: .45; cursor: not-allowed; }
.zbtn--ghost { background: transparent; color: var(--z-ink); box-shadow: inset 0 0 0 1.5px var(--z-line); }
.zbtn--wide { width: 100%; padding: .95em 1.2em; font-size: 1.05rem; }
.zbtn--sm { padding: .45em .8em; font-size: .88rem; }

.zfield { display: grid; gap: .35rem; margin: 0 0 1rem; }
.zfield > span { font-size: .88rem; font-weight: 600; color: var(--z-muted); }
.zinput, .zfield input, .zfield select {
  width: 100%; border: 1.5px solid var(--z-line); background: var(--z-surface);
  border-radius: var(--z-radius-sm); padding: .7em .85em; min-height: 46px;
}
.zfield input:focus, .zfield select:focus { border-color: var(--z-accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--z-accent) 25%, transparent); }
.zinput--id, input.zinput--id { font-family: var(--font-mono); letter-spacing: .18em; text-transform: uppercase; font-size: 1.15rem; }
.zhint { font-size: .85rem; color: var(--z-muted); margin: .2rem 0 1rem; }
.zerr { color: var(--z-bad); font-size: .9rem; min-height: 1.3em; margin: 0 0 .6rem; }

.zrange { display: flex; align-items: center; gap: .8rem; }
.zrange input[type=range] { flex: 1; accent-color: var(--z-accent); min-height: auto; padding: 0; border: 0; }
.zrange output { font-family: var(--font-mono); min-width: 4.5ch; text-align: right; font-weight: 600; }

.zchips { display: flex; flex-wrap: wrap; gap: .4rem; margin: -.4rem 0 1rem; }
.zchip {
  display: inline-flex; align-items: center; gap: .35rem; cursor: pointer;
  border: 1.5px solid var(--z-line); background: var(--z-surface); border-radius: 999px;
  padding: .2rem .6rem .2rem .25rem; font-family: var(--font-mono); font-size: .82rem; letter-spacing: .06em;
}
.zchip .z-identicon { width: 20px; height: 20px; }
.zchip[aria-pressed=true] { border-color: var(--z-accent); background: color-mix(in srgb, var(--z-accent) 12%, var(--z-surface)); }

.zid {
  font-family: var(--font-mono); letter-spacing: .14em; font-weight: 600;
  display: inline-flex; align-items: center; gap: .3em;
}
.zid-inline { font-family: var(--font-mono); letter-spacing: .08em; font-weight: 600; white-space: nowrap; }
.zempty { padding: 1.4rem; border: 1.5px dashed var(--z-line); border-radius: var(--z-radius); color: var(--z-muted); text-align: center; }
.ztag { display: inline-block; font-size: .8rem; font-weight: 600; padding: .25em .7em; border-radius: 999px; background: var(--z-surface-2); color: var(--z-muted); }

/* ---------- wallet pill ---------- */
.zpill {
  display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; border: 0;
  background: var(--z-surface); color: var(--z-ink); border-radius: 999px;
  padding: .3rem .9rem .3rem .3rem; box-shadow: 0 1px 0 var(--z-line), 0 6px 18px -10px rgba(0,0,0,.3);
  text-align: left; max-width: 100%;
}
.zpill .z-identicon { width: 36px; height: 36px; flex: none; }
.zpill-txt { display: grid; line-height: 1.15; min-width: 0; }
.zpill-name { font-size: .78rem; color: var(--z-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zpill-bal { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.zpill-bal small { font-size: .7em; font-weight: 600; color: var(--z-muted); margin-left: .2em; }
.zpill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--z-bad); flex: none; }
.zpill-dot.is-on { background: var(--z-ok); }

.z-bump-up { animation: zbumpUp .9s ease; }
.z-bump-down { animation: zbumpDown .9s ease; }
@keyframes zbumpUp { 30% { color: var(--z-ok); transform: translateY(-2px); } }
@keyframes zbumpDown { 30% { color: var(--z-bad); transform: translateY(2px); } }

/* ---------- modals and sheets ---------- */
.zlayer {
  position: fixed; inset: 0; z-index: 900; display: grid; align-items: end; justify-items: center;
  background: rgba(10, 16, 26, .48); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: zfade .2s ease;
}
@media (min-width: 640px) { .zlayer { align-items: center; } }
.zsheet {
  width: min(520px, 100%); max-height: min(92vh, 92dvh); overflow: auto;
  background: var(--z-surface); color: var(--z-ink);
  border-radius: 22px 22px 0 0; padding: 1.4rem 1.3rem calc(1.4rem + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--z-shadow); animation: zrise .28s cubic-bezier(.2,.9,.3,1.1);
}
@media (min-width: 640px) { .zsheet { border-radius: 22px; } }
.zsheet h2, .zsheet h3 { font-family: var(--font-display); margin: 0 0 .5rem; line-height: 1.15; }
.zsheet-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.1rem; }
.zsheet-head .zsheet-visual { width: 96px; flex: none; }
.zsheet-head p { margin: 0; color: var(--z-muted); font-size: .9rem; }
.zsheet-close { float: right; border: 0; background: var(--z-surface-2); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1.2rem; line-height: 1; }
.ztotal { display: flex; justify-content: space-between; align-items: baseline; padding: .8rem 0; border-top: 1.5px solid var(--z-line); margin-bottom: 1rem; }
.ztotal b { font-family: var(--font-display); font-size: 1.5rem; }
@keyframes zfade { from { opacity: 0; } }
@keyframes zrise { from { transform: translateY(40px); opacity: 0; } }

/* ---------- onboarding ---------- */
.zonb-id { display: flex; align-items: center; gap: .9rem; margin: .2rem 0 1.2rem; }
.zonb-id .z-identicon { width: 64px; height: 64px; }
.zonb-id .zid { font-size: 1.9rem; }

/* ---------- wallet drawer ---------- */
.zdrawer-layer { align-items: stretch; justify-items: end; }
.zdrawer {
  width: min(440px, 100%); height: 100%; overflow: auto; background: var(--z-surface); color: var(--z-ink);
  padding: calc(1.2rem + env(safe-area-inset-top, 0px)) 1.2rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  animation: zslide .28s cubic-bezier(.2,.9,.3,1);
}
@keyframes zslide { from { transform: translateX(40px); opacity: 0; } }
.zdrawer h2 { font-family: var(--font-display); margin: 0; }
.zdrawer h3 { font-family: var(--font-display); font-size: 1rem; margin: 1.6rem 0 .6rem; color: var(--z-muted); font-weight: 600; }
.zw-head { display: flex; gap: .9rem; align-items: center; margin: .6rem 0 1rem; }
.zw-head .z-identicon { width: 56px; height: 56px; }
.zw-copy { border: 0; background: var(--z-surface-2); border-radius: 999px; padding: .3em .7em; cursor: pointer; font-size: 1.25rem; }
.zw-bal { font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; line-height: 1; margin: .4rem 0 .2rem; }
.zw-bal small { font-size: .4em; color: var(--z-muted); }
.zw-avail { color: var(--z-muted); font-size: .88rem; }
.zw-list { display: grid; gap: .5rem; }
.zw-item { display: grid; grid-template-columns: 64px 1fr auto; gap: .8rem; align-items: center; padding: .5rem; border-radius: var(--z-radius-sm); background: var(--z-surface-2); }
.zw-item .zw-thumb { width: 64px; border-radius: 6px; overflow: hidden; }
.zw-item b { display: block; font-size: .92rem; line-height: 1.25; }
.zw-item small { color: var(--z-muted); }
.zw-qty { font-family: var(--font-mono); font-size: .85rem; text-align: right; }
.zw-fiat { display: flex; flex-wrap: wrap; gap: .5rem; }
.zw-fiat span { background: var(--z-surface-2); border-radius: 999px; padding: .35em .8em; font-weight: 600; }
.zw-foot { margin-top: 2rem; display: grid; gap: .6rem; }
.zw-foot a { color: var(--z-accent); font-weight: 600; }

/* ---------- toast ---------- */
.ztoasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); z-index: 1200; display: grid; gap: .5rem; width: min(92vw, 420px); pointer-events: none; }
.ztoast { background: var(--z-ink); color: var(--z-bg); padding: .8rem 1rem; border-radius: 12px; box-shadow: var(--z-shadow); animation: zrise .25s ease; font-size: .95rem; }
.ztoast.is-bad { background: var(--z-bad); color: #fff; }
.ztoast.is-ok { background: var(--z-ok); color: #fff; }

/* ---------- block ticker ---------- */
.zticker {
  position: fixed; left: calc(.8rem + env(safe-area-inset-left, 0px)); bottom: calc(.8rem + env(safe-area-inset-bottom, 0px)); z-index: 800;
  background: var(--z-surface); color: var(--z-ink); border-radius: 999px; padding: .35rem .8rem .35rem .45rem;
  display: flex; align-items: center; gap: .5rem; font-size: .8rem; box-shadow: 0 6px 20px -10px rgba(0,0,0,.4);
  opacity: 0; transform: translateY(8px); transition: .3s ease; pointer-events: none;
}
.zticker.is-on { opacity: 1; transform: none; }
.zticker i { width: 18px; height: 18px; border-radius: 5px; background: var(--z-accent); display: inline-block; }

/* ============ VALIDATION ANIMATION ============ */
.zv-layer { align-items: center; padding: 1rem; }
.zv-card {
  width: min(720px, 100%); background: var(--z-surface); color: var(--z-ink);
  border-radius: 24px; padding: 1.3rem 1.3rem 1.1rem; box-shadow: var(--z-shadow);
  max-height: calc(100dvh - 2rem); overflow: auto;
  animation: zrise .3s cubic-bezier(.2,.9,.3,1.1);
}
.zv-top { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.zv-title { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; margin: 0; line-height: 1.2; }
.zv-sub { margin: .25rem 0 0; color: var(--z-muted); font-size: .92rem; }
.zv-net { width: 100%; height: auto; margin: .8rem 0 .4rem; overflow: visible; }
.zv-edge { stroke: var(--z-line); stroke-width: 2; }
.zv-edge.is-hot { stroke: var(--z-accent); }
.zv-node circle { fill: var(--z-surface-2); stroke: var(--z-line); stroke-width: 2.5; transition: fill .25s, stroke .25s; }
.zv-node text { font-family: var(--font-body); font-size: 22px; fill: var(--z-muted); text-anchor: middle; font-weight: 600; }
.zv-node.is-on circle { fill: color-mix(in srgb, var(--z-accent) 18%, var(--z-surface)); stroke: var(--z-accent); }
.zv-node.is-mining circle { stroke: var(--z-mining); fill: color-mix(in srgb, var(--z-mining) 20%, var(--z-surface)); animation: zpulse .5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.zv-node.is-win circle { stroke: var(--z-ok); fill: color-mix(in srgb, var(--z-ok) 22%, var(--z-surface)); stroke-width: 4; }
.zv-node.is-done circle { fill: var(--z-ok); stroke: var(--z-ok); }
.zv-node.is-done text.zv-glyph { fill: #fff; }
.zv-node text.zv-glyph { font-size: 20px; fill: var(--z-ink); dominant-baseline: central; }
.zv-collabel { font-family: var(--font-body); font-size: 20px; fill: var(--z-muted); text-anchor: middle; }
.zv-packet { fill: var(--z-accent); filter: drop-shadow(0 0 4px var(--z-accent)); }
@keyframes zpulse { to { transform: scale(1.12); } }

.zv-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.zv-steps li { display: grid; grid-template-columns: 22px 1fr; gap: .55rem; align-items: start; color: var(--z-muted); font-size: .93rem; opacity: .45; transition: opacity .25s; }
.zv-steps li::before { content: ''; width: 14px; height: 14px; margin-top: .25em; border-radius: 50%; border: 2px solid currentColor; }
.zv-steps li.is-active { opacity: 1; color: var(--z-ink); }
.zv-steps li.is-active::before { border-color: var(--z-mining); border-top-color: transparent; animation: zspin .7s linear infinite; }
.zv-steps li.is-done { opacity: 1; color: var(--z-ink); }
.zv-steps li.is-done::before { background: var(--z-ok); border-color: var(--z-ok); }
.zv-steps small { grid-column: 2; display: block; color: var(--z-muted); font-family: var(--font-mono); font-size: .76rem; overflow-wrap: anywhere; }
@keyframes zspin { to { transform: rotate(360deg); } }

.zv-result { margin-top: 1rem; padding-top: .9rem; border-top: 1.5px solid var(--z-line); display: none; }
.zv-result.is-on { display: block; animation: zrise .3s ease; }
.zv-delta { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; line-height: 1.2; }
.zv-delta.is-up { color: var(--z-ok); }
.zv-delta.is-down { color: var(--z-bad); }
.zv-delta-sm { font-weight: 600; font-size: 1rem; }

/* ---------- marketplace ---------- */
.zm-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.zm-card { background: var(--z-surface); border-radius: var(--z-radius); overflow: hidden; display: flex; flex-direction: column; }
.zm-visual { background: var(--z-surface-2); }
.zm-visual svg { width: 100%; height: auto; }
.zm-body { padding: 1rem 1.1rem 1.1rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.zm-title { font-family: var(--font-display); font-size: 1.2rem; margin: 0; line-height: 1.2; }
.zm-sub { margin: 0; color: var(--z-muted); font-size: .9rem; }
.zm-specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem .9rem; margin: .2rem 0; font-size: .86rem; }
.zm-specs div { display: flex; flex-direction: column; }
.zm-specs dt { color: var(--z-muted); font-size: .76rem; }
.zm-specs dd { margin: 0; font-weight: 600; }
.zm-actions { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; padding-top: .6rem; }
.zm-own { font-size: .88rem; color: var(--z-muted); }
.zm-price b { font-family: var(--font-display); font-size: 1.3rem; }
.zm-price small { color: var(--z-muted); }
.zm-meta { font-size: .84rem; color: var(--z-muted); width: 100%; }
.zm-assetid { font-family: var(--font-mono); font-size: .72rem; color: var(--z-muted); letter-spacing: .05em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}

/* ---------- illustration details ---------- */
.zv-spark { opacity: 0; transform-box: fill-box; transform-origin: center; animation: ztwinkle 2.6s ease-in-out infinite; }
@keyframes ztwinkle { 0%, 70%, 100% { opacity: 0; transform: scale(.3); } 35% { opacity: 1; transform: scale(1); } }
.zv-veil rect { fill: rgba(18, 14, 10, .64); }
.zv-weeks rect.is-mine { fill: var(--z-accent); }
.zv-weeks rect.is-other { opacity: .5; }
.zv-weeks rect:not([style]).is-other { fill: var(--z-line); opacity: 1; }

/* ---------- home button ---------- */
.zhome-wrap { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.zhome {
  flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--z-surface); color: var(--z-ink); text-decoration: none; font-size: 16px;
  box-shadow: 0 1px 0 var(--z-line), 0 6px 18px -10px rgba(0,0,0,.3);
}
.zhome:hover { color: var(--z-accent); }
.zhome svg { display: block; }

/* ---------- wallet drawer: top-up and device ---------- */
.zw-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; margin-top: .9rem; }
.zw-device { display: grid; gap: .5rem; }
.zw-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .7rem .8rem; background: var(--z-surface-2); border-radius: var(--z-radius-sm); font-size: .88rem; }
.zw-row .zbtn { flex: none; }

/* ---------- install steps ---------- */
.zsteps { margin: 0 0 1rem; padding-left: 1.3rem; display: grid; gap: .5rem; }

/* ---------- install / notifications banner ---------- */
.zbanner {
  position: fixed; z-index: 850; left: 50%; transform: translateX(-50%);
  bottom: calc(.8rem + env(safe-area-inset-bottom, 0px)); width: min(calc(100% - 1.2rem), 480px);
  display: flex; align-items: center; gap: .7rem; padding: .6rem .6rem .6rem .7rem;
  background: var(--z-surface); color: var(--z-ink); border-radius: 18px; box-shadow: var(--z-shadow);
  animation: zrise .3s ease;
}
.zbanner img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.zbanner-txt { display: grid; min-width: 0; line-height: 1.25; flex: 1; }
.zbanner-txt b { font-size: .92rem; }
.zbanner-txt span { font-size: .78rem; color: var(--z-muted); }
.zbanner-x { flex: none; border: 0; background: transparent; color: var(--z-muted); font-size: 1.3rem; width: 32px; height: 32px; cursor: pointer; }
body.has-zbanner .ztoasts { bottom: calc(5.4rem + env(safe-area-inset-bottom, 0px)); }
body.has-zbanner .zticker { display: none; }
