:root {
  --bg-top: #f8c34a;
  --bg-bottom: #f6efe4;
  --card: #fffdfa;
  --line: rgba(214, 162, 56, 0.28);
  --gold: #d6a238;
  --accent: #ea4028;
  --text: #261300;
  --muted: #8f7858;
  --shadow: 0 16px 40px rgba(142, 101, 24, 0.14);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: linear-gradient(180deg, var(--bg-top) 0%, #fdf4da 16%, var(--bg-bottom) 100%);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
}

body { display: flex; justify-content: center; }

.history-page {
  width: min(100%, 430px);
  min-height: 100vh;
  padding: 16px 14px 24px;
}

.history-header,
.history-hero,
.chart-card {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.history-header {
  border-radius: 22px;
  padding: 16px 16px 14px;
  display: flex;
  gap: 14px;
  align-items: center;
}

.back-link {
  flex: 0 0 auto;
  color: #8d6500;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.history-title {
  font-size: 22px;
  font-weight: 800;
}

.history-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.history-hero {
  margin-top: 14px;
  border-radius: 24px;
  padding: 22px 18px;
  text-align: center;
}

.history-price-label {
  color: var(--muted);
  font-size: 14px;
}

.history-price-row {
  margin-top: 10px;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.history-price {
  font-size: clamp(54px, 15vw, 70px);
  font-weight: 800;
  color: var(--accent);
  line-height: 0.95;
}

.history-unit {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.range-tabs {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.range-tab {
  border: 0;
  border-radius: 999px;
  height: 42px;
  background: rgba(255, 249, 236, 0.92);
  color: #8b6a3e;
  font-size: 14px;
  font-weight: 700;
}

.range-tab.is-active {
  background: linear-gradient(180deg, #ffab33, #ff8912);
  color: #fff;
}

.chart-card {
  margin-top: 14px;
  border-radius: 24px;
  padding: 16px 12px 12px;
  position: relative;
  overflow: hidden;
  min-height: 360px;
}

.chart-loading,
.chart-empty {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
}

.chart-loading { display: flex; }

.chart-svg {
  width: 100%;
  height: 340px;
  display: block;
}

.chart-tooltip {
  position: absolute;
  display: none;
  transform: translate(-50%, -100%);
  min-width: 92px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(38, 19, 0, 0.86);
  color: #fff;
  pointer-events: none;
}

.chart-tooltip-price {
  font-size: 14px;
  font-weight: 800;
}

.chart-tooltip-date {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(255,255,255,0.82);
}
