:root {
  --bg: #080b10;
  --bg-gradient-start: #0a0e16;
  --bg-gradient-end: #111827;
  --panel: #111820;
  --panel-2: #17212b;
  --panel-hover: #1c2a3a;
  --text: #f3f6f8;
  --muted: #9aa8b4;
  --line: rgba(230, 237, 243, 0.13);
  --line-strong: rgba(230, 237, 243, 0.24);
  --green: #23d0a6;
  --red: #ff6f61;
  --amber: #f2c14e;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "IBM Plex Sans", "Microsoft YaHei", sans-serif;
}

a, button {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 40px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 80px;
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  background: rgba(17, 24, 32, 0.94);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
}

.brand, .nav-links, .hero-actions, .section-head {
  display: flex;
  align-items: center;
}

.brand {
  gap: 14px;
}

.strategy-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, #0e171d, #151f28);
  border: 1px solid rgba(35, 208, 166, 0.44);
  box-shadow: 0 4px 12px rgba(35, 208, 166, 0.15);
}

.strategy-icon svg {
  width: 36px;
  height: 36px;
}

.strategy-icon rect {
  fill: transparent;
  stroke: rgba(242, 193, 78, 0.65);
  stroke-width: 2;
}

.strategy-icon path {
  fill: none;
  stroke: var(--green);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.strategy-icon circle {
  fill: var(--red);
}

.brand strong, h1, h2, .capital-board strong, .metric-value {
  font-family: "Space Grotesk", "Microsoft YaHei", sans-serif;
}

.brand strong {
  display: block;
  font-size: 18px;
}

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

.nav-links {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a, .primary-action, .secondary-action {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 11px 16px;
  color: var(--text);
  background: rgba(23, 33, 43, 0.74);
  transition: all 0.25s ease;
  font-size: 14px;
}

.nav-links a:hover, .secondary-action:hover {
  border-color: var(--line-strong);
  background: rgba(31, 44, 57, 0.86);
  transform: translateY(-1px);
}

.invite-link, .primary-action {
  color: #07110f;
  background: linear-gradient(135deg, #23d0a6 0%, #1db98a 100%);
  border-color: var(--green);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(35, 208, 166, 0.3);
}

.invite-link:hover, .primary-action:hover {
  background: linear-gradient(135deg, #28e5b0 0%, #20d094 100%);
  box-shadow: 0 6px 20px rgba(35, 208, 166, 0.4);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 20px;
  padding: 30px 0 20px;
}

.hero-copy, .capital-board, .chart-section, .equity-section, .trades-section {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-md);
}

.hero-copy {
  display: grid;
  align-content: center;
  min-height: 320px;
  padding: clamp(24px, 4vw, 50px);
  position: relative;
}

.hero-copy::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(35, 208, 166, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1 {
  max-width: 820px;
  font-size: clamp(42px, 7vw, 82px);
  line-height: 0.96;
  background: linear-gradient(135deg, #f3f6f8 0%, #c9d4dd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: 26px;
  background: linear-gradient(135deg, #f3f6f8 0%, #a8b4c0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-copy p:not(.eyebrow) {
  max-width: 780px;
  margin: 20px 0 0;
  color: #c9d4dd;
  font-size: 17px;
  line-height: 1.8;
}

.hero-actions {
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 32px;
}

.primary-action, .secondary-action {
  min-height: 48px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.capital-board {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 32px;
  background: linear-gradient(145deg, var(--panel-2), #0f1620);
  position: relative;
}

.capital-board::before {
  content: "";
  position: absolute;
  bottom: -30%;
  left: -20%;
  width: 80%;
  height: 80%;
  background: radial-gradient(circle, rgba(242, 193, 78, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.capital-board span {
  font-size: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.capital-board strong {
  font-size: clamp(48px, 8vw, 78px);
  line-height: 1;
  background: linear-gradient(135deg, #f2c14e 0%, #ffd700 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.capital-board small {
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 20px;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  background: linear-gradient(145deg, #0f151c, #0a1017);
  transition: all 0.3s ease;
}

.metric-card:hover {
  border-color: var(--line-strong);
  background: var(--panel-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.metric-value {
  display: block;
  margin-top: 10px;
  font-size: 26px;
}

.metric-value.positive {
  color: var(--green);
  text-shadow: 0 0 10px rgba(35, 208, 166, 0.5);
}

.metric-value.negative {
  color: var(--red);
  text-shadow: 0 0 10px rgba(255, 111, 97, 0.5);
}

.chart-section, .equity-section, .trades-section {
  margin-top: 20px;
}

.section-head {
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.chart-status {
  text-align: right;
  font-size: 13px;
  color: var(--muted);
}

.price-chart {
  height: 640px;
}

.equity-chart {
  height: 320px;
}

.trade-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  padding: 20px 24px 24px;
}

.trade-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  background: linear-gradient(145deg, #0f151c, #0a1017);
}

.trade-card strong {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.side-long {
  color: var(--green);
}

.side-short {
  color: var(--red);
}

.trade-card dl {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px 12px;
  margin: 0;
  color: #d7e0e7;
  font-size: 13px;
}

.trade-card dt {
  color: var(--muted);
}

.trade-card dd {
  margin: 0;
  text-align: right;
}

.empty-state {
  grid-column: 1 / -1;
  color: var(--muted);
  padding: 20px 0;
  text-align: center;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.status-dot.connected {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.refresh-button.updating .loading-spinner {
  display: inline-block;
}

.footer {
  margin-top: 40px;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 1120px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .site-shell {
    width: min(100vw - 18px, 100%);
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .price-chart {
    height: 500px;
  }

  .equity-chart {
    height: 260px;
  }
}
