:root {
  --bg: #0f1117;
  --bg-card: #171a23;
  --bg-card-hover: #1c2030;
  --border: #2a2f3d;
  --text: #e8eaed;
  --text-muted: #9aa0a6;
  --accent: #7c9cff;
  --green: #34d399;
  --red: #f87171;
  --yellow: #fbbf24;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --font: "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.header {
  background: linear-gradient(180deg, #1a1e2b 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  font-size: 2rem;
  line-height: 1;
}

.brand h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
}

.btn {
  background: var(--accent);
  color: #0f1117;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn:hover {
  opacity: 0.9;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Disclaimer */
.disclaimer {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 16px 0 8px;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 12px 0 40px;
}

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

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 320px;
  max-height: 620px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.card-head h2 {
  font-size: 0.95rem;
  font-weight: 600;
}

.status-pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: #2a2f3d;
  color: var(--text-muted);
  white-space: nowrap;
}
.status-pill.live {
  background: rgba(52, 211, 153, 0.15);
  color: var(--green);
}
.status-pill.error {
  background: rgba(248, 113, 113, 0.15);
  color: var(--red);
}
.status-pill.loading {
  background: rgba(251, 191, 36, 0.15);
  color: var(--yellow);
}

.card-body {
  padding: 14px 16px;
  flex: 1;
  overflow: hidden;
}

.card-body.scrollable {
  overflow-y: auto;
}

/* Position item */
.pos-summary {
  background: #12151e;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.pos-summary .row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 3px 0;
}

.pos-summary .label {
  color: var(--text-muted);
}

.pos-item {
  background: #12151e;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.pos-item:last-child {
  margin-bottom: 0;
}

.pos-coin {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.pos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  font-size: 0.8rem;
}

.pos-grid span {
  color: var(--text-muted);
}

.pos-grid strong {
  color: var(--text);
  font-weight: 500;
}

/* Message list */
.msg-item {
  background: #12151e;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.msg-item:last-child {
  margin-bottom: 0;
}

.msg-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.msg-sender {
  font-weight: 600;
  color: var(--accent);
}

.msg-text {
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.msg-image {
  margin-top: 8px;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 32px 12px;
}

.error-box {
  color: var(--red);
  font-size: 0.85rem;
  padding: 16px;
  text-align: center;
}

/* Skeleton */
.skeleton {
  height: 120px;
  background: linear-gradient(90deg, #1c2030 25%, #252a3a 50%, #1c2030 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 20px 0 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer .small {
  margin-top: 6px;
  font-size: 0.72rem;
  opacity: 0.8;
}

/* Scrollbar */
.scrollable::-webkit-scrollbar {
  width: 6px;
}
.scrollable::-webkit-scrollbar-track {
  background: transparent;
}
.scrollable::-webkit-scrollbar-thumb {
  background: #3a4050;
  border-radius: 3px;
}
