/* ===== RUSSIAN ROULETTE CSS ===== */
/* Steel dark metallic theme inspired by mockup */

#rouletteGame {
  padding: 0; gap: 0;
  background:
    linear-gradient(180deg, #2d3139 0%, #1a1d23 100%);
  position: relative; overflow: hidden;
}

/* Grid texture overlay from mockup */
#rouletteGame::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      rgba(255,255,255,0.02) 1px,
      transparent 2px,
      transparent 40px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      rgba(255,255,255,0.02) 1px,
      transparent 2px,
      transparent 40px
    );
  pointer-events: none; z-index: 0;
}

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

/* -- Header: Steel bar -- */
.roulette-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.3) 100%);
  border-bottom: 2px solid #4a4d55;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.roulette-header .back-btn {
  background: rgba(0,0,0,0.4) !important;
  border: 1px solid rgba(255,255,255,0.15) !important;
  border-radius: 6px !important;
  color: #f5f5dc !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  touch-action: manipulation;
}

.roulette-title {
  font-family: 'Black Han Sans', sans-serif; font-size: 20px; letter-spacing: 1px;
  color: #f5f5dc;
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

.roulette-survivors {
  font-family: 'Black Han Sans', sans-serif; font-size: 16px;
  color: #2d8a4d;
  text-shadow: 0 0 8px rgba(45,138,77,0.5);
}

/* -- Setup Panel: Dark steel card (발사버튼 위, 실린더 위에 배치) -- */
.roulette-setup {
  padding: 16px 14px;
  background: rgba(0,0,0,0.5);
  border-radius: 8px;
  border: 2px solid #444;
  margin: 10px 12px;
}

.setup-card {
  background: rgba(0,0,0,0.3);
  padding: 14px; border-radius: 8px;
  margin-bottom: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}

.setup-label {
  font-size: 13px; font-weight: 700; margin-bottom: 8px;
  color: #8a8a9a;
  text-transform: uppercase; letter-spacing: 1px;
}

.setup-slider-row { display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; }

.setup-slider {
  flex: 1; -webkit-appearance: none; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, #2d3139, #3a3d45); outline: none;
}

.setup-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #7a7a88, #4a4d55);
  cursor: pointer; border: 2px solid #5a5d65;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 0 8px rgba(90,93,101,0.3);
}

.setup-slider::-moz-range-thumb {
  width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #7a7a88, #4a4d55);
  cursor: pointer; border: 2px solid #5a5d65;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 0 8px rgba(90,93,101,0.3);
}

.setup-slider::-moz-range-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, #2d3139, #3a3d45);
  border: none;
}

.setup-value {
  font-family: 'Black Han Sans', sans-serif; font-size: 20px; color: #f5f5dc;
  min-width: 30px; text-align: center;
}

/* -- Cylinder Area -- */
.cylinder-area {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 12px; gap: 14px; min-height: 0;
}

.current-turn-display {
  font-size: 15px; font-weight: 700; color: #f5f5dc; text-align: center;
  padding: 8px 20px;
  background: rgba(0,0,0,0.5);
  border-radius: 20px;
  border: 1px solid #444;
  backdrop-filter: blur(4px);
}

#currentTurnName {
  color: #f5f5dc; font-family: 'Black Han Sans', sans-serif;
  text-shadow: 0 0 8px rgba(245,245,220,0.3);
}

/* -- Cylinder: Mockup-style brushed metal -- */
.cylinder-container {
  position: relative;
  width: min(240px, 60vw);
  height: min(240px, 60vw);
  max-width: 260px; max-height: 260px;
  filter: drop-shadow(0 12px 40px rgba(0,0,0,0.8));
}

.cylinder {
  width: 100%; height: 100%; border-radius: 50%; position: relative;
  background:
    radial-gradient(circle at 50% 50%, #3a4149 0%, #2d3139 50%, #1a1d23 100%);
  box-shadow:
    inset 0 8px 24px rgba(0,0,0,0.6),
    0 12px 40px rgba(0,0,0,0.8),
    inset 0 2px 6px rgba(255,255,255,0.08),
    inset 0 -4px 12px rgba(0,0,0,0.6);
  border: 6px solid #4a4d55;
  transition: transform 3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.cylinder.spinning { animation: spin-cylinder 3s cubic-bezier(0.25, 0.1, 0.25, 1); }

@keyframes spin-cylinder { from { transform: rotate(0deg); } to { transform: rotate(1440deg); } }

/* Cylinder center hub */
.cylinder-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 46px; height: 46px; border-radius: 50%;
  background: radial-gradient(circle, #2a2d35 0%, #1a1d23 100%);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  box-shadow:
    inset 0 2px 8px rgba(0,0,0,0.8),
    0 2px 8px rgba(0,0,0,0.5);
  border: 3px solid #5a5d65; pointer-events: none;
}

/* -- Chamber Indicators: Mockup-style holes -- */
.chamber-indicator {
  position: absolute; width: 32px; height: 32px; border-radius: 50%;
  background: radial-gradient(circle, #2a2d35 0%, #1a1d23 100%);
  border: 3px solid #4a4d55;
  transform: translate(-50%, -50%);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.9);
}

/* Loaded chamber: Red glow (mockup .chamber.loaded) */
.chamber-indicator.bullet {
  background: radial-gradient(circle, #2a2d35 0%, #1a1d23 100%);
  border-color: #4a4d55;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.9);
  position: relative;
}

.chamber-indicator.bullet::after {
  content: '';
  position: absolute;
  width: 12px; height: 12px;
  background: #d42f2f;
  border-radius: 50%;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px rgba(212,47,47,0.9);
}

/* Empty chamber */
.chamber-indicator.empty {
  background: radial-gradient(circle at 40% 35%, rgba(60,60,70,0.5), rgba(30,30,38,0.8));
  box-shadow: inset 0 3px 6px rgba(0,0,0,0.6), inset 0 -1px 2px rgba(255,255,255,0.03);
}

.cylinder-info {
  font-size: 12px; color: #8a8a9a; text-align: center;
  min-height: 18px; letter-spacing: 0.5px; font-style: italic;
}

/* -- Survivors List: Mockup-style grid -- */
.survivors-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
  gap: 6px; padding: 0 12px;
  max-height: 170px; overflow-y: auto; -webkit-overflow-scrolling: touch;
}

.survivor-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 6px 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px; position: relative; transition: all 0.3s;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Dead survivor: Mockup .survivor-item.eliminated */
.survivor-item.dead {
  opacity: 0.35; filter: grayscale(1);
  border-color: rgba(212,47,47,0.3);
}

.survivor-item.dead::after {
  content: '\2715';
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 36px; color: #d42f2f; font-weight: 900;
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(212,47,47,0.6));
}

/* Survivor avatar */
.survivor-avatar-sm {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  background: linear-gradient(135deg, #8b7930 0%, #d4af37 100%);
  border: 3px solid #d4af37;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  font-weight: 900;
}

.survivor-item.dead .survivor-avatar-sm {
  background: linear-gradient(135deg, #666 0%, #444 100%);
  border-color: #888;
  opacity: 0.5;
}

.survivor-name {
  font-size: 12px; font-weight: 700; max-width: 65px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; text-align: center;
  color: #f5f5dc;
}

.survivor-item.dead .survivor-name {
  text-decoration: line-through;
  opacity: 0.5;
}

/* Current turn highlight */
.survivor-item.current-turn {
  border-color: #d4af37;
  background: rgba(212,175,55,0.15);
  box-shadow: 0 0 12px rgba(212,175,55,0.4);
  animation: rr-turn-glow 1.5s ease-in-out infinite alternate;
}
@keyframes rr-turn-glow {
  from { box-shadow: 0 0 8px rgba(212,175,55,0.3); }
  to { box-shadow: 0 0 16px rgba(212,175,55,0.6); }
}
.survivor-order {
  font-size: 9px; font-weight: 700; padding: 1px 6px;
  border-radius: 8px; color: #aaa;
  background: rgba(255,255,255,0.08);
}
.survivor-order.now {
  color: #ffd700; background: rgba(212,175,55,0.2);
  font-size: 10px; animation: rr-pulse-label 1s ease-in-out infinite alternate;
}
@keyframes rr-pulse-label {
  from { opacity: 0.8; }
  to { opacity: 1; }
}

/* -- Action Buttons (상단 배치) -- */
.roulette-actions {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 12px 14px 8px;
}

/* Spin button: Mockup steel style */
#spinBtn, .roulette-actions .btn-secondary {
  background: linear-gradient(145deg, #3a4149 0%, #2d3139 100%) !important;
  color: #f5f5dc !important;
  padding: 16px 40px;
  font-family: 'Black Han Sans', sans-serif;
  font-size: 18px;
  border: 3px solid #5a5d65 !important;
  border-radius: 8px;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 6px 20px rgba(0,0,0,0.6);
  transition: all 0.3s ease;
}

#spinBtn:hover, .roulette-actions .btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.7);
}

/* Trigger button: Mockup red danger style */
.btn-danger {
  background: linear-gradient(145deg, #8a1a1a 0%, #d42f2f 100%);
  color: white;
  padding: 24px 48px;
  font-family: 'Black Han Sans', sans-serif;
  font-size: 28px;
  border: 4px solid #ff4444;
  border-radius: 12px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow:
    0 8px 32px rgba(212,47,47,0.7),
    inset 0 2px 4px rgba(255,255,255,0.2);
  transition: all 0.3s ease;
  min-height: 54px;
  position: relative; overflow: hidden;
  touch-action: manipulation;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.btn-danger:hover {
  transform: scale(1.05);
  box-shadow:
    0 12px 48px rgba(212,47,47,0.9),
    inset 0 2px 4px rgba(255,255,255,0.3);
}

.btn-danger::before {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 0; height: 0; border-radius: 50%; background: rgba(255,255,255,0.2);
  transform: translate(-50%, -50%); transition: width 0.6s, height 0.6s;
}

.btn-danger:active::before { width: 300px; height: 300px; }

/* -- Flash Overlays: 3-Phase (suspense → bang/safe → fade) -- */
.roulette-flash {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 150; align-items: center; justify-content: center;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.roulette-flash.active { display: flex; pointer-events: auto; }
.roulette-flash.fading { opacity: 0; pointer-events: none; }

/* -- Phase 1: Suspense -- */
.roulette-flash.suspense {
  background: rgba(0,0,0,0.85);
  animation: rr-suspense-in 0.4s ease;
}

.roulette-flash.suspense .flash-icon {
  animation: rr-gun-pulse 0.6s ease-in-out infinite alternate;
}

.roulette-flash.suspense .flash-text {
  font-size: 28px; color: rgba(255,255,255,0.7);
  animation: rr-suspense-text 0.8s ease-in-out infinite alternate;
}

@keyframes rr-suspense-in {
  from { opacity: 0; } to { opacity: 1; }
}

@keyframes rr-gun-pulse {
  from { transform: scale(0.95); filter: drop-shadow(0 0 10px rgba(255,0,0,0.3)); }
  to { transform: scale(1.05); filter: drop-shadow(0 0 30px rgba(255,0,0,0.7)); }
}

@keyframes rr-suspense-text {
  from { opacity: 0.5; } to { opacity: 1; }
}

.rr-suspense-dots {
  font-size: 0;
}
.rr-suspense-dots::before {
  content: '.';
  font-size: 28px;
  animation: rr-dots 1s step-end infinite;
}

@keyframes rr-dots {
  0% { content: '.'; }
  33% { content: '..'; }
  66% { content: '...'; }
}

/* -- Phase 2: BANG (death) -- */
.roulette-flash.bang {
  background: radial-gradient(circle,
    rgba(255,50,50,0.95) 0%,
    rgba(180,0,0,0.85) 30%,
    rgba(100,0,0,0.7) 60%,
    rgba(0,0,0,0.9) 100%
  );
  animation: rr-bang-flash 0.15s ease-out 3;
}

@keyframes rr-bang-flash {
  0% { background-color: rgba(255,255,255,0.8); }
  50% { background-color: transparent; }
  100% { background-color: transparent; }
}

.roulette-flash.bang .flash-content {
  animation: rr-bang-zoom 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.roulette-flash.bang .flash-icon {
  animation: rr-bang-icon 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 0 40px rgba(255,100,0,0.8));
}

@keyframes rr-bang-zoom {
  0% { transform: scale(0) rotate(-20deg); }
  50% { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes rr-bang-icon {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  40% { transform: scale(1.5) rotate(10deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}

/* -- Phase 2: SAFE (survive) -- */
.roulette-flash.safe {
  background: radial-gradient(circle,
    rgba(45,138,77,0.8) 0%,
    rgba(30,100,60,0.6) 40%,
    rgba(0,0,0,0.85) 100%
  );
  animation: rr-safe-glow 0.6s ease;
}

@keyframes rr-safe-glow {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 1; }
}

.roulette-flash.safe .flash-content {
  animation: rr-safe-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.roulette-flash.safe .flash-icon {
  animation: rr-safe-icon 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes rr-safe-bounce {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

@keyframes rr-safe-icon {
  0% { transform: scale(0) translateY(20px); }
  50% { transform: scale(1.3) translateY(-10px); }
  100% { transform: scale(1) translateY(0); }
}

/* -- Flash Content -- */
.flash-content {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center; padding: 20px;
}

.flash-icon {
  font-size: 120px; line-height: 1;
  filter: drop-shadow(0 0 20px rgba(0,0,0,0.5));
}

.flash-text {
  font-family: 'Black Han Sans', sans-serif;
  font-size: 36px; line-height: 1.3;
  color: white;
  text-shadow: 3px 3px 8px rgba(0,0,0,0.9);
}

.rr-bang-text {
  font-size: 72px;
  color: #ff4444;
  text-shadow:
    0 0 20px rgba(255,68,68,0.8),
    0 0 60px rgba(255,68,68,0.4),
    4px 4px 12px rgba(0,0,0,0.9);
  display: block;
}

.rr-safe-text {
  font-size: 48px;
  color: #44ff88;
  text-shadow:
    0 0 20px rgba(68,255,136,0.6),
    0 0 40px rgba(68,255,136,0.3),
    3px 3px 8px rgba(0,0,0,0.9);
  display: block;
}

.rr-sub-text {
  font-size: 22px;
  color: rgba(255,255,255,0.8);
  margin-top: 4px;
  display: block;
}

/* -- Screen Shake -- */
.rr-shake {
  animation: rr-screen-shake 0.5s ease-out !important;
}

@keyframes rr-screen-shake {
  0%, 100% { transform: none; }
  10% { transform: translate(-8px, 3px) rotate(-1deg); }
  20% { transform: translate(8px, -3px) rotate(1deg); }
  30% { transform: translate(-6px, 2px); }
  40% { transform: translate(6px, -2px); }
  50% { transform: translate(-4px, 1px); }
  60% { transform: translate(4px); }
  70% { transform: translate(-2px); }
}

/* -- Spin Glow Effect -- */
.cylinder-container.rr-spin-active {
  animation: rr-spin-glow 0.5s ease-in-out infinite alternate;
}

@keyframes rr-spin-glow {
  from { filter: drop-shadow(0 12px 40px rgba(0,0,0,0.8)) drop-shadow(0 0 15px rgba(212,175,55,0.3)); }
  to { filter: drop-shadow(0 12px 40px rgba(0,0,0,0.8)) drop-shadow(0 0 40px rgba(212,175,55,0.7)); }
}

/* Trigger button pulse animation */
@keyframes rr-pulse {
  0% { box-shadow: 0 0 20px rgba(255,0,0,0.3); }
  100% { box-shadow: 0 0 40px rgba(255,0,0,0.7), 0 0 80px rgba(255,0,0,0.2); }
}

.rr-trigger-btn {
  background: radial-gradient(circle at 50% 40%, #cc2222 0%, #8a1a1a 70%) !important;
  border: 4px solid #ff4444 !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

/* ===== MOBILE RESPONSIVE (max-width: 430px) ===== */
@media (max-width: 430px) {

  /* -- Header -- */
  .roulette-header {
    padding: 6px 10px;
  }
  .roulette-title {
    font-size: 16px;
  }
  .roulette-survivors {
    font-size: 14px;
  }

  /* -- Setup panel -- */
  .roulette-setup {
    padding: 10px;
    margin: 6px 8px;
  }
  .setup-card {
    padding: 10px;
    margin-bottom: 8px;
  }
  .setup-label {
    font-size: 12px;
    margin-bottom: 6px;
  }
  .setup-slider {
    height: 6px;
  }
  .setup-value {
    font-size: 18px;
  }

  /* -- Cylinder area -- */
  .cylinder-area {
    padding: 8px;
    gap: 10px;
  }
  .cylinder-container {
    width: min(200px, 55vw) !important;
    height: min(200px, 55vw) !important;
    max-width: 200px;
    max-height: 200px;
  }
  .cylinder {
    border-width: 4px;
  }
  .cylinder-center {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .chamber-indicator {
    width: 28px;
    height: 28px;
  }
  .chamber-indicator.bullet::after {
    width: 10px;
    height: 10px;
  }
  .current-turn-display {
    font-size: 13px;
    padding: 6px 14px;
  }
  .cylinder-info {
    font-size: 11px;
  }

  /* -- Survivors list -- */
  .survivors-list {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 5px;
    padding: 0 8px;
    max-height: 150px;
  }
  .survivor-item {
    padding: 8px 4px 6px;
  }
  .survivor-avatar-sm {
    width: 40px;
    height: 40px;
    font-size: 20px;
    border-width: 2px;
  }
  .survivor-name {
    font-size: 11px;
    max-width: 60px;
  }
  .survivor-item.dead::after {
    font-size: 28px;
  }
  .survivor-order {
    font-size: 8px;
    padding: 1px 5px;
  }

  /* -- Action buttons: touch-friendly (상단) -- */
  .roulette-actions {
    padding: 10px 10px 6px;
    gap: 8px;
  }
  #spinBtn, .roulette-actions .btn-secondary {
    padding: 12px 28px;
    font-size: 16px;
    min-height: 48px !important;
    touch-action: manipulation;
  }
  .btn-danger {
    padding: 16px 32px;
    font-size: 22px;
    min-height: 48px;
  }
  .rr-trigger-btn {
    width: 90px !important;
    height: 90px !important;
  }
  #restartBtn {
    min-height: 48px !important;
    font-size: 16px;
    touch-action: manipulation;
  }

  /* -- Flash overlay -- */
  .flash-icon {
    font-size: 80px;
  }
  .flash-text {
    font-size: 28px;
  }
  .rr-bang-text {
    font-size: 56px;
  }
  .rr-safe-text {
    font-size: 36px;
  }
  .rr-sub-text {
    font-size: 18px;
  }

  /* -- Lottery/Roulette wheel (lotteryGame context) -- */
  #lotteryGame .roulette-wheel-container {
    max-width: min(260px, 70vw);
  }
  #lotteryGame .roulette-wheel {
    max-width: min(240px, 65vw);
  }
  #lotteryGame #rouletteCanvas {
    width: min(240px, 65vw) !important;
    height: min(240px, 65vw) !important;
  }
  #lotteryGame .roulette-spin-btn {
    padding: 12px 24px;
    font-size: 16px;
    min-height: 48px !important;
    touch-action: manipulation;
  }
  #lotteryGame .roulette-result-display {
    padding: 10px;
  }
  #lotteryGame .result-text {
    font-size: 18px;
  }
}

