:root {
  --bg: #0b0e11;
  --panel: #12161c;
  --panel2: #171d25;
  --line: #232b36;
  --text: #e6edf3;
  --muted: #8b98a9;
  --green: #0ecb81;
  --red: #f6465d;
  --amber: #f0b90b;
  --blue: #3b82f6;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.35;
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 14, 17, 0.96);
  backdrop-filter: blur(8px);
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--line);
}

.title-row { display: flex; align-items: center; justify-content: space-between; }

.brand { font-size: 15px; font-weight: 700; letter-spacing: .3px; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.off { background: var(--red); box-shadow: 0 0 6px var(--red); }
.dot.wait { background: var(--amber); }

.sub { color: var(--muted); font-size: 11.5px; margin-top: 3px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 5px 4px; text-align: center; }
.stat b { display: block; font-size: 16px; font-weight: 700; }
.stat span { color: var(--muted); font-size: 10.5px; }

.tabs { position: sticky; top: 112px; z-index: 19; display: flex; background: var(--bg); border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; background: none; border: none; color: var(--muted); padding: 10px 4px;
  font-size: 13.5px; font-weight: 600; border-bottom: 2px solid transparent; cursor: pointer;
}
.tab.active { color: var(--text); border-bottom-color: var(--green); }
.badge {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px;
  background: var(--panel2); border-radius: 9px; font-size: 10.5px; color: var(--muted);
}

.searchbar { padding: 8px 12px; background: var(--bg); }
.searchbar input {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 14px; outline: none;
}

.legend {
  display: flex; gap: 10px; align-items: center; padding: 4px 12px 8px;
  color: var(--muted); font-size: 10.5px; flex-wrap: wrap;
}
.legend-note { color: #5c6b7f; }

main { padding: 0 8px 90px; }

.row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.row.cand { border-color: #2a4a3a; }
.row.hit { border-color: var(--green); box-shadow: 0 0 0 1px rgba(14, 203, 129, .25); }
.row.miss { opacity: .92; }

.row-main { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sym { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.sym .name { font-weight: 700; font-size: 14.5px; letter-spacing: .2px; }
.sym .star { color: var(--amber); font-size: 12px; }
.sym .tag { font-size: 10px; color: var(--muted); background: var(--panel2); border-radius: 4px; padding: 1px 4px; }
.sym .tag.cand { color: var(--green); background: rgba(14, 203, 129, .12); }
.sym .tag.hit { color: #ffd479; background: rgba(240, 185, 11, .15); }

.px { text-align: right; white-space: nowrap; }
.px .price { font-size: 14px; font-weight: 600; }
.px .chg { font-size: 11px; }
.up { color: var(--green); }
.down { color: var(--red); }
.flat { color: var(--muted); }

.chips { display: flex; gap: 3px; }
.chip {
  flex: 1; text-align: center; font-style: normal; font-size: 10.5px; font-weight: 700;
  padding: 2px 0; border-radius: 4px; border: 1px solid transparent; min-width: 0;
}
.chip.g { background: rgba(14, 203, 129, .14); color: var(--green); }
.chip.d { background: rgba(246, 70, 93, .14); color: var(--red); }
.chip.n { background: #1a2029; color: #4d5a6b; }
.chip.k12 { border-color: #3a4553; }

.row-sub { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 10.5px; }
.row-sub b { color: var(--text); font-weight: 600; }
.row-sub .hl { color: #ffd479; }

.alerts-tab { padding-top: 6px; }
.alert-item {
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--green);
  border-radius: 8px; padding: 8px 10px; margin-bottom: 6px;
}
.alert-item.short { border-left-color: var(--red); }
.alert-head { display: flex; justify-content: space-between; font-weight: 700; }
.alert-time { color: var(--muted); font-size: 11px; font-weight: 400; }
.alert-body { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.alert-body b { color: var(--text); }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

.banner {
  position: fixed; left: 8px; right: 8px; bottom: 16px; z-index: 40;
  background: linear-gradient(180deg, #17342a, #0f231b);
  border: 1px solid var(--green); border-radius: 12px; padding: 10px 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .55);
}
.banner.short { background: linear-gradient(180deg, #3a1720, #251016); border-color: var(--red); }
.banner .b-title { font-weight: 700; }
.banner .b-body { color: var(--muted); font-size: 11.5px; margin-top: 3px; }

footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  background: rgba(11, 14, 17, .97); border-top: 1px solid var(--line);
  padding: 7px 12px calc(7px + env(safe-area-inset-bottom));
  color: var(--muted); font-size: 10.5px;
}
.foot-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-line code { color: #9fd0ff; }
.foot-note { color: #566275; margin-top: 4px; font-size: 10px; }
.actions { display: flex; gap: 8px; margin-top: 6px; }

button.ghost {
  background: none; border: 1px solid var(--line); color: var(--muted);
  border-radius: 6px; padding: 3px 8px; font-size: 11.5px;
}
button.ghost:active { background: var(--panel2); }
button.tiny { padding: 1px 6px; font-size: 10.5px; }

.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 82vh; overflow-y: auto;
  background: var(--panel); border-radius: 16px 16px 0 0; padding: 14px 14px calc(20px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.sheet h2 { font-size: 16px; margin: 0 0 2px; }
.sheet .sheet-sub { color: var(--muted); font-size: 11.5px; margin-bottom: 10px; }
.sheet table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sheet th, .sheet td { text-align: right; padding: 4px 3px; border-bottom: 1px solid var(--line); }
.sheet th:first-child, .sheet td:first-child { text-align: left; }
.sheet th { color: var(--muted); font-weight: 500; }
.sheet .close { margin-top: 12px; width: 100%; padding: 10px; border-radius: 8px; background: var(--panel2); color: var(--text); border: 1px solid var(--line); font-size: 14px; }

@media (min-width: 720px) {
  body { max-width: 720px; margin: 0 auto; }
}
