:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #e6eaf0;
  --text: #111827;
  --muted: #6b778c;
  --subtle: #98a2b3;
  --green: #22c55e;
  --green-dark: #159447;
  --red: #ef4444;
  --orange: #ff9418;
  --shadow: 0 18px 48px rgba(19, 31, 51, 0.08);
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  margin: 0;
}

body {
  background: radial-gradient(circle at 10% -10%, #ffffff 0, var(--bg) 42%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.app-shell {
  width: min(1540px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.market-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 14px;
}

.market-identity {
  display: flex;
  align-items: center;
  min-width: 360px;
}

.coin-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-right: 16px;
  border-radius: 16px;
  color: white;
  background: linear-gradient(145deg, #ffad32, #f18400);
  box-shadow: 0 10px 24px rgba(255, 148, 24, 0.22);
  font-size: 42px;
  font-weight: 800;
}

.market-copy h1 {
  margin: 5px 0 4px;
  font-size: clamp(22px, 2vw, 30px);
  letter-spacing: -0.03em;
}

.market-copy p, .eyebrow-row {
  margin: 0;
  color: var(--muted);
}

.eyebrow-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.source-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
  letter-spacing: 0;
}

.source-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.source-status.healthy { color: var(--green-dark); background: #e9f9ef; }
.source-status.degraded { color: #b66b00; background: #fff4df; }
.source-status.unavailable { color: #b42318; background: #feeceb; }

.headline-stats {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(190px, 1.2fr) minmax(150px, 0.9fr);
  gap: 10px;
  min-width: min(610px, 54vw);
}

.stat-card, .countdown-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 78px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 24px rgba(19, 31, 51, 0.035);
}

.stat-card span, .countdown-card span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.stat-card strong, .countdown-card strong {
  font-size: clamp(21px, 1.7vw, 28px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-card.target strong { color: #667085; }
.stat-card.current strong { color: var(--orange); }

.stat-card small {
  min-height: 14px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.stat-card small.up { color: var(--green-dark); }
.stat-card small.down { color: var(--red); }
.countdown-card { text-align: center; }
.countdown-card strong { letter-spacing: 0.08em; }

.chart-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.chart-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: 52px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.interval-switch, .range-switch {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: #f2f4f7;
}

.interval-switch button, .range-switch button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.interval-switch button { padding: 7px 12px; }
.range-switch button { padding: 7px 9px; }
.interval-switch button:hover, .range-switch button:hover { color: var(--text); }

.interval-switch button.active, .range-switch button.active {
  background: white;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.12);
}

.ohlc-strip {
  display: flex;
  justify-content: center;
  gap: 14px;
  color: var(--subtle);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.ohlc-strip b { color: var(--muted); font-weight: 700; }

.chart-wrap {
  position: relative;
  height: clamp(420px, 62vh, 780px);
}

.chart { width: 100%; height: 100%; }

.chart-message {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.chart-message.error { color: #b42318; }
.chart-message[hidden] { display: none; }

.chart-hint {
  padding: 7px 14px 9px;
  color: var(--subtle);
  font-size: 10px;
  text-align: center;
}

.contract-bar {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px auto;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
}

.nav-arrow, .market-chip, .official-link {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  box-shadow: 0 5px 18px rgba(19, 31, 51, 0.04);
}

.nav-arrow { cursor: pointer; font-size: 27px; }

.market-chips {
  display: grid;
  grid-template-columns: repeat(5, minmax(92px, 1fr));
  gap: 7px;
  min-width: 0;
}

.market-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  color: #344054;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.market-chip:hover, .nav-arrow:hover, .official-link:hover { border-color: #bec7d5; }
.market-chip.active { border-color: #1f2937; background: #111827; color: white; }

.market-chip .outcome-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c5ccd7;
}

.market-chip .outcome-dot.up { background: var(--green); }
.market-chip .outcome-dot.down { background: var(--red); }

.official-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  color: #344054;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .market-header { flex-direction: column; }
  .headline-stats { min-width: 0; width: 100%; }
  .market-chips {
    overflow-x: auto;
    grid-template-columns: repeat(5, minmax(105px, 1fr));
    scrollbar-width: none;
  }
}

@media (max-width: 720px) {
  .app-shell { width: calc(100% - 16px); padding-top: 12px; }
  .market-identity { min-width: 0; }
  .coin-icon { width: 52px; height: 52px; margin-right: 12px; border-radius: 13px; font-size: 34px; }
  .headline-stats { grid-template-columns: 1fr 1fr; }
  .countdown-card { grid-column: 1 / -1; min-height: 56px; }
  .chart-toolbar { grid-template-columns: 1fr auto; }
  .ohlc-strip { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; overflow: hidden; }
  .range-switch button { padding-inline: 7px; }
  .chart-wrap { height: 52vh; min-height: 380px; }
  .contract-bar { grid-template-columns: 38px minmax(0, 1fr) 38px; }
  .official-link { grid-column: 1 / -1; }
}

