/* Laptop design system.
   The whole site is one desk: a warm paper ground, ink text, and cards that read
   as small windows (hairline bezel, a quiet chrome bar with three square lamps).
   One accent, Base blue, carries every action. Numbers are always lining and
   tabular so columns line up. No emoji anywhere: icons are inline SVG in ui.js. */

@font-face { font-display: swap; }

:root {
  --paper: #f6f6f3;
  --paper-2: #efefea;
  --card: #ffffff;
  --ink: #12151a;
  --ink-2: #545b66;
  --ink-3: #878e99;
  --line: rgba(18, 21, 26, 0.10);
  --line-2: rgba(18, 21, 26, 0.06);
  --accent: #0052ff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(0, 82, 255, 0.08);
  --up: #12a150;
  --down: #e5484d;
  --warn: #b26a00;
  --shadow: 0 1px 2px rgba(18, 21, 26, 0.05), 0 8px 24px rgba(18, 21, 26, 0.06);
  --shadow-lift: 0 2px 6px rgba(18, 21, 26, 0.07), 0 18px 48px rgba(18, 21, 26, 0.10);
  --r: 14px;
  --r-sm: 9px;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Bricolage Grotesque", "Instrument Sans", var(--sans);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --header-h: 60px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  font-variant-numeric: lining-nums tabular-nums;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px;
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; margin: 0 0 .4em; line-height: 1.08; }
h1 { font-size: clamp(34px, 5.4vw, 58px); font-weight: 800; }
h2 { font-size: clamp(22px, 3vw, 28px); }
h3 { font-size: 17px; }
p { margin: 0 0 1em; color: var(--ink-2); }
small { font-size: 12.5px; color: var(--ink-3); }
hr { border: 0; border-top: 1px solid var(--line-2); margin: 28px 0; }
.num { font-variant-numeric: lining-nums tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--ink-3); }
.up { color: var(--up); }
.down { color: var(--down); }
.center { text-align: center; }
[hidden] { display: none !important; }

/* ---- shell ------------------------------------------------------------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 820px; margin: 0 auto; padding: 0 20px; }
main { padding: 28px 0 72px; min-height: 60vh; }

.lt-header-ph { height: var(--header-h); }
.hdr {
  position: fixed; inset: 0 0 auto 0; z-index: 40; height: var(--header-h);
  background: rgba(246, 246, 243, 0.82);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--line-2);
}
.hdr-in { max-width: 1180px; margin: 0 auto; padding: 0 20px; height: 100%; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: -0.02em; }
.brand svg { display: block; }
.hdr nav { display: flex; align-items: center; gap: 4px; margin-left: 6px; }
.hdr nav a { padding: 7px 11px; border-radius: 8px; font-size: 14px; color: var(--ink-2); }
.hdr nav a:hover { background: var(--paper-2); color: var(--ink); }
.hdr nav a.on { color: var(--ink); background: var(--paper-2); }
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.burger { display: none; }

footer { border-top: 1px solid var(--line-2); padding: 26px 0 48px; color: var(--ink-3); font-size: 13.5px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; }
footer nav { margin-left: auto; display: flex; gap: 16px; }
footer a:hover { color: var(--ink); }

/* ---- window card ------------------------------------------------------- */
.win {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); overflow: hidden;
}
.win-bar {
  display: flex; align-items: center; gap: 8px; padding: 9px 13px;
  border-bottom: 1px solid var(--line-2); background: linear-gradient(180deg, #fcfcfb, #f7f7f4);
  font-size: 12.5px; color: var(--ink-3);
}
.lamps { display: inline-flex; gap: 4px; }
.lamps i { width: 6px; height: 6px; border-radius: 2px; background: var(--line); display: block; }
.win-bar .title { font-weight: 500; color: var(--ink-2); }
.win-bar .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.win-body { padding: 16px; }
.win.lift:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.win.lift { transition: box-shadow .18s ease, transform .18s ease; }

/* ---- buttons: small and compact by house rule --------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.btn:hover { background: var(--paper-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #0047db; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 40px; padding: 0 18px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn.ok { border-color: var(--up); color: var(--up); }
.btn svg { flex: none; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 6px; background: var(--paper-2); color: var(--ink-2); font-size: 11.5px; font-weight: 500;
}
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.up { background: rgba(18, 161, 80, .10); color: var(--up); }
.pill.down { background: rgba(229, 72, 77, .10); color: var(--down); }

/* ---- forms ------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field > label, .lbl { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.err { font-size: 12.5px; color: var(--down); margin-top: 6px; }
input[type="text"], input[type="url"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--card); color: var(--ink); font: inherit; font-size: 14px;
  font-variant-numeric: lining-nums tabular-nums;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; min-height: 80px; line-height: 1.5; }
input:disabled, select:disabled, textarea:disabled { background: var(--paper-2); color: var(--ink-3); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
.row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.row-3 { display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 3px; background: var(--paper-2); border: 1px solid var(--line-2); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -7px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); cursor: pointer; }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 3px; background: var(--paper-2); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; cursor: pointer; }

.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--paper-2); border-radius: 10px; border: 1px solid var(--line-2); }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }

/* ---- data ------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px; background: var(--line-2); border-radius: var(--r-sm); overflow: hidden; }
.stats > div { background: var(--card); padding: 11px 13px; }
.stats small { display: block; font-size: 11.5px; color: var(--ink-3); margin-bottom: 2px; }
.stats b { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }

.ca {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--paper); font-family: var(--mono); font-size: 12.5px;
}
.ca span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ca button { margin-left: auto; }

.chart { width: 100%; height: 460px; border: 0; border-radius: var(--r-sm); background: var(--paper-2); display: block; }

.board { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.tok-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: var(--paper-2); flex: none; }
.tok-logo.ph { display: grid; place-items: center; font-family: var(--display); font-weight: 600; color: var(--ink-3); }

.skel { background: linear-gradient(90deg, var(--paper-2) 25%, #f6f6f2 37%, var(--paper-2) 63%); background-size: 400% 100%; animation: skel 1.2s ease infinite; border-radius: 6px; color: transparent !important; }
@keyframes skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* a new token arriving on the board: one short shake plus a fading ring */
@keyframes tremble {
  0%, 100% { transform: translate3d(0,0,0); }
  15% { transform: translate3d(-3px, 1px, 0) rotate(-.5deg); }
  35% { transform: translate3d(3px, -1px, 0) rotate(.5deg); }
  55% { transform: translate3d(-2px, 1px, 0); }
  75% { transform: translate3d(2px, 0, 0); }
}
.is-new { animation: tremble .55s ease-in-out 1; }
.is-new::after {
  content: ""; position: absolute; inset: -1px; border-radius: var(--r); pointer-events: none;
  box-shadow: 0 0 0 2px var(--accent); opacity: .9; animation: ringout 2.4s ease-out forwards;
}
@keyframes ringout { to { opacity: 0; } }
.rel { position: relative; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(14px);
  max-width: min(460px, calc(100vw - 32px)); padding: 11px 15px; border-radius: 11px;
  background: var(--ink); color: #fff; font-size: 13.5px; box-shadow: var(--shadow-lift);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty { text-align: center; padding: 56px 20px; color: var(--ink-3); }
.empty h3 { color: var(--ink); }

@media (max-width: 860px) {
  .row, .row-3 { grid-template-columns: 1fr; }
  .hdr nav { display: none; }
  .hdr nav.open {
    display: flex; position: fixed; inset: var(--header-h) 0 auto 0; flex-direction: column; gap: 2px;
    background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 16px 16px;
  }
  .hdr nav.open a { padding: 11px 10px; font-size: 15px; }
  .burger { display: inline-flex; }
  .chart { height: 380px; }
}
/* Under about 380px the header's right hand group runs past the edge and clips
   the menu button. Drop the labels there and keep the icons, which is enough:
   the same actions stay reachable and nothing is cut off. */
@media (max-width: 400px) {
  .hdr-in { gap: 10px; padding: 0 14px; }
  .hdr-right { gap: 6px; }
  .hdr-right .btn { padding: 0 9px; }
  .hdr-right .btn-primary span { display: none; }
}
@media (max-width: 340px) {
  .brand span { display: none; }
}

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