/* ==========================================================================
   $PONZI — design tokens
   ========================================================================== */
:root {
  --red: #e2231a;
  --red-dim: #b31c15;
  --bg: #0a0a0a;
  --bg-elev: #121212;
  --bg-elev-2: #171717;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #ffffff;
  --text-dim: #8c8c8c;
  --text-dimmer: #5f5f5f;
  --green: #24c26b;
  --loss: #ff4d43;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;

  --max-width: 1400px;
  --gutter: 32px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* Both nav tiers are sticky — keep anchored sections clear of them. */
#top, #chart, #participate, #links { scroll-margin-top: 104px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

.bar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
  width: 100%;
}

.section-title {
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--text);
}

.section-label {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--red);
  margin: 0 0 10px;
}

/* ==========================================================================
   Nav — two tier
   ========================================================================== */
.topbar {
  background: var(--red);
  position: sticky;
  top: 0;
  z-index: 60;
}

.topbar .bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}

.brand img {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  object-fit: cover;
}

.brand span {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-links {
  display: flex;
  gap: 26px;
}

.topbar-links a {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: opacity 0.15s ease;
}

.topbar-links a:hover { opacity: 0.7; }

.subnav {
  background: #000;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 54px;
  z-index: 55;
}

.subnav .bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 46px;
  gap: 20px;
}

.subnav-links {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

.subnav-links::-webkit-scrollbar { display: none; }

.subnav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 13px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.subnav-links a:hover { color: var(--text); }

.subnav-links a.is-active {
  color: var(--red);
  border-bottom-color: var(--red);
}

.subnav-cta {
  background: var(--red);
  color: #fff;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 15px;
  border-radius: 4px;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.subnav-cta:hover { background: var(--red-dim); }

/* ==========================================================================
   Dashboard (Section 1)
   ========================================================================== */
.dashboard {
  padding: 30px 0 44px;
  border-bottom: 1px solid var(--border);
}

.hero-card {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 6px 10px;
  margin-bottom: 10px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px 20px;
}

.stat {
  padding: 16px 14px;
  min-width: 0;
  border-radius: 8px;
}

.stat-wide { grid-column: span 2; }

.stat-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-dim);
  margin-bottom: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value {
  display: block;
  font-size: clamp(1.6rem, 2.7vw, 2.35rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.12;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-delta {
  display: block;
  margin-top: 5px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-dimmer);
  min-height: 1.2em;
}

.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--loss); }

.squeeze-answer {
  display: inline-block !important;
  padding: 2px 16px;
  border-radius: 6px;
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
}

.squeeze-answer.yes { background: var(--green); color: #06210f; }
.squeeze-answer.no { background: rgba(255, 255, 255, 0.05); color: var(--text-dim); }

.dash-footnote {
  margin: 26px 14px 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 0.76rem;
  line-height: 1.75;
  color: var(--text-dimmer);
  max-width: 900px;
}

.dash-footnote code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--text-dim);
}

/* Flash on value change */
@keyframes flashUpTile {
  0%   { background: rgba(36, 194, 107, 0.16); }
  100% { background: transparent; }
}
@keyframes flashDownTile {
  0%   { background: rgba(255, 77, 67, 0.16); }
  100% { background: transparent; }
}
@keyframes flashUpText {
  0%   { color: var(--green); text-shadow: 0 0 22px rgba(36, 194, 107, 0.45); }
  100% { color: var(--text); text-shadow: none; }
}
@keyframes flashDownText {
  0%   { color: var(--loss); text-shadow: 0 0 22px rgba(255, 77, 67, 0.45); }
  100% { color: var(--text); text-shadow: none; }
}

.stat.flash-up { animation: flashUpTile 1.6s ease-out; }
.stat.flash-down { animation: flashDownTile 1.6s ease-out; }
.stat.flash-up .stat-value { animation: flashUpText 1.6s ease-out; }
.stat.flash-down .stat-value { animation: flashDownText 1.6s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .stat.flash-up,
  .stat.flash-down,
  .stat.flash-up .stat-value,
  .stat.flash-down .stat-value { animation: none; }
}

/* ==========================================================================
   Chart (Section 2)
   ========================================================================== */
.chart-section {
  padding: 48px 0 56px;
  border-bottom: 1px solid var(--border);
}

.chart-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.chart-sub {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.chart-controls {
  display: flex;
  gap: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
}

.chart-controls button {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.chart-controls button:hover { color: var(--text); }

.chart-controls button.is-active {
  background: var(--red);
  color: #fff;
}

/* Fixed square. The chart must not resize while the page scrolls —
   a changing height forces lightweight-charts to re-fit on every frame. */
.chart-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.chart-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.pair-ratio {
  margin: 16px 0 0;
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
}

.pair-ratio strong {
  color: var(--text);
  font-weight: 600;
}

/* ==========================================================================
   How to participate (Section 3)
   ========================================================================== */
.howto-section {
  padding: 56px 0;
  border-bottom: 1px solid var(--border);
}

.howto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.howto-step {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px 22px;
  transition: border-color 0.15s ease;
}

.howto-step:hover { border-color: var(--border-strong); }

.step-number {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--red);
  margin-bottom: 14px;
}

.howto-step h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.howto-step p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.6;
}

.copy-ca-btn {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--red);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.copy-ca-btn:hover { background: var(--red-dim); }
.copy-ca-btn.copied { background: var(--green); color: #06210f; }

.disclaimer-inline {
  margin: 28px 0 0;
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--text-dimmer);
  max-width: 760px;
}

/* ==========================================================================
   Links (Section 4)
   ========================================================================== */
.links-section { padding: 56px 0; border-bottom: 1px solid var(--border); }

.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.link-card:hover {
  border-color: var(--red);
  transform: translateY(-2px);
}

.link-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(226, 35, 26, 0.14);
  border: 1px solid rgba(226, 35, 26, 0.35);
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.link-body strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.link-body span {
  display: block;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* ==========================================================================
   Footer (Section 5)
   ========================================================================== */
.site-footer { padding: 36px 0 44px; }

.footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.footer-brand img {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  object-fit: cover;
}

.footer-links {
  display: flex;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.footer-links a {
  text-decoration: none;
  color: var(--text-dim);
  font-size: 0.85rem;
  transition: color 0.15s ease;
}

.footer-links a:hover { color: var(--red); }

.footer-disclaimer {
  margin: 22px 0 0;
  font-size: 0.76rem;
  line-height: 1.8;
  color: var(--text-dimmer);
  max-width: 940px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1000px) {
  :root { --gutter: 20px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .stat-wide { grid-column: span 2; }
}

@media (max-width: 620px) {
  .stat-row { grid-template-columns: 1fr; }
  .stat-wide { grid-column: span 1; }
  .topbar-links { gap: 16px; }
  .topbar-links a { font-size: 0.8rem; }
}
