:root {
  color-scheme: dark;
  --bg: #0c0f14;
  --card: #151a22;
  --border: #243044;
  --text: #e8edf5;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --ok: #34d399;
  --warn: #fbbf24;
}

* {
  box-sizing: border-box;
}

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

.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tab {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  cursor: pointer;
}

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

.tab.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(61, 139, 253, 0.12);
}

.tab.tab-busy::after {
  content: " · run";
  color: var(--warn);
  font-weight: 500;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.trade-hint {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

.trade-table {
  font-size: 0.78rem;
}

.result-pill {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.result-pill.win {
  background: rgba(52, 211, 153, 0.18);
  color: var(--ok);
}

.result-pill.lose {
  background: rgba(248, 113, 113, 0.16);
  color: #f87171;
}

.result-pill.pending {
  background: rgba(251, 191, 36, 0.14);
  color: var(--warn);
}

.result-pill.na,
.result-pill.unknown {
  background: rgba(139, 156, 179, 0.12);
  color: var(--muted);
}

.header {
  margin-bottom: 1.5rem;
}

.hero {
  margin-bottom: 1rem;
}

.hero h2 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.btc-question {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
}

.btc-countdown {
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 0 0 1rem;
  color: var(--warn);
}

.btc-prices {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btc-pill {
  flex: 1;
  min-width: 120px;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
}

.btc-pill.up {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.35);
}

.btc-pill.down {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.35);
}

.btc-pill-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.btc-pill-price {
  font-size: 1.65rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.btc-meta {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.btc-err {
  margin: 0.5rem 0 0;
}

.demo-trade {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.btn-demo {
  appearance: none;
  border: 1px solid rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.18);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.65rem 1.1rem;
  border-radius: 10px;
  cursor: pointer;
}

.btn-demo:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.28);
}

.btn-demo:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.demo-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.btn-link {
  display: inline-block;
  margin: 0 0 0.5rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
}

.btn-link:hover {
  color: #6aa8ff;
}

.header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
  font-weight: 650;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.conn {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--warn);
}

.conn.live {
  color: var(--ok);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}

.card.full {
  margin-top: 1rem;
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.status {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.meta {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.pre {
  margin: 0;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
}

.wrap {
  word-break: break-all;
}

.price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
}

.footer {
  margin-top: 1rem;
}

.error {
  color: #f87171;
  font-size: 0.9rem;
  margin: 0;
}

.trade-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.trade-tools-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.btn-tool {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
}

.btn-tool:hover {
  border-color: var(--accent);
}

.btn-tool-file {
  display: inline-block;
  cursor: pointer;
}

.trade-tools-hint {
  font-size: 0.78rem;
  color: var(--muted);
  flex-basis: 100%;
  margin: 0;
}
