:root {
  --bg-main: #0c0f17;
  --bg-card: rgba(22, 27, 39, 0.85);
  --bg-card-hover: rgba(29, 36, 52, 0.95);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.4);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --felt-green: #143828;
  --felt-border: #23583f;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

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

.brand-logo {
  font-size: 36px;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.brand-text h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-text h1 span {
  color: var(--accent-primary);
}

.brand-text .tagline {
  color: var(--text-muted);
  font-size: 14px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Tabs */
.nav-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  overflow-x: auto;
}

.nav-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab.active {
  color: #fff;
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.35);
}

/* Tab Content */
.tab-content {
  display: none;
}

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

/* Buttons */
.btn {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.4);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-block {
  width: 100%;
}

/* Live Table Layout */
.table-view-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}

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

.table-stage-wrapper {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.table-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  color: var(--text-secondary);
}

.badge {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

/* Poker Table Graphic */
.poker-table {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 520px;
  margin: 32px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.felt-surface {
  position: relative;
  width: 90%;
  height: 85%;
  background: radial-gradient(circle at center, #1c4b36 0%, #102d20 85%, #0a1f16 100%);
  border: 12px solid #3d2314;
  outline: 4px solid #1a0f08;
  border-radius: 200px;
  box-shadow: 
    inset 0 0 50px rgba(0, 0, 0, 0.6),
    0 16px 40px rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Center Board */
.board-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 10;
}

.pot-badge {
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--accent-gold);
  font-size: 16px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.community-cards {
  display: flex;
  gap: 8px;
}

/* Cards */
.card {
  width: 48px;
  height: 68px;
  background: #ffffff;
  border-radius: 5px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  user-select: none;
  border: 1px solid #e2e8f0;
}

.card.red {
  color: #dc2626;
}

.card.black {
  color: #1e293b;
}

.card-back {
  background: repeating-linear-gradient(45deg, #1e3a8a, #1e3a8a 5px, #172554 5px, #172554 10px);
  border: 2px solid #ffffff;
}

.card-slot {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

/* Seats Around Table */
.seats-container {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.seat {
  position: absolute;
  width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
}

.seat-avatar {
  position: relative;
  background: #1e293b;
  border: 2px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  width: 100%;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.seat.active-turn .seat-avatar {
  border-color: var(--accent-gold);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.6);
  animation: turnPulse 1.5s infinite;
}

@keyframes turnPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.seat.folded {
  opacity: 0.45;
}

.seat-name {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat-chips {
  font-size: 11px;
  color: var(--accent-gold);
  font-weight: 600;
}

.seat-cards {
  display: flex;
  gap: 4px;
}

.seat-cards .card {
  width: 32px;
  height: 46px;
  font-size: 11px;
}

.seat-bet {
  background: rgba(0, 0, 0, 0.7);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.dealer-button {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  color: #000;
  font-weight: 900;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ef4444;
}

/* Sidebar Action Feed */
.action-sidebar {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 600px;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.live-tag {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.action-feed-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.feed-item {
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-primary);
}

.feed-item.raise {
  border-left-color: var(--accent-gold);
}

.feed-item.fold {
  border-left-color: var(--accent-red);
  opacity: 0.7;
}

.feed-item.winner {
  border-left-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
}

/* Panels & Tables */
.card-panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.content-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.content-header p {
  color: var(--text-muted);
  font-size: 14px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 12px 16px;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.positive {
  color: var(--accent-green);
  font-weight: 600;
}

.negative {
  color: var(--accent-red);
  font-weight: 600;
}

/* Testbench Layout */
.testbench-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
}

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

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-group input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.2s ease;
}

.form-group input:focus {
  border-color: var(--accent-primary);
}

.form-group small {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.result-card {
  display: flex;
  flex-direction: column;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.exchanges-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 540px;
  overflow-y: auto;
}

.exchange-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.exchange-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
}

.latency-badge {
  font-size: 11px;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

pre.code-view {
  background: #090c12;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  overflow-x: auto;
  color: #cbd5e1;
  max-height: 180px;
}

.summary-box {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 14px;
}

.summary-box.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

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

.hidden {
  display: none !important;
}

/* Key box */
.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 20px;
  border-radius: var(--radius-md);
}

.key-box {
  margin-top: 12px;
}

.key-box label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.key-box code {
  display: block;
  background: rgba(0, 0, 0, 0.4);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  color: #38bdf8;
  word-break: break-all;
}
