/* Agents of Chaos — economy sim + bet on richest (dark dashboard) */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-base: #0a0c0f;
  --bg-elevated: #11151a;
  --bg-card: #141920;
  --bg-input: #0d1014;
  --border: #252b34;
  --border-strong: #343c48;
  --text: #e8edf4;
  --text-secondary: #9aa4b2;
  --text-muted: #6b7684;
  --accent: #3d9eff;
  --accent-hover: #5eb0ff;
  --accent-muted: rgba(61, 158, 255, 0.14);
  --positive: #3ecf8e;
  --positive-bg: rgba(62, 207, 142, 0.12);
  --negative: #f87171;
  --negative-bg: rgba(248, 113, 113, 0.12);
  --warning: #fbbf24;
  --r: 10px;
  --r-sm: 8px;
  --r-pill: 6px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

html {
  font-size: 15px;
}

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Subtle grid — not decorative blobs */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 100%);
}

body > * {
  position: relative;
  z-index: 1;
}

/* === Header === */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.75rem;
  background: rgba(17, 21, 26, 0.85);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left,
.header-center,
.header-right {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-mark {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
}

.logo-text h1 {
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.logo-sub {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.125rem;
}

.app-tagline {
  margin: 0;
  padding: 0.65rem 1.75rem 0.85rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text-secondary);
  background: rgba(17, 21, 26, 0.55);
  border-bottom: 1px solid var(--border);
}

.app-tagline strong {
  color: var(--text);
  font-weight: 600;
}

.tagline-sep {
  margin: 0 0.35rem;
  color: var(--text-muted);
}

.sim-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.offline {
  background: var(--text-muted);
}

.status-dot.online {
  background: var(--positive);
  box-shadow: 0 0 0 3px var(--positive-bg);
}

@keyframes pulse {
  50% { opacity: 0.65; }
}

.status-dot.online {
  animation: pulse 2s ease-in-out infinite;
}

.tick-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.tick-label {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.12em;
}

.tick-num {
  font-weight: 600;
  color: var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  border: 1px solid transparent;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

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

.btn-start {
  background: var(--accent);
  color: #0a0c0f;
  border-color: var(--accent);
}

.btn-start:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-stop {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-stop:hover:not(:disabled) {
  border-color: var(--text-muted);
  background: var(--bg-card);
}

.pm-contract-warning {
  margin: 0 1.25rem 0.75rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.75rem;
  line-height: 1.45;
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 8px;
}

.pm-contract-warning code {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #fecaca;
}

/* Betting */
.betting-panel {
  margin: 0 1.75rem 2rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

.transparency-panel {
  margin: 0 1.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

.transparency-body {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.transparency-pitch {
  margin: 0 0 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.transparency-pitch strong {
  color: var(--text);
}

.transparency-list,
.transparency-rules {
  margin: 0 0 0.75rem 1rem;
  padding: 0;
}

.transparency-rules li {
  margin-bottom: 0.35rem;
}

.transparency-body a {
  color: var(--accent);
  text-decoration: none;
}

.transparency-body a:hover {
  text-decoration: underline;
}

.market-meta {
  padding: 0 1.25rem 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.meta-pill {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.meta-open {
  color: var(--positive);
  background: var(--positive-bg);
}

.meta-closed {
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.countdown-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.25rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.countdown-label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.625rem;
  font-family: var(--font);
  font-weight: 700;
}

.countdown-value {
  color: var(--accent);
  font-weight: 600;
}

/* —— Polymarket-style bet card —— */
.betting-panel .pm-card {
  margin: 0 1.25rem 1rem;
  padding: 1rem 1.125rem 1.125rem;
  border-radius: 12px;
  background: linear-gradient(180deg, #12161c 0%, #0e1116 100%);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  max-width: 420px;
}

.pm-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.pm-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.pm-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #22c55e;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pm-icon-tri {
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 12px solid #0a0c0f;
  transform: translateY(-1px);
}

.pm-headlines {
  min-width: 0;
}

.pm-market-line {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-close-line {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.pm-connect {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
}

.pm-connect:hover {
  border-color: var(--text-muted);
}

/* Wallet bar — connect / connected row */
.pm-wallet-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 2rem;
}

.pm-wallet-connected {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
}

.pm-wallet-addr {
  font-size: 0.75rem;
  color: var(--text-secondary);
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-wallet-switch,
.pm-disconnect {
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font);
}

.pm-wallet-switch:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.pm-disconnect {
  border-color: rgba(248, 113, 113, 0.35);
  color: var(--negative);
  background: var(--negative-bg);
}

.pm-disconnect:hover {
  border-color: var(--negative);
  color: #fca5a5;
}

/* EIP-6963 wallet picker modal */
.wallet-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.wallet-modal[hidden] {
  display: none !important;
}

.wallet-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.wallet-modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  padding: 1.25rem 1.35rem;
  border-radius: var(--r);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  box-shadow: var(--shadow), 0 24px 64px rgba(0, 0, 0, 0.55);
}

.wallet-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.wallet-modal-hint {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.wallet-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: min(50vh, 320px);
  overflow-y: auto;
}

.wallet-list-item {
  margin: 0;
}

.wallet-list-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.wallet-list-btn:hover {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.wallet-list-icon {
  border-radius: 6px;
  flex-shrink: 0;
}

.wallet-list-label {
  flex: 1;
  min-width: 0;
}

.wallet-modal-cancel {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.55rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
}

.wallet-modal-cancel:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.pm-field-label {
  display: block;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.pm-select-full {
  width: 100%;
  margin-bottom: 0.75rem;
}

.pm-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-family: var(--font);
  font-size: 0.8125rem;
  background: var(--bg-input);
  color: var(--text);
  cursor: pointer;
}

.pm-select:focus {
  outline: none;
  border-color: #0085ff;
  box-shadow: 0 0 0 2px rgba(0, 133, 255, 0.2);
}

.pm-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.pm-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  flex: 1;
}

.pm-tab {
  flex: 1;
  padding: 0.5rem 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.pm-tab:hover {
  color: var(--text-secondary);
}

.pm-tab-active {
  color: var(--text);
  border-bottom-color: var(--text);
}

.pm-order-select {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 1.75rem 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa4b2' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.35rem center;
}

.pm-tabs-single {
  flex: 1;
}

.pm-tabs-single .pm-tab {
  flex: 1;
  text-align: center;
}

.pm-pool-share {
  margin-bottom: 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.pm-pool-share-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.pm-pool-share-main {
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text);
  line-height: 1.3;
}

.pm-pool-share-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  line-height: 1.4;
}

.pm-yesno {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.pm-yesno-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.75rem 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pm-yesno-label {
  font-size: 0.9375rem;
  font-weight: 700;
}

.pm-yesno-price {
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font-mono);
  opacity: 0.9;
}

.pm-yesno-yes.pm-yesno-active {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.55);
  color: #4ade80;
}

.pm-yesno-no.pm-yesno-active {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.45);
  color: var(--text-secondary);
}

.pm-yesno-btn:not(.pm-yesno-active) {
  opacity: 0.75;
}

.pm-amount-block {
  margin-bottom: 0.85rem;
}

.pm-amount-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.pm-amount-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.pm-amount-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}

.pm-dollar {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pm-amount-input {
  width: 100%;
  max-width: 160px;
  font-size: 1.35rem;
  font-weight: 600;
  text-align: right;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  padding: 0.25rem 0;
}

.pm-amount-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.pm-amount-input:focus {
  outline: none;
}

.pm-quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pm-chip {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-mono);
}

.pm-chip:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.pm-quote-line {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-muted);
  min-height: 2.2em;
}

.pm-trade-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  font-weight: 700;
  font-family: var(--font);
  border: none;
  border-radius: 10px;
  background: #0085ff;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, transform 0.08s;
}

.pm-trade-btn:hover:not(:disabled) {
  background: #0070e0;
}

.pm-trade-btn:active:not(:disabled) {
  transform: translateY(1px);
}

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

.pm-terms {
  margin-top: 0.65rem;
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-align: center;
}

.pm-terms a {
  color: var(--text-secondary);
  text-decoration: underline;
}

.pm-refresh-pos {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.35rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
}

.pm-refresh-pos:hover {
  text-decoration: underline;
}

@media (max-width: 520px) {
  .betting-panel .pm-card {
    max-width: none;
    margin-left: 1rem;
    margin-right: 1rem;
  }
}

.betting-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding: 0 1.25rem 1.25rem;
}

.betting-card-wide {
  grid-column: 1 / -1;
}

.betting-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.75rem 1rem;
}

.betting-card h3 {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.betting-card pre {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
}

.quote-hint,
.positions-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  line-height: 1.45;
}

.positions-table-wrap {
  overflow-x: auto;
  max-height: 280px;
  overflow-y: auto;
}

.positions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

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

.positions-table th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.625rem;
}

.positions-table .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.positions-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 1rem !important;
}

.pnl-pos {
  color: var(--positive);
}

.pnl-neg {
  color: var(--negative);
}

.positions-action-cell {
  white-space: nowrap;
}

.positions-action-muted {
  color: var(--text-muted);
}

.pm-exit-stake {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.35rem 0.55rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--accent);
  background: var(--accent-muted);
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font);
}

.pm-exit-stake:hover {
  border-color: var(--accent-hover);
  color: var(--accent-hover);
}

.pm-claim-winnings {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.35rem 0.55rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--positive);
  background: var(--positive-bg);
  color: var(--positive);
  cursor: pointer;
  font-family: var(--font);
}

.pm-claim-winnings:hover {
  filter: brightness(1.08);
}

/* === Stats Row === */
.stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  padding: 1rem 1.75rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease;
}

.stat-card:hover {
  border-color: var(--border-strong);
}

.stat-icon {
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

.stat-value-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stat-change {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.stat-change.up {
  color: var(--positive);
  background: var(--positive-bg);
}

.stat-change.down {
  color: var(--negative);
  background: var(--negative-bg);
}

.active-val {
  color: var(--positive) !important;
}

.danger-val {
  color: var(--negative) !important;
}

.economy-val {
  color: var(--warning) !important;
}

/* === Charts Row === */
.charts-row {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.85fr;
  gap: 0.75rem;
  padding: 0 1.75rem 1rem;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chart-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.chart-header h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.chart-body {
  padding: 1rem;
  height: 220px;
  position: relative;
}

.chart-body-donut {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === Main Grid === */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 0.75rem;
  padding: 0 1.75rem 1rem;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
}

.panel-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.panel-lede {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--text-muted);
  max-width: 36rem;
}

.panel-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.panel-badge {
  flex-shrink: 0;
  align-self: center;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0.25rem 0.5rem;
  background: var(--accent-muted);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
}

/* === Agent Grid === */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
  padding: 1rem;
}

.agent-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 1rem;
  transition: border-color 0.15s ease;
}

.agent-card:hover {
  border-color: var(--border-strong);
}

.agent-card.starving {
  border-color: rgba(248, 113, 113, 0.45);
  background: var(--negative-bg);
}

.agent-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.agent-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.agent-status {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

.agent-status.active {
  color: var(--positive);
  background: var(--positive-bg);
}

.agent-status.starving {
  color: var(--negative);
  background: var(--negative-bg);
}

.agent-personality {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
  line-height: 1.45;
}

.agent-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.agent-stat {
  text-align: center;
  padding: 0.5rem 0.25rem;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.agent-stat-label {
  font-size: 0.625rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}

.agent-stat-value {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
}

.credits-color {
  color: var(--warning);
}

.food-color {
  color: var(--positive);
}

.energy-color {
  color: var(--accent);
}

.agent-action {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.action-tag {
  background: var(--bg-base);
  color: var(--text-secondary);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  margin-left: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  border: 1px solid var(--border);
}

/* === Events Panel === */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  max-height: 500px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.event-item {
  padding: 0.65rem 0.85rem;
  border-radius: var(--r-sm);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-secondary);
  font-weight: 500;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.event-item.warning {
  background: var(--negative-bg);
  border-color: rgba(248, 113, 113, 0.25);
  color: var(--text);
}

.event-item.success {
  background: var(--positive-bg);
  border-color: rgba(62, 207, 142, 0.2);
  color: var(--text);
}

.event-tick {
  font-size: 0.625rem;
  color: var(--text-muted);
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}

.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 2.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
}

.loading code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--bg-base);
  color: var(--accent);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.footer {
  text-align: center;
  padding: 1.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* === Responsive === */
@media (max-width: 1100px) {
  .charts-row {
    grid-template-columns: 1fr 1fr;
  }

  .chart-small {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  .main-grid,
  .stats-row,
  .charts-row {
    grid-template-columns: 1fr;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .betting-panel {
    margin-left: 1rem;
    margin-right: 1rem;
  }

  .chart-small {
    grid-column: span 1;
  }

  .header {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }
}

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

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

  .betting-card-wide {
    grid-column: 1;
  }
}
