:root {
  color-scheme: dark;
  --bg: #000;
  --panel: #000;
  --panel2: rgba(0, 0, 0, 0.85);
  --text: #e6eaf2;
  --muted: #9aa6b2;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #00d2c6;
  --danger: #ff5a6d;
  --success: #00c087;
  --warn: #ffcc66;
  --h-kline: 400px;
  --h-placeholder: 60px;
  --h-liq: 220px;
  --h-oi: 280px;
  --h-ratio: 240px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 15, 20, 0.84);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 260px;
}

.brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.brand .sub {
  color: var(--muted);
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
}

.dot.ok {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(0, 192, 135, 0.16);
}

.dot.warn {
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(255, 204, 102, 0.12);
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 7px 10px;
  outline: none;
}

button {
  background: linear-gradient(180deg, rgba(0, 210, 198, 0.22), rgba(0, 210, 198, 0.12));
  border: 1px solid rgba(0, 210, 198, 0.35);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  border-color: rgba(0, 210, 198, 0.6);
}

main {
  max-width: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.statrow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 1100px) {
  .statrow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .statrow {
    grid-template-columns: 1fr;
  }
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  min-height: 74px;
}

.k {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.v {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 1.2;
}

.v small {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}

/* 新7行布局 */
.layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.row-full,
.row-placeholder,
.row-split {
  position: relative;
  width: 100%;
}

/* 拖拽手柄 */
.resize-handle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 8px;
  cursor: ns-resize;
  touch-action: none;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}

.resize-handle::before {
  content: '';
  width: 40px;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  transition: background 0.2s;
}

.resize-handle:hover::before {
  background: rgba(255, 255, 255, 0.35);
}

.resize-handle:active::before {
  background: var(--accent);
}

.row-placeholder {
  padding: 8px 12px;
}

.placeholder-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  height: var(--h-placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
}

.row-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 1100px) {
  .row-split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.tvpanel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
}

.tvhdr {
  position: absolute;
  top: 8px;
  left: 10px;
  right: 10px;
  z-index: 5;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.1px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}

.tvhdr .tvr {
  font-size: 12px;
  font-weight: 650;
  color: rgba(230, 234, 242, 0.78);
}

.ex-icon {
  width: 16px;
  height: 16px;
  vertical-align: -2px;
  margin-right: 6px;
}

.tvhdr .ratio {
  color: rgba(255, 204, 102, 0.95);
  font-weight: 800;
  margin-left: 6px;
}

.tvhdr .oiVal {
  color: rgba(60, 160, 255, 0.95);
  font-weight: 900;
  margin-left: 6px;
}

.tvhdr .pos {
  color: rgba(0, 255, 195, 0.95);
  font-weight: 900;
  margin-left: 6px;
}

.tvhdr .neg {
  color: rgba(180, 120, 255, 0.95);
  font-weight: 900;
  margin-left: 6px;
}

.tv-lightweight-charts__watermark,
.tv-lightweight-charts__watermark-logo,
.tv-lightweight-charts__watermark-text {
  display: none !important;
}

.chart {
  width: 100%;
  height: 160px;
  touch-action: pan-y pinch-zoom;
}

.chart.oi {
  height: var(--h-oi);
}

.chart.top {
  height: var(--h-top);
}

.chart.liq {
  height: var(--h-liq);
}

.panel {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
}

.panel .hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.panel .hd .title {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.2px;
}

.panel .bd {
  padding: 10px 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.table th,
.table td {
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
  text-align: left;
}

.table th {
  color: var(--muted);
  font-weight: 700;
}

.scroll {
  max-height: 690px;
  overflow: auto;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

.tag.red {
  border-color: rgba(255, 90, 109, 0.35);
  background: rgba(255, 90, 109, 0.08);
  color: rgba(255, 180, 190, 0.95);
}

.tag.green {
  border-color: rgba(0, 192, 135, 0.35);
  background: rgba(0, 192, 135, 0.08);
  color: rgba(150, 255, 230, 0.95);
}

#status {
  color: var(--muted);
  font-size: 12px;
}
