* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: #0b2e13;
  color: #fff;
  margin: 0;
  padding: 12px;
  text-align: center;
}

h1 {
  color: #ffd700;
  margin-bottom: 10px;
}

#warning-banner {
  background: #b30000;
  color: #fff;
  font-weight: bold;
  padding: 15px;
  margin: 10px auto;
  border-radius: 6px;
  max-width: 900px;
  font-size: 16px;
  text-align: center;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  animation: blink 1.5s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

#credit-display {
  font-size: 20px;
  margin-bottom: 10px;
  color: #ffd700;
}

#chip-selector {
  margin-bottom: 20px;
}

#main-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  max-width: 1600px;
  margin: 0 auto;
}

.casino-side {
  width: 260px;
  flex-shrink: 0;
}

.casino-card {
  background: linear-gradient(180deg, #1b1b1b, #111);
  padding: 15px;
  border-radius: 14px;
  color: #fff;
  text-align: left;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 215, 0, 0.18);
}

.casino-card h3 {
  color: #ffd700;
  margin-top: 0;
  margin-bottom: 10px;
  text-align: center;
}

.casino-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.casino-card li {
  margin: 8px 0;
  line-height: 1.4;
}

.casino-btn {
  display: block;
  margin-top: 12px;
  padding: 10px 15px;
  background: #ffd700;
  color: #000;
  font-weight: bold;
  text-decoration: none;
  border-radius: 6px;
  text-align: center;
  transition: background 0.3s;
}

.casino-btn:hover {
  background: #e6c200;
}

#roulette-section {
  flex: 1;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(180deg, rgba(20, 20, 20, 0.45), rgba(0, 0, 0, 0.2));
  border: 1px solid rgba(255, 215, 0, 0.15);
  border-radius: 18px;
  padding: 20px 14px;
  box-shadow: 0 0 22px rgba(0, 0, 0, 0.35);
}

#roulette-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
}

#roulette-container {
  position: relative;
  width: min(70vmin, 420px);
  height: min(70vmin, 420px);
  margin: 0 auto;
}

#roulette-wheel {
  width: 100%;
  height: 100%;
  display: block;
}

.white-ball {
  width: 20px;
  height: 20px;
  background-color: white;
  border-radius: 50%;
  position: absolute;
  z-index: 10;
  box-shadow: 0 0 8px #fff, inset 0 0 5px #ccc;
  transition: left 0.016s, top 0.016s;
}

/* Plateau */
#bet-table-container {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}

#bet-table-scroll {
  width: max-content;
  min-width: 100%;
}

#roulette-board {
  display: flex;
  align-items: stretch;
  gap: 4px;
  width: max-content;
  position: relative;
  z-index: 10;
}

.zero {
  width: 48px;
  min-width: 48px;
  height: 132px;
  background-color: green;
  color: #fff;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-weight: bold;
}

#numbers-grid {
  display: grid;
  grid-template-columns: repeat(12, 44px);
  grid-template-rows: repeat(3, 42px);
  gap: 3px;
  width: auto;
}

.number-cell {
  width: 44px;
  min-width: 44px;
  height: 42px;
  font-size: 13px;
  font-weight: bold;
}

.betting-area {
  border: 1px solid #ccc;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border-radius: 4px;
  padding: 0 6px;
  color: #fff;
  user-select: none;
  position: relative;
  z-index: 10;
  touch-action: manipulation;
}

.outside-bets {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin-top: 10px;
  width: 580px;
  position: relative;
  z-index: 10;
}

.outside {
  background-color: #333;
  min-height: 42px;
}

.dozens-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 10px;
  width: 580px;
  position: relative;
  z-index: 10;
}

.dozen {
  background-color: #444;
  min-height: 42px;
}

#chips-container {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 20;
}

.chip {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  border: 1px solid #fff;
  background-color: blue;
  z-index: 20;
}

#spin-btn {
  margin-top: 15px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 8px;
  background: #ffd700;
  border: none;
  cursor: pointer;
}

#gain-message {
  margin-top: 15px;
  background: #222;
  padding: 15px;
  border-radius: 8px;
  width: 100%;
  max-width: 700px;
}

#gain-message.hidden {
  display: none;
}

#gain-message button {
  margin: 5px;
  padding: 10px;
  font-size: 14px;
  cursor: pointer;
  border-radius: 5px;
  background-color: #ffd700;
  border: none;
}

/* Scrollbar */
#bet-table-container::-webkit-scrollbar {
  height: 8px;
}

#bet-table-container::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.45);
  border-radius: 999px;
}

/* Loader */
#loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: radial-gradient(circle at center, rgba(20, 70, 30, 0.95) 0%, rgba(0, 0, 0, 0.98) 70%);
}

.loader-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 215, 0, 0.08), transparent 45%);
  animation: loaderGlow 2s ease-in-out infinite;
}

.loader-box {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 30px 20px;
  animation: loaderFadeInUp 0.8s ease;
}

.mini-roulette {
  position: relative;
  width: 170px;
  height: 170px;
  margin: 0 auto 24px;
}

.mini-wheel {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 8px solid #c8a800;
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.35), inset 0 0 25px rgba(0, 0, 0, 0.75);
  background: conic-gradient(
    #15803d 0deg 10deg,
    #111 10deg 20deg,
    #b30000 20deg 30deg,
    #111 30deg 40deg,
    #b30000 40deg 50deg,
    #111 50deg 60deg,
    #b30000 60deg 70deg,
    #111 70deg 80deg,
    #b30000 80deg 90deg,
    #111 90deg 100deg,
    #b30000 100deg 110deg,
    #111 110deg 120deg,
    #b30000 120deg 130deg,
    #111 130deg 140deg,
    #b30000 140deg 150deg,
    #111 150deg 160deg,
    #b30000 160deg 170deg,
    #111 170deg 180deg,
    #b30000 180deg 190deg,
    #111 190deg 200deg,
    #b30000 200deg 210deg,
    #111 210deg 220deg,
    #b30000 220deg 230deg,
    #111 230deg 240deg,
    #b30000 240deg 250deg,
    #111 250deg 260deg,
    #b30000 260deg 270deg,
    #111 270deg 280deg,
    #b30000 280deg 290deg,
    #111 290deg 300deg,
    #b30000 300deg 310deg,
    #111 310deg 320deg,
    #b30000 320deg 330deg,
    #111 330deg 340deg,
    #b30000 340deg 350deg,
    #111 350deg 360deg
  );
  animation: wheelSpin 2.8s linear infinite;
}

.mini-wheel::before {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  border: 3px solid rgba(255, 215, 0, 0.45);
  background: radial-gradient(circle, rgba(20, 50, 20, 0.75), rgba(0, 0, 0, 0.85));
}

.mini-center {
  position: absolute;
  width: 24px;
  height: 24px;
  background: #ffd700;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.9), inset 0 0 6px rgba(255, 255, 255, 0.5);
  z-index: 3;
}

.mini-ball {
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  margin-left: -9px;
  margin-top: -9px;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.95), inset 0 0 4px rgba(180, 180, 180, 0.8);
  transform-origin: 0 0;
  animation: ballOrbit 1.4s linear infinite;
  z-index: 4;
}

.loader-title {
  color: #ffd700;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 3px;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.7), 0 0 20px rgba(255, 215, 0, 0.35);
  margin-bottom: 10px;
}

.loader-subtitle {
  color: #f5f5f5;
  font-size: 16px;
  letter-spacing: 1px;
  opacity: 0.9;
  animation: subtitlePulse 1.4s ease-in-out infinite;
}

@keyframes wheelSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes ballOrbit {
  0% { transform: rotate(0deg) translateX(72px) rotate(0deg); }
  100% { transform: rotate(360deg) translateX(72px) rotate(-360deg); }
}

@keyframes subtitlePulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

@keyframes loaderGlow {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}

@keyframes loaderFadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@media screen and (max-width: 1200px) {
  #main-layout {
    flex-direction: column;
    align-items: center;
  }

  .casino-side {
    width: min(92vw, 500px);
  }

  #roulette-section {
    width: 100%;
    max-width: 1100px;
  }
}

@media screen and (max-width: 700px) {
  body {
    padding: 10px;
  }

  #warning-banner {
    font-size: 14px;
  }

  .zero {
    width: 42px;
    min-width: 42px;
    height: 126px;
    font-size: 12px;
  }

  #numbers-grid {
    grid-template-columns: repeat(12, 40px);
    grid-template-rows: repeat(3, 40px);
  }

  .number-cell {
    width: 40px;
    min-width: 40px;
    height: 40px;
    font-size: 12px;
  }

  .outside-bets,
  .dozens-row {
    width: 532px;
  }

  .outside,
  .dozen {
    min-height: 40px;
    font-size: 12px;
  }

  .chip {
    width: 15px;
    height: 15px;
    font-size: 10px;
  }

  #spin-btn {
    width: 100%;
    max-width: 250px;
  }

  .mini-roulette {
    width: 140px;
    height: 140px;
  }

  .mini-ball {
    width: 14px;
    height: 14px;
    margin-left: -7px;
    margin-top: -7px;
  }

  .loader-title {
    font-size: 22px;
    letter-spacing: 2px;
  }

  .loader-subtitle {
    font-size: 14px;
  }
}