/* ==========================================================================
   ZELENCIO — b3 SURFACES
   History · Devices · Invite hub · Leaderboard · Referral log · Crypto Gift
   --------------------------------------------------------------------------
   Same language as app.css: 45° chamfers (never rounded), cyan brand streak,
   Space Grotesk for anything structural.

   DESKTOP AND MOBILE ARE NOT THE SAME LAYOUT. This is a full exchange on a
   1240px monitor and a one-handed app on a 380px phone, so:

     - history is a TABLE on desktop and a stacked CARD LIST on mobile,
       not a table squeezed sideways into a scrollbar
     - the invite hub is a 2-column split on desktop, a vertical stack on
       mobile with the QR sized to the thumb
     - the leaderboard podium is three columns wide, and collapses to a
       single highlighted winner with a list beneath on a phone
     - every tap target on mobile is at least 44px

   Motion is real but restrained: things arrive, they do not bounce.
   Everything respects prefers-reduced-motion.
   ========================================================================== */

/* ── Shared shell ───────────────────────────────────────────────────────── */

.zpage           { padding-block: clamp(22px, 4vw, 48px); }
.zpage .wrap     { max-width: var(--w-page); }

.zhead           { display: flex; align-items: flex-end; gap: 16px;
                   flex-wrap: wrap; margin-bottom: clamp(16px, 3vw, 28px); }
.zhead h1        { font-family: var(--font-display); line-height: 1.06;
                   font-size: clamp(1.5rem, 3.6vw, 2.35rem); margin: 0; }
.zhead .sub      { color: var(--ink-3); margin: 6px 0 0; font-size: .93rem; }
.zhead .spacer   { flex: 1 1 auto; }

.zcard           { background: var(--bg-raised); border: 1px solid var(--line);
                   clip-path: var(--cut-md); padding: clamp(16px, 2.4vw, 24px); }

.zmuted          { color: var(--ink-3); }
.zmono           { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Staggered arrival. Index is set inline as --i. */
@keyframes zRise { from { opacity: 0; transform: translateY(10px); }
                   to   { opacity: 1; transform: none; } }
.zrise           { animation: zRise .42s var(--ease) both;
                   animation-delay: calc(var(--i, 0) * 45ms); }

@keyframes zShimmer { 0% { background-position: -420px 0; }
                      100% { background-position: 420px 0; } }
.zskel           { background: linear-gradient(90deg,
                     var(--bg-inset) 0%, var(--line-soft) 50%, var(--bg-inset) 100%);
                   background-size: 420px 100%;
                   animation: zShimmer 1.1s linear infinite;
                   clip-path: var(--cut-sm); height: 58px; margin-bottom: 8px; }

.zempty          { text-align: center; padding: clamp(34px, 7vw, 64px) 20px; }
.zempty .icon    { font-size: 2.4rem; opacity: .35; display: block; margin-bottom: 12px; }
.zempty h4       { margin: 0 0 6px; font-family: var(--font-display); }

/* ── Filter chips ───────────────────────────────────────────────────────── */

.zchips          { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
                   scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.zchips::-webkit-scrollbar { display: none; }

.zchip           { flex: 0 0 auto; padding: 8px 15px; min-height: 38px;
                   border: 1px solid var(--line); background: var(--bg-raised);
                   color: var(--ink-2); font-size: .84rem; font-weight: 600;
                   clip-path: var(--cut-sm); cursor: pointer;
                   transition: color .18s var(--ease), border-color .18s var(--ease),
                               background .18s var(--ease); }
.zchip:hover     { border-color: var(--brand); color: var(--ink); }
.zchip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand);
                              color: #04222b; }

/* ── History ────────────────────────────────────────────────────────────── */

.ztable          { width: 100%; border-collapse: collapse; }
.ztable th       { text-align: left; font-size: .72rem; letter-spacing: .09em;
                   text-transform: uppercase; color: var(--ink-faint);
                   font-weight: 700; padding: 0 14px 11px; }
.ztable td       { padding: 13px 14px; border-top: 1px solid var(--line-soft);
                   vertical-align: middle; }
.ztable tbody tr { cursor: pointer; transition: background .15s var(--ease); }
.ztable tbody tr:hover { background: var(--bg-sunk); }

.zglyph          { width: 38px; height: 38px; display: grid; place-items: center;
                   clip-path: var(--cut-sm); font-size: 1rem; font-weight: 700;
                   flex: 0 0 auto; }
.zglyph.in       { background: color-mix(in srgb, var(--up) 14%, transparent);   color: var(--up); }
.zglyph.out      { background: color-mix(in srgb, var(--down) 14%, transparent); color: var(--down); }
.zglyph.mid      { background: var(--brand-wash); color: var(--brand-deep); }

.zamt.in         { color: var(--up); }
.zamt.out        { color: var(--down); }

.zpill           { display: inline-block; padding: 4px 10px; font-size: .72rem;
                   font-weight: 700; clip-path: var(--cut-sm); white-space: nowrap; }
.zpill.ok        { background: color-mix(in srgb, var(--up) 15%, transparent);   color: var(--up); }
.zpill.warn      { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.zpill.bad       { background: color-mix(in srgb, var(--down) 14%, transparent); color: var(--down); }
.zpill.mid       { background: var(--bg-inset); color: var(--ink-3); }

/* Mobile: the table becomes a list of cards. */
.zhrow           { display: none; }

@media (max-width: 860px) {
  .ztable        { display: none; }
  .zhrow         { display: flex; align-items: center; gap: 13px;
                   padding: 14px; border: 1px solid var(--line);
                   background: var(--bg-raised); clip-path: var(--cut-sm);
                   margin-bottom: 9px; cursor: pointer; min-height: 66px; }
  .zhrow:active  { transform: scale(.985); }
  .zhrow .body   { flex: 1 1 auto; min-width: 0; }
  .zhrow .t      { font-weight: 650; font-size: .93rem; }
  .zhrow .s      { font-size: .78rem; color: var(--ink-3);
                   white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .zhrow .r      { text-align: right; flex: 0 0 auto; }
}

/* ── Devices ────────────────────────────────────────────────────────────── */

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

.zdev            { display: flex; gap: 14px; padding: 16px;
                   border: 1px solid var(--line); background: var(--bg-raised);
                   clip-path: var(--cut-md); position: relative;
                   transition: border-color .2s var(--ease), transform .2s var(--ease); }
.zdev:hover      { border-color: var(--brand); transform: translateY(-2px); }
.zdev.is-current { border-color: var(--brand);
                   box-shadow: 0 0 0 1px var(--brand) inset; }

.zdev .ico       { width: 44px; height: 44px; flex: 0 0 auto; display: grid;
                   place-items: center; background: var(--bg-inset);
                   clip-path: var(--cut-sm); font-size: 1.25rem; }
.zdev .nm        { font-weight: 650; font-family: var(--font-display); }
.zdev dl         { margin: 10px 0 0; display: grid; gap: 5px;
                   grid-template-columns: auto 1fr; font-size: .8rem; }
.zdev dt         { color: var(--ink-faint); }
.zdev dd         { margin: 0; color: var(--ink-2); word-break: break-word; }

.zdev .badge     { position: absolute; top: 12px; right: 12px; font-size: .66rem;
                   font-weight: 800; letter-spacing: .05em; padding: 3px 8px;
                   background: var(--brand); color: #04222b; clip-path: var(--cut-sm); }

/* ── Invite hub ─────────────────────────────────────────────────────────── */

.zinvite         { display: grid; gap: clamp(16px, 2.6vw, 26px);
                   grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
                   align-items: start; }

@media (max-width: 900px) { .zinvite { grid-template-columns: 1fr; } }

.zqr             { display: grid; place-items: center; padding: clamp(18px, 3vw, 30px);
                   background: var(--bg-raised); border: 1px solid var(--line);
                   clip-path: var(--cut-lg); }
.zqr canvas, .zqr svg { width: min(232px, 62vw); height: auto; display: block; }

.zcopy           { display: flex; align-items: center; gap: 10px; padding: 12px 14px;
                   background: var(--bg-inset); border: 1px solid var(--line);
                   clip-path: var(--cut-sm); min-height: 50px; }
.zcopy code      { flex: 1 1 auto; font-family: var(--font-mono); font-size: .9rem;
                   overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zcopy button    { flex: 0 0 auto; min-height: 38px; padding-inline: 14px; }

.ztiles          { display: grid; gap: 11px;
                   grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.ztile           { display: block; padding: 17px; text-decoration: none;
                   border: 1px solid var(--line); background: var(--bg-raised);
                   clip-path: var(--cut-md); color: inherit; min-height: 96px;
                   transition: transform .2s var(--ease), border-color .2s var(--ease); }
.ztile:hover     { transform: translateY(-3px); border-color: var(--brand); }
.ztile .ico      { font-size: 1.35rem; display: block; margin-bottom: 8px; }
.ztile .t        { font-weight: 650; font-family: var(--font-display); }
.ztile .d        { font-size: .78rem; color: var(--ink-3); margin-top: 3px; }

/* The shareable card that gets downloaded as a PNG. */
.zrefcard        { position: relative; overflow: hidden; color: #eaf7ff;
                   background: linear-gradient(150deg, #041b26 0%, #06303f 52%, #0a4d63 100%);
                   padding: 26px; clip-path: var(--cut-lg); }
.zrefcard::after { content: ""; position: absolute; inset: 0;
                   background: radial-gradient(560px 200px at 82% -12%,
                               rgba(0,212,255,.34), transparent 70%); pointer-events: none; }
.zrefcard .rc-top{ display: flex; align-items: center; gap: 11px; }
.zrefcard .rc-nm { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; }
.zrefcard .rc-un { font-size: .84rem; opacity: .78; }
.zrefcard .rc-cd { font-family: var(--font-mono); font-size: clamp(1.5rem, 5.5vw, 2.1rem);
                   font-weight: 700; letter-spacing: .05em; margin-top: 16px; }
.zrefcard .rc-qr { background: #fff; padding: 9px; display: inline-block;
                   clip-path: var(--cut-sm); margin-top: 14px; }

/* ── Leaderboard ────────────────────────────────────────────────────────── */

.zpodium         { display: grid; gap: 13px; grid-template-columns: repeat(3, 1fr);
                   align-items: end; margin-bottom: 22px; }

@media (max-width: 720px) {
  .zpodium       { grid-template-columns: 1fr; }
  .zpodium .pod  { order: 2; }
  .zpodium .pod--1 { order: 1; }
}

.pod             { text-align: center; padding: 20px 14px; position: relative;
                   border: 1px solid var(--line); background: var(--bg-raised);
                   clip-path: var(--cut-md); }
.pod--1          { border-color: #d4a017;
                   background: linear-gradient(180deg,
                     color-mix(in srgb, #d4a017 12%, var(--bg-raised)), var(--bg-raised)); }
.pod--2          { border-color: #9aa8bd; }
.pod--3          { border-color: #c07b42; }
.pod .rk         { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; }
.pod .av         { width: 62px; height: 62px; clip-path: var(--cut-sm);
                   object-fit: cover; margin: 8px auto; display: block;
                   background: var(--bg-inset); }
.pod--1 .av      { width: 78px; height: 78px; }

.zlb             { display: flex; align-items: center; gap: 13px; padding: 12px 14px;
                   border: 1px solid var(--line); background: var(--bg-raised);
                   clip-path: var(--cut-sm); margin-bottom: 8px; min-height: 62px; }
.zlb.is-me       { border-color: var(--brand); background: var(--brand-wash); }
.zlb .rk         { width: 34px; text-align: center; font-weight: 700;
                   font-family: var(--font-mono); color: var(--ink-3); flex: 0 0 auto; }
.zlb .av         { width: 40px; height: 40px; clip-path: var(--cut-sm);
                   object-fit: cover; background: var(--bg-inset); flex: 0 0 auto; }
.zlb .nm         { flex: 1 1 auto; min-width: 0; }
.zlb .nm b       { display: block; font-size: .92rem;
                   overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pinned to the bottom of the viewport when the user is below the fold. */
.zmebar          { position: sticky; bottom: 10px; z-index: 5;
                   box-shadow: var(--shadow-lg); }

/* ── Crypto Gift ────────────────────────────────────────────────────────── */

.zsteps          { display: flex; gap: 6px; margin-bottom: 22px; }
.zstep           { flex: 1 1 0; height: 4px; background: var(--line);
                   position: relative; overflow: hidden; }
.zstep::after    { content: ""; position: absolute; inset: 0; background: var(--brand);
                   transform: scaleX(0); transform-origin: left;
                   transition: transform .45s var(--ease); }
.zstep.done::after, .zstep.now::after { transform: scaleX(1); }

.zpane           { display: none; }
.zpane.now       { display: block; animation: zRise .34s var(--ease) both; }

.zopts           { display: grid; gap: 10px; }
.zopt            { display: flex; gap: 13px; align-items: flex-start; padding: 15px;
                   border: 1px solid var(--line); background: var(--bg-raised);
                   clip-path: var(--cut-sm); cursor: pointer; text-align: left;
                   width: 100%; min-height: 64px;
                   transition: border-color .18s var(--ease), background .18s var(--ease); }
.zopt:hover      { border-color: var(--brand); }
.zopt[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-wash); }
.zopt .t         { font-weight: 650; }
.zopt .d         { font-size: .8rem; color: var(--ink-3); margin-top: 2px; }

.zsum            { display: grid; gap: 7px; }
.zsum .r         { display: flex; justify-content: space-between; gap: 12px;
                   font-size: .88rem; }
.zsum .r.total   { border-top: 1px solid var(--line); padding-top: 9px;
                   font-weight: 700; font-size: 1rem; }

/* Gift card templates — the downloadable art. */
.zgift           { position: relative; overflow: hidden; padding: 26px;
                   clip-path: var(--cut-lg); color: #fff; text-align: center;
                   min-height: 300px; display: grid; align-content: center; gap: 10px; }
.zgift .g-amt    { font-family: var(--font-display); font-weight: 700;
                   font-size: clamp(1.6rem, 6.5vw, 2.4rem); }
.zgift .g-code   { font-family: var(--font-mono); font-size: 1.15rem;
                   letter-spacing: .22em; }
.zgift .g-qr     { background: #fff; padding: 8px; display: inline-block;
                   clip-path: var(--cut-sm); margin: 4px auto 0; }
.zgift .g-logo   { position: absolute; top: 16px; left: 16px; height: 22px; opacity: .95; }

.tpl-aurora      { background: linear-gradient(145deg, #04212e, #0a5a72 55%, #12908f); }
.tpl-midnight    { background: linear-gradient(145deg, #0a0f1d, #1a1f3d 60%, #2d1b52); }
.tpl-ember       { background: linear-gradient(145deg, #2b0a0a, #7a1f12 55%, #c2571d); }
.tpl-mint        { background: linear-gradient(145deg, #03251c, #0a5c40 58%, #14a06a); }
.tpl-violet      { background: linear-gradient(145deg, #16072b, #3b1177 55%, #7c3aed); }
.tpl-gold        { background: linear-gradient(145deg, #241a04, #6b4d0c 55%, #c9971b); }

.ztpls           { display: grid; gap: 9px;
                   grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); }
.ztpl            { height: 54px; clip-path: var(--cut-sm); cursor: pointer;
                   border: 2px solid transparent;
                   transition: transform .18s var(--ease); }
.ztpl:hover      { transform: translateY(-2px); }
.ztpl[aria-pressed="true"] { border-color: var(--brand); }

.zgcard          { border: 1px solid var(--line); background: var(--bg-raised);
                   clip-path: var(--cut-md); padding: 17px; margin-bottom: 12px; }
.zbar            { height: 7px; background: var(--bg-inset); overflow: hidden; margin-top: 11px; }
.zbar i          { display: block; height: 100%; background: var(--brand);
                   transition: width .6s var(--ease); }

/* ── Reduced motion ─────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .zrise, .zpane.now { animation: none; }
  .zskel             { animation: none; }
  .ztile:hover, .zdev:hover, .ztpl:hover { transform: none; }
  .zstep::after      { transition: none; }
}

/* Rich dialog body (opts.html) — used by the history and gift detail views. */
.zdlg__rich      { text-align: left; margin-top: 12px; max-height: 58vh;
                   overflow: auto; -webkit-overflow-scrolling: touch; }
.zdlg__rich .zsum .r { padding: 3px 0; }

/* Divider between the site nav and the account links in the slide-out menu. */
.menu-sep        { height: 1px; background: var(--line); margin: 10px 0; }
