/* ── RESET & VARS ─────────────────────────────────────────────────────────── */
:root {
  --bg: #eef0f4;
  --surface: #ffffff;
  --surface2: #f4f6f9;
  --border: #dde2ea;
  --accent: #0a84ff;
  --accent2: #ff6b35;
  --green: #16a34a;
  --red: #dc2626;
  --text: #0d1117;
  --muted: #6b7280;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.07);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.13);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Syne', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, rgba(0,0,0,.055) 1px, transparent 1px) 0 0 / 24px 24px;
  pointer-events: none;
  z-index: 0;
}
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px);
  position: relative;
  z-index: 1;
}

/* ── HEADER ───────────────────────────────────────────────────────────────── */
header {
  padding: clamp(28px,5vw,56px) 0 clamp(24px,4vw,44px);
  text-align: center;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent);
  text-transform: uppercase;
  background: rgba(10,132,255,.08);
  border: 1px solid rgba(10,132,255,.2);
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 18px;
}
h1 {
  font-size: clamp(36px, 9vw, 96px);
  font-weight: 800;
  line-height: .88;
  letter-spacing: clamp(-2px, -.04em, -4px);
  margin-bottom: 12px;
}
h1 .hi { color: var(--accent); }
h1 .lo { color: #c0c5cf; }
.subtitle {
  font-family: 'Space Mono', monospace;
  color: var(--muted);
  font-size: clamp(10px, 1.8vw, 13px);
  letter-spacing: 1px;
}

/* ── CARD ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: clamp(18px, 3.5vw, 32px);
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

/* ── FORM ─────────────────────────────────────────────────────────────────── */
.fgrid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.field { display: flex; flex-direction: column; }
label {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}
input[type=number], input[type=date], input[type=text] {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Space Mono', monospace;
  font-size: 14px;
  padding: 0 14px;
  height: 44px;
  outline: none;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10,132,255,.1);
}

/* type-sel (Preset/Manual) */
.type-sel {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  padding: 0 30px 0 12px;
  height: 44px;
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
  width: 105px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath fill='%236b7280' d='M1 1l5 4.5L11 1'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color .15s;
}
.type-sel:focus { border-color: var(--accent); }

.asset-row { display: flex; gap: 8px; align-items: center; }

/* ── CUSTOM DROPDOWN ──────────────────────────────────────────────────────── */
.cd { position: relative; flex: 1; min-width: 0; }

.cd-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  height: 44px;
  cursor: pointer;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
  user-select: none;
}
.cd-btn:hover, .cd-btn.open {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10,132,255,.1);
}
.cd-name {
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
.cd-chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform .2s;
}
.cd-btn.open .cd-chevron { transform: rotate(180deg); }

.cd-menu {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  max-height: 300px;
  overflow-y: auto;
}
.cd-menu.show { display: block; }

.cd-group {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px 5px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
}
.cd-group:first-child { border-top: none; }

.cd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background .1s;
}
.cd-item:hover { background: rgba(10,132,255,.06); }
.cd-item.active { background: rgba(10,132,255,.1); }
.cd-item-name {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  color: var(--text);
  flex: 1;
}
.cd-item-ticker {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: var(--muted);
}

/* ── TOGGLE ───────────────────────────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  cursor: pointer;
  user-select: none;
  width: fit-content;
}
.tog {
  width: 38px; height: 22px;
  background: #d1d5db;
  border-radius: 12px;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}
.tog.on { background: var(--accent); }
.tog::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.tog.on::after { transform: translateX(16px); }
.tog-label {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
}
.cmp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

/* ── BUTTONS ──────────────────────────────────────────────────────────────── */
.btn-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(13px, 2vw, 15px);
  letter-spacing: .5px;
  padding: 12px clamp(20px, 4vw, 32px);
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(10,132,255,.3);
}
.btn-primary:hover { background: #0070e0; transform: translateY(-1px); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.loader {
  display: none;
  align-items: center;
  gap: 10px;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--accent);
  text-transform: uppercase;
}
.loader.on { display: flex; }
.spin {
  width: 14px; height: 14px;
  border: 2px solid rgba(10,132,255,.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.err {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: var(--red);
  padding: 10px 14px;
  background: rgba(220,38,38,.06);
  border: 1px solid rgba(220,38,38,.2);
  border-radius: 8px;
  margin-top: 12px;
  display: none;
  line-height: 1.6;
}
.err.on { display: block; }

/* ── RESULTS ──────────────────────────────────────────────────────────────── */
#results { display: none; }
#results.on { display: block; }

.results-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}
.btn-share {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: .5px;
  padding: 9px 16px;
  cursor: pointer;
  transition: all .2s;
  text-transform: uppercase;
}
.btn-share:hover { background: #222; transform: translateY(-1px); }

/* ── SENTIMENT ────────────────────────────────────────────────────────────── */
.sentiment {
  border-radius: var(--radius);
  padding: clamp(14px,3vw,22px) clamp(16px,3vw,28px);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}
.s-moon { background: linear-gradient(135deg,#ecfdf5,#d1fae5); border: 1px solid #6ee7b7; }
.s-fire { background: linear-gradient(135deg,#eff6ff,#dbeafe); border: 1px solid #93c5fd; }
.s-meh  { background: linear-gradient(135deg,#fffbeb,#fef3c7); border: 1px solid #fcd34d; }
.s-rip  { background: linear-gradient(135deg,#fff1f2,#ffe4e6); border: 1px solid #fca5a5; }
.s-emoji { font-size: clamp(28px,5vw,40px); line-height: 1; flex-shrink: 0; }
.s-title { font-size: clamp(15px,3vw,19px); font-weight: 800; margin-bottom: 3px; }
.s-sub   { font-family: 'Space Mono',monospace; font-size: clamp(9px,1.5vw,11px); color: var(--muted); }

/* ── ASSET CARDS ──────────────────────────────────────────────────────────── */
.cards { display: grid; gap: 10px; margin-bottom: 16px; }
.acard {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(14px,3vw,20px) clamp(16px,3vw,24px);
  display: grid;
  grid-template-columns: 40px 1fr auto auto;
  gap: 0 clamp(10px,2.5vw,22px);
  align-items: center;
  position: relative;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
  overflow: hidden;
}
.acard:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.acard.r1 { border-color: #fbbf24; background: linear-gradient(to right,#fffbeb,#fff); }
.acard-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.acard-rank { font-size: clamp(22px,4vw,28px); line-height: 1; }
.acard-name {
  font-size: clamp(16px,2.8vw,20px);
  font-weight: 800;
  letter-spacing: -.4px;
  margin-bottom: 3px;
}
.acard-sub {
  font-family: 'Space Mono',monospace;
  font-size: clamp(9px,1.3vw,10px);
  color: var(--muted);
}
.badge {
  font-family: 'Space Mono',monospace;
  font-size: 8px;
  background: rgba(22,163,74,.1);
  color: var(--green);
  border: 1px solid rgba(22,163,74,.3);
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-left: 8px;
  vertical-align: middle;
}
.acard-amount {
  font-family: 'Space Mono',monospace;
  font-size: clamp(14px,2.2vw,20px);
  font-weight: 700;
  text-align: right;
}
.acard-lbl {
  font-family: 'Space Mono',monospace;
  font-size: 8px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 2px;
  text-align: right;
}
.acard-pct {
  font-family: 'Space Mono',monospace;
  font-size: clamp(16px,2.8vw,22px);
  font-weight: 700;
  text-align: right;
  min-width: 80px;
}
.pos { color: var(--green); }
.neg { color: var(--red); }

/* ── CHART ────────────────────────────────────────────────────────────────── */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(16px,3vw,26px);
  margin-bottom: 40px;
  box-shadow: var(--shadow);
}
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.chart-lbl {
  font-family: 'Space Mono',monospace;
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--muted);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chart-lbl::before {
  content: '';
  display: inline-block;
  width: 3px; height: 14px;
  background: var(--accent);
  border-radius: 2px;
}
.legend { display: flex; gap: 14px; flex-wrap: wrap; }
.leg-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Space Mono',monospace;
  font-size: 10px;
  color: var(--muted);
}
.leg-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── MODAL ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  max-width: 680px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
  position: relative;
}
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: none; border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--text); }
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 5px; }
.modal-sub {
  font-family: 'Space Mono',monospace;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 14px;
}
.modal-img { width: 100%; display: block; border-radius: 8px; margin-bottom: 14px; border: 1px solid var(--border); }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.mbtn {
  display: flex; align-items: center; gap: 7px;
  border-radius: 8px;
  font-family: 'Space Mono',monospace;
  font-size: 11px;
  letter-spacing: .5px;
  padding: 10px 16px;
  cursor: pointer;
  border: none;
  text-transform: uppercase;
  font-weight: 700;
  text-decoration: none;
  transition: all .15s;
}
.mbtn-copy { background: #f0f2f5; color: var(--text); }
.mbtn-copy:hover { background: #e2e6ed; }
.mbtn-copy.ok { background: #dcfce7; color: var(--green); }
.mbtn-x { background: #000; color: #fff; }
.mbtn-x:hover { background: #222; }
.mbtn-dl { background: #f0f2f5; color: var(--text); }
.mbtn-dl:hover { background: #e2e6ed; }
.mbtn-wa { background: #25d366; color: #fff; }
.mbtn-wa:hover { background: #1ebe5d; }
.modal-hint {
  font-family: 'Space Mono',monospace;
  font-size: 10px;
  color: #9ca3af;
  margin-top: 10px;
  text-align: center;
  line-height: 1.6;
}

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .fgrid { grid-template-columns: 1fr 1fr; }
  .fgrid .field:last-child { grid-column: 1/-1; }
}
@media (max-width: 580px) {
  .fgrid, .cmp-grid { grid-template-columns: 1fr; }
  .asset-row { flex-direction: column; }
  .type-sel { width: 100%; }
  .acard { grid-template-columns: 36px 1fr; grid-template-rows: auto auto; gap: 5px 10px; }
  .acard-amount, .acard-pct { grid-column: 2; text-align: left; min-width: 0; }
  .acard-lbl { text-align: left; }
  .btn-primary { width: 100%; justify-content: center; }
  .btn-row { flex-direction: column; align-items: stretch; }
  .chart-head { flex-direction: column; align-items: flex-start; }
}

/* ── POPULAR TIME TRAVELS ───────────────────────────────────────────────── */
#popularSection {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 40px;
}
#popularSection::before {
  content: '⚡ Popular time travels';
  display: block;
  width: 100%;
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.pop-btn {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  text-align: left;
}
.pop-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10,132,255,.08);
  transform: translateY(-1px);
}
.pop-name {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}
.pop-since {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── SEO TEXT BLOCK ─────────────────────────────────────────────────────── */
.seo-block {
  max-width: 1100px;
  margin: 0 auto 48px;
  padding: 28px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.seo-block h2 {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text);
}
.seo-block p {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  line-height: 1.8;
  color: var(--muted);
  margin-bottom: 8px;
}
.seo-block p:last-child { margin-bottom: 0; }
.seo-block em { color: var(--accent); font-style: normal; }

/* ── BACK LINK ──────────────────────────────────────────────────────────── */
.back-link {
  text-align: center;
  padding: 32px 0 48px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.back-link a {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}
.back-link a:hover { color: var(--accent); }
