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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: #FF5046;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Prevent text overflow by allowing long words/URLs to wrap */
html, body, .card, .status, .toast, table, th, td, pre, code, #game-header, .header-content, .game-title {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Header styles */
#game-header {
    background: white;
    padding: 20px 100px;
    border-bottom: 1px solid rgba(255, 80, 70, 0.1);
    transition: all 0.3s ease;
    z-index: 100;
    position: relative;
    overflow: hidden;
}

#game-header.hidden {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-width: 0;
    opacity: 0;
    pointer-events: none;
}

#game-header.visible {
    max-height: 200px;
    opacity: 1;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo {
    height: 28px;
    width: auto;
}

.game-title {
    color: #FF5046;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
}

/* Game container */
#game-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px;
    overflow: hidden;
}

/* Unity container - 16:9 aspect ratio */
#unity-container {
    position: relative;
    width: 75vw;
    max-width: 1280px;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 12px 24px rgba(0, 0, 0, 0.25);
}

#unity-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: default;
}

#unity-canvas:focus {
    outline: none;
}

/* Loading cover */
.loading-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.5s ease;
}

.loading-cover.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    animation: fadeInUp 0.8s ease;
}

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

.loading-spinner {
    width: 80px;
    height: 80px;
    border: 4px solid rgba(255, 80, 70, 0.2);
    border-top-color: #FF5046;
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    box-shadow: 0 0 30px rgba(255, 80, 70, 0.3);
}

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

.loading-text {
    color: white;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    animation: pulse 2s ease-in-out infinite;
    text-shadow: 0 0 20px rgba(255, 80, 70, 0.5);
}

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

/* Toast notifications */
#toast-container {
    position: fixed;
    top: 100px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    color: #FF5046;
    padding: 16px 24px;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    min-width: 250px;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(400px);
    }
}

/* Particle canvas */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

/* Responsive design */
@media (max-width: 768px) {
    #game-container {
        padding: 20px;
    }

    #unity-container {
        width: 85vw;
    }

    .game-title {
        font-size: 18px;
    }

    .logo {
        height: 40px;
    }

    #game-header {
        padding: 15px 20px;
    }

    #toast-container {
        right: 15px;
        top: 80px;
    }

    .toast {
        min-width: 200px;
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Fullscreen mode adjustments */
#unity-container.fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
}

/* Mobile/Portrait warning */
#mobile-warning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #FF5046;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.mobile-warning-content {
    text-align: center;
    color: white;
    padding: 40px;
}

.phone-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 30px;
    animation: rotatePhone 2s ease-in-out infinite;
}

.phone-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

@keyframes rotatePhone {
    0% {
        transform: rotate(0deg);
    }
    30% {
        transform: rotate(-90deg);
    }
    70% {
        transform: rotate(-90deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

.mobile-warning-content p {
    font-size: 24px;
    font-weight: 300;
    line-height: 1.6;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Show warning on portrait or small screens */
@media (orientation: portrait), (max-width: 500px), (max-height: 500px) {
    #mobile-warning {
        display: flex;
    }
}
