:root {
  color-scheme: dark;
  --bg: #090b10;
  --surface: rgba(21, 24, 32, 0.84);
  --surface-strong: #171a22;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f7f8fb;
  --muted: #9aa1ae;
  --bitcoin: #f7931a;
  --positive: #35d49a;
  --negative: #ff627d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(247, 147, 26, 0.11), transparent 35%),
    radial-gradient(circle at 85% 40%, rgba(112, 72, 232, 0.08), transparent 35%),
    var(--bg);
}

button, input { font: inherit; }
button { color: inherit; }

.background-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 76%);
}

.site-header,
.dashboard,
footer {
  position: relative;
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.02em;
}


.brand-copy {
  display: grid;
  gap: 1px;
  line-height: 1.05;
}

.brand-copy strong {
  font-size: 1.02rem;
  letter-spacing: -0.025em;
}

.brand-copy small {
  color: var(--bitcoin);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.bitcoin-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: #111;
  background: var(--bitcoin);
  box-shadow: 0 0 30px rgba(247,147,26,.23);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .82rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.status-dot--live { background: var(--positive); box-shadow: 0 0 12px rgba(53,212,154,.65); }
.status-dot--error { background: var(--negative); }
.status-dot--loading { animation: pulse 1.2s ease-in-out infinite; }

.dashboard {
  display: grid;
  gap: 18px;
  padding: 16px 0 42px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(24px, 5vw, 44px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--bitcoin);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .14em;
}

.price-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.price {
  margin: 0;
  font-size: clamp(3rem, 9vw, 6.4rem);
  line-height: .98;
  letter-spacing: -0.075em;
}

.change-badge {
  padding: 8px 11px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 800;
}
.change-badge--positive { color: var(--positive); background: rgba(53,212,154,.11); }
.change-badge--negative { color: var(--negative); background: rgba(255,98,125,.11); }
.change-badge--neutral { color: var(--muted); background: rgba(255,255,255,.06); }

.updated { margin: 14px 0 0; color: var(--muted); font-size: .86rem; }

.refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 110px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  background: rgba(255,255,255,.045);
  transition: transform .18s ease, background .18s ease;
}
.refresh-button:hover { transform: translateY(-2px); background: rgba(255,255,255,.08); }
.refresh-button:disabled { opacity: .6; cursor: wait; transform: none; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.stat { padding: 21px; }
.stat p { margin: 0 0 8px; color: var(--muted); font-size: .78rem; }
.stat strong { font-size: clamp(1rem, 2.3vw, 1.35rem); letter-spacing: -.025em; }

.chart-card { padding: clamp(22px, 4vw, 34px); }
.chart-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.chart-header h2, .converter h2 { margin: 0; font-size: clamp(1.25rem, 2.8vw, 1.7rem); letter-spacing: -.035em; }

.range-selector { display: flex; gap: 7px; padding: 5px; border: 1px solid var(--border); border-radius: 13px; background: rgba(255,255,255,.025); }
.range-button { min-width: 45px; padding: 8px 10px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-size: .78rem; font-weight: 800; }
.range-button.active { color: #17130d; background: var(--bitcoin); }

.chart-summary { display: flex; align-items: center; gap: 12px; margin: 30px 0 3px; }
.chart-summary span:first-child { font-size: 1.15rem; font-weight: 800; }
.chart-summary span:last-child { color: var(--muted); font-size: .8rem; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }

.chart-wrap { position: relative; height: 360px; margin-top: 4px; }
#priceChart { width: 100%; height: 100%; display: block; }
.chart-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .9rem; }

.tooltip {
  position: absolute;
  z-index: 4;
  transform: translate(-50%, calc(-100% - 14px));
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  background: #11141b;
  box-shadow: 0 12px 28px rgba(0,0,0,.4);
  pointer-events: none;
  white-space: nowrap;
  font-size: .76rem;
}

.converter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: clamp(22px, 4vw, 32px);
}

.converter-fields { display: flex; align-items: end; gap: 12px; }
.converter label { display: grid; gap: 7px; color: var(--muted); font-size: .73rem; font-weight: 800; }
.converter input { width: min(220px, 32vw); padding: 13px 14px; border: 1px solid var(--border); border-radius: 13px; outline: none; color: var(--text); background: rgba(255,255,255,.045); }
.converter input:focus { border-color: rgba(247,147,26,.6); box-shadow: 0 0 0 3px rgba(247,147,26,.1); }
.equals { padding-bottom: 12px; color: var(--muted); }

footer { padding: 2px 0 36px; color: #737b89; text-align: center; font-size: .73rem; }

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

@media (max-width: 800px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .converter { align-items: flex-start; flex-direction: column; }
  .converter-fields { width: 100%; }
  .converter label { flex: 1; }
  .converter input { width: 100%; }
}

@media (max-width: 560px) {
  .site-header, .dashboard, footer { width: min(100% - 22px, 1120px); }
  .site-header { padding-top: 18px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .refresh-button { width: 100%; }
  .stats-grid { gap: 11px; }
  .chart-header { flex-direction: column; }
  .range-selector { width: 100%; }
  .range-button { flex: 1; }
  .chart-wrap { height: 300px; }
  .converter-fields { align-items: stretch; flex-direction: column; }
  .equals { padding: 0; text-align: center; }
}
