
#winner-message {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 3000 !important;
  display: none !important;
  width: 90vw;
    height: auto;
  max-width: 400px;
  pointer-events: auto;
  margin: 0 !important;
  box-sizing: border-box;
}
#winner-message.show {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.winner-content {
  width: 100%;
  background: linear-gradient(135deg, #23234a 60%, #1a1a2e 100%);
  border-radius: 1.5rem;
  box-shadow: 0 8px 40px rgba(0,0,0,0.35);
  padding: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  animation: bounceIn 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.winner-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 16px #00ffff44, 0 1px 0 #222;
  margin-bottom: 0.5rem;
}
.winner-actions {
  display: flex;
  gap: 1.2rem;
  width: 100%;
  justify-content: center;
}
.winner-btn {
  background: linear-gradient(135deg, #00cfff 0%, #0055ff 100%);
  color: #fff;
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 0.8rem;
  padding: 0.7rem 1.5rem;
  box-shadow: 0 2px 12px #00cfff33;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  outline: none;
}

.winner-btn:hover, .winner-btn:focus {
  background: linear-gradient(135deg, #00eaff 0%, #0077ff 100%);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 24px #00cfff55;
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.7) translateY(40px);
  }
  60% {
    opacity: 1;
    transform: scale(1.05) translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

body {
    margin: 0;
    overflow: hidden;
    font-family: 'Orbitron', 'Exo 2', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0c0c0c 0%, #1a1a2e 25%, #16213e 50%, #0f3460 75%, #001122 100%);
    direction: ltr;
    color: #ffffff;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body.rtl {
    overflow: hidden;
    direction: rtl;
}


#game-container {
    
    position: relative;
    width: 100vw;
    height: 100vh;
}

canvas {
    display: block;
}

/* Starting Screen Overlay */
.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(0, 0, 30, 0.95) 0%,
        rgba(10, 10, 50, 0.9) 50%,
        rgba(0, 20, 60, 0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    box-sizing: border-box;
    
    /* Mobile viewport handling */
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
    
    /* Entrance animation */
    animation: modalFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 1;
    visibility: visible;
    transition: all 0.5s ease;
}

.start-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Character Images as Background Elements */
.character-left, .character-right {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    opacity: 0.8;
    pointer-events: none;
}

.character-left {
    left: 15%;
    animation: float-left 4s ease-in-out infinite;
}

.character-right {
    right: 15%;
    animation: float-right 4s ease-in-out infinite 2s;
}

.character-left canvas, .character-right canvas {
    width: clamp(480px, 72vw, 900px);
    height: clamp(480px, 72vw, 900px);
    border-radius: 10px;
    filter: drop-shadow(0 0 15px rgba(0, 255, 255, 0.4));
    transition: all 0.3s ease;
}

@keyframes float-left {
    0%, 100% { 
        transform: translateY(-50%) translateX(0px) rotate(-3deg);
        opacity: 0.7;
    }
    50% { 
        transform: translateY(-60%) translateX(10px) rotate(3deg);
        opacity: 0.9;
    }
}

@keyframes float-right {
    0%, 100% { 
        transform: translateY(-50%) translateX(0px) rotate(3deg);
        opacity: 0.7;
    }
    50% { 
        transform: translateY(-60%) translateX(-10px) rotate(-3deg);
        opacity: 0.9;
    }
}

.start-content {
    text-align: center;
    width: 100%;
    max-width: 480px;
    padding: 20px;
    position: relative;
    z-index: 2;
    /* FIXED: Replaced bounceIn with simple fade-in to prevent scale-based layout shifts
       The parent container scaling was causing child button jumping during their slideInUp animations */
    opacity: 0;
    animation: fadeIn 0.6s ease-out 0.2s both;
    
    /* Mobile optimizations */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    min-height: 0; /* Allow content to shrink */
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
}

.game-logo h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 900;
    margin: 0 0 15px 0;
    background: linear-gradient(135deg, #ffffff, #00ffff, #ffffff);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-flow 3s ease-in-out infinite;
    text-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
}

/* Mobile adjustments for better UI */
@media (max-width: 768px) {
    .character-left, .character-right {
        opacity: 0.3;
        top: 20%;
        z-index: 0; /* Behind everything */
    }
    
    .character-left {
        left: -15%;
    }
    
    .character-right {
        right: -15%;
    }
    
    .character-left canvas, .character-right canvas {
        width: clamp(50px, 12vw, 80px);
        height: clamp(50px, 12vw, 80px);
    }
    
    .start-content {
        max-width: 95vw;
        padding: 15px;
        margin: 0 auto;
    }
    
    .game-logo h1 {
        font-size: clamp(2rem, 10vw, 3rem);
        margin-bottom: 10px;
    }
    
    .game-logo p {
        font-size: clamp(0.9rem, 4vw, 1.1rem);
        margin-bottom: 25px;
    }
}

@media (max-width: 480px) {
    /* Hide characters on very small screens */
    .character-left, .character-right {
        display: none;
    }
    
    .start-content {
        max-width: 100vw;
        padding: 10px;
        height: 100vh;
        height: 100dvh;
        justify-content: space-evenly;
    }
    
    .game-logo {
        flex-shrink: 0;
    }
    
    .game-logo h1 {
        font-size: clamp(1.8rem, 12vw, 2.5rem);
        margin-bottom: 8px;
    }
    
    .game-logo p {
        font-size: clamp(0.8rem, 5vw, 1rem);
        margin-bottom: 20px;
    }
    
    .start-game-modes {
        width: 100%;
        gap: 12px;
    }
    
    .start-btn {
        padding: 12px 16px;
        min-height: 70px;
    }
    
    .btn-icon {
        font-size: 1.8rem;
        min-width: 40px;
    }
    
    .btn-title {
        font-size: 1rem;
    }
    
    .btn-subtitle {
        font-size: 0.8rem;
    }
    
    .start-lang-toggle {
        top: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .start-lang-toggle span {
        font-size: 1rem;
    }
    
    .difficulty-selection {
        width: 100%;
        padding: 0;
    }
    
    .difficulty-options {
        gap: 8px;
        flex-direction: column;
    }
    
    .difficulty-btn {
        padding: 10px 15px;
        min-height: 60px;
        width: 100%;
    }
    
    .difficulty-btn span {
        font-size: 1.5rem;
    }
    
    .diff-title {
        font-size: 0.95rem;
    }
    
    .diff-desc {
        font-size: 0.75rem;
    }
}

@keyframes gradient-flow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.game-logo p {
    font-family: 'Exo 2', sans-serif;
    font-size: clamp(1rem, 3vw, 1.3rem);
    color: #a0a0ff;
    margin: 0 0 40px 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.start-game-modes {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 32px 0;
    width: 100%;
    
    /* Mobile optimizations */
    max-width: 100%;
    padding: 0;
}

.start-btn {
    background: linear-gradient(145deg, 
        rgba(0, 100, 200, 0.3) 0%,
        rgba(0, 50, 150, 0.2) 100%);
    border: 2px solid rgba(0, 255, 255, 0.4);
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 1.5rem;
    width: 100%;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    
    /* Mobile touch optimizations */
    min-height: 70px;
    height: 70px; /* Fixed height to prevent layout shift */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    
    /* Performance optimizations to prevent layout shifts */
    will-change: opacity, transform;
    contain: layout;
    transform: translateZ(0); /* Force hardware acceleration */
    
    /* Staggered entrance animation */
    opacity: 0;
    transform: translateY(20px);
    animation: slideInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    font-family: 'Orbitron', sans-serif;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.start-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.1), 
        transparent);
    transition: left 0.5s;
}

.start-btn:hover::before {
    left: 100%;
}

.start-btn:hover {
    background: linear-gradient(145deg, 
        rgba(0, 150, 255, 0.4) 0%,
        rgba(0, 100, 200, 0.3) 100%);
    border-color: rgba(0, 255, 255, 0.8);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 255, 255, 0.3);
}

/* Staggered animation delays */
.start-btn:nth-child(1) {
    animation-delay: 0.4s;
}

.start-btn:nth-child(2) {
    animation-delay: 0.6s;
}

.btn-icon {
    font-size: clamp(2.5rem, 6vw, 3rem);
    line-height: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(5px);
}

.btn-content {
    text-align: left;
    flex: 1;
    min-width: 0; /* Allows text to wrap properly */
}

.btn-title {
    font-size: clamp(1.1rem, 4vw, 1.4rem);
    font-weight: 700;
    margin-bottom: 4px;
    color: #ffffff;
    line-height: 1.2;
}

.btn-subtitle {
    font-size: clamp(0.8rem, 3vw, 1rem);
    color: #a0a0ff;
    font-family: 'Exo 2', sans-serif;
    font-weight: 400;
    line-height: 1.3;
    opacity: 0.9;
}

.difficulty-selection {
    margin: 20px 0;
    width: 100%;
    animation: slideInUp 0.4s ease-out;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Modal animations */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
        backdrop-filter: blur(20px);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.difficulty-selection h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    color: #00ffff;
    margin: 0 0 20px 0;
    text-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.difficulty-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.difficulty-btn {
    background: linear-gradient(145deg, 
        rgba(0, 50, 100, 0.4) 0%,
        rgba(0, 30, 80, 0.3) 100%);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 12px;
    padding: 16px 20px;
    margin: 0;
    width: 100%;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    transition: all 0.3s ease;
    font-family: 'Orbitron', sans-serif;
    box-sizing: border-box;
    
    /* Mobile touch optimizations */
    min-height: 60px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.difficulty-btn:hover {
    background: linear-gradient(145deg, 
        rgba(0, 100, 180, 0.5) 0%,
        rgba(0, 60, 140, 0.4) 100%);
    border-color: rgba(0, 255, 255, 0.6);
    transform: translateX(10px);
    box-shadow: 0 8px 25px rgba(0, 255, 255, 0.2);
}

.difficulty-btn span {
    font-size: clamp(1.3rem, 4vw, 1.5rem);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.diff-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 3px;
}

.diff-desc {
    font-size: 0.8rem;
    color: #a0a0ff;
    font-family: 'Exo 2', sans-serif;
}

.start-lang-toggle {
    position: absolute;
    top: 30px;
    right: 30px;
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.1), 
        rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 10px 15px;
    color: #ffffff;
    cursor: pointer;
    font-family: 'Exo 2', sans-serif;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 8px;
}

.start-lang-toggle:hover {
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.15), 
        rgba(255, 255, 255, 0.08));
    border-color: rgba(0, 255, 255, 0.5);
    transform: translateY(-2px);
}

/* Main Action Controls */
.main-controls {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1000;
    pointer-events: auto;
}

.action-btn {
    width: 70px;
    height: 70px;
    background: linear-gradient(145deg, 
        rgba(0, 20, 40, 0.95) 0%,
        rgba(0, 40, 80, 0.9) 100%);
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.action-btn span:first-child {
    font-size: 24px;
    line-height: 1;
}

.action-btn .btn-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    line-height: 1;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(0, 255, 255, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.action-btn:hover {
    transform: scale(1.1);
    border-color: rgba(0, 255, 255, 0.6);
    box-shadow: 0 12px 40px rgba(0, 255, 255, 0.3);
}

.action-btn:hover::before {
    opacity: 1;
}

.action-btn.active {
    background: linear-gradient(145deg, #00aaff, #0080cc);
    border-color: rgba(0, 255, 255, 0.8);
    box-shadow: 0 12px 40px rgba(0, 170, 255, 0.5);
    transform: scale(1.05);
}

.action-btn#wall-btn.active {
    background: linear-gradient(145deg, #aa00ff, #8800cc);
    box-shadow: 0 12px 40px rgba(170, 0, 255, 0.5);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: linear-gradient(145deg, 
        rgba(60, 60, 60, 0.7), 
        rgba(40, 40, 40, 0.6));
    border-color: rgba(100, 100, 100, 0.3);
    transform: none !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
}

.action-btn:active {
    transform: scale(0.95);
}

/* Foldable Game Menu */
.game-menu {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: linear-gradient(135deg, 
        rgba(0, 0, 50, 0.95) 0%,
        rgba(20, 20, 60, 0.9) 100%);
    border: 1px solid rgba(0, 255, 255, 0.3);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-radius: 15px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
    max-width: 320px;
    pointer-events: auto;
}

.game-menu.collapsed {
    width: 60px;
    height: 60px;
}

.game-menu:not(.collapsed) {
    width: 300px;
    min-height: 200px;
    padding: 20px;
}

.menu-toggle {
    position: fixed;
    top: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
    background: linear-gradient(145deg, rgba(0, 255, 255, 0.2), rgba(0, 200, 200, 0.1));
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 10px;
    color: #00ffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    z-index: 1001;
    /* Ensure consistent positioning regardless of text direction */
    direction: ltr;
}

/* Override RTL behavior for menu toggle to keep it in consistent position */
body.rtl .menu-toggle {
    left: 10px;
    right: auto;
}

.menu-toggle:hover {
    background: linear-gradient(145deg, rgba(0, 255, 255, 0.3), rgba(0, 200, 200, 0.2));
    box-shadow: 0 5px 15px rgba(0, 255, 255, 0.3);
    transform: scale(1.05);
}

.menu-content {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    margin-top: 60px;
}

.game-menu:not(.collapsed) .menu-content {
    opacity: 1;
    visibility: visible;
    animation: modalSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.menu-section {
    margin-bottom: 20px;
}

.menu-section:last-child {
    margin-bottom: 0;
}

.menu-section h2 {
    margin: 0 0 10px 0;
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.4rem;
    text-align: center;
    background: linear-gradient(135deg, #ffffff, #00ffff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.menu-section h3 {
    margin: 0 0 10px 0;
    color: #00ffff;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    text-align: center;
}

.menu-section p {
    margin: 0 0 15px 0;
    color: #a0a0ff;
    font-family: 'Exo 2', sans-serif;
    font-size: 0.9rem;
    text-align: center;
}

/* Menu Buttons */
.menu-btn {
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.1), 
        rgba(255, 255, 255, 0.05));
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 8px;
    text-align: left;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.menu-btn:last-child {
    margin-bottom: 0;
}

.menu-btn.small {
    padding: 8px 12px;
    font-size: 0.85rem;
    min-height: 36px;
}

.menu-btn:hover {
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.15), 
        rgba(255, 255, 255, 0.08));
    border-color: rgba(0, 255, 255, 0.5);
    box-shadow: 0 5px 15px rgba(0, 255, 255, 0.2);
    transform: translateY(-2px);
}

.menu-btn.active {
    background: linear-gradient(145deg, #00aaff, #0080cc);
    border-color: rgba(0, 255, 255, 0.8);
    box-shadow: 0 5px 20px rgba(0, 170, 255, 0.4);
    color: white;
}

.menu-btn#wall-btn.active {
    background: linear-gradient(145deg, #aa00ff, #8800cc);
    box-shadow: 0 5px 20px rgba(170, 0, 255, 0.4);
}

.menu-btn#reset-btn {
    background: linear-gradient(145deg, #00ff88, #00cc66);
    box-shadow: 0 5px 20px rgba(0, 255, 136, 0.3);
}

.menu-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: linear-gradient(145deg, 
        rgba(100, 100, 100, 0.1), 
        rgba(80, 80, 80, 0.05));
    border-color: rgba(100, 100, 100, 0.2);
    transform: none !important;
    box-shadow: none !important;
}

/* Game Status */
.game-status {
    margin-bottom: 20px;
}

.players-info {
    margin: 15px 0;
}

.player-info {
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    color: #ffffff;
    text-align: center;
}

.player-info:last-child {
    margin-bottom: 0;
}

.turn-info {
    color: #00ffff;
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    text-align: center;
    margin: 10px 0;
    font-size: 1rem;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.action-info {
    color: #a0a0ff;
    font-family: 'Exo 2', sans-serif;
    font-size: 0.85rem;
    text-align: center;
    margin: 10px 0;
    min-height: 20px;
}

/* Game Mode Buttons */
.game-mode-buttons, .difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.game-mode-buttons .menu-btn {
    padding: 16px 20px;
    font-size: 1.1rem;
    min-height: 60px;
    justify-content: center;
    text-align: center;
    background: linear-gradient(145deg, 
        rgba(0, 100, 200, 0.2), 
        rgba(0, 50, 150, 0.1));
    border: 2px solid rgba(0, 255, 255, 0.4);
}

.game-mode-buttons .menu-btn:hover {
    background: linear-gradient(145deg, 
        rgba(0, 150, 255, 0.3), 
        rgba(0, 100, 200, 0.2));
    border-color: rgba(0, 255, 255, 0.7);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 255, 255, 0.4);
}

.difficulty-buttons .menu-btn {
    justify-content: center;
    text-align: center;
    padding: 12px 16px;
}

/* Game Info Section */
.game-info {
    margin-top: 10px;
}

.game-info p {
    margin: 8px 0;
    font-family: 'Exo 2', sans-serif;
    font-size: 0.85rem;
    color: #a0a0ff;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.game-info strong {
    color: #ffffff;
    font-weight: 600;
}

.settings-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Menu Footer */
.menu-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Winner Overlay */
.winner-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    background: linear-gradient(135deg, 
        rgba(255, 215, 0, 0.95) 0%,
        rgba(255, 165, 0, 0.9) 100%);
    color: #000;
    border: 3px solid #ffff00;
    padding: 30px 40px;
    border-radius: 20px;
    font-size: 2rem;
    font-weight: 900;
    font-family: 'Orbitron', sans-serif;
    text-align: center;
    box-shadow: 0 20px 60px rgba(255, 215, 0, 0.6);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
    backdrop-filter: blur(10px);
    text-shadow: 0 0 20px rgba(255, 255, 0, 0.8);
    max-width: 90vw;
    z-index: 2000;
}

.winner-overlay.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Mobile Help Text */
.mobile-help {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: 'Exo 2', sans-serif;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-width: 80vw;
    text-align: center;
}

.mobile-help.show {
    opacity: 1;
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff33;
    border-radius: 50%;
    border-top-color: #00ffff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

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

/* Responsive Design */
@media (max-width: 480px) {
    .game-menu {
        top: 10px;
        left: 10px;
        max-width: calc(100vw - 20px);
    }
    
    .game-menu:not(.collapsed) {
        width: calc(100vw - 40px);
        max-width: 320px;
    }
    
    .menu-btn {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
    
    .menu-section h2 {
        font-size: 1.2rem;
    }
    
    .winner-overlay {
        padding: 20px 30px;
        font-size: 1.5rem;
        max-width: 85vw;
    }
    
    /* Mobile main controls */
    .main-controls {
        bottom: 20px;
        right: 20px;
        gap: 12px;
    }
    
    .action-btn {
        width: 60px;
        height: 60px;
    }
    
    .action-btn span:first-child {
        font-size: 20px;
    }
    
    .action-btn .btn-label {
        font-size: 9px;
    }
    
    /* Mobile starting screen */
    .start-content {
        padding: 20px 15px;
        max-width: 90%;
    }
    
    .game-logo h1 {
        font-size: clamp(2rem, 10vw, 3rem);
        margin-bottom: 10px;
    }
    
    .game-logo p {
        font-size: clamp(0.9rem, 4vw, 1.1rem);
        margin-bottom: 30px;
    }
    
    .start-btn {
        padding: 15px 20px;
        gap: 15px;
        min-height: 70px;
    }
    
    .btn-icon {
        font-size: 2.5rem;
    }
    
    .btn-title {
        font-size: clamp(1rem, 4vw, 1.2rem);
    }
    
    .btn-subtitle {
        font-size: clamp(0.8rem, 3vw, 0.9rem);
    }
    
    .difficulty-btn {
        padding: 12px 15px;
        gap: 12px;
    }
    
    .difficulty-btn span {
        font-size: 1.3rem;
    }
    
    .diff-title {
        font-size: 0.9rem;
    }
    
    .diff-desc {
        font-size: 0.75rem;
    }
    
    .start-lang-toggle {
        top: 15px;
        right: 15px;
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    /* Mobile menu content */
    .game-info p {
        font-size: 0.8rem;
        margin: 6px 0;
    }
    
    .menu-section h3 {
        font-size: 1rem;
        margin-bottom: 8px;
    }
}

@media (max-height: 600px) {
    .game-menu {
        top: 10px;
    }
    
    .game-menu:not(.collapsed) {
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }
    
    .menu-content {
        margin-top: 50px;
    }
    
    .menu-section {
        margin-bottom: 15px;
    }
}

/* Touch-friendly interactions */
@media (hover: none) {
    .menu-btn:hover, .menu-toggle:hover {
        transform: none;
        box-shadow: none;
    }
    
    .menu-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
}

/* Winner Overlay */
.winner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(0, 50, 0, 0.95) 0%, 
        rgba(0, 80, 40, 0.9) 50%, 
        rgba(0, 100, 50, 0.95) 100%);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(2rem, 8vw, 4rem);
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.8);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
}

.winner-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    animation: bounceIn 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Landscape mobile optimization */
@media (max-height: 500px) and (orientation: landscape) {
    .game-menu {
        top: 5px;
        left: 5px;
    }
    
    .game-menu:not(.collapsed) {
        max-height: calc(100vh - 20px);
        width: 280px;
        padding: 15px;
    }
    
    .menu-section {
        margin-bottom: 12px;
    }
    
    .menu-btn {
        padding: 8px 12px;
        margin-bottom: 6px;
    }
    
    /* Landscape main controls */
    .main-controls {
        bottom: 15px;
        right: 15px;
        gap: 10px;
    }
    
    .action-btn {
        width: 55px;
        height: 55px;
    }
    
    .action-btn span:first-child {
        font-size: 18px;
    }
    
    .action-btn .btn-label {
        font-size: 8px;
    }
    
    /* Landscape starting screen */
    .start-content {
        padding: 15px;
        max-width: 450px;
    }
    
    .game-logo h1 {
        font-size: clamp(1.8rem, 8vw, 2.5rem);
        margin-bottom: 8px;
    }
    
    .game-logo p {
        font-size: clamp(0.8rem, 3vw, 1rem);
        margin-bottom: 25px;
    }
    
    .start-game-modes {
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .start-btn {
        padding: 12px 18px;
        min-height: 60px;
        gap: 15px;
    }
    
    .btn-icon {
        font-size: 2.2rem;
    }
    
    .difficulty-selection h3 {
        font-size: clamp(1rem, 4vw, 1.2rem);
        margin-bottom: 15px;
    }
    
    .difficulty-options {
        gap: 10px;
    }
    
    .difficulty-btn {
        padding: 10px 15px;
    }
    
    .start-lang-toggle {
        top: 10px;
        right: 10px;
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}

/* Hide scrollbar but keep functionality */
.game-menu:not(.collapsed) {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.game-menu:not(.collapsed)::-webkit-scrollbar {
    display: none;
}

/* ===== MOBILE-FIRST RESPONSIVE IMPROVEMENTS ===== */

/* Small mobile devices */
@media (max-width: 480px) {
    .start-screen {
        padding: 16px;
    }
    
    .start-content {
        padding: 16px;
        min-height: calc(100vh - 32px);
        min-height: calc(100dvh - 32px);
    }
    
    .game-logo h1 {
        font-size: clamp(2rem, 10vw, 3rem);
        margin-bottom: 12px;
    }
    
    .game-logo p {
        font-size: clamp(0.9rem, 4vw, 1.1rem);
        margin-bottom: 24px;
    }
    
    .start-game-modes {
        gap: 14px;
        margin: 24px 0;
    }
    
    .start-btn {
        padding: 18px 20px;
        min-height: 65px;
        border-radius: 14px;
    }
    
    .btn-icon {
        width: 50px;
        height: 50px;
        font-size: clamp(2rem, 8vw, 2.5rem);
    }
    
    .btn-title {
        font-size: clamp(1rem, 5vw, 1.2rem);
    }
    
    .btn-subtitle {
        font-size: clamp(0.75rem, 3.5vw, 0.9rem);
    }
    
    .difficulty-btn {
        padding: 14px 18px;
        min-height: 55px;
    }
    
    .difficulty-btn span {
        width: 35px;
        height: 35px;
        font-size: clamp(1.1rem, 5vw, 1.3rem);
    }
    
    .start-lang-toggle {
        top: 16px;
        right: 16px;
        padding: 10px 14px;
        min-height: 40px;
        min-width: 40px;
        font-size: 0.8rem;
    }
}

/* Landscape mobile optimization */
@media (max-height: 500px) and (orientation: landscape) {
    .start-content {
        min-height: auto;
        justify-content: flex-start;
        padding-top: 40px;
    }
    
    .game-logo {
        margin-bottom: 20px;
    }
    
    .game-logo h1 {
        font-size: clamp(1.8rem, 8vw, 2.5rem);
        margin-bottom: 8px;
    }
    
    .game-logo p {
        font-size: clamp(0.8rem, 3vw, 1rem);
        margin-bottom: 20px;
    }
    
    .start-game-modes {
        gap: 12px;
        margin: 20px 0;
    }
    
    .start-btn {
        min-height: 55px;
        padding: 14px 18px;
    }
}

/* Large mobile / small tablet */
@media (min-width: 481px) and (max-width: 768px) {
    .start-content {
        max-width: 480px;
        padding: 24px;
    }
    
    .start-btn {
        padding: 22px 26px;
        min-height: 75px;
    }
    
    .btn-icon {
        width: 65px;
        height: 65px;
    }
}

/* Enhanced touch targets for all mobile devices */
@media (hover: none) and (pointer: coarse) {
    .start-btn,
    .difficulty-btn,
    .start-lang-toggle {
        transform: none !important;
        transition: background-color 0.2s ease, border-color 0.2s ease;
    }
    
    .start-btn:active,
    .difficulty-btn:active {
        background: linear-gradient(145deg, 
            rgba(0, 150, 255, 0.4) 0%,
            rgba(0, 100, 200, 0.3) 100%);
        border-color: rgba(0, 255, 255, 0.7);
    }
    
    .start-lang-toggle:active {
        background: linear-gradient(145deg, 
            rgba(255, 255, 255, 0.2), 
            rgba(255, 255, 255, 0.1));
    }
}

/* ===== RTL SUPPORT FOR HEBREW ===== */
.rtl {
    direction: rtl;
}

.rtl .start-content {
    text-align: center; /* Keep centered for start screen */
}

.rtl .btn-content {
    text-align: right;
}

.rtl .start-btn,
.rtl .difficulty-btn {
    flex-direction: row-reverse;
}

.rtl .game-menu {
    left: 0;
    right: auto;
}

.rtl .start-lang-toggle {
    left: 20px;
    right: auto;
}

.rtl .menu-btn {
    flex-direction: row-reverse;
}

.rtl .game-info {
    text-align: right;
}

.rtl .winner-actions {
    flex-direction: row-reverse;
}

/* Mobile RTL adjustments */
@media (max-width: 480px) {
    .rtl .start-lang-toggle {
        left: 16px;
        right: auto;
    }
}