/* ====================== Relai — exchange ====================== */
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,600;12..96,700&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #F5F6FB;
  --paper: #FFFFFF;
  --ink: #0D1220;
  --ink-2: #2A3242;
  --muted: #5C667A;
  --faint: #97A0B2;
  --line: #E7E9F2;
  --line-2: #EFF1F8;
  --brand: #6D5EF6;       /* relai violet */
  --brand-2: #16C2A3;     /* teal */
  --pos: #12B886;         /* savings green */
  --pos-bg: #E7F8F1;

  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --maxw: 1140px;

  /* per-model accents */
  --c-deepseek: #6D5EF6;
  --c-llama:    #F0852B;
  --c-qwen:     #DC4A8B;
  --c-mistral:  #E5484D;
  --c-gpt:      #0FA985;
  --c-gemini:   #3B82F6;
  --c-claude:   #E07856;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
img, svg { display: block; }

/* ---- nav ---- */
.nav { position: sticky; top: 0; z-index: 40; background: rgba(245,246,251,0.82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.nav-in { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.brand .mark { width: 26px; height: 26px; }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a.link { padding: 8px 12px; border-radius: 9px; font-size: 14px; color: var(--muted); font-weight: 500; transition: color .15s, background .15s; }
.nav-links a.link:hover { color: var(--ink); background: var(--line-2); }
.nav-links a.link.active { color: var(--ink); background: #fff; box-shadow: 0 1px 2px rgba(13,18,32,.05); }

.btn { font-family: var(--body); font-weight: 600; font-size: 14px; padding: 10px 17px; border-radius: 11px; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink); transition: transform .05s, box-shadow .15s, border-color .15s, background .15s; }
.btn:hover { box-shadow: 0 4px 14px -6px rgba(13,18,32,.25); border-color: #d6dae6; }
.btn:active { transform: translateY(1px); }
.btn-brand { background: linear-gradient(96deg, #6D5EF6, #8170FA); border-color: transparent; color: #fff; box-shadow: 0 6px 18px -8px rgba(109,94,246,.7), inset 0 1px 0 rgba(255,255,255,.18); }
.btn-brand:hover { background: linear-gradient(96deg, #5d4df0, #7a68fb); box-shadow: 0 12px 28px -10px rgba(109,94,246,.75), inset 0 1px 0 rgba(255,255,255,.22); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-sm { padding: 7px 13px; border-radius: 9px; font-size: 13px; }

/* ---- hero ---- */
.hero { position: relative; overflow: hidden; }
.hero::before {
  content: ''; position: absolute; inset: -20% -10% auto -10%; height: 660px; z-index: 0; pointer-events: none;
  background:
    radial-gradient(540px 320px at 16% 8%, rgba(109,94,246,0.24), transparent 60%),
    radial-gradient(520px 320px at 88% 0%, rgba(22,194,163,0.22), transparent 62%),
    radial-gradient(620px 360px at 60% 30%, rgba(224,120,86,0.14), transparent 65%);
  filter: saturate(1.08);
  animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift {
  0% { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(-2%, 1.5%, 0) scale(1.06); }
}
.hero-in { position: relative; z-index: 1; display: grid; grid-template-columns: 1.04fr 0.96fr; gap: 54px; align-items: center; padding: 80px 0 60px; }
.pill { display: inline-flex; align-items: center; gap: 9px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 12.5px; color: var(--muted); font-family: var(--mono); box-shadow: 0 2px 8px -4px rgba(13,18,32,.12); }
.pill .ping { position: relative; width: 8px; height: 8px; }
.pill .ping i { position: absolute; inset: 0; border-radius: 50%; background: var(--pos); }
.pill .ping i.ring { animation: ping 1.6s cubic-bezier(0,0,.2,1) infinite; }
@keyframes ping { 75%,100% { transform: scale(2.2); opacity: 0; } }

h1 { font-family: var(--display); font-weight: 700; font-size: 56px; line-height: 1.0; letter-spacing: -0.035em; margin: 22px 0 0; }
h1 .grad { background: linear-gradient(96deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { font-size: 17.5px; color: var(--muted); max-width: 30em; margin: 20px 0 30px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.stats { display: flex; gap: 30px; margin-top: 34px; }
.stat .v { font-family: var(--mono); font-weight: 600; font-size: 22px; color: var(--ink); }
.stat .l { font-size: 12.5px; color: var(--faint); margin-top: 2px; }
.stat .v.pos { color: var(--pos); }

/* hero visual: market-vs-locked panel */
.hero-card { background: linear-gradient(180deg, #fff, #fcfcff); border: 1px solid var(--line); border-radius: 20px; padding: 22px; box-shadow: 0 40px 80px -36px rgba(76,58,180,.5), 0 2px 6px rgba(13,18,32,.04); }

/* works-with strip */
.works { display: flex; align-items: center; gap: 14px; margin-top: 30px; flex-wrap: wrap; }
.works .wl { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.works .chip { font-family: var(--mono); font-size: 12.5px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; box-shadow: 0 1px 2px rgba(13,18,32,.04); }
.hero-card .hc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.hero-card .hc-top .lab { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.hero-card .hc-legend { display: flex; gap: 16px; margin: 14px 2px 0; font-size: 12.5px; color: var(--muted); }
.hero-card .hc-legend span { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 11px; height: 3px; border-radius: 2px; display: inline-block; }

/* ---- marketplace ---- */
.market { padding: 26px 0 70px; }
.market-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.ey { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--brand); margin-bottom: 10px; }
h2 { font-family: var(--display); font-weight: 600; font-size: 30px; letter-spacing: -0.025em; margin: 0; }
.market-head p { color: var(--muted); margin: 8px 0 0; font-size: 15px; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.mcard { --c: var(--brand); position: relative; background: linear-gradient(180deg, #fff, #fdfdff); border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; transition: transform .18s, box-shadow .18s, border-color .18s; overflow: hidden; box-shadow: 0 1px 2px rgba(13,18,32,.04); }
.mcard::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 45%, #fff)); }
.mcard:hover { transform: translateY(-4px); box-shadow: 0 28px 50px -26px color-mix(in srgb, var(--c) 60%, transparent), 0 4px 12px rgba(13,18,32,.05); border-color: color-mix(in srgb, var(--c) 38%, var(--line)); }
.mc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.mc-id { display: flex; align-items: center; gap: 12px; }
.glyph { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(140deg, color-mix(in srgb, var(--c) 18%, #fff), color-mix(in srgb, var(--c) 6%, #fff)); border: 1px solid color-mix(in srgb, var(--c) 24%, var(--line)); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 6px 14px -10px color-mix(in srgb, var(--c) 60%, transparent); }
.mc-name { font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: -0.01em; }
.mc-sub { font-size: 12.5px; color: var(--faint); margin-top: 1px; }
.save-badge { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--pos); background: var(--pos-bg); border-radius: 999px; padding: 4px 9px; }

.price-row { display: flex; align-items: baseline; gap: 10px; }
.price-now { font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: -0.03em; color: var(--ink); }
.price-now small { font-size: 14px; font-weight: 600; color: var(--muted); }
.price-mkt { font-family: var(--mono); font-size: 14px; color: var(--faint); text-decoration: line-through; }
.you-lock { font-size: 12px; color: var(--faint); margin-top: 3px; }

/* spread meter (signature) */
.spread { margin: 16px 0 4px; }
.spread .track { position: relative; height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.spread .fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px; background: var(--c); transition: width 1s cubic-bezier(.22,1,.36,1); }
.spread .marks { display: flex; justify-content: space-between; margin-top: 7px; font-family: var(--mono); font-size: 10.5px; color: var(--faint); letter-spacing: .02em; }

.mc-meta { display: flex; gap: 14px; margin: 14px 0 18px; font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.mc-meta .sep { color: var(--line); }
.mc-foot { margin-top: auto; }
.buy-btn { width: 100%; border: none; border-radius: 12px; padding: 12px; font-family: var(--body); font-weight: 600; font-size: 14px; color: #fff; background: var(--c); cursor: pointer; transition: filter .15s, transform .05s; }
.buy-btn:hover { filter: brightness(1.07); }
.buy-btn:active { transform: translateY(1px); }
.buy-btn.soon { background: #fff; color: var(--muted); border: 1px solid var(--line); cursor: default; }
.buy-btn.soon:hover { filter: none; }
.tag-soon { font-family: var(--mono); font-size: 11px; color: var(--faint); border: 1px solid var(--line); border-radius: 999px; padding: 4px 9px; }

/* ---- how it works ---- */
.how { padding: 64px 0; border-top: 1px solid var(--line); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.step { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.step .n { font-family: var(--mono); font-size: 12px; color: var(--brand); letter-spacing: .1em; }
.step h3 { font-family: var(--display); font-weight: 600; font-size: 18px; margin: 12px 0 8px; }
.step p { color: var(--muted); font-size: 14px; margin: 0; }
.code { margin-top: 28px; background: #0E1220; border-radius: 16px; padding: 22px 24px; font-family: var(--mono); font-size: 13.5px; color: #c9d2e3; overflow-x: auto; line-height: 1.75; }
.code .c { color: #5d6b85; } .code .k { color: #8fe3c8; }

/* ---- footer ---- */
footer { border-top: 1px solid var(--line); padding: 40px 0; }
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot-brand { font-family: var(--display); font-weight: 600; }
.foot-links { display: flex; gap: 22px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.foot-links a:hover { color: var(--ink); }
.foot-note { color: var(--faint); font-size: 12.5px; margin-top: 14px; }

/* ---- buy modal ---- */
.overlay { position: fixed; inset: 0; background: rgba(13,18,32,.46); backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.overlay.on { display: flex; }
.modal { --c: var(--brand); width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 24px; box-shadow: 0 40px 90px -30px rgba(13,18,32,.6); }
.modal .m-top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.modal h3 { font-family: var(--display); font-weight: 600; font-size: 20px; margin: 0; }
.modal .close { margin-left: auto; background: none; border: none; font-size: 22px; color: var(--faint); cursor: pointer; line-height: 1; }
.amt-row { display: flex; gap: 8px; margin: 14px 0; }
.amt-row button { flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-family: var(--mono); font-size: 13px; cursor: pointer; color: var(--ink-2); }
.amt-row button.sel { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fff); color: var(--c); font-weight: 600; }
.summary { background: var(--line-2); border-radius: 12px; padding: 14px 16px; margin: 6px 0 18px; font-size: 14px; }
.summary .line { display: flex; justify-content: space-between; padding: 5px 0; color: var(--muted); }
.summary .line.total { color: var(--ink); font-weight: 600; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 11px; }
.summary .line .mono { font-family: var(--mono); }
.modal-note { font-size: 12.5px; color: var(--faint); margin: 12px 0 0; text-align: center; }

/* ====================== dashboard ====================== */
.app-main { padding: 44px 0 80px; min-height: 62vh; }
.gate { max-width: 460px; margin: 56px auto; text-align: center; }
.gate h1 { font-size: 36px; }
.gate p { color: var(--muted); margin: 14px 0 26px; }
.gate-err { color: var(--c-mistral); margin-top: 18px; font-size: 14px; display: none; }

.dash-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 26px; flex-wrap: wrap; gap: 10px; }
.dash-head h2 { margin: 0; }
.who { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.who b { color: var(--ink); font-weight: 600; }
.link-btn { background: none; border: none; color: var(--brand); font-family: var(--mono); font-size: 13px; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }

.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.panel.full { grid-column: 1 / -1; }
.panel h3 { font-family: var(--display); font-weight: 600; font-size: 17px; margin: 0 0 4px; }
.panel .hint { font-size: 13px; color: var(--faint); margin: 0 0 18px; }
.bal { font-family: var(--display); font-weight: 700; font-size: 42px; letter-spacing: -0.03em; background: linear-gradient(96deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.soon-pill { display: inline-block; font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; }
.keyrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.keyrow:first-of-type { border-top: none; }
.keyrow .kn { font-family: var(--mono); color: var(--muted); }
.keyrow .kn b { color: var(--ink); font-weight: 600; }
.revoked { opacity: .45; }
.keyreveal { background: #0E1220; border-radius: 12px; padding: 14px 16px; margin-top: 16px; font-family: var(--mono); font-size: 13px; color: #e6ebf5; word-break: break-all; }
.keyreveal .lbl { color: var(--brand-2); display: block; margin-bottom: 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.field { display: flex; gap: 10px; margin-top: 16px; }
.field input { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; color: var(--ink); font-family: var(--body); font-size: 14px; }
.field input:focus { outline: none; border-color: var(--brand); }
table.usage { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.usage th { text-align: left; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.usage td { padding: 10px; border-bottom: 1px solid var(--line-2); font-family: var(--mono); color: var(--muted); }
table.usage td.model { color: var(--ink); }
.empty { color: var(--faint); font-size: 14px; padding: 16px 0; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 14px; z-index: 80; box-shadow: 0 16px 40px -12px rgba(13,18,32,.5); }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .hero-in { grid-template-columns: 1fr; gap: 36px; padding-top: 52px; }
  h1 { font-size: 42px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .panels { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .cards { grid-template-columns: 1fr; }
  h1 { font-size: 35px; }
  .stats { gap: 22px; flex-wrap: wrap; }
  .nav-links a.link:not(.active) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .pill .ping i.ring { animation: none; }
  .spread .fill { transition: none; }
  .hero::before { animation: none; }
}

/* ---- status page ---- */
.status-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 40px 0 28px; }
.status-hero h1 { margin: 0; }
.status-badge { display: inline-flex; align-items: center; gap: 9px; font-family: var(--mono); font-size: 13px; font-weight: 600; padding: 9px 15px; border-radius: 999px; border: 1px solid; }
.status-badge.ok { color: #0a8a5f; background: var(--pos-bg); border-color: #bde8d7; }
.status-badge.down { color: #c0392b; background: #FCEDEC; border-color: #f3c9c5; }
.status-badge .d { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-card { background: linear-gradient(180deg,#fff,#fdfdff); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: 0 1px 2px rgba(13,18,32,.04); }
.stat-card .big { font-family: var(--display); font-weight: 700; font-size: 32px; letter-spacing: -0.03em; }
.stat-card .lbl { font-size: 13px; color: var(--faint); margin-top: 4px; }
.tre { font-family: var(--mono); font-size: 13.5px; word-break: break-all; background: var(--line-2); border-radius: 10px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tre button { flex: 0 0 auto; }
.mini-rates { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.mini-rate { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.mini-rate .nm { font-family: var(--display); font-weight: 600; font-size: 15px; }
.mini-rate .rt { font-family: var(--mono); font-size: 14px; color: var(--brand); }
.mini-rate .st { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.muted-line { color: var(--faint); font-size: 13px; font-family: var(--mono); margin-top: 18px; }
@media (max-width: 700px) { .stat-grid { grid-template-columns: 1fr; } .mini-rates { grid-template-columns: 1fr; } }
