/* echivo.app — profile share page + root landing + 404.  OWNED BY: links agent 2.
   Same visual language as echivo.com: night blue, gold #F5C882, SF Pro caps. No external fonts (CSP: self only). */

:root {
  --night: #05070d;
  --ink: #0b1020;
  --midnight: #141d33;
  --gold: #f5c882;
  --amber: #d4a560;
  --sky: #4fb3ff;
  --mint: #5ee6b5;
  --text: #f3f1ec;
  --text-2: rgba(243, 241, 236, 0.68);
  --text-3: rgba(243, 241, 236, 0.44);
  --hairline: rgba(255, 255, 255, 0.10);
  --tint: var(--gold);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --gutter: 16px;
  --radius: 28px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: dark;
}
@media (min-width: 600px) { :root { --gutter: 32px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--night); }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column;
  background: var(--night);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
p, h1, h2, ul, dl, dd { margin: 0; }
::selection { background: var(--gold); color: var(--night); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 12px; }

.caps { text-transform: uppercase; letter-spacing: 0.015em; font-weight: 800; line-height: 0.95; }
.gold { color: var(--gold); }
.eyebrow, .label {
  font-size: 0.72rem; font-weight: 650; letter-spacing: 0.22em; text-transform: uppercase;
}
.eyebrow { color: var(--gold); }
.label { color: var(--text-3); letter-spacing: 0.18em; }

/* ---------- Night sky backdrop ---------- */
.sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.sky__glow {
  position: absolute; left: 50%; top: -30vh; width: 160vmax; height: 90vh; transform: translateX(-50%);
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--tint) 22%, transparent), transparent 70%),
    radial-gradient(60% 60% at 50% 40%, rgba(20, 29, 51, 0.9), transparent 75%);
  opacity: 0.9;
}
.sky__stars {
  position: absolute; inset: 0; opacity: 0.55;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff8, transparent 60%),
    radial-gradient(1px 1px at 78% 12%, #fff9, transparent 60%),
    radial-gradient(1.5px 1.5px at 64% 30%, #ffffff70, transparent 60%),
    radial-gradient(1px 1px at 30% 42%, #fff6, transparent 60%),
    radial-gradient(1px 1px at 88% 52%, #fff7, transparent 60%),
    radial-gradient(1.5px 1.5px at 8% 70%, #ffffff60, transparent 60%),
    radial-gradient(1px 1px at 46% 84%, #fff5, transparent 60%),
    radial-gradient(1px 1px at 92% 88%, #fff6, transparent 60%),
    radial-gradient(1px 1px at 22% 94%, #fff4, transparent 60%);
  background-size: 640px 640px;
}
.page > :not(.sky) { position: relative; z-index: 1; }

/* ---------- Top bar + footer ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) var(--gutter) 6px;
  max-width: 1180px; width: 100%; margin: 0 auto;
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: 0.28em; font-size: 0.8rem; text-transform: uppercase; }
.brand img { width: 26px; height: 26px; filter: drop-shadow(0 0 14px rgba(245, 200, 130, 0.35)); }
.topbar__tag {
  font-size: 0.68rem; font-weight: 650; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-3);
  padding: 6px 11px; border: 1px solid var(--hairline); border-radius: 999px;
}
.foot {
  margin-top: auto; padding: 28px var(--gutter) max(24px, env(safe-area-inset-bottom));
  text-align: center; font-size: 0.82rem; color: var(--text-3);
}
.foot a { color: var(--text-2); border-bottom: 1px solid var(--hairline); transition: color .2s, border-color .2s; }
.foot a:hover { color: var(--gold); border-color: var(--gold); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55em;
  min-height: 52px; padding: 0.9em 1.5em; border-radius: 999px;
  font-weight: 650; font-size: 1rem; line-height: 1.15; text-align: center;
  transition: transform .5s var(--ease-spring), background .3s, box-shadow .3s, border-color .3s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(0.97); transition-duration: .15s; }
.btn-gold { background: var(--gold); color: #1a1206; box-shadow: 0 10px 40px rgba(245, 200, 130, 0.32); }
.btn-gold:hover { box-shadow: 0 14px 50px rgba(245, 200, 130, 0.45); }
.btn-glass {
  color: var(--text);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14);
}
.btn-glass:hover { border-color: rgba(255,255,255,0.28); }
.btn-block { width: 100%; }
.btn__ico { width: 19px; height: 19px; flex: none; }
.btn span { overflow-wrap: anywhere; }

/* ---------- Glass surface ---------- */
.glass, .pass, .broken, .qr {
  background: linear-gradient(180deg, rgba(255,255,255,0.085), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 30px 80px rgba(0,0,0,0.45);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
}

/* =====================================================================
   Profile page
   ===================================================================== */
.stage {
  width: 100%; max-width: 1180px; margin: 0 auto;
  padding: 18px var(--gutter) 8px;
  display: grid; gap: 22px; align-content: start;
  grid-template-columns: minmax(0, 1fr);
}
.stage.is-ready > * { animation: rise .8s var(--ease-out) both; }
.stage.is-ready > :nth-child(2) { animation-delay: .08s; }
.stage.is-ready > :nth-child(3) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

/* Loading skeleton (replaced by JS within a frame or two) */
.loading { display: grid; justify-items: center; gap: 14px; padding: 48px 0; }
.loading__avatar { width: 96px; height: 96px; border-radius: 50%; background: rgba(255,255,255,0.06); }
.loading__line { width: 60%; max-width: 240px; height: 18px; border-radius: 9px; background: rgba(255,255,255,0.06); }
.loading__line--short { width: 34%; max-width: 140px; }
.loading > * { animation: pulse 1.4s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .45; } }

/* Intro */
.intro { display: grid; gap: 10px; text-align: center; justify-items: center; padding-top: 6px; }
.intro__title { font-size: clamp(1.9rem, 8.4vw, 2.6rem); max-width: 14ch; overflow-wrap: anywhere; }
.intro__lede { color: var(--text-2); font-size: 0.95rem; max-width: 38ch; display: none; }

.col { display: grid; gap: 18px; width: 100%; max-width: 480px; justify-self: center; }

/* The pass card */
.pass {
  position: relative; overflow: hidden;
  border-radius: var(--radius);
  padding: 18px 18px 22px;
  display: grid; gap: 22px;
}
.pass::before { /* tier-tinted sheen */
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background:
    radial-gradient(120% 60% at 50% -10%, color-mix(in srgb, var(--tint) 20%, transparent), transparent 60%),
    linear-gradient(120deg, rgba(255,255,255,0.07), transparent 35%);
}
.pass > * { position: relative; }
.pass__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pass__brand {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-3);
}
.pass__brand img { width: 18px; height: 18px; opacity: .9; }

.tier {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 6px 11px 6px 9px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 750; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--tint);
  background: color-mix(in srgb, var(--tint) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--tint) 40%, transparent);
}
.tier__ico { width: 15px; height: 15px; }

.pass__id { display: grid; justify-items: center; text-align: center; gap: 6px; padding-top: 6px; }
.pass__name {
  margin-top: 12px; font-size: clamp(2rem, 10vw, 2.6rem); max-width: 100%;
  overflow-wrap: anywhere; word-break: break-word; hyphens: auto;
}
.pass__name.is-long { font-size: clamp(1.55rem, 7.4vw, 2rem); }
.pass__name.is-xlong { font-size: clamp(1.3rem, 6vw, 1.6rem); line-height: 1.05; }
.pass__handle { color: var(--text-2); font-weight: 600; font-size: 0.98rem; letter-spacing: 0.01em; }

/* Avatar — mirrors ProfileAvatar in the app: hue gradient disc + tier halo + glass ring */
.avatar { position: relative; width: 112px; height: 112px; display: grid; place-items: center; }
.avatar__halo {
  position: absolute; inset: -42%; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--tint) 50%, transparent), transparent 75%);
  filter: blur(8px); opacity: .8;
}
.avatar__disc {
  position: relative; width: 100%; height: 100%; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--a1, #f5c882), var(--a2, #5b3d12));
  box-shadow:
    0 0 0 6px rgba(255,255,255,0.07),
    0 0 0 7px color-mix(in srgb, var(--tint) 45%, transparent),
    inset 0 2px 0 rgba(255,255,255,0.35),
    inset 0 -10px 24px rgba(0,0,0,0.25),
    0 18px 40px rgba(0,0,0,0.45);
}
.avatar__ico { width: 46%; height: 46%; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3)); }

/* Level + XP */
.xp {
  display: grid; gap: 10px; padding: 16px; border-radius: 20px;
  background: rgba(5, 7, 13, 0.38); border: 1px solid var(--hairline);
}
.xp__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.xp__level { display: flex; align-items: center; gap: 12px; min-width: 0; }
.xp__badge {
  width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center;
  color: var(--gold); background: rgba(245, 200, 130, 0.12); border: 1px solid rgba(245, 200, 130, 0.28);
}
.xp__ico { width: 22px; height: 22px; }
.xp__name { font-size: 1.2rem; margin-top: 3px; }
.xp__num { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-2); font-size: 0.9rem; }
.xp__num strong { color: var(--text); font-size: 1.25rem; font-weight: 800; }
.xp__bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,0.08); overflow: hidden; }
.xp__fill {
  display: block; height: 100%; width: calc(var(--frac, 0) * 100%); min-width: 8px; border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), var(--gold) 70%, #fff3d9);
  box-shadow: 0 0 16px rgba(245, 200, 130, 0.55);
  transform-origin: left; animation: grow 1.2s .3s var(--ease-out) both;
}
@keyframes grow { from { transform: scaleX(0); } }
.xp__next { font-size: 0.82rem; color: var(--text-3); }

/* Stamps */
.stamps { display: grid; gap: 14px; }
.stamps__count { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 4px; font-variant-numeric: tabular-nums; }
.stamps__count strong { font-size: 2.6rem; font-weight: 800; line-height: 1; color: var(--gold); letter-spacing: -0.02em; }
.stamps__of { font-size: 1.4rem; font-weight: 700; color: var(--text-3); }
.stamps__label { flex-basis: 100%; margin-top: 6px; }
.stamps__list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 7px; }
@media (max-width: 420px) { .chip { font-size: 0.78rem; padding: 6px 10px 6px 7px; gap: 5px; } .chip__ico { width: 14px; height: 14px; } }
.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 7px 12px 7px 8px; border-radius: 999px;
  font-size: 0.82rem; font-weight: 600; color: #fbe8c8;
  background: rgba(245, 200, 130, 0.10); border: 1px solid rgba(245, 200, 130, 0.26);
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip__ico { width: 16px; height: 16px; color: var(--gold); flex: none; }
.stamps__empty { color: var(--text-2); font-size: 0.92rem; }

/* Meta */
.meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px;
  padding-top: 16px; border-top: 1px dashed rgba(255,255,255,0.14);
}
.meta dt { font-size: 0.68rem; font-weight: 650; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-3); }
.meta dd { margin-top: 3px; font-weight: 650; font-size: 0.98rem; }

/* Actions */
.actions { display: grid; gap: 10px; }
.actions--row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.status {
  display: none; padding: 12px 14px; border-radius: 16px; font-size: 0.88rem; color: var(--text-2); text-align: center;
  background: rgba(245, 200, 130, 0.07); border: 1px solid rgba(245, 200, 130, 0.2);
}
.status.is-on { display: block; animation: rise .5s var(--ease-out) both; }

/* Desktop QR */
.qr { display: none; }

/* Broken link card */
.broken {
  width: 100%; max-width: 520px; justify-self: center; margin-top: 8vh;
  border-radius: var(--radius); padding: 32px 22px 26px;
  display: grid; justify-items: center; text-align: center; gap: 12px;
}
.broken__ico {
  width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; margin-bottom: 6px;
  color: var(--gold); background: rgba(245, 200, 130, 0.1); border: 1px solid rgba(245, 200, 130, 0.25);
}
.broken__svg { width: 32px; height: 32px; }
.broken__title { font-size: clamp(1.7rem, 7vw, 2.4rem); max-width: 14ch; }
.broken__text { color: var(--text-2); max-width: 36ch; margin-bottom: 10px; }

/* ---------- Wide screens: intro left, pass right, QR under intro ---------- */
@media (min-width: 960px) {
  .stage {
    grid-template-columns: minmax(0, 1fr) 460px;
    grid-template-areas: "intro col" "qr col";
    column-gap: clamp(48px, 7vw, 110px); row-gap: 34px;
    padding-top: clamp(20px, 4vh, 64px); align-content: center; align-items: start;
  }
  .stage.is-broken { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; }
  .intro { grid-area: intro; text-align: left; justify-items: start; align-self: end; gap: 18px; padding-top: 0; }
  .intro__title { font-size: clamp(3.2rem, 5.6vw, 5.2rem); max-width: 11ch; }
  .intro__lede { display: block; font-size: 1.08rem; max-width: 40ch; }
  .col { grid-area: col; max-width: none; }
  .pass { padding: 20px 24px 22px; gap: 18px; }
  .avatar { width: 100px; height: 100px; }
  .pass__name { margin-top: 8px; font-size: 2.4rem; }
  .actions { grid-template-columns: minmax(0, 1fr) auto; }
  .actions .status { grid-column: 1 / -1; }
  .actions .btn-glass { width: auto; padding-inline: 1.5em; }
  .qr {
    grid-area: qr; align-self: start;
    display: flex; align-items: center; gap: 18px; padding: 16px 22px 16px 16px; border-radius: 22px; max-width: 420px;
  }
  .qr__code {
    width: 148px; height: 148px; flex: none; padding: 6px; border-radius: 14px; background: #fff; color: #05070d;
  }
  .qr__code svg { width: 100%; height: 100%; }
  .qr__title { margin-top: 4px; color: var(--text-2); font-size: 0.95rem; line-height: 1.4; }
  .broken { margin-top: 10vh; padding: 44px 40px 36px; }
}

/* =====================================================================
   Root landing (index.html) + 404
   ===================================================================== */
.hero {
  flex: 1; width: 100%; max-width: 760px; margin: 0 auto;
  display: grid; justify-items: center; align-content: center; text-align: center; gap: 18px;
  padding: 40px var(--gutter);
}
.hero__mark { position: relative; width: 92px; height: 92px; margin-bottom: 8px; }
.hero__mark::before {
  content: ""; position: absolute; inset: -110%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(245, 200, 130, 0.30), transparent);
}
.hero__mark img { position: relative; width: 100%; height: 100%; filter: drop-shadow(0 0 28px rgba(245, 200, 130, 0.45)); animation: float 3.4s ease-in-out infinite alternate; }
@keyframes float { to { transform: translateY(-8px); } }
.hero__title { font-size: clamp(2.6rem, 11vw, 5.6rem); }
.hero__title span { display: block; }
.hero__lede { color: var(--text-2); max-width: 34ch; font-size: clamp(1rem, 2.6vw, 1.15rem); }
.hero .actions--row { margin-top: 10px; }
.hero__note { font-size: 0.82rem; color: var(--text-3); margin-top: 6px; }
.hero__code { font-family: var(--mono); color: var(--text-3); letter-spacing: 0.3em; font-size: 0.85rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* QR nudge when "Add" is tapped on a computer */
@media (min-width: 960px) {
  .qr.is-flash { animation: flash 1.2s var(--ease-out); }
  @keyframes flash { 0%, 60% { box-shadow: 0 0 0 2px var(--gold), 0 0 40px rgba(245, 200, 130, 0.45); } }
}

/* Phones: a compact dock keeps "Add" in reach while scrolling the pass */
@media (max-width: 959px) {
  .col > .actions {
    position: sticky; bottom: 0; z-index: 5;
    grid-template-columns: minmax(0, 1fr) auto; align-items: center;
    margin: 0 calc(var(--gutter) * -1);
    padding: 12px var(--gutter) max(12px, env(safe-area-inset-bottom));
    background: rgba(5, 7, 13, 0.82);
    border-top: 1px solid var(--hairline);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    backdrop-filter: blur(18px) saturate(140%);
  }
  .col > .actions .btn { min-height: 52px; }
  .col > .actions .btn-gold span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
  .col > .actions .btn-glass { width: 52px; padding: 0; }
  .col > .actions .btn-glass span {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .col > .actions .status { grid-column: 1 / -1; order: -1; background: #16130d; }
}
