:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a25;
  --bg-elevated: #22222f;
  --border-color: #2a2a3a;
  --border-light: #3a3a4a;
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent-primary: #6366f1;
  --accent-secondary: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --joker: #ef4444;
  --blue-range: #3b82f6;
  --purple-range: #a855f7;
  --pink-range: #ec4899;
  --skip-bg: rgba(100, 100, 120, 0.15);
  --bust-bg: rgba(239, 68, 68, 0.2);
}

[data-theme="light"] {
  --bg-primary: #f8f9fc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f1f5;
  --bg-elevated: #ffffff;
  --border-color: #e0e0e8;
  --border-light: #d0d0d8;
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a5a;
  --text-muted: #8a8a9a;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --success-bg: rgba(16, 185, 129, 0.08);
  --danger-bg: rgba(239, 68, 68, 0.08);
  --warning-bg: rgba(245, 158, 11, 0.08);
  --skip-bg: rgba(100, 100, 120, 0.08);
  --bust-bg: rgba(239, 68, 68, 0.1);
}

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

body {
  font-family: "IBM Plex Sans", -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  line-height: 1.5;
  overflow: hidden;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 380px;
  min-width: 380px;
  max-width: 380px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-primary), var(--purple-range));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: white;
  flex-shrink: 0;
}

.logo-text {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.5px;
}
.logo-text span {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 14px;
  margin-left: 6px;
}

.header-buttons {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

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

.icon-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
}

.config-section {
  margin-bottom: 24px;
}

.config-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.config-grid.single {
  grid-template-columns: 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.form-group.full-width {
  grid-column: span 2;
}

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input {
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  transition: all 0.2s;
  width: 100%;
  min-width: 0;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder {
  color: var(--text-muted);
}
.form-input.formula {
  font-size: 12px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-family: "IBM Plex Mono", monospace;
}

.form-select {
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  min-width: 0;
}

.form-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* JSON Editor */
.json-editor-container {
  display: none;
  flex-direction: column;
  height: 100%;
}

.json-editor-container.active {
  display: flex;
}

.form-config-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.form-config-container.hidden {
  display: none;
}

.json-editor {
  flex: 1;
  width: 100%;
  min-height: 400px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.6;
  resize: none;
}

.json-editor:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.json-error {
  color: var(--danger);
  font-size: 11px;
  margin-top: 8px;
  font-family: "IBM Plex Mono", monospace;
}

.json-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.footer-buttons {
  display: flex;
  gap: 10px;
}

.btn {
  height: 44px;
  padding: 0 24px;
  border-radius: 10px;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
}

.btn-primary {
  flex: 1;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-sm {
  height: 36px;
  padding: 0 16px;
  font-size: 13px;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.main-header {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  flex-shrink: 0;
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}
.tab.active {
  color: var(--accent-primary);
  background: var(--accent-glow);
  border-color: var(--accent-primary);
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.memory-badge {
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--success-bg);
  color: var(--success);
  font-size: 11px;
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
}

.mode-badge {
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--accent-glow);
  color: var(--accent-primary);
  font-size: 11px;
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
}

.stats-panel {
  padding: 24px 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 16px 20px;
  border: 1px solid var(--border-color);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: clamp(16px, 2.5vw, 24px);
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: -1px;
  word-break: break-word;
  overflow-wrap: break-word;
}

.stat-value.positive {
  color: var(--success);
}
.stat-value.negative {
  color: var(--danger);
}
.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.distribution-panel {
  padding: 24px 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}
.distribution-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.distribution-card {
  flex: 1;
  min-width: 140px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 16px 20px;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.distribution-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}
.distribution-card.joker::before {
  background: var(--joker);
}
.distribution-card.blue::before {
  background: var(--blue-range);
}
.distribution-card.purple::before {
  background: var(--purple-range);
}
.distribution-card.pink::before {
  background: var(--pink-range);
}

.distribution-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.distribution-range {
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.distribution-value {
  font-size: 20px;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
}

.distribution-card.joker .distribution-value {
  color: var(--joker);
}
.distribution-card.blue .distribution-value {
  color: var(--blue-range);
}
.distribution-card.purple .distribution-value {
  color: var(--purple-range);
}
.distribution-card.pink .distribution-value {
  color: var(--pink-range);
}

.distribution-pct {
  font-size: 12px;
  color: var(--text-muted);
}

.custom-range-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.range-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.range-input-group label {
  font-size: 11px;
  color: var(--text-muted);
}

.range-input-group input {
  width: 100px;
  height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.range-result {
  padding: 8px 16px;
  background: var(--bg-elevated);
  border-radius: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  color: var(--accent-secondary);
}

.table-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.table-toolbar {
  padding: 12px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-label {
  font-size: 12px;
  color: var(--text-muted);
}

.filter-select {
  height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
}

.rows-per-page {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rows-input {
  width: 60px;
  height: 34px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
  text-align: center;
}

.rows-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.page-info {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
  font-family: "IBM Plex Mono", monospace;
}

.table-scroll {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.results-table th {
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  z-index: 10;
}

.results-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-family: "IBM Plex Mono", monospace;
}

.results-table tbody tr:hover {
  background: var(--bg-tertiary);
}
.results-table tbody tr.win {
  background: var(--success-bg);
}
.results-table tbody tr.loss {
  background: var(--danger-bg);
}
.results-table tbody tr.skipped {
  background: var(--skip-bg);
  opacity: 0.7;
}
.results-table tbody tr.bust {
  background: var(--bust-bg);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.win {
  background: var(--success-bg);
  color: var(--success);
}
.status-badge.loss {
  background: var(--danger-bg);
  color: var(--danger);
}
.status-badge.skipped {
  background: var(--skip-bg);
  color: var(--text-muted);
}
.status-badge.bust {
  background: var(--bust-bg);
  color: var(--danger);
}

.multiplier {
  font-weight: 600;
}
.multiplier.joker {
  color: var(--joker);
}
.multiplier.blue {
  color: var(--blue-range);
}
.multiplier.purple {
  color: var(--purple-range);
}
.multiplier.pink {
  color: var(--pink-range);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.pagination.top {
  border-bottom: 1px solid var(--border-color);
}

.pagination.bottom {
  border-top: 1px solid var(--border-color);
}

.pagination-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 13px;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}
.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-input {
  width: 100px;
  height: 36px;
  text-align: center;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
}

.pagination-total {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 8px;
}

.progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.progress-overlay.hidden {
  display: none;
}

.progress-card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 40px 50px;
  text-align: center;
  border: 1px solid var(--border-color);
  min-width: 450px;
}

.progress-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}
.progress-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.progress-bar-container {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  font-size: 12px;
  color: var(--text-secondary);
}
.progress-stat {
  font-family: "IBM Plex Mono", monospace;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  text-align: center;
}

.empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
}

.empty-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}
.empty-description {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 400px;
}

.mini-stats {
  display: flex;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  font-size: 12px;
}

.mini-stat {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mini-stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.mini-stat-dot.win {
  background: var(--success);
}
.mini-stat-dot.loss {
  background: var(--danger);
}
.mini-stat-dot.skipped {
  background: var(--text-muted);
}

.marker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 8px;
}

.marker.best {
  background: var(--success-bg);
  color: var(--success);
}
.marker.worst {
  background: var(--danger-bg);
  color: var(--danger);
}
.marker.maxstake {
  background: var(--warning-bg);
  color: var(--warning);
}

.loading-row {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 10px;
  vertical-align: middle;
}

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

/* Multi-Simulation Results */
.multi-sim-panel {
  padding: 24px 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: none;
}

.multi-sim-panel.active {
  display: block;
}

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

.multi-sim-title {
  font-size: 16px;
  font-weight: 600;
}

.multi-sim-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.multi-sim-card {
  background: var(--bg-tertiary);
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  min-width: 0;
  overflow: hidden;
}

.multi-sim-card .label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.multi-sim-card .value {
  font-size: 16px;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.3;
}

.multi-sim-card .sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  word-break: break-word;
}

.multi-sim-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.multi-sim-table th,
.multi-sim-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.multi-sim-table th {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg-elevated);
}

.multi-sim-table td {
  font-family: "IBM Plex Mono", monospace;
}

.multi-sim-table tbody tr:hover {
  background: var(--bg-tertiary);
}

.multi-sim-table tbody tr.selected {
  background: var(--accent-glow);
}

.multi-sim-table tbody tr.unprofitable {
  border-left: 3px solid var(--danger);
}

.multi-sim-table tbody tr.bust {
  border-left: 3px solid var(--joker);
}

.sim-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.sim-badge.profit {
  background: var(--success-bg);
  color: var(--success);
}

.sim-badge.loss {
  background: var(--danger-bg);
  color: var(--danger);
}

.view-bets-btn {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.view-bets-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-glow);
}

/* History Panel */
.history-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.history-panel.open {
  transform: translateX(0);
}

.history-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-title {
  font-size: 16px;
  font-weight: 600;
}

.history-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.history-item {
  background: var(--bg-tertiary);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s;
}

.history-item:hover {
  border-color: var(--accent-primary);
}

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

.history-item-name {
  font-size: 14px;
  font-weight: 600;
}

.history-item-date {
  font-size: 11px;
  color: var(--text-muted);
}

.history-item-stats {
  display: flex;
  gap: 12px;
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
}

.history-item-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

.history-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.history-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 400px;
  border: 1px solid var(--border-color);
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

.modal-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 16px;
}

.modal-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

@media (max-width: 1200px) {
  .sidebar {
    width: 340px;
    min-width: 340px;
    max-width: 340px;
  }
}

@media (max-width: 900px) {
  .app-container {
    flex-direction: column;
    height: 100vh;
  }
  .sidebar {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 50vh;
    position: relative;
    flex-shrink: 0;
  }
  .main-content {
    flex: 1;
    min-height: 0;
  }
  .history-panel {
    width: 100%;
  }
}

/* Authentication Styles */
.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.login-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--danger-bg);
  border-radius: 6px;
  display: none;
}

.login-error.show {
  display: block;
}

.user-menu-dropdown {
  position: absolute;
  top: 60px;
  right: 24px;
  width: 280px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
}

.user-menu-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.user-menu-header .user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.user-info-menu {
  flex: 1;
  min-width: 0;
}

.user-email-menu {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0 12px;
}

.user-menu-item {
  width: 100%;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
  border-radius: 0 0 12px 12px;
}

.user-menu-item:hover {
  background: var(--bg-tertiary);
}

.user-menu-item svg {
  flex-shrink: 0;
}
