/* Skolespil Gaming Center - Arcade Style */
:root {
    --bg-dark: #0a0a12;
    --bg-card: #12121f;
    --accent-cyan: #00f5ff;
    --accent-magenta: #ff00aa;
    --accent-yellow: #ffd700;
    --text-primary: #e8e8f0;
    --text-secondary: #8888aa;
    --neon-glow: 0 0 20px currentColor, 0 0 40px currentColor;
}

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

body {
    font-family: 'Rajdhani', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ========== Keyframe animations ========== */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-15px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes gridPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}
@keyframes logoGlow {
    0%, 100% { text-shadow: 0 0 20px var(--accent-cyan), 0 0 40px var(--accent-cyan); }
    50% { text-shadow: 0 0 30px var(--accent-cyan), 0 0 60px var(--accent-cyan), 0 0 80px rgba(0, 245, 255, 0.5); }
}
@keyframes iconBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}
@keyframes btnShine {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes overlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Animated grid background */
.neon-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 245, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 245, 255, 0.04) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
    animation: gridPulse 4s ease-in-out infinite;
}
.neon-grid::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(0, 245, 255, 0.06) 0%, transparent 50%);
    pointer-events: none;
    animation: gridPulse 6s ease-in-out infinite reverse;
}

/* Header */
.header {
    text-align: center;
    padding: 3rem 2rem 2rem;
    position: relative;
    z-index: 1;
    animation: fadeInDown 0.6s ease-out;
}

.logo {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 900;
    letter-spacing: 0.1em;
    color: var(--accent-cyan);
    text-shadow: var(--neon-glow);
    margin-bottom: 0.5rem;
    animation: logoGlow 3s ease-in-out infinite;
}

.logo-icon {
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}

.logo-sub {
    display: block;
    font-size: 0.35em;
    font-weight: 400;
    color: var(--accent-magenta);
    letter-spacing: 0.3em;
}

.tagline {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    animation: fadeInDown 0.6s ease-out 0.15s both;
}

.saves-btn {
    display: inline-block;
    margin-top: 1rem;
    animation: fadeInDown 0.6s ease-out 0.25s both;
    padding: 0.5rem 1.25rem;
    background: rgba(0, 245, 255, 0.15);
    color: var(--accent-cyan);
    border: 2px solid var(--accent-cyan);
    border-radius: 50px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.saves-btn:hover {
    background: rgba(0, 245, 255, 0.25);
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.3);
}

/* Saves modal */
.saves-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1001;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.saves-modal.active {
    display: flex;
    opacity: 1;
    animation: overlayIn 0.25s ease;
}
.saves-modal.active .saves-modal-content {
    animation: modalIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.saves-modal-content {
    position: relative;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-card);
    border: 2px solid var(--accent-cyan);
    border-radius: 12px;
    padding: 1.5rem;
    margin: auto;
    box-shadow: 0 0 50px rgba(0, 245, 255, 0.15);
}
.saves-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.saves-modal-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: var(--accent-cyan);
}
.saves-close {
    position: static;
}
.saves-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.4;
}
.saves-slots {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.saves-slot {
    background: rgba(0, 245, 255, 0.06);
    border: 1px solid rgba(0, 245, 255, 0.25);
    border-radius: 8px;
    padding: 0.75rem;
}
.saves-slot label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.saves-slot-name {
    width: 100%;
    max-width: 280px;
    padding: 0.4rem 0.6rem;
    background: var(--bg-dark);
    border: 1px solid rgba(0, 245, 255, 0.3);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
}
.saves-slot-data {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.25rem;
    background: var(--bg-dark);
    border: 1px solid rgba(0, 245, 255, 0.3);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
}
.saves-slot-date {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.35rem;
}
.saves-slot-btns {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
}
.saves-slot-btn {
    padding: 0.35rem 0.75rem;
    background: rgba(0, 245, 255, 0.2);
    color: var(--accent-cyan);
    border: 1px solid var(--accent-cyan);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}
.saves-slot-btn:hover {
    background: rgba(0, 245, 255, 0.3);
}
.saves-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}
.saves-action-btn {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
}
.saves-email-btn {
    background: linear-gradient(135deg, rgba(255,0,170,0.3), rgba(0,245,255,0.3));
    border-color: var(--accent-magenta);
    color: var(--text-primary);
}

/* Ad containers */
.ad-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.ad-top {
    padding-top: 0;
    padding-bottom: 0.5rem;
}

.ad-bottom {
    padding: 1.5rem 2rem;
}

.ad-game {
    max-width: 720px;
    margin: 1rem auto 0;
    padding: 1rem;
}

.ad-container .adsbygoogle {
    min-height: 90px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(0, 245, 255, 0.2);
}

/* Main content */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
}

/* Game cards */
.game-card {
    background: var(--bg-card);
    border: 2px solid rgba(0, 245, 255, 0.3);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease, border-color 0.3s ease;
}

.game-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--accent-cyan);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 40px rgba(0, 245, 255, 0.25);
}

.game-card:hover .game-icon {
    animation: iconBounce 0.5s ease;
}

.game-card-inner {
    padding: 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease;
}

.game-card:hover .game-card-inner {
    transform: translateZ(0);
}

.game-icon {
    font-size: 4rem;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
    transition: filter 0.3s ease;
}

.game-card:hover .game-icon {
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.8)) drop-shadow(0 0 25px rgba(0, 245, 255, 0.4));
}

.game-card h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.game-card p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.play-btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
    background-size: 200% auto;
    color: var(--bg-dark);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    border-radius: 50px;
    transition: transform 0.25s ease, box-shadow 0.3s ease, filter 0.2s ease;
    margin-top: 0.5rem;
    border: none;
    cursor: pointer;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

button.play-btn {
    text-align: center;
}

.play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 0 30px rgba(0, 245, 255, 0.6), 0 0 50px rgba(255, 0, 170, 0.3);
}

.play-btn:active {
    transform: scale(0.98);
    transition-duration: 0.1s;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.back-link {
    color: var(--accent-cyan);
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.2s ease, text-shadow 0.2s ease, transform 0.2s ease;
}

.back-link:hover {
    text-decoration: underline;
    text-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
}

/* Game page wrapper - when viewing a game */
.game-container {
    min-height: 100vh;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 60vw;
    margin-bottom: 0.5rem;
}

.fullscreen-btn {
    background: rgba(0, 245, 255, 0.15);
    color: var(--accent-cyan);
    border: 2px solid var(--accent-cyan);
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fullscreen-btn:hover {
    background: rgba(0, 245, 255, 0.25);
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.3);
}

/* Game + side ad layout (window mode) */
.game-area {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}
.ad-side {
    width: 160px;
    min-width: 160px;
    flex-shrink: 0;
    min-height: 300px;
}
.ad-side .adsbygoogle {
    min-height: 300px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(0, 245, 255, 0.2);
}
@media (max-width: 900px) {
    .game-area { flex-direction: column; align-items: center; }
    .ad-side { width: 100%; max-width: 400px; min-height: 100px; }
}

/* Snow Rider - 60% of viewport in window mode */
.game-container .webgl-content {
    width: 60vw !important;
    max-width: 60vw !important;
    height: 60vh !important;
}
.game-area .webgl-content {
    flex: 0 0 auto;
}
.game-area .embed-wrapper {
    flex: 0 0 auto;
}

/* Fullscreen mode - game fills viewport */
#gameWrapper:fullscreen {
    max-width: none;
    width: 100vw;
    height: 100vh;
    margin: 0;
}

#gameWrapper:-webkit-full-screen {
    max-width: none;
    width: 100vw;
    height: 100vh;
    margin: 0;
}

/* Embedded game modal */
.embed-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.embed-modal.active {
    display: flex;
}

.embed-modal-content {
    position: relative;
    width: 100%;
    max-width: 95vw;
    height: 90vh;
    background: var(--bg-card);
    border: 2px solid var(--accent-cyan);
    border-radius: 12px;
    overflow: hidden;
}

.embed-modal-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.embed-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
}

.embed-close:hover {
    background: rgba(255, 0, 0, 1);
}

/* Embed wrapper for game pages */
.embed-wrapper {
    width: 60vw;
    max-width: 60vw;
    height: 60vh;
    margin: 1rem auto;
    overflow: hidden;
    border: 1px solid rgba(0, 245, 255, 0.3);
    border-radius: 8px;
}

.embed-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.embed-wrapper:fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
}

/* Responsive */
@media (max-width: 600px) {
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .header {
        padding: 2rem 1rem;
    }
}
