:root {
  --bg: #0f1419;
  --panel: #171e26;
  --panel-2: #1c2630;
  --border: #26303b;
  --border-soft: #1f2833;
  --text: #e6edf3;
  --muted: #8b98a5;
  --faint: #6e7b87;
  --gold: #e3b341;
  --pressure: #e5534b;
  --support: #2ea043;
  --pivot: #d29922;
  --confluence: #a371f7;
  --bullish: #2ea043;
  --bearish: #e5534b;
  --neutral: #8b98a5;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 20% -10%, rgba(227, 179, 65, 0.06), transparent 60%),
    var(--bg);
}

.app {
  max-width: 1560px;
  margin: 0 auto;
  padding: 18px 24px 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
  color: #151a1f;
  background: linear-gradient(135deg, #f1cc6b, #c99b2e);
  box-shadow: 0 6px 18px rgba(227, 179, 65, 0.18);
}

h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 1.2px;
}

.price-block {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.price {
  font-size: 34px;
  font-weight: 650;
  line-height: 1;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.change {
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.change.up {
  color: var(--bullish);
}

.change.down {
  color: var(--bearish);
}

.quote-meta {
  width: 100%;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  justify-content: flex-end;
}

.updated {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.refresh {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.refresh:hover {
  border-color: #3a4755;
  background: #222d38;
}

.refresh:disabled {
  opacity: 0.55;
  cursor: default;
}

.banner {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
}

.banner.warn {
  color: #e8c76b;
  background: rgba(210, 153, 34, 0.09);
  border-color: rgba(210, 153, 34, 0.28);
}

.banner.error {
  color: #f08a84;
  background: rgba(229, 83, 75, 0.09);
  border-color: rgba(229, 83, 75, 0.3);
}

.banner button {
  appearance: none;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
}

.tabs {
  display: flex;
  gap: 6px;
  margin: 16px 0 12px;
  flex-wrap: wrap;
}

.tab {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.15s ease;
}

.tab:hover {
  color: var(--text);
  border-color: #3a4755;
}

.tab.active {
  color: #151a1f;
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 650;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  gap: 16px;
  align-items: start;
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.012), transparent 40%),
    var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
}

.chart-panel {
  padding: 14px 14px 8px;
  position: relative;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 4px 10px;
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.chart-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
  padding-top: 3px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
}

.swatch.pressure {
  background: rgba(229, 83, 75, 0.65);
}

.swatch.support {
  background: rgba(46, 160, 67, 0.65);
}

.swatch.pivot {
  background: var(--pivot);
}

.swatch.confluence {
  background: var(--confluence);
}

.swatch.flipped {
  background: transparent;
  border: 1px dashed var(--muted);
}

#chart {
  width: 100%;
  height: calc(100vh - 262px);
  min-height: 440px;
}

.empty {
  position: absolute;
  inset: 90px 0 40px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  background: rgba(23, 30, 38, 0.65);
  border-radius: 8px;
}

.summary-panel {
  padding: 14px 14px 12px;
  position: sticky;
  top: 18px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

th {
  color: var(--faint);
  font-size: 10px;
  font-weight: 500;
  text-align: left;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th:nth-child(1) {
  width: 9%;
}
th:nth-child(2) {
  width: 13%;
}
th:nth-child(3) {
  width: 10%;
}
th:nth-child(4) {
  width: 23%;
}
th:nth-child(5) {
  width: 20%;
}
th:nth-child(6) {
  width: 25%;
}

td {
  padding: 9px 4px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 11.5px;
  vertical-align: middle;
  color: var(--text);
}

th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5) {
  border-right: 1px solid rgba(38, 48, 59, 0.55);
}

tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: var(--panel-2);
}

tbody tr.active {
  background: rgba(227, 179, 65, 0.07);
  box-shadow: inset 2px 0 0 var(--gold);
}

tbody tr:last-child td {
  border-bottom: none;
}

.tf-name {
  font-weight: 600;
  letter-spacing: 0.4px;
}

.inside-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--confluence);
  vertical-align: 1px;
}

.inside-tag {
  display: block;
  margin-top: 3px;
  color: #c9aef9;
  font-size: 8.5px;
  line-height: 1.2;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.bullish {
  color: var(--bullish);
  background: rgba(46, 160, 67, 0.12);
}

.badge.bearish {
  color: var(--bearish);
  background: rgba(229, 83, 75, 0.12);
}

.badge.neutral {
  color: var(--neutral);
  background: rgba(139, 152, 165, 0.12);
}

.badge.unknown {
  color: var(--faint);
  background: rgba(139, 152, 165, 0.08);
}

.level {
  font-size: 10.5px;
  white-space: nowrap;
}

.level.res {
  color: #f08a84;
}

.level.sup {
  color: #6fce83;
}

.touch {
  color: var(--faint);
  font-size: 9.5px;
}

.flip-tag {
  display: inline-block;
  margin-left: 2px;
  padding: 0 2px;
  border: 1px dashed currentColor;
  border-radius: 3px;
  font-size: 7.5px;
  line-height: 1.3;
  vertical-align: 1px;
  opacity: 0.85;
}

.muted {
  color: var(--faint);
}

.confluence-list {
  display: inline-block;
  color: #c9aef9;
  font-size: 9px;
  letter-spacing: 0;
  white-space: nowrap;
}

.summary-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.6;
}

footer {
  margin-top: 14px;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.7;
  text-align: center;
}

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

  .summary-panel {
    position: static;
  }

  #chart {
    height: 460px;
  }

  .brand {
    min-width: 0;
  }
}

@media (max-width: 760px) {
  .app {
    padding: 14px;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 14px;
  }

  .toolbar {
    min-width: 0;
    width: 100%;
    justify-content: space-between;
  }

  .price {
    font-size: 28px;
  }

  .legend {
    gap: 9px;
  }
}
