:root {
  --bg: #0b1020;
  --panel: #121933;
  --panel-2: #172149;
  --border: #263160;
  --text: #e7ecf5;
  --muted: #8a97b8;
  --accent: #7cf5a4;
  --accent-2: #66a7ff;
  --warn: #ffb86b;
  --grid: #22305e;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans HK", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 10% -10%, #1a2a6b 0%, transparent 60%),
              radial-gradient(900px 500px at 120% 10%, #2a1a6b 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.hero {
  padding: 56px 0 24px;
}
.hero h1 {
  font-size: clamp(28px, 4.2vw, 44px);
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}
.hero h1 span {
  color: var(--muted);
  font-weight: 500;
}
.hero .sub {
  color: var(--muted);
  max-width: 900px;
  margin: 0;
}

.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 16px 40px rgba(0,0,0,0.35);
}

.banner {
  margin-top: 16px;
  background: linear-gradient(135deg, rgba(124, 245, 164, 0.10), rgba(102, 167, 255, 0.10));
  border: 1px solid rgba(124, 245, 164, 0.35);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
.banner strong { color: var(--accent); }

.switch-callout {
  margin-top: 16px;
  background: linear-gradient(135deg, rgba(255, 184, 107, 0.10), rgba(124, 245, 164, 0.08));
  border: 1px solid rgba(255, 184, 107, 0.35);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
}
.switch-callout .hl {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.contact-card {
  margin-top: 20px;
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.10), rgba(37, 211, 102, 0.04));
  border-color: rgba(37, 211, 102, 0.35);
}
.contact-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.contact-inner h3 { margin: 0 0 6px; font-size: 18px; color: var(--text); }
.contact-inner p { margin: 0; color: var(--muted); max-width: 640px; }
.wa-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #25d366;
  color: #0b1020;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 18px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.wa-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(37, 211, 102, 0.45);
  text-decoration: none;
}
.wa-icon { font-size: 18px; }

.controls {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr) 1.6fr;
  gap: 20px;
  align-items: end;
  margin-top: 12px;
}
.control label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}
.age-row {
  display: flex;
  gap: 12px;
  align-items: center;
}
#age {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 50%, var(--warn) 100%);
  outline: none;
}
#age::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent-2);
  cursor: grab;
}
#age::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent-2);
  cursor: grab;
}
#ageNum {
  width: 72px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 15px;
}
#ageNote { color: var(--muted); font-size: 12px; display: block; margin-top: 6px; }

.seg {
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  width: 100%;
}
.seg-btn {
  flex: 1;
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.seg-btn.active {
  background: linear-gradient(180deg, var(--accent-2), #4b84dc);
  color: #fff;
  font-weight: 600;
}

.summary .top-pick {
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
}
.renewal-note {
  display: block;
  margin-top: 8px;
  color: var(--warn);
  font-size: 12px;
}
.top-pick .name { color: var(--accent); }
.top-pick .price { margin-left: 6px; color: var(--text); font-variant-numeric: tabular-nums; }
.top-pick .diff { color: var(--muted); font-weight: 500; font-size: 13px; margin-left: 6px; }

.grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  margin-top: 20px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.card-head h2 {
  font-size: 16px;
  margin: 0;
  letter-spacing: -0.01em;
}
.legend-hint {
  color: var(--muted);
  font-size: 12px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
}
.dot.cheapest { background: var(--accent); }
.dot.other { background: #3b4780; }
.dot.highlight { background: var(--warn); }

.chart-wrap {
  position: relative;
  height: 460px;
}

#filter {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  min-width: 0;
  width: 140px;
}

.rank {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 460px;
  overflow-y: auto;
}
.rank li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.rank li:hover {
  background: rgba(255,255,255,0.03);
  border-color: var(--border);
}
.rank li.active {
  background: rgba(124, 245, 164, 0.08);
  border-color: rgba(124, 245, 164, 0.45);
}
.rank li .rnum {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 13px;
}
.rank li:first-child .rnum {
  color: var(--accent);
  font-weight: 700;
}
.rank li .name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank li .tag {
  display: inline-block;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}
.rank li .price {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.rank li .delta {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}
.rank li.cheapest .price { color: var(--accent); }
.rank li.pinned { border-color: var(--warn); }

.disclaim {
  margin: 20px 0;
}
.disclaim h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.disclaim ul { margin: 0; padding-left: 20px; color: var(--text); }
.disclaim li { margin-bottom: 6px; }

.foot {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  padding-top: 12px;
  padding-bottom: 40px;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 1100px) {
  .controls { grid-template-columns: 1fr 1fr 1fr; }
  .controls .summary { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .controls { grid-template-columns: 1fr 1fr; }
  .grid { grid-template-columns: 1fr; }
  .chart-wrap { height: 360px; }
  .rank { max-height: 360px; }
  .contact-inner { justify-content: flex-start; }
  .wa-btn { width: 100%; justify-content: center; }
}
@media (max-width: 520px) {
  .controls { grid-template-columns: 1fr; }
  .hero { padding-top: 40px; }
}
