/* Responsive styles for Roulette - Universal fit without overlapping v5.0 - Cache bust */

/* Universal fit for all screens - Progressive scaling */
@media (max-width: 1400px) {
  #game-container {
    height: 100vh;
    overflow-y: auto;
    padding: 0.5vw;
  }
  
  .game-table {
    padding: 0.5vw;
    gap: 0.5vw;
    min-height: auto;
  }
  
  .top-game-area {
    min-height: 120px;
    max-height: 200px;
    gap: 0.5vw;
  }
  
  .roulette-wheel-container {
    width: 10vw;
    height: 10vw;
    max-width: 120px;
    max-height: 120px;
  }
  
  .betting-section {
    max-height: 20vh;
    gap: 0.5vw;
  }
  
  .betting-row {
    gap: 0.5vw;
  }
  
  .betting-controls-panel {
    width: 8vw;
    max-width: 120px;
  }
  
  .betting-controls-header {
    padding: 0.3vw;
    min-height: 6vh;
    max-height: 8vh;
  }
  
  .betting-board {
    padding: 0.3vw;
    min-height: 6vh;
    max-height: 8vh;
  }
  
  /* Players and bets in top area */
  .players-bets-section {
    gap: 6px;
    margin-bottom: 4px;
  }
  
  .players-bets-section .players-section,
  .players-bets-section .bets-section {
    max-height: 80px;
    padding: 6px;
  }
  
  .players-bets-section h3 {
    font-size: 0.5rem;
    margin-bottom: 2px;
  }
  
  .players-bets-section .player-item,
  .players-bets-section .bet-item {
    font-size: 0.4rem;
    padding: 1px 2px;
    margin-bottom: 1px;
  }
  
  /* Scale down betting table elements */
  .number-cell {
    font-size: 0.4rem;
    height: 24px;
    min-height: 24px;
  }
  
  .outside-bet {
    font-size: 0.4rem;
    min-height: 24px;
  }
  
  .column-bet {
    font-size: 0.5rem;
    height: 28px;
    width: 28px;
    min-height: 28px;
    min-width: 28px;
  }
  
  .number-cell.zero {
    font-size: 0.8rem;
    height: 80px;
    width: 75px;
    min-height: 80px;
    min-width: 75px;
  }
  
  /* Current bets section removed */
  
  /* Old game-status and bet-results styles removed - now using unified game modal */
  
  #phase-display {
    font-size: 0.8rem;
  }
  
  .timer {
    font-size: 0.6rem;
    padding: 4px 8px;
  }
}

/* Smaller screens - More aggressive scaling */
@media (max-width: 1200px) {
  .roulette-wheel-container {
    width: 8vw;
    height: 8vw;
    max-width: 100px;
    max-height: 100px;
  }
  
  .betting-controls-panel {
    width: 6vw;
    max-width: 100px;
  }
  
  .betting-section {
    max-height: 18vh;
  }
  
  .betting-controls-header {
    min-height: 4vh;
    max-height: 6vh;
    padding: 0.2vw;
  }
  
  .betting-board {
    min-height: 4vh;
    max-height: 6vh;
    padding: 0.2vw;
  }
  
  .players-bets-section .players-section,
  .players-bets-section .bets-section {
    max-height: 70px;
    padding: 4px;
  }
  
  .number-cell {
    font-size: 0.35rem;
    height: 20px;
    min-height: 20px;
  }
  
  .outside-bet {
    font-size: 0.35rem;
    min-height: 20px;
  }
  
  .column-bet {
    font-size: 0.4rem;
    height: 24px;
    width: 24px;
    min-height: 24px;
    min-width: 24px;
  }
  
  .number-cell.zero {
    font-size: 0.7rem;
    height: 70px;
    width: 65px;
    min-height: 70px;
    min-width: 65px;
  }
  
  /* Current bets section removed */
}

/* Very small screens - Ultra compact */
@media (max-width: 1000px) {
  .roulette-wheel-container {
    width: 6vw;
    height: 6vw;
    max-width: 80px;
    max-height: 80px;
  }
  
  .betting-controls-panel {
    width: 5vw;
    max-width: 80px;
  }
  
  .betting-section {
    max-height: 15vh;
  }
  
  .betting-controls-header {
    min-height: 3vh;
    max-height: 5vh;
    padding: 0.1vw;
  }
  
  .betting-board {
    min-height: 3vh;
    max-height: 5vh;
    padding: 0.1vw;
  }
  
  .players-bets-section .players-section,
  .players-bets-section .bets-section {
    max-height: 60px;
    padding: 3px;
  }
  
  .number-cell {
    font-size: 0.3rem;
    height: 16px;
    min-height: 16px;
  }
  
  .outside-bet {
    font-size: 0.3rem;
    min-height: 16px;
  }
  
  .column-bet {
    font-size: 0.35rem;
    height: 20px;
    width: 20px;
    min-height: 20px;
    min-width: 20px;
  }
  
  .number-cell.zero {
    font-size: 0.6rem;
    height: 60px;
    width: 55px;
    min-height: 60px;
    min-width: 55px;
  }
  
  /* Current bets section removed */
  
  #phase-display {
    font-size: 0.6rem;
  }
  
  .timer {
    font-size: 0.5rem;
    padding: 3px 6px;
  }
}

/* Mobile - Stack layout */
@media (max-width: 768px) {
  .game-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px;
  }
  
  .top-game-area {
    flex-direction: column;
    gap: 8px;
    min-height: 100px;
    max-height: 150px;
  }
  
  .roulette-wheel-container {
    width: 60px;
    height: 60px;
    align-self: center;
  }
  
  .betting-section {
    flex-direction: column;
    gap: 8px;
    max-height: none;
  }
  
  .betting-row {
    flex-direction: column;
    gap: 8px;
  }
  
  .betting-controls-panel {
    width: 100%;
    max-width: none;
  }
  
  .betting-board {
    width: 100%;
    min-height: 200px;
    max-height: 300px;
  }
  
  .betting-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .outside-bet-row {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .number-cell {
    font-size: 0.4rem;
    height: 20px;
    min-height: 20px;
  }
  
  .outside-bet {
    font-size: 0.4rem;
    min-height: 20px;
  }
  
  .column-bet {
    font-size: 0.4rem;
    height: 24px;
    width: 24px;
    min-height: 24px;
    min-width: 24px;
  }
  
  .number-cell.zero {
    font-size: 0.7rem;
    height: 70px;
    width: 65px;
    min-height: 70px;
    min-width: 65px;
  }
  
  /* Current bets section removed */
}

@media (max-width: 480px) {
  #game-container {
    padding: 5px;
  }
  
  .game-table {
    padding: 10px;
    min-height: 60vh;
  }
  
  .roulette-wheel {
    width: 120px;
    height: 120px;
  }
  
  .winning-number {
    font-size: 1.2rem;
    padding: 6px 12px;
  }
  
  .betting-board {
    padding: 8px;
  }
  
  .number-cell {
    min-height: 30px;
    font-size: 0.7rem;
  }
  
  .outside-bet {
    padding: 8px 4px;
    font-size: 0.7rem;
  }
  
  .betting-controls {
    bottom: 5px;
    left: 5px;
    right: 5px;
    padding: 10px;
    min-width: auto;
  }
  
  .chip-btn {
    width: 35px;
    height: 35px;
    font-size: 0.7rem;
  }
  
  .leaderboard {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    margin-top: 20px;
  }
  
  /* Current bets section removed */
}

/* Small Tablets - Updated to work with layout.css fixes */
@media (min-width: 481px) and (max-width: 768px) {
  .betting-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .outside-bet-row {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .number-cell {
    min-height: 35px;
    font-size: 0.8rem;
  }
  
  .roulette-wheel {
    width: 150px;
    height: 150px;
  }
  
  .betting-controls {
    bottom: 10px;
    left: 10px;
    right: 10px;
    transform: none;
  }
  
  /* Ensure layout.css fixes take precedence */
  .game-table {
    overflow: visible !important;
    min-height: auto !important;
  }
  
  .top-game-area {
    min-height: 140px !important;
    max-height: 180px !important;
  }
  
  .betting-section {
    margin-bottom: 5px !important;
  }
  
  .bottom-game-area {
    min-height: 50px !important;
  }
  
  .bottom-game-area .players-section,
  .bottom-game-area .bets-section {
    overflow-y: auto !important;
  }
}

/* Large Tablets - Updated to work with layout.css fixes */
@media (min-width: 769px) and (max-width: 1024px) {
  .betting-grid {
    grid-template-columns: 1fr 180px;
  }
  
  .outside-bet-row {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .number-cell {
    min-height: 30px;
    font-size: 0.6rem;
  }
  
  .roulette-wheel {
    width: 150px;
    height: 150px;
  }
  
  /* Ensure layout.css fixes take precedence */
  .game-table {
    overflow: visible !important;
    min-height: auto !important;
    padding: 0.8vw !important;
    gap: 0.8vw !important;
  }
  
  .top-game-area {
    min-height: 140px !important;
    max-height: 180px !important;
    gap: 0.8vw !important;
  }
  
  .roulette-wheel-container {
    width: 14vw !important;
    height: 14vw !important;
    max-width: 150px !important;
    max-height: 150px !important;
  }
  
  .betting-section {
    margin-bottom: 8px !important;
    max-height: 18vh !important;
    gap: 0.8vw !important;
  }
  
  .betting-controls-panel {
    width: 10vw !important;
    max-width: 140px !important;
  }
  
  .betting-controls-header {
    min-height: 8vh !important;
    max-height: 10vh !important;
    padding: 0.5vw !important;
  }
  
  .betting-board {
    min-height: 8vh !important;
    max-height: 10vh !important;
    padding: 0.5vw !important;
  }
  
  .bottom-game-area {
    min-height: 50px !important;
    margin-top: 0.8vh !important;
    gap: 0.8vw !important;
  }
  
  .bottom-game-area .players-section,
  .bottom-game-area .bets-section {
    overflow-y: auto !important;
    min-height: 4vh !important;
    padding: 0.5vw !important;
  }
  
  .bottom-game-area h3 {
    font-size: 0.8vw !important;
    margin-bottom: 0.4vw !important;
  }
  
  .bottom-game-area .player-item,
  .bottom-game-area .bet-item {
    font-size: 0.6vw !important;
    padding: 0.3vw !important;
    margin-bottom: 0.3vw !important;
  }
  
  /* Make betting table more compact */
  .outside-bet {
    font-size: 0.5rem !important;
    padding: 3px 3px !important;
    min-height: 20px !important;
  }
  
  .column-bet {
    font-size: 0.5rem !important;
    padding: 3px 2px !important;
    min-height: 20px !important;
  }
  
  .zero-cell {
    font-size: 0.6rem !important;
    padding: 3px 2px !important;
    min-height: 20px !important;
  }
  
  .betting-grid {
    gap: 3px !important;
  }
  
  .controls-title {
    font-size: 0.7rem !important;
  }
  
  #phase-display {
    font-size: 0.7rem !important;
  }
  
  .timer {
    font-size: 0.6rem !important;
  }
  
  .winning-number {
    font-size: 0.8rem !important;
    padding: 3px 6px !important;
  }
}

/* Small screens (801px - 1000px) - Very compact */
@media (min-width: 801px) and (max-width: 1000px) {
  .game-table {
    padding: 0.3vw !important;
    gap: 0.3vw !important;
  }
  
  .top-game-area {
    min-height: 100px !important;
    max-height: 140px !important;
    gap: 0.3vw !important;
  }
  
  .roulette-wheel-container {
    width: 10vw !important;
    height: 10vw !important;
    max-width: 100px !important;
    max-height: 100px !important;
  }
  
  .betting-section {
    margin-bottom: 3px !important;
    max-height: 12vh !important;
    gap: 0.3vw !important;
  }
  
  .betting-controls-panel {
    width: 6vw !important;
    max-width: 90px !important;
  }
  
  .betting-controls-header {
    min-height: 4vh !important;
    max-height: 6vh !important;
    padding: 0.2vw !important;
  }
  
  .betting-board {
    min-height: 4vh !important;
    max-height: 6vh !important;
    padding: 0.2vw !important;
  }
  
  .bottom-game-area {
    min-height: 35px !important;
    margin-top: 0.3vh !important;
    gap: 0.3vw !important;
  }
  
  .bottom-game-area .players-section,
  .bottom-game-area .bets-section {
    min-height: 2.5vh !important;
    padding: 0.2vw !important;
  }
  
  .bottom-game-area h3 {
    font-size: 0.5vw !important;
    margin-bottom: 0.2vw !important;
  }
  
  .bottom-game-area .player-item,
  .bottom-game-area .bet-item {
    font-size: 0.4vw !important;
    padding: 0.1vw !important;
    margin-bottom: 0.1vw !important;
  }
  
  .number-cell {
    font-size: 0.35rem !important;
    padding: 1px 1px !important;
    min-height: 12px !important;
  }
  
  .outside-bet {
    font-size: 0.3rem !important;
    padding: 1px 1px !important;
    min-height: 12px !important;
  }
  
  .column-bet {
    font-size: 0.3rem !important;
    padding: 1px 1px !important;
    min-height: 12px !important;
  }
  
  .zero-cell {
    font-size: 0.35rem !important;
    padding: 1px 1px !important;
    min-height: 12px !important;
  }
  
  .betting-grid {
    gap: 1px !important;
  }
  
  .controls-title {
    font-size: 0.45rem !important;
  }
  
  #phase-display {
    font-size: 0.45rem !important;
  }
  
  .timer {
    font-size: 0.35rem !important;
  }
  
  .winning-number {
    font-size: 0.55rem !important;
    padding: 1px 3px !important;
  }
  
  #game-container {
    padding: 0.1vw !important;
  }
}

/* Small screens (769px - 900px) - Handle collision issues */
@media (min-width: 769px) and (max-width: 900px) {
  /* Ensure layout.css fixes take precedence */
  .game-table {
    overflow: visible !important;
    min-height: auto !important;
    height: auto !important;
    padding: 0.5vw !important;
    gap: 0.5vw !important;
  }
  
  .top-game-area {
    min-height: 120px !important;
    max-height: 150px !important;
    height: auto !important;
    gap: 0.5vw !important;
  }
  
  .roulette-wheel-container {
    width: 12vw !important;
    height: 12vw !important;
    max-width: 120px !important;
    max-height: 120px !important;
  }
  
  .betting-section {
    margin-bottom: 5px !important;
    max-height: 12vh !important;
    gap: 0.5vw !important;
  }
  
  .betting-controls-panel {
    width: 8vw !important;
    max-width: 120px !important;
  }
  
  .betting-controls-header {
    min-height: 6vh !important;
    max-height: 8vh !important;
    overflow-y: auto !important;
    padding: 0.3vw !important;
  }
  
  .betting-board {
    min-height: 6vh !important;
    max-height: 8vh !important;
    overflow-y: auto !important;
    padding: 0.3vw !important;
  }
  
  .bottom-game-area {
    min-height: 40px !important;
    margin-top: 0.5vh !important;
    gap: 0.5vw !important;
  }
  
  .bottom-game-area .players-section,
  .bottom-game-area .bets-section {
    overflow-y: auto !important;
    min-height: 3vh !important;
    padding: 0.3vw !important;
  }
  
  .bottom-game-area h3 {
    font-size: 0.7vw !important;
    margin-bottom: 0.3vw !important;
  }
  
  .bottom-game-area .player-item,
  .bottom-game-area .bet-item {
    font-size: 0.5vw !important;
    padding: 0.2vw !important;
    margin-bottom: 0.2vw !important;
  }
  
  /* Make betting table more compact */
  .number-cell {
    font-size: 0.5rem !important;
    padding: 2px 1px !important;
    min-height: 15px !important;
  }
  
  .outside-bet {
    font-size: 0.4rem !important;
    padding: 2px 2px !important;
    min-height: 15px !important;
  }
  
  .column-bet {
    font-size: 0.4rem !important;
    padding: 2px 1px !important;
    min-height: 15px !important;
  }
  
  .zero-cell {
    font-size: 0.5rem !important;
    padding: 2px 1px !important;
    min-height: 15px !important;
  }
  
  .betting-grid {
    gap: 2px !important;
  }
  
  .controls-title {
    font-size: 0.6rem !important;
  }
  
  #phase-display {
    font-size: 0.6rem !important;
  }
  
  .timer {
    font-size: 0.5rem !important;
  }
  
  .winning-number {
    font-size: 0.7rem !important;
    padding: 2px 4px !important;
  }
  
  /* Force proper spacing */
  #game-container {
    overflow-y: auto !important;
    height: 100vh !important;
    padding: 0.2vw !important;
  }
}

/* Small screens adjustments */
@media (min-width: 769px) and (max-width: 1000px) {
  .roulette-wheel-container {
    width: 12vw;
    height: 12vw;
    max-width: 150px;
    max-height: 150px;
  }
  
  .betting-controls-panel {
    width: 12vw;
    max-width: 160px;
  }
  
  .betting-section {
    gap: 1vw;
    max-height: 20vh;
  }
  
  /* Players and bets in top area - smaller screens */
  .players-bets-section {
    gap: 8px;
    margin-bottom: 6px;
  }
  
  .players-bets-section .players-section,
  .players-bets-section .bets-section {
    max-height: 80px;
    padding: 6px;
  }
  
  .players-bets-section h3 {
    font-size: 0.6rem;
    margin-bottom: 3px;
  }
  
  .players-bets-section .player-item,
  .players-bets-section .bet-item {
    font-size: 0.5rem;
    padding: 1px 3px;
    margin-bottom: 1px;
  }
}

/* Desktop */
@media (min-width: 1025px) {
  .betting-grid {
    grid-template-columns: 1fr 200px;
  }
  
  .outside-bet-row {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .number-cell {
    min-height: 45px;
    font-size: 1rem;
  }
  
  .roulette-wheel {
    width: 200px;
    height: 200px;
  }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .game-table {
    min-height: 50vh;
    padding: 10px;
  }
  
  .roulette-wheel {
    width: 80px;
    height: 80px;
  }
  
  .betting-board {
    padding: 5px;
  }
  
  .number-cell {
    min-height: 20px;
    font-size: 0.6rem;
  }
  
  .outside-bet {
    padding: 5px 2px;
    font-size: 0.6rem;
  }
  
  .betting-controls {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    transform: none;
    margin-top: 10px;
  }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .roulette-wheel {
    border-width: 2px;
  }
  
  .number-cell {
    border-width: 1px;
  }
  
  .outside-bet {
    border-width: 1px;
  }
}

/* Print Styles */
@media print {
  .betting-controls,
  .chat-panel,
  .roulette-chat-toggle,
  .leaderboard {
    display: none !important;
  }
  
  .game-table {
    background: white !important;
    color: black !important;
  }
  
  .number-cell {
    border: 1px solid black !important;
    color: black !important;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .roulette-wheel.spinning,
  .wheel-ball.spinning,
  .number-cell.winning {
    animation: none;
  }
  
  .timer.warning,
  .timer.critical {
    animation: none;
  }
  
  .pulse {
    animation: none;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --felt-green: #0a5f20;
    --gold: #d4af37;
    --red: #dc143c;
    --black: #111;
    --white: #fff;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .number-cell {
    border: 2px solid currentColor;
  }
  
  .outside-bet {
    border: 2px solid currentColor;
  }
  
  .betting-controls {
    border: 3px solid var(--gold);
  }
}

/* Focus Management */
@media (prefers-reduced-motion: no-preference) {
  .fade-in {
    animation: fadeIn 0.5s ease;
  }
  
  .slide-in {
    animation: slideIn 0.3s ease;
  }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
  .number-cell,
  .outside-bet,
  .chip-btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  .betting-controls {
    padding: 20px;
  }
  
  .chip-btn {
    width: 50px;
    height: 50px;
  }
}

/* Very Small Screens */
@media (max-width: 320px) {
  .game-table {
    padding: 5px;
  }
  
  .betting-board {
    padding: 5px;
  }
  
  .number-cell {
    min-height: 20px;
    font-size: 0.6rem;
  }
  
  .outside-bet {
    padding: 6px 2px;
    font-size: 0.6rem;
  }
  
  .roulette-wheel {
    width: 80px;
    height: 80px;
  }
  
  .winning-number {
    font-size: 1.2rem;
    padding: 6px 12px;
  }
  
  .betting-controls {
    padding: 8px;
    gap: 8px;
  }
  
  .chip-btn {
    width: 30px;
    height: 30px;
    font-size: 0.6rem;
  }
}
