/* Rytner Game Plugin - Modern Professional UI */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --dark-gradient: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow-light: 0 8px 32px rgba(31, 38, 135, 0.37);
    --shadow-heavy: 0 15px 35px rgba(31, 38, 135, 0.5);
    --border-radius: 16px;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.rytner-game-container {
    width: 100%;
    max-width: 900px;
    margin: 30px auto;
    border: none;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-heavy);
    position: relative;
    transition: var(--transition);
    animation: gameContainerEntry 0.8s ease-out;
}

.rytner-game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    z-index: 10;
}

.rytner-game-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(31, 38, 135, 0.6);
}

.rytner-game-wrapper {
    width: 100%;
    min-height: 500px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    position: relative;
    overflow: hidden;
}

.rytner-game-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1;
}

@keyframes gameContainerEntry {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modern Fullscreen Button */
.rytner-fullscreen-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-light);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    font-family: 'Inter', sans-serif;
}

.rytner-fullscreen-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-gradient);
    border-radius: 12px;
    opacity: 0;
    transition: var(--transition);
    z-index: -1;
}

.rytner-fullscreen-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 25px rgba(31, 38, 135, 0.4);
    color: white;
}

.rytner-fullscreen-btn:hover::before {
    opacity: 1;
}

.rytner-fullscreen-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Immersive Fullscreen Gaming Mode */
.rytner-fullscreen-active {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background: radial-gradient(ellipse at center, #0f0f23 0%, #000000 100%) !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.rytner-fullscreen-active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 25% 25%, #1a1a2e 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, #16213e 0%, transparent 50%),
        linear-gradient(45deg, transparent 40%, rgba(0, 255, 255, 0.03) 50%, transparent 60%);
    animation: fullscreenAmbient 20s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 1;
}

@keyframes fullscreenAmbient {
    0% { opacity: 0.3; transform: scale(1) rotate(0deg); }
    100% { opacity: 0.6; transform: scale(1.1) rotate(2deg); }
}

.rytner-fullscreen-active > * {
    max-width: 100%;
    max-height: 100%;
    position: relative;
    z-index: 2;
}

.rytner-fullscreen-active canvas {
    max-width: 85vw;
    max-height: 65vh;
    width: auto;
    height: auto;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 
        0 0 50px rgba(0, 255, 255, 0.2),
        0 0 100px rgba(255, 0, 255, 0.1),
        inset 0 0 20px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(1px);
    transition: var(--transition);
}

.rytner-fullscreen-active canvas:hover {
    box-shadow: 
        0 0 60px rgba(0, 255, 255, 0.3),
        0 0 120px rgba(255, 0, 255, 0.15),
        inset 0 0 25px rgba(255, 255, 255, 0.08);
}

.rytner-fullscreen-active .game-header {
    color: white;
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.4em;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    position: relative;
    z-index: 3;
}

.rytner-fullscreen-active .game-header h3 {
    color: white;
    font-size: 2.2em;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 255, 255, 0.3);
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    0% { filter: drop-shadow(0 0 10px rgba(102, 126, 234, 0.5)); }
    100% { filter: drop-shadow(0 0 20px rgba(118, 75, 162, 0.8)); }
}

.rytner-fullscreen-active .game-controls {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: white;
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    margin-top: 30px;
    padding: 25px;
    box-shadow: var(--shadow-light);
    position: relative;
    z-index: 3;
}

.rytner-fullscreen-active .game-controls::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--success-gradient);
    opacity: 0.1;
    border-radius: var(--border-radius);
    z-index: -1;
}

.rytner-fullscreen-active .game-controls p {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 16px;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.rytner-fullscreen-active .game-controls button {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    border: 1px solid var(--glass-border);
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    margin: 8px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rytner-fullscreen-active .game-controls button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--success-gradient);
    transition: var(--transition);
    z-index: -1;
}

.rytner-fullscreen-active .game-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.4);
}

.rytner-fullscreen-active .game-controls button:hover::before {
    left: 0;
}

.rytner-fullscreen-active .game-controls button:active {
    transform: translateY(0);
}

.rytner-fullscreen-active .game-instructions {
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    margin-top: 20px;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 25px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    z-index: 3;
}

.rytner-fullscreen-active .rytner-fullscreen-btn {
    background: rgba(255, 255, 255, 0.8);
    color: #000;
    position: fixed;
    top: 20px;
    right: 20px;
}

.rytner-fullscreen-active .rytner-fullscreen-btn:hover {
    background: rgba(255, 255, 255, 1);
}

/* Ensure game content is properly centered in fullscreen */
.rytner-fullscreen-active .dino-game,
.rytner-fullscreen-active .memory-game,
.rytner-fullscreen-active .snake-game,
.rytner-fullscreen-active .tetris-game,
.rytner-fullscreen-active .pong-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.rytner-game-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    background: var(--dark-gradient);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    position: relative;
    z-index: 2;
}

.rytner-game-loading::before {
    content: '';
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid;
    border-image: var(--primary-gradient) 1;
    border-radius: 50%;
    animation: modernSpin 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    margin-bottom: 20px;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.rytner-game-loading::after {
    content: 'Loading Game...';
    font-size: 16px;
    opacity: 0.8;
    animation: loadingPulse 2s ease-in-out infinite;
}

@keyframes modernSpin {
    0% { 
        transform: rotate(0deg);
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(118, 75, 162, 0.5);
    }
    100% { 
        transform: rotate(360deg);
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
    }
}

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

.rytner-game-error {
    padding: 30px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: var(--border-radius);
    margin: 20px;
    text-align: center;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    box-shadow: var(--shadow-light);
    position: relative;
    animation: errorShake 0.5s ease-in-out;
}

.rytner-game-error::before {
    content: '⚠️';
    display: block;
    font-size: 32px;
    margin-bottom: 15px;
    animation: errorIcon 2s ease-in-out infinite;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes errorIcon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Modern Game Wrapper Styles */
.rytner-game-wrapper canvas {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    width: 800px;
    height: 400px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
    position: relative;
    z-index: 2;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.rytner-game-wrapper canvas:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

.rytner-game-wrapper .game-controls {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    margin: 20px;
    padding: 20px;
    box-shadow: var(--shadow-light);
    position: relative;
    z-index: 2;
}

.rytner-game-wrapper .game-controls button {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    margin: 8px;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.rytner-game-wrapper .game-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.rytner-game-wrapper .game-controls button:active {
    transform: translateY(0);
}

.rytner-game-wrapper .game-header {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    margin: 20px;
    padding: 20px;
    box-shadow: var(--shadow-light);
    position: relative;
    z-index: 2;
}

.rytner-game-wrapper .game-header h3 {
    color: white;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 255, 255, 0.3);
    font-size: 24px;
}

.rytner-game-wrapper .game-instructions {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    margin: 20px;
    padding: 20px;
    box-shadow: var(--shadow-light);
    color: rgba(255, 255, 255, 0.9);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    position: relative;
    z-index: 2;
}

/* Enhanced Responsive Design */
@media (max-width: 1024px) {
    .rytner-game-container {
        max-width: 95%;
        margin: 20px auto;
    }
}

@media (max-width: 768px) {
    .rytner-game-container {
        margin: 15px;
        max-width: none;
        border-radius: 12px;
    }
    
    .rytner-game-wrapper {
        min-height: 400px;
    }
    
    .rytner-fullscreen-active {
        padding: 20px;
    }
    
    .rytner-fullscreen-active canvas {
        max-width: 95vw;
        max-height: 60vh;
    }
    
    .rytner-fullscreen-active .game-header h3 {
        font-size: 1.8em;
    }
    
    .rytner-fullscreen-active .game-controls {
        padding: 20px;
        margin-top: 25px;
    }
    
    .rytner-fullscreen-active .game-controls button {
        padding: 12px 20px;
        font-size: 14px;
        margin: 6px;
    }
}

@media (max-width: 480px) {
    .rytner-game-container {
        margin: 10px;
        border-radius: 8px;
    }
    
    .rytner-game-wrapper {
        min-height: 350px;
    }
    
    .rytner-fullscreen-active {
        padding: 15px;
    }
    
    .rytner-fullscreen-active canvas {
        max-width: 98vw;
        max-height: 55vh;
    }
    
    .rytner-fullscreen-active .game-header h3 {
        font-size: 1.5em;
    }
    
    .rytner-fullscreen-active .game-controls {
        padding: 15px;
        margin-top: 20px;
    }
    
    .rytner-fullscreen-active .game-controls button {
        padding: 10px 16px;
        font-size: 13px;
        margin: 4px;
    }
    
    .rytner-fullscreen-btn {
        top: 15px;
        right: 15px;
        padding: 10px 12px;
        font-size: 16px;
        min-width: 40px;
        min-height: 40px;
    }
}

/* Performance optimizations */
.rytner-game-wrapper * {
    will-change: transform;
}

.rytner-game-wrapper canvas {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.rytner-game-wrapper .game-score {
    font-size: 20px;
    font-weight: bold;
    color: white;
    margin: 10px 0;
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}