* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #04070e;
  --panel: #080d16;
  --cyan: #00e5ff;
  --text: #e8f4ff;
  --muted: #5f7391;
  --down: #22e2b6;
  --up: #ff5d6c;
}

html, body {
  background: #02040a;
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100dvh; }

.mono { font-family: "DIN Alternate", "SF Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  background-image:
    linear-gradient(rgba(0,229,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,255,.03) 1px, transparent 1px);
  background-size: 28px 28px;
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  background: rgba(4,7,14,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0,229,255,.08);
}

.brand {
  display: flex;
  align-items: center;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #f0faff;
}

.brand-dot {
  width: 7px; height: 7px; margin-right: 9px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 12px var(--cyan);
}

.city-select {
  padding: 7px 12px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  color: #b9e9ff;
  border: 1px solid rgba(0,229,255,.35);
  background: rgba(0,229,255,.07);
  outline: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.city-caret { font-size: 9px; opacity: .8; }

.city-modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(2,5,10,.72);
  backdrop-filter: blur(6px);
}
.city-modal[hidden] { display: none; }

.city-panel {
  width: 100%; max-width: 480px; max-height: 78vh;
  display: flex; flex-direction: column;
  background: #080d16;
  border-top: 1px solid rgba(0,229,255,.22);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 40px rgba(0,229,255,.12);
  animation: sheetUp .22s ease both;
}

@keyframes sheetUp {
  from { transform: translateY(16px); opacity: .6; }
  to { transform: none; opacity: 1; }
}

.city-head { display: flex; gap: 8px; padding: 14px 16px 10px; }

.city-search {
  flex: 1; padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0,229,255,.25);
  background: rgba(0,229,255,.05);
  color: var(--text);
  font-family: inherit; font-size: 14px;
  outline: none;
}
.city-search:focus { border-color: rgba(0,229,255,.6); }

.city-close {
  padding: 0 14px; border-radius: 10px;
  border: 1px solid rgba(0,229,255,.25);
  background: transparent; color: #b9e9ff;
  font-family: inherit; font-size: 13px;
  cursor: pointer;
}

.city-list {
  overflow-y: auto;
  padding: 0 8px calc(14px + env(safe-area-inset-bottom));
}

.city-group {
  padding: 12px 8px 4px;
  font-size: 10px; letter-spacing: 1px; color: var(--muted);
}

.city-item {
  display: block; width: 100%; padding: 11px 10px;
  text-align: left;
  background: transparent; border: 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
  color: var(--text); font-family: inherit; font-size: 14px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.city-item:active { background: rgba(0,229,255,.08); }
.city-item.active { color: var(--cyan); }

.city-empty { padding: 26px 12px; text-align: center; color: var(--muted); font-size: 13px; }

.city-hot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 16px 12px;
}
.city-hot[hidden] { display: none; }

.city-chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0,229,255,.28);
  background: rgba(0,229,255,.06);
  color: #c9f2ff;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.city-chip:active { background: rgba(0,229,255,.16); }
.city-chip.active { border-color: rgba(0,229,255,.75); color: var(--cyan); }

.main {
  flex: 1;
  padding: 14px 16px calc(84px + env(safe-area-inset-bottom));
}

.view { display: none; }
.view.active { display: block; animation: fadeUp .24s ease both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.view-head { display: flex; align-items: flex-end; justify-content: space-between; }
.view-head h1 { font-size: 23px; font-weight: 700; letter-spacing: 1px; }
.view-sub { margin-top: 5px; font-size: 11px; color: var(--muted); }

.card {
  border-radius: 14px;
  border: 1px solid rgba(0,229,255,.16);
  background: linear-gradient(155deg, rgba(24,44,74,.9), rgba(7,12,22,.94));
  box-shadow: 0 6px 20px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06);
}

.status {
  display: flex;
  align-items: center;
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid rgba(0,229,255,.14);
  background: rgba(0,229,255,.05);
}

.status-dot {
  width: 6px; height: 6px; margin-right: 7px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 8px var(--cyan);
  animation: blink 1.4s ease-in-out infinite;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.status-label { font-size: 11px; color: #7d97b8; }
.status-time { margin-left: 7px; font-size: 14px; font-weight: 700; color: #7df3ff; text-shadow: 0 0 10px rgba(0,229,255,.5); }

.seg {
  display: flex;
  margin-top: 14px;
  padding: 3px;
  border-radius: 11px;
  border: 1px solid rgba(0,229,255,.16);
  background: rgba(9,16,28,.9);
}

.seg-item {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 1px;
  color: #6f88a8;
  cursor: pointer;
}

.seg-item.active {
  color: #041019;
  font-weight: 700;
  background: linear-gradient(120deg, var(--cyan), #2f9bff);
  box-shadow: 0 4px 14px rgba(0,229,255,.32);
}

.list { margin-top: 12px; display: flex; flex-direction: column; gap: 9px; }

.row { display: flex; align-items: center; padding: 14px 15px; border-radius: 12px; }
.row-grade { display: flex; align-items: baseline; width: 62px; }
.grade-num { font-size: 27px; font-weight: 700; color: #8beeff; text-shadow: 0 0 12px rgba(0,229,255,.4); }
.grade-hash { margin-left: 3px; font-size: 12px; color: #3f6a8c; }
.row-mid { flex: 1; }
.row-name { font-size: 12px; letter-spacing: 1px; color: #9fc2e0; }
.row-meta { display: flex; align-items: center; margin-top: 5px; }
.row-prev { font-size: 12px; color: #5a708c; text-decoration: line-through; }
.row-delta { margin-left: 7px; padding: 1px 6px; border-radius: 4px; font-size: 10px; background: rgba(34,226,182,.1); }
.row-delta.up { background: rgba(255,93,108,.12); }
.row-price { font-size: 33px; font-weight: 700; line-height: 1; color: #fff; text-shadow: 0 0 16px rgba(0,229,255,.3); }
.down { color: var(--down); }
.up { color: var(--up); }

.round { display: flex; align-items: center; margin-top: 13px; padding: 13px 15px; }
.round-cell { flex: 1; }
.round-label { font-size: 10px; letter-spacing: 1px; color: var(--muted); }
.round-value { display: block; margin-top: 3px; font-size: 12px; color: #b9d9f2; }
.round-line {
  width: 1px; height: 30px; margin: 0 12px;
  background: linear-gradient(180deg, rgba(0,229,255,0), rgba(0,229,255,.5), rgba(0,229,255,0));
}

.alert {
  display: flex; align-items: center; margin-top: 10px; padding: 13px 15px;
  border-color: rgba(255,160,60,.28);
  background: linear-gradient(120deg, rgba(255,140,20,.14), rgba(7,12,22,.94));
}
.alert-text { flex: 1; }
.alert-title { font-size: 14px; font-weight: 600; color: #ffd9a8; }
.alert-desc { display: block; margin-top: 3px; font-size: 11px; color: #9d8467; }
.alert-btn {
  padding: 8px 16px; border: none; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 700; color: #1a1003;
  background: linear-gradient(120deg, #ffc46b, #ff8a1f);
  box-shadow: 0 4px 12px rgba(255,138,31,.3);
}
.alert-btn.on { color: #ffcf9a; background: rgba(255,150,40,.12); border: 1px solid rgba(255,150,40,.4); box-shadow: none; }

.foot-note { margin-top: 18px; text-align: center; font-size: 10px; letter-spacing: .5px; color: #3f526c; }

.locate {
  display: flex;
  align-items: center;
  margin-top: 11px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid rgba(0,229,255,.14);
  background: rgba(0,229,255,.05);
}
.locate-dot {
  width: 6px; height: 6px; margin-right: 7px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 8px var(--cyan);
  animation: blink 1.4s ease-in-out infinite;
}
.locate-text { flex: 1; font-size: 11px; color: #7d97b8; }
.locate-btn {
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: 11px; color: #7df3ff;
  border: 1px solid rgba(0,229,255,.4); background: rgba(0,229,255,.08);
}

.chip-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.chip {
  padding: 8px 15px; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: 13px; color: #7d97b8;
  border: 1px solid rgba(255,255,255,.08); background: rgba(12,20,34,.9);
}
.chip.active {
  color: #7df3ff; border-color: rgba(0,229,255,.5); background: rgba(0,229,255,.1);
  box-shadow: 0 0 14px rgba(0,229,255,.18);
}

.sort-row {
  display: flex; margin-top: 10px; padding: 3px; border-radius: 9px;
  border: 1px solid rgba(0,229,255,.16); background: rgba(9,16,28,.9);
}
.sort {
  flex: 1; padding: 9px 0; border: none; border-radius: 7px; cursor: pointer;
  font-family: inherit; font-size: 12px; color: #6f88a8; background: transparent;
}
.sort.active { color: #041019; font-weight: 700; background: linear-gradient(120deg, var(--cyan), #2f9bff); }

.summary { display: flex; align-items: center; margin-top: 12px; padding: 14px 15px; }
.sum-label { display: block; font-size: 10px; letter-spacing: .5px; color: var(--muted); }
.sum-price { display: flex; align-items: baseline; margin-top: 3px; }
.sum-num { font-size: 27px; font-weight: 700; line-height: 1; color: #7df3ff; text-shadow: 0 0 14px rgba(0,229,255,.5); }
.sum-unit { margin-left: 5px; font-size: 10px; color: #6f88a8; }
.sum-line {
  width: 1px; height: 34px; margin: 0 16px;
  background: linear-gradient(180deg, rgba(0,229,255,0), rgba(0,229,255,.4), rgba(0,229,255,0));
}
.sum-right { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; }
.sum-avg { margin-top: 5px; font-size: 18px; font-weight: 700; color: #b9d9f2; }
.summary .summary-item { flex: 1; text-align: center; border-right: 1px solid rgba(0,229,255,.1); }
.summary .summary-item:last-child { border-right: none; }
.summary .summary-value { display: block; margin-top: 4px; font-size: 20px; font-weight: 700; color: #e9f7ff; }

.station { margin-top: 9px; padding: 13px 14px; }
.st-top { display: flex; align-items: center; }
.st-brand {
  flex-shrink: 0; padding: 2px 7px; border-radius: 4px;
  font-size: 10px; font-weight: 600; color: #041019; background: #59b6ff;
}
.brand-petro { background: #ff9f6b; }
.brand-shell { background: #ffd166; }
.brand-sino { background: #8f9bff; }
.brand-private { background: #5ce6c0; }
.st-name { margin-left: 7px; font-size: 14px; font-weight: 600; color: #e9f7ff; }
.st-best {
  margin-left: 7px; padding: 1px 6px; border-radius: 4px; font-size: 9px;
  color: var(--down); border: 1px solid rgba(34,226,182,.45); background: rgba(34,226,182,.1);
}
.st-dist { margin-left: auto; font-size: 11px; color: #6f88a8; }
.st-addr { display: block; margin-top: 5px; font-size: 11px; color: #54697f; }
.st-bottom { display: flex; align-items: flex-end; margin-top: 8px; }
.st-tags { flex: 1; display: flex; flex-wrap: wrap; }
.st-tag { margin: 0 6px 4px 0; padding: 2px 6px; border-radius: 4px; font-size: 9px; color: #8fb3d0; background: rgba(255,255,255,.05); }
.st-price-wrap { display: flex; align-items: flex-end; flex-shrink: 0; }
.st-price-col { display: flex; flex-direction: column; align-items: flex-end; }
.st-grade { font-size: 9px; color: var(--muted); }
.st-price { font-size: 27px; font-weight: 700; line-height: 1.05; color: #fff; text-shadow: 0 0 14px rgba(0,229,255,.3); }
.st-save { font-size: 9px; color: #6f88a8; }
.st-nav {
  margin-left: 10px; padding: 7px 13px; border: none; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: 11px; font-weight: 700; color: #041019;
  background: linear-gradient(120deg, var(--cyan), #2f9bff);
  box-shadow: 0 4px 12px rgba(0,229,255,.26);
}

.chart { margin-top: 12px; padding: 14px 14px 8px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; }
.chart-title { font-size: 13px; color: #b9d9f2; }
.chart-tip { font-size: 10px; color: #4d6482; }
.chart-body { margin-top: 12px; }
.chart-grid { position: relative; height: 132px; }
.grid-line { position: absolute; left: 0; right: 0; height: 1px; background: rgba(0,229,255,.08); }
.bars { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; cursor: pointer; }
.bar-value { height: 12px; font-size: 8px; color: transparent; }
.bar-value.show { color: #7df3ff; text-shadow: 0 0 6px rgba(0,229,255,.7); }
.bar-track { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 100px; }
.bar {
  width: 56%; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, rgba(0,229,255,.85), rgba(47,123,255,.18));
  animation: growUp .5s cubic-bezier(.22,1,.36,1) both;
}
.bar.highlight { background: linear-gradient(180deg, #9dfbff, rgba(0,190,255,.5)); box-shadow: 0 0 10px rgba(0,229,255,.6); }
@keyframes growUp { from { transform: scaleY(.04); opacity: .2; } to { transform: scaleY(1); opacity: 1; } }
.bar-labels { display: flex; margin-top: 5px; }
.bar-label { flex: 1; text-align: center; font-size: 8px; color: #4d6482; height: 12px; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 9px; }
.section-title { display: flex; align-items: center; font-size: 15px; font-weight: 600; color: #d8ecff; }
.section-title::before {
  content: ""; width: 3px; height: 13px; margin-right: 7px; border-radius: 2px;
  background: linear-gradient(180deg, var(--cyan), #2f7bff); box-shadow: 0 0 7px rgba(0,229,255,.8);
}
.section-hint { font-size: 11px; color: var(--muted); }

.record { display: flex; align-items: center; margin-bottom: 8px; padding: 12px 14px; border-radius: 11px; }
.record-left { width: 112px; }
.record-date { font-size: 15px; font-weight: 600; color: #d8ecff; }
.record-full { display: block; margin-top: 3px; font-size: 9px; color: #4d6482; }
.record-right { flex: 1; display: flex; align-items: center; justify-content: space-between; }
.record-cell { display: flex; flex-direction: column; align-items: center; }
.record-label { font-size: 9px; color: var(--muted); }
.record-price { margin-top: 2px; font-size: 15px; color: #e9f7ff; }
.record-delta { width: 40px; text-align: right; font-size: 11px; }

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(8,13,22,.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid #0b1520;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; padding: 10px 0 11px; border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 11px; letter-spacing: 1px; color: #6b7a94;
}
.tab::before { content: ""; width: 16px; height: 2px; border-radius: 2px; background: transparent; }
.tab.active { color: var(--cyan); }
.tab.active::before { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }

@media (min-width: 481px) {
  body { background: #02040a; }
  .app { box-shadow: 0 0 60px rgba(0,229,255,.06); }
}
