/* ===== CANOPY DICE - RETRO CRT AESTHETIC ===== */

:root {
  --primary: #33ff33;
  --primary-dim: #1a8c1a;
  --primary-glow: rgba(51, 255, 51, 0.3);
  --accent: #ffaa00;
  --accent-dim: #a67000;
  --accent-glow: rgba(255, 170, 0, 0.3);
  --bad: #ff3333;
  --bad-glow: rgba(255, 51, 51, 0.3);
  --bg-dark: #0a0a0a;
  --bg-panel: #1a1a1a;
  --bg-input: #111111;
  --border-color: #2a2a2a;
  --border-glow: rgba(51, 255, 51, 0.27);
  --text-dim: #666666;
  --font-family: 'Press Start 2P', 'Courier New', monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--primary);
  font-family: var(--font-family);
  font-size: 10px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== SCANLINE OVERLAY ===== */
.scanline-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15) 0px,
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 3px
  );
}

.scanline-overlay::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    ellipse at center,
    transparent 50%,
    rgba(0, 0, 0, 0.4) 100%
  );
  pointer-events: none;
}

/* ===== HEADER ===== */
.game-header {
  position: relative;
  text-align: center;
  padding: 16px 0 8px;
  border-bottom: 2px solid var(--border-color);
  background: var(--bg-panel);
}

.game-title {
  font-size: 24px;
  color: var(--primary);
  text-shadow:
    0 0 10px var(--primary-glow),
    0 0 20px var(--primary-glow),
    0 0 40px var(--primary-glow);
  letter-spacing: 6px;
}

.header-subtitle {
  font-size: 8px;
  color: var(--accent);
  letter-spacing: 8px;
  margin-top: 4px;
  text-shadow: 0 0 8px var(--accent-glow);
}

/* ===== GAME LAYOUT ===== */
.game-layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px;
  gap: 12px;
  min-height: calc(100vh - 70px);
}

/* ===== PANELS ===== */
.panel {
  width: 200px;
  min-width: 200px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5), 0 0 8px var(--border-glow);
}

.panel-title {
  font-size: 10px;
  color: var(--accent);
  text-align: center;
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
  letter-spacing: 3px;
  text-shadow: 0 0 6px var(--accent-glow);
}

.feed-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

/* Scrollbar styling */
.panel-content::-webkit-scrollbar {
  width: 4px;
}

.panel-content::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

.panel-content::-webkit-scrollbar-thumb {
  background: var(--primary-dim);
  border-radius: 2px;
}

/* ===== PLAYER SLOTS ===== */
.player-slot {
  padding: 8px;
  margin-bottom: 6px;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  background: var(--bg-dark);
  transition: border-color 0.3s;
}

.player-slot.active {
  border-color: var(--primary);
  box-shadow: 0 0 6px var(--primary-glow);
}

.player-slot.empty {
  opacity: 0.3;
  border-style: dashed;
}

.player-color-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 1px;
  margin-right: 6px;
  vertical-align: middle;
}

.player-address {
  font-size: 7px;
  color: var(--primary);
  word-break: break-all;
}

.player-balance {
  font-size: 8px;
  color: var(--accent);
  margin-top: 4px;
  text-shadow: 0 0 4px var(--accent-glow);
}

/* ===== GAME MAIN ===== */
.game-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

#game-container {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.6), 0 0 12px var(--border-glow);
  overflow: hidden;
  aspect-ratio: 800 / 400;
}

#game-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ===== CONTROLS ===== */
.controls-area {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 16px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5), 0 0 8px var(--border-glow);
}

.controls-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.control-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-label {
  font-size: 8px;
  color: var(--accent);
  letter-spacing: 2px;
  text-shadow: 0 0 4px var(--accent-glow);
}

/* ===== SLIDER ===== */
.retro-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-dark);
  border: 1px solid var(--primary-dim);
  border-radius: 0;
  outline: none;
  cursor: pointer;
}

.retro-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 20px;
  background: var(--primary);
  border: 2px solid var(--primary-dim);
  cursor: pointer;
  box-shadow: 0 0 8px var(--primary-glow);
}

.retro-slider::-moz-range-thumb {
  width: 16px;
  height: 20px;
  background: var(--primary);
  border: 2px solid var(--primary-dim);
  cursor: pointer;
  border-radius: 0;
  box-shadow: 0 0 8px var(--primary-glow);
}

.target-value {
  font-size: 18px;
  color: var(--primary);
  text-align: center;
  text-shadow: 0 0 10px var(--primary-glow);
}

/* ===== INPUTS ===== */
.retro-input {
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--primary);
  background: var(--bg-input);
  border: 2px solid var(--primary-dim);
  padding: 8px 10px;
  outline: none;
  width: 100%;
  text-shadow: 0 0 4px var(--primary-glow);
}

.retro-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

/* Remove spinner arrows */
.retro-input[type="number"]::-webkit-inner-spin-button,
.retro-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.retro-input[type="number"] {
  -moz-appearance: textfield;
}

/* ===== BUTTONS ===== */
.retro-btn {
  font-family: var(--font-family);
  font-size: 10px;
  color: var(--primary);
  background: var(--bg-dark);
  border: 2px solid var(--primary-dim);
  padding: 10px 16px;
  cursor: pointer;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: all 0.15s;
  text-shadow: 0 0 4px var(--primary-glow);
}

.retro-btn:hover {
  background: var(--primary-dim);
  color: var(--bg-dark);
  box-shadow: 0 0 12px var(--primary-glow);
  text-shadow: none;
}

.retro-btn:active {
  transform: scale(0.97);
}

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

.retro-btn:disabled:hover {
  background: var(--bg-dark);
  color: var(--primary);
  box-shadow: none;
  text-shadow: 0 0 4px var(--primary-glow);
}

/* Toggle button */
.toggle-btn {
  min-width: 100px;
  text-align: center;
}

.toggle-btn.under {
  color: var(--accent);
  border-color: var(--accent-dim);
  text-shadow: 0 0 4px var(--accent-glow);
}

.toggle-btn.under:hover {
  background: var(--accent-dim);
  color: var(--bg-dark);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Roll button */
.roll-btn {
  width: 100%;
  font-size: 16px;
  padding: 14px;
  color: var(--accent);
  border-color: var(--accent);
  letter-spacing: 4px;
  text-shadow: 0 0 8px var(--accent-glow);
}

.roll-btn:hover {
  background: var(--accent);
  color: var(--bg-dark);
  box-shadow: 0 0 16px var(--accent-glow);
  text-shadow: none;
}

/* Cash out button */
.cashout-btn {
  font-size: 10px;
  padding: 10px 12px;
  color: var(--accent);
  border-color: var(--accent-dim);
  letter-spacing: 1px;
  text-shadow: 0 0 6px var(--accent-glow);
  min-width: 120px;
}

.cashout-btn:hover:not(:disabled) {
  background: var(--accent-dim);
  color: var(--bg-dark);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Seed hash bar */
.seed-bar {
  font-family: var(--font-family);
  font-size: 7px;
  color: var(--text-dim);
  text-align: center;
  padding: 4px 8px;
  margin-bottom: 6px;
  border: 1px solid var(--border-color);
  background: rgba(0,0,0,0.2);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: default;
}

/* Verify button */
.verify-section {
  margin-top: 10px;
  text-align: center;
}

.verify-btn {
  font-size: 7px;
  padding: 6px 12px;
  color: var(--text-dim);
  border-color: var(--border-color);
  text-shadow: none;
}

.verify-btn:hover {
  color: var(--primary);
  border-color: var(--primary-dim);
}

/* ===== CONTROLS INFO ROW ===== */
.controls-info {
  justify-content: center;
  gap: 24px;
  margin-bottom: 14px;
}

.info-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.info-label {
  font-size: 7px;
  color: var(--text-dim);
  letter-spacing: 2px;
}

.info-value {
  font-size: 14px;
  color: var(--primary);
  text-shadow: 0 0 6px var(--primary-glow);
}

/* ===== BET FEED ENTRIES ===== */
.bet-entry {
  padding: 6px;
  margin-bottom: 4px;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  background: var(--bg-dark);
  font-size: 7px;
  line-height: 1.6;
}

.bet-entry.win {
  border-left: 3px solid var(--primary);
}

.bet-entry.lose {
  border-left: 3px solid var(--bad);
}

.bet-player {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}

.bet-details {
  color: var(--text-dim);
}

.bet-result {
  font-size: 8px;
  margin-top: 2px;
}

.bet-result.win {
  color: var(--primary);
  text-shadow: 0 0 4px var(--primary-glow);
}

.bet-result.lose {
  color: var(--bad);
  text-shadow: 0 0 4px var(--bad-glow);
}

/* ===== VERIFY MODAL ===== */
.verify-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.verify-modal-content {
  background: var(--bg-panel);
  border: 2px solid var(--primary-dim);
  padding: 20px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 0 20px var(--primary-glow);
}

.verify-modal-content h2 {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 16px;
  text-align: center;
  letter-spacing: 2px;
}

.verify-entry {
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-dark);
  font-size: 7px;
  line-height: 1.8;
  word-break: break-all;
}

.verify-entry .verified {
  color: var(--primary);
}

.verify-entry .failed {
  color: var(--bad);
}

.verify-close-btn {
  margin-top: 12px;
  width: 100%;
}

/* ===== ANIMATIONS ===== */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.97; }
}


@keyframes glow-pulse {
  0%, 100% { text-shadow: 0 0 10px var(--primary-glow); }
  50% { text-shadow: 0 0 20px var(--primary-glow), 0 0 30px var(--primary-glow); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .game-layout {
    flex-direction: column;
  }

  .panel {
    width: 100%;
    min-width: unset;
    max-height: 200px;
  }

  .panel-left {
    order: 2;
  }

  .game-main {
    order: 1;
  }

  .panel-right {
    order: 3;
  }
}

/* ===== MOBILE BOTTOM BAR — hidden on desktop ===== */
.mobile-bottom-bar {
  display: none;
}

/* ===== MOBILE LAYOUT (≤768px or touch device) ===== */
@media (max-width: 768px), (pointer: coarse) {

  /* Stack game layout vertically */
  .game-layout {
    flex-direction: column;
    padding: 8px;
    gap: 8px;
    min-height: unset;
  }

  /* Canvas area: full width, fixed height */
  #game-container {
    width: 100%;
    height: 280px;
    aspect-ratio: unset;
  }

  /* Panels become bottom drawers */
  .panel-left,
  .panel-right {
    position: fixed;
    bottom: 48px;        /* clear the bottom bar */
    left: 0;
    right: 0;
    height: 50vh;
    transform: translateY(100%);
    transition: transform 0.25s ease;
    z-index: 200;
    overflow-y: auto;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 4px 4px 0 0;
  }

  /* Drawer open state */
  .panel-left.drawer-open,
  .panel-right.drawer-open {
    transform: translateY(0);
  }

  /* Bottom bar */
  .mobile-bottom-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    z-index: 300;
  }

  /* Bottom bar buttons */
  .bottom-bar-btn {
    flex: 1;
    min-height: 44px;
    font-family: var(--font-family);
    font-size: 10px;
    color: var(--primary);
    background: transparent;
    border: none;
    border-right: 1px solid var(--border-color);
    cursor: pointer;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 4px var(--primary-glow);
  }

  .bottom-bar-btn:last-child {
    border-right: none;
  }

  .bottom-bar-btn:active {
    background: var(--bg-input);
  }

  /* Touch target overrides for controls */
  .retro-btn,
  .retro-input,
  .retro-slider {
    min-height: 44px;
    font-size: 12px;
  }
}

/* ===== AUTO-BET PANEL ===== */
.autobet-panel {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-panel);
  box-shadow: 0 0 10px var(--border-glow);
}

.autobet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-weight: bold;
  color: var(--primary);
}

.autobet-header label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.autobet-header input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.autobet-summary {
  font-size: 0.875rem;
  color: var(--text-dim);
}

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

.autobet-section,
.autobet-subsection {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.autobet-section label,
.autobet-subsection label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
}

.autobet-section input,
.autobet-subsection input {
  padding: 0.4rem;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--primary);
  font-family: var(--font-family);
  font-size: 10px;
  border-radius: 3px;
}

/* ===== CUSTOM SELECT ===== */
.custom-select {
  display: block;
}

.custom-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--primary);
  font-family: var(--font-family);
  font-size: 10px;
  border-radius: 3px;
  cursor: pointer;
  gap: 0.4rem;
}

.custom-select-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.custom-select-chevron {
  flex-shrink: 0;
  color: var(--primary);
}

.custom-select-trigger:hover,
.custom-select-trigger.active {
  border-color: var(--primary-dim);
  box-shadow: 0 0 4px var(--primary-glow);
}

.custom-select-list {
  display: none;
  background-color: var(--bg-dark);
  border: 1px solid var(--primary-dim);
  border-top: none;
  list-style: none;
  margin: 0;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.custom-select-list.open {
  display: block;
}

.custom-select-option {
  list-style: none;
  padding: 0.4rem;
  color: var(--primary);
  font-family: var(--font-family);
  font-size: 10px;
  cursor: pointer;
}

.custom-select-option:hover {
  background: var(--primary-dim);
  color: var(--bg-input);
}

.custom-select-option.selected {
  color: var(--accent);
}

.autobet-section input:disabled,
.autobet-subsection input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.autobet-section small,
.autobet-subsection small {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: -0.2rem;
}

/* ===== QUICK-BETS BUTTONS ===== */
.retro-quick-bets {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  justify-content: space-between;
}

.retro-btn-quick {
  flex: 1;
  font-family: var(--font-family);
  font-size: 10px;
  color: var(--primary);
  background: var(--bg-input);
  border: 1px solid var(--primary-dim);
  padding: 6px 4px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 0 4px var(--primary-glow);
  border-radius: 2px;
  transition: all 0.1s ease;
}

.retro-btn-quick:hover:not(:disabled) {
  background: var(--primary-dim);
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow), inset 0 0 8px var(--primary-glow);
}

.retro-btn-quick:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: inset 0 0 4px var(--primary-glow);
}

.retro-btn-quick:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== SESSION STATS BAR ===== */
.retro-stats-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--primary-dim);
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 9px;
  color: var(--primary);
  text-shadow: 0 0 4px var(--primary-glow);
  flex-wrap: wrap;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.3);
}

.stats-item {
  display: inline-block;
  padding: 0 4px;
  border-right: 1px solid var(--primary-dim);
}

.stats-item:last-of-type {
  border-right: none;
}

.retro-btn-mini {
  font-family: var(--font-family);
  font-size: 8px;
  color: var(--primary);
  background: var(--bg-dark);
  border: 1px solid var(--primary-dim);
  padding: 4px 8px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 0 4px var(--primary-glow);
  border-radius: 2px;
  transition: all 0.1s ease;
  white-space: nowrap;
}

.retro-btn-mini:hover:not(:disabled) {
  background: var(--primary-dim);
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow), inset 0 0 8px var(--primary-glow);
}

.retro-btn-mini:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: inset 0 0 4px var(--primary-glow);
}

.retro-btn-mini:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
