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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #333;
    padding: 20px 0;
}

#game-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    max-width: 1200px;
    width: 95%;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#header-left {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

header h1 {
    font-size: 2.5rem;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
    user-select: none;
    margin-right: auto;
}

header h1:hover {
    opacity: 0.8;
    transform: scale(1.02);
}

header h1:active {
    transform: scale(0.98);
}

#header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 0 0 auto;
}

/* Back button */
.back-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    color: white;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: bold;
    font-family: 'Impact', 'Arial Black', sans-serif;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateX(-2px);
    color: white;
}

.back-button:active {
    transform: translateX(-1px) scale(0.98);
}

.back-arrow {
    font-size: 1rem;
    font-weight: bold;
}

.back-text {
    white-space: nowrap;
}

/* Site Footer */
.site-footer {
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    margin-top: 20px;
}

.site-footer .back-button {
    margin: 0;
}

/* Mobile footer adjustments */
@media (max-width: 768px) {
    .site-footer {
        padding: 15px;
        margin-top: 15px;
    }
}

@media (max-width: 480px) {
    .site-footer {
        padding: 12px 15px;
        margin-top: 10px;
    }

    .site-footer .back-button {
        width: 100%;
        justify-content: center;
    }
}

#score-display {
    display: flex;
    gap: 30px;
}

.score-item {
    text-align: right;
}

.score-item .label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
}

.score-item span:last-child {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
}

/* Sound toggle button */
.sound-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 24px;
    flex-shrink: 0;
}

.sound-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.sound-toggle:active {
    transform: scale(0.95);
}

.sound-toggle.muted {
    background: rgba(231, 76, 60, 0.3);
    border-color: rgba(231, 76, 60, 0.5);
}

/* Header-based Difficulty Selector */
.difficulty-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.difficulty-header .difficulty-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

.difficulty-btn-header {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.difficulty-btn-header:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

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

.difficulty-header .difficulty-display {
    font-size: 1.3rem;
    font-weight: bold;
    color: white;
    min-width: 30px;
    text-align: center;
}

.difficulty-header.hidden {
    display: none;
}

main {
    position: relative;
    min-height: 600px;
    height: 600px;
    overflow-y: auto;
    /* Enable scrolling */
}

/* Mobile scroll behavior improvements */
html {
    scroll-behavior: smooth;
}

/* Enable full-screen scrolling during gameplay on mobile */
@media (hover: none) and (pointer: coarse) {

    html,
    body {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        /* iOS momentum scrolling */
    }

    main {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        /* Prevent pull-to-refresh during gameplay */
    }

    /* Ensure game container allows scrolling on mobile */
    #game-container {
        overflow: visible;
        touch-action: pan-y;
        /* Allow vertical scrolling */
    }

    /* Remove any scroll restrictions during gameplay */
    #game-canvas {
        touch-action: pan-y;
        /* Allow vertical scrolling while preserving tap interactions */
        user-select: none;
        /* Prevent text selection during touch interactions */
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }

    /* Prevent text selection on interactive elements during touch */
    .facility,
    .btn-primary,
    .sound-toggle,
    .difficulty-btn-header,
    .back-button,
    header h1 {
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        -webkit-touch-callout: none;
        /* Prevent iOS callout menu */
    }

    /* Improve tap responsiveness by removing delay */
    * {
        -webkit-tap-highlight-color: transparent;
        /* Remove default tap highlight */
    }

    /* Custom tap highlights for interactive elements */
    .facility.available {
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.3);
    }

    .btn-primary {
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
    }
}

#game-canvas {
    display: block;
    width: 100%;
    height: 600px;
    background: #f5f5f5;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100%;
    background: rgba(255, 255, 255, 0.98);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
}

.screen-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.screen.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

.screen h2 {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 20px;
}

.screen p {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 30px;
    max-width: 500px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

#final-score-display {
    margin: 20px 0;
}

#final-score-display p {
    font-size: 1.5rem;
    margin: 10px 0;
}

#final-score {
    font-weight: bold;
    color: #667eea;
    font-size: 2rem;
}

#high-score-message {
    color: #f39c12;
    font-size: 1.8rem;
    font-weight: bold;
    animation: pulse 1s infinite;
    margin-bottom: 20px;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Facility Styles */
.facility {
    cursor: pointer;
    transition: all 0.2s;
}

.facility.urinal {
    fill: #3498db;
}

.facility.urinal.occupied {
    fill: #e74c3c;
}

.facility.urinal.available:hover {
    fill: #2980b9;
}

.facility.cubicle {
    fill: #2ecc71;
}

.facility.cubicle.occupied {
    fill: #e67e22;
}

.facility.cubicle.available:hover {
    fill: #27ae60;
}

.facility.out-of-order {
    fill: #95a5a6;
    cursor: not-allowed;
}

/* Male waiting indicator */
.male-waiting {
    animation: bounce 0.5s infinite alternate;
}

@keyframes bounce {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-10px);
    }
}

/* Time bar colors */
.time-bar-green {
    fill: #2ecc71;
}

.time-bar-yellow {
    fill: #f39c12;
}

.time-bar-orange {
    fill: #e67e22;
}

.time-bar-red {
    fill: #e74c3c;
}

/* Touch-friendly interface */
.facility {
    cursor: pointer;
    transition: all 0.2s;
    min-width: 44px;
    /* Minimum touch target size */
    min-height: 44px;
}

.facility:hover {
    transform: scale(1.05);
}

.facility:active {
    transform: scale(0.95);
}

/* Mobile optimizations - Enhanced touch interaction styling */
@media (hover: none) and (pointer: coarse) {

    /* Increase touch target sizes for facilities on mobile */
    .facility {
        min-width: 50px;
        /* Increased from 44px for better touch accuracy */
        min-height: 50px;
        padding: 4px;
        /* Add padding to expand touch area */
    }

    /* Remove hover effects on touch devices */
    .facility:hover {
        transform: none;
    }

    /* Touch-specific active states with visual feedback */
    .facility:active {
        transform: scale(0.92);
        opacity: 0.8;
        transition: all 0.1s ease-out;
    }

    .facility.urinal:active {
        filter: brightness(0.9);
    }

    .facility.cubicle:active {
        filter: brightness(0.9);
    }

    /* Gesture conflict resolution - prevent scroll interference */
    .facility.available {
        touch-action: manipulation;
        /* Disable double-tap zoom, allow single tap */
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.3);
        /* Visual tap feedback */
    }

    /* Enhanced button touch targets */
    .btn-primary {
        min-height: 48px;
        /* Larger touch targets */
        font-size: 1.1rem;
        min-width: 120px;
        padding: 15px 40px;
        touch-action: manipulation;
        /* Prevent double-tap zoom */
    }

    /* Touch-specific active state for buttons */
    .btn-primary:active {
        transform: scale(0.96);
        box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
    }

    /* Sound toggle button - larger touch target */
    .sound-toggle {
        width: 54px;
        height: 54px;
        touch-action: manipulation;
    }

    .sound-toggle:active {
        transform: scale(0.9);
        background: rgba(255, 255, 255, 0.4);
    }

    /* Difficulty buttons - enhanced touch targets */
    .difficulty-btn-header {
        width: 32px;
        height: 32px;
        touch-action: manipulation;
    }

    .difficulty-btn-header:active {
        transform: scale(0.88);
        background: rgba(255, 255, 255, 0.6);
    }

    /* Back button - enhanced touch interaction */
    .back-button {
        min-height: 36px;
        padding: 10px 16px;
        touch-action: manipulation;
    }

    .back-button:active {
        transform: scale(0.95);
        background: rgba(255, 255, 255, 0.4);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    #game-container {
        width: 98%;
        margin: 10px auto;
    }

    #game-canvas {
        height: 550px;
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }

    header h1 {
        font-size: 2rem;
        touch-action: manipulation;
        /* Prevent double-tap zoom on title */
    }

    #header-left {
        width: 100%;
        justify-content: center;
        order: -2;
    }

    #header-right {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 15px;
        /* Increased spacing for better touch separation */
    }

    .difficulty-header {
        order: -1;
        width: 100%;
        justify-content: center;
        padding: 10px 18px;
        /* Slightly larger for easier touch */
    }

    #score-display {
        gap: 20px;
        justify-content: center;
    }

    .score-item span:last-child {
        font-size: 1.5rem;
    }

    .screen h2 {
        font-size: 2rem;
    }

    .screen p {
        font-size: 1rem;
        padding: 0 20px;
    }

    #game-canvas {
        height: 500px;
    }

    /* Larger touch targets for mobile */
    .btn-primary {
        padding: 15px 35px;
        font-size: 1.1rem;
        min-height: 50px;
    }
}

@media (max-width: 480px) {
    #game-container {
        width: 100%;
        border-radius: 0;
        min-height: 100vh;
    }

    header {
        padding: 12px 15px;
    }

    header h1 {
        font-size: 1.8rem;
        letter-spacing: 1px;
    }

    #header-right {
        gap: 12px;
        /* Increased for better touch separation */
    }

    .back-button {
        padding: 8px 12px;
        /* Slightly larger for easier touch */
        font-size: 0.7rem;
        gap: 5px;
        min-height: 32px;
    }

    .back-arrow {
        font-size: 0.9rem;
    }

    .difficulty-header .difficulty-label {
        font-size: 0.8rem;
    }

    .difficulty-btn-header {
        width: 28px;
        /* Increased from 24px for better touch */
        height: 28px;
        font-size: 16px;
    }

    .difficulty-header .difficulty-display {
        font-size: 1.1rem;
        min-width: 25px;
    }

    #score-display {
        gap: 15px;
    }

    .score-item span:last-child {
        font-size: 1.3rem;
    }

    .screen {
        padding: 30px 20px;
    }

    .screen h2 {
        font-size: 1.8rem;
    }

    .screen p {
        font-size: 0.95rem;
        line-height: 1.4;
    }

    .btn-primary {
        padding: 14px 32px;
        /* Slightly larger padding for better touch */
        font-size: 1rem;
        min-height: 50px;
        /* Increased from 48px */
        width: 200px;
    }

    #game-canvas {
        height: 450px;
    }

    /* Adjust final score display for mobile */
    #final-score-display p {
        font-size: 1.2rem;
        margin: 8px 0;
    }

    #final-score {
        font-size: 1.6rem;
    }

    #high-score-message {
        font-size: 1.4rem;
    }

    /* Smaller mobile instructions styling */
    .instructions-container {
        width: calc(100% - 20px);
        padding: 18px;
        margin: 20px auto 15px;
        background: white;
        border: 2px solid rgba(102, 126, 234, 0.3);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }

    .instructions-title {
        font-size: 1.4rem;
        margin-bottom: 12px;
    }

    .instruction-content {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .instruction-content p {
        margin: 8px 0;
    }

    .instruction-content p.indent {
        margin-left: 22px;
        margin-top: 4px;
        margin-bottom: 4px;
    }
}

@media (max-width: 320px) {
    header h1 {
        font-size: 1.5rem;
    }

    .btn-primary {
        width: 180px;
        font-size: 0.9rem;
    }

    #game-canvas {
        height: 400px;
    }

    /* Extra small mobile instructions */
    .instructions-container {
        width: calc(100% - 20px);
        padding: 15px;
        margin: 15px auto 10px;
        background: white;
        border: 2px solid rgba(102, 126, 234, 0.3);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }

    .instructions-title {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }

    .instruction-content {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    .instruction-content p {
        margin: 7px 0;
    }

    .instruction-content p.indent {
        margin-left: 20px;
        margin-top: 3px;
        margin-bottom: 3px;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    #game-container {
        max-width: none;
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    header {
        padding: 8px 15px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .score-item span:last-child {
        font-size: 1.2rem;
    }

    #game-canvas {
        height: calc(100vh - 80px);
    }

    .screen {
        padding: 20px;
    }

    .screen h2 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    .screen p {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }

    .btn-primary {
        padding: 10px 25px;
        font-size: 0.9rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    #game-canvas {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {

    .facility,
    .btn-primary,
    .male-waiting {
        animation: none !important;
        transition: none !important;
    }

    #high-score-message {
        animation: none !important;
    }
}

/* Error message styling */
.error-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.error-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.error-content h3 {
    color: #e74c3c;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.error-content p {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.4;
}

/* Loading state */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* User feedback animations */
.success-feedback {
    animation: successPulse 0.3s ease-out;
}

@keyframes successPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
        background-color: rgba(46, 204, 113, 0.3);
    }

    100% {
        transform: scale(1);
    }
}

.error-feedback {
    animation: errorShake 0.5s ease-out;
}

@keyframes errorShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* Tap feedback ripple for mobile touch interactions */
.tap-feedback-ripple {
    position: fixed;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.6) 0%, rgba(102, 126, 234, 0) 70%);
    pointer-events: none;
    z-index: 9999;
    animation: rippleExpand 0.6s ease-out;
}

@keyframes rippleExpand {
    0% {
        transform: scale(0);
        opacity: 1;
    }

    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* User message notifications */
.user-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
    max-width: 300px;
    word-wrap: break-word;
}

.user-message.info {
    background: #3498db;
}

.user-message.error {
    background: #e74c3c;
}

.user-message.success {
    background: #2ecc71;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }

    #game-container {
        background: #2c3e50;
        color: #ecf0f1;
    }

    .screen {
        background: rgba(44, 62, 80, 0.98);
        color: #ecf0f1;
    }

    .screen h2 {
        color: #3498db;
    }

    .screen p {
        color: #bdc3c7;
    }

    .error-content {
        background: #34495e;
        color: #ecf0f1;
    }

    .error-content p {
        color: #bdc3c7;
    }
}


/* Game Instructions Section */
.instructions-container {
    width: calc(100% - 40px);
    max-width: 600px;
    margin: 30px auto 20px;
    padding: 25px 30px;
    background: white;
    border-radius: 12px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: left;
    flex-shrink: 0;
}

.instructions-title {
    font-size: 1.8rem;
    color: #667eea;
    text-align: center;
    margin-bottom: 20px;
    font-weight: bold;
    font-family: 'Impact', 'Arial Black', sans-serif;
    letter-spacing: 1px;
}

.instruction-content {
    font-size: 1.05rem;
    color: #555;
    line-height: 1.8;
}

.instruction-content p {
    margin: 12px 0;
    color: #555;
}

.instruction-content p.indent {
    margin-left: 30px;
    margin-top: 6px;
    margin-bottom: 6px;
}

/* Video Container - Below instructions, requires scrolling */
.video-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 30px auto 20px;
    padding-bottom: 56.25%;
    /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    border: none;
}



/* Improved Game Theming */
body {
    font-family: 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    padding-bottom: 44px;
}

#game-container {
    background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
    border: 3px solid rgba(102, 126, 234, 0.3);
}

header h1 {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    font-family: 'Impact', 'Arial Black', sans-serif;
    letter-spacing: 4px;
}

.screen h2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    font-family: 'Impact', 'Arial Black', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

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

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

/* Mobile Responsive Adjustments */
@media (max-width: 600px) {
    .video-container {
        max-width: 320px;
        margin: 20px auto 20px;
    }

    .screen {
        padding: 30px 15px;
    }

    .screen h2 {
        font-size: 2rem;
    }

    .screen p {
        font-size: 0.95rem;
    }

    /* Mobile-optimized instructions */
    .instructions-container {
        width: calc(100% - 30px);
        max-width: 100%;
        padding: 20px;
        margin: 25px auto 15px;
        background: white;
        border: 2px solid rgba(102, 126, 234, 0.3);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }

    .instructions-title {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }

    .instruction-content {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .instruction-content p {
        margin: 10px 0;
    }

    .instruction-content p.indent {
        margin-left: 25px;
        margin-top: 5px;
        margin-bottom: 5px;
    }
}

/* Mobile Compatibility Warnings and Feedback */
.compatibility-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

.warning-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    margin: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease-out;
}

.warning-content h3 {
    color: #f39c12;
    margin-bottom: 15px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.warning-content p {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
    font-size: 1rem;
}

.warning-content .btn-primary {
    margin-top: 10px;
}

/* Mobile Feedback Messages */
.mobile-feedback {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 12px 24px;
    border-radius: 25px;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease-out;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    text-align: center;
}

.mobile-feedback.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.mobile-feedback-info {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.mobile-feedback-success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.mobile-feedback-warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.mobile-feedback-error {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Mobile feedback responsive adjustments */
@media (max-width: 480px) {
    .mobile-feedback {
        top: 70px;
        font-size: 0.85rem;
        padding: 10px 20px;
        max-width: 85%;
    }

    .warning-content {
        padding: 25px 20px;
        margin: 15px;
    }

    .warning-content h3 {
        font-size: 1.3rem;
    }

    .warning-content p {
        font-size: 0.9rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }

    #game-container {
        background: linear-gradient(to bottom, #2c3e50 0%, #34495e 100%);
        border-color: rgba(102, 126, 234, 0.4);
    }

    .screen {
        background: rgba(44, 62, 80, 0.98);
    }

    .screen h2 {
        color: #5dade2;
    }

    .screen p {
        color: #bdc3c7;
    }

    /* Dark mode instructions box */
    .instructions-container {
        background: #34495e;
        border-color: rgba(93, 173, 226, 0.4);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }

    .instructions-title {
        color: #5dade2;
    }

    .instruction-content {
        color: #ecf0f1;
    }

    .instruction-content p {
        color: #ecf0f1;
    }

    /* Dark mode error content */
    .error-content {
        background: #34495e;
        color: #ecf0f1;
    }

    .error-content h3 {
        color: #e74c3c;
    }

    .error-content p {
        color: #bdc3c7;
    }

    /* Dark mode warning content */
    .warning-content {
        background: #34495e;
        color: #ecf0f1;
    }

    .warning-content h3 {
        color: #f39c12;
    }

    .warning-content p {
        color: #bdc3c7;
    }

    /* Dark mode game canvas */
    #game-canvas {
        background: #2c3e50;
    }
}