/* TILT: shared tokens and parts.
   Direction: night, no brand colour. The only colours are the market's:
   loss (red) and buy (green), and only on numbers that carry them.
   Type: Bricolage Grotesque (display + UI, no italics) and IBM Plex Mono (data). */

@font-face {
  font-family: 'Bricolage';
  src: url('../fonts/Bricolage-var-latin.woff2') format('woff2-variations'), url('../fonts/Bricolage-var-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face { font-family: 'Plex Mono'; src: url('../fonts/IBMPlexMono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('../fonts/IBMPlexMono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --bg: #0b0a09;
  --panel: #12110f;
  --raised: #1a1815;
  --raised2: #23201c;
  --ink: #efe9df;
  --ink2: #b0a99c;
  --ink3: #8d8679;
  --hair: rgba(239, 233, 223, 0.13);
  --hair2: rgba(239, 233, 223, 0.07);
  --loss: #f0614b;
  --loss-dim: rgba(240, 97, 75, 0.14);
  --gain: #52c08e;
  --gain-dim: rgba(82, 192, 142, 0.13);
  --sans: 'Bricolage', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --r: 6px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-width: thin; scrollbar-color: rgba(239,233,223,.18) transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
::selection { background: var(--ink); color: var(--bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(239,233,223,.16); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(239,233,223,.28); background-clip: content-box; border: 3px solid transparent; }
:focus { outline: none; }
:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 2px; border-radius: 3px; }
a { color: inherit; }
img, canvas, svg { display: block; }
button { font: inherit; color: inherit; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--gain); }
.down { color: var(--loss); }
.muted { color: var(--ink2); }
.faint { color: var(--ink3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Labels: mono, small caps feel */
.label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink3);
  font-weight: 400;
}

/* Wordmark: the last T is knocked over. */
.wm {
  font-family: var(--sans);
  font-weight: 800;
  font-stretch: 75%;
  font-variation-settings: 'opsz' 96;
  letter-spacing: -0.015em;
  line-height: 0.8;
  display: inline-flex;
  align-items: flex-end;
  white-space: nowrap;
}
.wm .t2 { display: inline-block; margin-left: -0.035em; transform-origin: 8% 96%; transform: rotate(11deg); transition: transform 0.5s var(--spring); }
.wm:hover .t2 { transform: rotate(16deg); }

/* Buttons */
.btn {
  --h: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: var(--h);
  padding: 0 20px;
  border-radius: var(--r);
  border: 1px solid var(--hair);
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 560;
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.12s var(--ease), opacity 0.18s var(--ease);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover { border-color: rgba(239,233,223,.32); background: rgba(239,233,223,.04); }
.btn:active { transform: scale(0.96); }
.btn.primary { background: var(--ink); color: #12100d; border-color: var(--ink); }
.btn.primary:hover { background: #fffaf1; }
.btn.sm { --h: 40px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn .arrow { font-family: var(--mono); font-weight: 400; transition: transform 0.2s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

/* Site frame (hairline around the viewport, corner ticks) */
.frame { position: fixed; inset: 12px; border: 1px solid var(--hair); pointer-events: none; z-index: 40; }
.frame::before, .frame::after { content: ''; position: absolute; width: 9px; height: 9px; border: 1px solid rgba(239,233,223,.5); }
.frame::before { left: -5px; top: -5px; border-width: 0 1px 1px 0; }
.frame::after { right: -5px; bottom: -5px; border-width: 1px 0 0 1px; }
@media (max-width: 640px) { .frame { inset: 6px; } }

/* Top bar */
.topbar {
  position: fixed; left: 12px; right: 12px; top: 12px; z-index: 30;
  display: flex; align-items: center; gap: 28px;
  height: 64px; padding: 0 22px;
  transition: background-color 0.3s var(--ease), height 0.3s var(--ease), border-color 0.3s var(--ease);
  border-bottom: 1px solid transparent;
}
.topbar.compact { height: 54px; background: rgba(11,10,9,.82); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); border-bottom-color: var(--hair); }
.topbar .brand { text-decoration: none; font-size: 30px; display: inline-flex; align-items: center; gap: 10px; padding: 6px 0; }
.topbar nav { display: flex; gap: 4px; margin-left: 8px; }
.topbar nav a { text-decoration: none; color: var(--ink2); font-size: 14.5px; font-weight: 480; padding: 10px 12px; border-radius: var(--r); transition: color 0.18s var(--ease), background-color 0.18s var(--ease); }
.topbar nav a:hover, .topbar nav a[aria-current='page'] { color: var(--ink); }
.topbar nav a:hover { background: rgba(239,233,223,.05); }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
@media (max-width: 860px) { .topbar nav { display: none; } }
@media (max-width: 640px) { .topbar { left: 6px; right: 6px; top: 6px; padding: 0 14px; height: 56px; gap: 12px; } .topbar .brand { font-size: 26px; } }

/* Demo banner: discreet, always present in demo mode */
.demo-flag {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink2); border: 1px dashed rgba(239,233,223,.28); border-radius: 99px;
  padding: 4px 10px; white-space: nowrap;
}

/* Popover menu (wallet list, etc.) */
.menu {
  position: absolute; z-index: 60; min-width: 240px;
  background: var(--raised); border: 1px solid var(--hair); border-radius: 10px;
  padding: 6px; box-shadow: 0 24px 60px -20px rgba(0,0,0,.8);
  transform-origin: top right; animation: pop 0.18s var(--ease) both;
}
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 0 12px; border: 0; background: transparent; border-radius: 7px; text-align: left; text-decoration: none; cursor: pointer; font-size: 14.5px; }
.menu button:hover, .menu a:hover { background: rgba(239,233,223,.06); }
.menu img { width: 22px; height: 22px; border-radius: 5px; }
.menu .label { padding: 8px 12px 4px; }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(-4px); } to { opacity: 1; transform: none; } }

/* Toast */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; background: var(--raised); border: 1px solid var(--hair); border-radius: 10px; padding: 12px 16px; font-size: 14px; max-width: 340px; box-shadow: 0 20px 50px -20px rgba(0,0,0,.8); animation: toastIn 0.32s var(--spring) both; }
.toast.out { animation: toastOut 0.2s var(--ease) both; }
.toast b { font-weight: 600; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }
@media (max-width: 640px) { .toasts { left: 12px; right: 12px; bottom: 12px; } .toast { max-width: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0ms !important; transition-duration: 0.001ms !important; }
}
