/* ── Reset & Base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root { color-scheme: dark; }

body {
  min-height: 100vh;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  color: #f0f4ff;
  padding: 28px 20px 56px;

  background-color: #060b18;
  background-image:
    radial-gradient(ellipse 70% 55% at 15% 10%,  rgba(56,120,255,0.20) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 85% 85%,  rgba(140,50,255,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%,  rgba(0,200,150,0.06)  0%, transparent 60%);
  background-attachment: fixed;
}

.app { max-width: 1280px; margin: 0 auto; }

/* ── Glass util ──────────────────────────────────────────────────────── */
.glass {
  background: rgba(255,255,255,0.055);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 8px 40px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.09);
}

/* ── Header ──────────────────────────────────────────────────────────── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 18px 24px;
  border-radius: 18px;
  margin-bottom: 24px;
}

.brand { display: flex; align-items: center; gap: 16px; }

.brand-icon {
  width: 50px; height: 50px; flex-shrink: 0;
  background: linear-gradient(135deg, #3b82f6, #7c3aed);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 0 24px rgba(99,102,241,0.5), 0 0 60px rgba(99,102,241,0.12);
}

.brand-name {
  font-size: 1.35rem; font-weight: 800; letter-spacing: -0.03em;
  background: linear-gradient(135deg, #e0eaff, #a5b4fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-sub { font-size: 0.8rem; color: #8ba0c4; margin-top: 3px; }

.header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.status-pill {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  padding: 7px 14px; border-radius: 22px;
  font-size: 0.8rem; color: #a0b8d8;
}

.dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot.live    { background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.dot.loading { background: #fbbf24; box-shadow: 0 0 6px #fbbf24; animation: blink 0.85s infinite; }
.dot.error   { background: #f87171; box-shadow: 0 0 6px #f87171; }

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.15} }

.btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #c0d4f0; padding: 8px 16px; border-radius: 9px;
  cursor: pointer; font-size: 0.82rem; font-weight: 600;
  transition: all 0.18s;
}
.btn:hover { background: rgba(255,255,255,0.15); color: #fff; box-shadow: 0 0 14px rgba(100,140,255,0.22); }

/* ── Coin Selector ───────────────────────────────────────────────────── */
.coin-selector {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 22px;
}

.coin-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.09);
  background: rgba(255,255,255,0.045);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  cursor: pointer; transition: all 0.2s;
  color: #7a9abf; font-size: 0.83rem; font-weight: 600;
  user-select: none;
}
.coin-pill:hover { border-color: rgba(255,255,255,0.2); color: #c8deff; background: rgba(255,255,255,0.08); }
.coin-pill.active {
  color: #fff;
  border-color: var(--cc);
  background: color-mix(in srgb, var(--cc) 20%, rgba(8,12,28,0.6));
  box-shadow: 0 0 16px color-mix(in srgb, var(--cc) 45%, transparent), inset 0 1px 0 rgba(255,255,255,0.12);
}

.swatch {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--cc);
  box-shadow: 0 0 7px var(--cc);
  flex-shrink: 0;
}

.ptag {
  font-size: 0.72rem; font-weight: 500; color: #566880;
  background: rgba(0,0,0,0.28); padding: 2px 7px; border-radius: 4px;
}
.coin-pill.active .ptag { color: rgba(255,255,255,0.6); }

/* ── Main Grid ───────────────────────────────────────────────────────── */
.grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 18px; margin-bottom: 18px;
}
@media (max-width: 720px) { .grid { grid-template-columns: 1fr; } }

/* ── Cards ───────────────────────────────────────────────────────────── */
.card { border-radius: 18px; padding: 26px; }

.card-title {
  font-size: 0.7rem; font-weight: 800;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: #5a7898; margin-bottom: 20px;
}

.profitability-title {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

.merged-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; text-decoration: none;
  padding: 5px 12px; border-radius: 7px;
  color: #fde68a;
  background: linear-gradient(135deg, rgba(251,191,36,0.22), rgba(180,90,10,0.18));
  border: 1px solid rgba(251,191,36,0.55);
  box-shadow: 0 0 14px rgba(251,191,36,0.35), inset 0 1px 0 rgba(255,255,255,0.08);
  transition: all 0.2s;
  cursor: pointer;
  animation: merged-pulse 2.4s ease-in-out infinite;
}
.merged-badge:hover {
  color: #fff;
  background: linear-gradient(135deg, rgba(251,191,36,0.38), rgba(180,90,10,0.28));
  box-shadow: 0 0 24px rgba(251,191,36,0.55), inset 0 1px 0 rgba(255,255,255,0.12);
  transform: translateY(-1px);
}

@keyframes merged-pulse {
  0%, 100% { box-shadow: 0 0 14px rgba(251,191,36,0.35), inset 0 1px 0 rgba(255,255,255,0.08); }
  50%       { box-shadow: 0 0 26px rgba(251,191,36,0.60), inset 0 1px 0 rgba(255,255,255,0.08); }
}

/* ── Form Fields ─────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }

.field label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: #8ab0d0; margin-bottom: 5px;
}

.label-note { font-size: 0.72rem; font-weight: 400; color: #3d5a78; }

input, select {
  width: 100%;
  background: rgba(255,255,255,0.065);
  border: 1px solid rgba(255,255,255,0.12);
  color: #f0f4ff; padding: 10px 12px;
  border-radius: 9px; font-size: 0.9rem;
  outline: none; transition: all 0.18s;
  -webkit-appearance: none; font-family: inherit;
}
input::placeholder { color: rgba(255,255,255,0.18); }
input:focus, select:focus {
  background: rgba(255,255,255,0.10);
  border-color: rgba(99,140,255,0.65);
  box-shadow: 0 0 0 3px rgba(99,140,255,0.16);
}
select option { background: #1a2540; }

.row {
  display: flex; gap: 8px;
}
.row input  { flex: 2; }
.row select { flex: 1; }

.price-row { display: flex; gap: 8px; align-items: center; }
.price-row input { flex: 1; }

.live-badge {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.05em;
  padding: 5px 10px; border-radius: 6px; white-space: nowrap; flex-shrink: 0;
  background: rgba(74,222,128,0.13); color: #4ade80;
  border: 1px solid rgba(74,222,128,0.28);
  box-shadow: 0 0 10px rgba(74,222,128,0.12);
}
.live-badge.manual {
  background: rgba(251,191,36,0.10); color: #fbbf24;
  border-color: rgba(251,191,36,0.28);
  box-shadow: 0 0 10px rgba(251,191,36,0.08);
}

/* ── Merged Learn Banner ─────────────────────────────────────────────── */
.merged-learn-banner {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 4px; margin-bottom: 6px;
  padding: 11px 14px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(251,191,36,0.09), rgba(180,90,10,0.07));
  border: 1px solid rgba(251,191,36,0.28);
  text-decoration: none;
  transition: all 0.2s;
}
.merged-learn-banner:hover {
  background: linear-gradient(135deg, rgba(251,191,36,0.16), rgba(180,90,10,0.12));
  border-color: rgba(251,191,36,0.50);
  box-shadow: 0 0 18px rgba(251,191,36,0.18);
}
.merged-learn-arrow {
  font-size: 1rem; flex-shrink: 0; margin-top: 1px;
}
.merged-learn-text {
  flex: 1; font-size: 0.78rem; color: #a89060; line-height: 1.45;
}
.merged-learn-text strong { color: #d4a84a; font-weight: 700; }
.merged-learn-link {
  flex-shrink: 0; font-size: 0.75rem; font-weight: 700;
  color: #fbbf24; white-space: nowrap; align-self: center;
  letter-spacing: 0.02em;
}
.merged-learn-banner:hover .merged-learn-link { color: #fff; }

/* ── Results ─────────────────────────────────────────────────────────── */
.results { display: flex; flex-direction: column; gap: 2px; }

.metric {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 14px; border-radius: 9px;
  transition: background 0.15s;
}
.metric:hover { background: rgba(255,255,255,0.04); }
.metric.divider { border-top: 1px solid rgba(255,255,255,0.07); margin-top: 6px; padding-top: 14px; }

.metric-label { font-size: 0.82rem; color: #7a9abf; }

.metric-val {
  font-size: 1.05rem; font-weight: 700;
  letter-spacing: -0.02em;
}
.metric-val.green  { color: #4ade80; text-shadow: 0 0 16px rgba(74,222,128,0.3); }
.metric-val.red    { color: #f87171; text-shadow: 0 0 16px rgba(248,113,113,0.25); }
.metric-val.yellow { color: #fbbf24; }
.metric-val.neutral{ color: #a0b8d4; }

/* ── Merged Mining Breakdown ─────────────────────────────────────────────── */
#mergedBreakdown {
  border-left: 2px solid rgba(255,255,255,0.07);
  margin: 2px 14px 6px;
  padding: 2px 0;
}

.metric-sub {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 5px 14px 5px 18px;
}

.metric-sub .metric-label { font-size: 0.76rem; color: #4a6888; }
.metric-sub .metric-val   { font-size: 0.9rem; font-weight: 700; }

/* ── Breakeven Banner ────────────────────────────────────────────────── */
.breakeven-box {
  margin-top: 16px; padding: 18px; border-radius: 12px; text-align: center;
}
.breakeven-box.good { background: rgba(74,222,128,0.08);  border: 1px solid rgba(74,222,128,0.22); }
.breakeven-box.ok   { background: rgba(251,191,36,0.08);  border: 1px solid rgba(251,191,36,0.22); }
.breakeven-box.bad  { background: rgba(248,113,113,0.08); border: 1px solid rgba(248,113,113,0.20); }

.be-days { font-size: 2.4rem; font-weight: 900; letter-spacing: -0.04em; }
.be-days.good { color: #4ade80; text-shadow: 0 0 30px rgba(74,222,128,0.45); }
.be-days.ok   { color: #fbbf24; text-shadow: 0 0 30px rgba(251,191,36,0.38); }
.be-days.bad  { color: #f87171; text-shadow: 0 0 30px rgba(248,113,113,0.38); }

.be-label { font-size: 0.82rem; color: #7a9abf; margin-top: 3px; font-weight: 600; }
.be-date  { font-size: 0.75rem; color: #4a6888; margin-top: 7px; }

.hint {
  padding: 12px; background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 9px; text-align: center;
  font-size: 0.82rem; color: #4a6888; margin-top: 12px;
}

/* ── Chart ───────────────────────────────────────────────────────────── */
.chart-card { border-radius: 18px; padding: 26px; }

.chart-top { margin-bottom: 18px; }

.chart-sub { font-size: 0.77rem; color: #4a6888; margin-top: 4px; }

.chart-wrap { position: relative; height: 270px; }
.chart-wrap canvas { width: 100% !important; height: 100% !important; }

.chart-empty {
  text-align: center; padding: 60px 0;
  font-size: 0.85rem; color: #4a6888;
}
