*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --border:    #30363d;
  --text:      #e6edf3;
  --muted:     #7d8590;
  --accent:    #f7931a;
  --green:     #3fb950;
  --red:       #f85149;
  --blue:      #58a6ff;
  --purple:    #bc8cff;
  --yellow:    #e3b341;
  --rose:      #fb7185;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-price {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btc-label {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.usd-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  align-self: flex-end;
  margin-bottom: 3px;
}

.price-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: var(--muted);
  text-transform: uppercase;
}

#live-price-val {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  transition: color 0.3s;
}

.header-preds {
  display: flex;
  gap: 20px;
  padding-left: 20px;
  border-left: 1px solid var(--border);
}

.header-pred {
  display: flex;
  flex-direction: column;
}

.header-pred span:last-child {
  font-size: 18px;
  font-weight: 700;
}

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  position: relative;
}

.about-btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: color 0.15s, border-color 0.15s;
}

.about-btn:hover {
  color: var(--text);
  border-color: var(--text);
}

.about-popup {
  position: absolute;
  top: 56px;
  right: 24px;
  left: max(8px, calc(100% - 540px - 24px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  width: auto;
  max-width: 540px;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.about-lead {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 16px;
}

.about-lead strong { color: var(--accent); }
.about-lead code {
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--blue);
}

.about-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 8px;
  margin-top: 4px;
}

.about-steps {
  font-size: 12px;
  color: var(--text);
  line-height: 1.7;
  padding-left: 18px;
  margin-bottom: 16px;
}

.about-steps strong { color: var(--accent); }

.about-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.about-tag {
  font-size: 11px;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  color: var(--text);
  letter-spacing: 0.3px;
}

.about-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.ws-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  position: relative;
}

.ws-status.live {
  color: var(--green);
}

.usage-popup {
  position: absolute;
  top: 56px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  width: 240px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.usage-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 12px;
}

.usage-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--text);
}

.usage-row span:first-child { color: var(--muted); }

.usage-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-top: 12px;
  overflow: hidden;
}

.usage-bar {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.4s;
}

.usage-bar-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  text-align: right;
}

.info-btn {
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  font-weight: 400;
  vertical-align: middle;
  transition: color 0.2s;
  margin-left: 4px;
}

.info-btn:hover { color: var(--text); }

.info-popup {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
}

.info-desc {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.6;
}

.info-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}

.info-table th {
  font-size: 11px;
  padding: 6px 10px;
}

.info-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.info-table tr:last-child td { border-bottom: none; }

/* ── donate bar ── */
.donate-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 24px;
  background: rgba(247, 147, 26, 0.05);
  border-bottom: 1px solid rgba(247, 147, 26, 0.2);
  gap: 16px;
}

.donate-text {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s;
  user-select: none;
}

.donate-text:hover {
  color: var(--accent);
  text-decoration: underline;
}

.donate-btn-form {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.donate-btn-form input[type="image"] {
  display: block;
}

/* ── donate popup overlay ── */
.donate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donate-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 32px;
  max-width: 340px;
  width: 90%;
  box-shadow: 0 12px 48px rgba(0,0,0,0.6);
  color: var(--text);
  text-align: center;
}

.donate-desc {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.donate-qr {
  width: 200px;
  height: 200px;
  display: block;
  margin: 0 auto 14px;
  border-radius: 6px;
  border: 2px solid var(--border);
}

.donate-link {
  display: block;
  font-size: 12px;
  color: var(--blue);
  text-decoration: underline;
  margin-bottom: 16px;
  word-break: break-all;
}

/* ── disclaimer (bottom) ── */
.disclaimer {
  background: rgba(247, 147, 26, 0.07);
  border-bottom: 1px solid rgba(247, 147, 26, 0.25);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 7px 24px;
  letter-spacing: 0.2px;
}

.disclaimer-bottom {
  border-bottom: none;
  border-top: 1px solid rgba(247, 147, 26, 0.25);
}
.disclaimer-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  white-space: nowrap;
}
.disclaimer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.disclaimer-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 32px;
  max-width: 540px;
  width: 90%;
  box-shadow: 0 12px 48px rgba(0,0,0,0.6);
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
}
.disclaimer-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
}
.disclaimer-modal p {
  margin: 0 0 12px;
  color: var(--muted);
}
.disclaimer-copy {
  font-size: 11px;
  margin-top: 16px !important;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.disclaimer-close {
  margin-top: 8px;
  width: 100%;
  padding: 8px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.card h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 16px;
}

.sentiment-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.sentiment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  position: relative;
}

.sentiment-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.sentiment-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.sentiment-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid var(--muted);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1;
  flex-shrink: 0;
}

.sentiment-info-icon:hover { color: var(--text); border-color: var(--text); }

.sentiment-value {
  font-size: 20px;
  font-weight: 700;
  display: block;
  margin-bottom: 14px;
}

/* Fear & Greed gauge */
.fg-track {
  height: 6px;
  background: linear-gradient(to right, #f85149 0%, #e3b341 50%, #3fb950 100%);
  border-radius: 3px;
  position: relative;
  margin-bottom: 5px;
}

.fg-needle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--text);
  border: 2px solid var(--bg);
  border-radius: 50%;
  top: -3px;
  transform: translateX(-50%);
  transition: left 0.5s ease;
}

/* Funding rate bar */
.fr-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  position: relative;
  margin-bottom: 5px;
}

.fr-center {
  position: absolute;
  left: 50%;
  top: -3px;
  width: 2px;
  height: 12px;
  background: var(--muted);
  transform: translateX(-50%);
  border-radius: 1px;
}

.fr-fill {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 3px;
  transition: left 0.5s ease, width 0.5s ease;
}

/* Shared gauge labels */
.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  opacity: 0.6;
}

/* Sentiment info popup */
.sent-info-popup {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.period-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.period-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 4px 9px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.period-btn:hover {
  border-color: var(--text);
  color: var(--text);
}

.period-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

.reset-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 4px 9px;
  margin-left: auto;
  transition: border-color 0.15s, color 0.15s;
}

.reset-btn:hover {
  border-color: var(--text);
  color: var(--text);
}

.pred-toggle-btn {
  background: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 4px 8px;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
#ptoggle-1h { margin-left: 8px; }
.pred-toggle-btn.pred-1h { border: 1px solid rgba(88,166,255,0.4); color: #58a6ff; }
.pred-toggle-btn.pred-1d { border: 1px solid rgba(188,140,255,0.4); color: #bc8cff; }
.pred-toggle-btn.pred-1w { border: 1px solid rgba(251,113,133,0.4);  color: var(--rose); }
.pred-toggle-btn.pred-1h.active { background: rgba(88,166,255,0.12); border-color: #58a6ff; }
.pred-toggle-btn.pred-1d.active { background: rgba(188,140,255,0.12); border-color: #bc8cff; }
.pred-toggle-btn.pred-1w.active { background: rgba(251,113,133,0.12);  border-color: var(--rose); }

.chart-wrap {
  position: relative;
}

#chart {
  width: 100%;
  height: 420px;
  border-radius: 4px;
}

.price-marker {
  position: absolute;
  top: 0;
  right: 2px;
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 16px;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-50%);
  opacity: 0;
  z-index: 5;
  user-select: none;
}
.pm-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
}
#chart-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  background: rgba(22,27,34,0.92);
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.1s;
}
#chart-tooltip .tt-time { color: var(--muted); font-size: 11px; margin-bottom: 2px; }
#chart-tooltip .tt-o { color: var(--muted); }
#chart-tooltip .tt-h { color: var(--green); }
#chart-tooltip .tt-l { color: var(--red); }
#chart-tooltip .tt-c { color: var(--accent); font-weight: 600; }
#chart-tooltip .tt-v { color: var(--muted); }

#pm-price { color: #f7931a; }
#pm-1h    { color: #58a6ff; }
#pm-1d    { color: #bc8cff; }
#pm-1w    { color: var(--rose); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
}

.stat-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.horizon-1h { color: var(--blue); }
.horizon-1d { color: var(--purple); }
.horizon-1w { color: var(--rose); }

.latest-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
}

.latest-horizons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.horizon-block {
  text-align: center;
  padding: 12px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.horizon-block .h-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

.horizon-block .h-price {
  font-size: 18px;
  font-weight: 700;
}

.horizon-block .h-delta {
  font-size: 12px;
  margin-top: 3px;
}

.reasoning-box {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  border-left: 3px solid var(--border);
  padding-left: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

.up   { color: var(--green); }
.down { color: var(--red); }
.na   { color: var(--muted); }

footer {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
}


/* ── game chip & popup ── */
.game-chip {
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: opacity 0.15s;
}
.game-chip:hover  { opacity: 0.8; }
.game-chip-up     { color: var(--green); border-color: var(--green); }
.game-chip-down   { color: var(--red);   border-color: var(--red);   }

.game-popup {
  position: absolute;
  top: 56px;
  right: 24px;
  left: max(8px, calc(100% - 560px - 24px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  width: auto;
  max-width: 560px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.game-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid var(--muted);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
  margin-left: 6px;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1;
}
.game-info-icon:hover { color: var(--text); border-color: var(--text); }

.game-info-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 12px;
}

.game-info-box strong { color: var(--text); }

.game-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(247, 147, 26, 0.15);
  border: 1px solid rgba(247, 147, 26, 0.4);
  color: var(--accent);
  border-radius: 4px;
  padding: 2px 6px;
  vertical-align: middle;
  margin-left: 6px;
}

/* ── kraken real portfolio chip & popup ── */
.kraken-chip {
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  padding: 4px 10px;
  border: 1px solid #5b9cf6;
  border-radius: 4px;
  color: #5b9cf6;
  transition: opacity 0.15s;
}
.kraken-chip:hover { opacity: 0.8; }

.kraken-popup {
  position: absolute;
  top: 56px;
  right: 24px;
  left: max(8px, calc(100% - 700px - 24px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  width: auto;
  max-width: 700px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.kraken-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(91, 156, 246, 0.15);
  border: 1px solid rgba(91, 156, 246, 0.4);
  color: #5b9cf6;
  border-radius: 4px;
  padding: 2px 6px;
  vertical-align: middle;
  margin-left: 6px;
}
