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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ===== UNITY CONTAINER ===== */

/* Desktop - Portrait Mode (Boot Scene) */
.unity-desktop.unity-portrait #unity-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(414px, 90vw);
    height: min(896px, 90vh);
    max-width: 414px;
    max-height: 896px;
    background: #000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
}

/* Desktop - Landscape Mode (Game Scene) */
.unity-desktop.unity-landscape #unity-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    background: #000;
}

/* Mobile - Always Fullscreen */
.unity-mobile #unity-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    background: #000;
}

#unity-container {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #000;
}

#unity-canvas {
    background: #000;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
}

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

/* ===== LOADING BAR ===== */

#unity-loading-bar {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

#unity-logo {
    width: 154px;
    height: 130px;
    background: url('unity-logo-dark.png') no-repeat center;
    background-size: contain;
}

#unity-progress-bar-empty {
    width: 141px;
    height: 18px;
    margin-top: 10px;
    margin-left: 6.5px;
    background: url('progress-bar-empty-dark.png') no-repeat center;
    background-size: contain;
}

#unity-progress-bar-full {
    width: 0%;
    height: 18px;
    background: url('progress-bar-full-dark.png') no-repeat center;
    background-size: contain;
}

#loading-percentage {
    margin-top: 20px;
    text-align: center;
    color: #ffffff;
    font-size: 24px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ===== FULLSCREEN BUTTON ===== */

#unity-fullscreen-button {
    position: absolute;
    right: 20px;
    bottom: 20px;
    width: 48px;
    height: 48px;
    background: url('fullscreen-button.png') no-repeat center;
    background-size: contain;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    z-index: 1000;
}

#unity-fullscreen-button:hover {
    opacity: 1;
}

/* ===== ORIENTATION MESSAGES ===== */

.orientation-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.orientation-message.show {
    display: flex;
}

.message-content {
    text-align: center;
    color: white;
}

.message-content svg {
    margin-bottom: 20px;
    animation: rotate 2s ease-in-out infinite;
}

.message-content p {
    font-size: 18px;
    font-weight: 500;
}

@keyframes rotate {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(15deg); }
}

/* ===== MEDIA QUERIES ===== */

/* Mobile Portrait */
@media screen and (max-width: 768px) and (orientation: portrait) {
    /* Hide landscape message */
    #landscape-message.show {
        display: none !important;
    }

    /* Show portrait message if in landscape mode */
    .unity-mobile.unity-landscape #portrait-message {
        display: flex;
    }
}

/* Mobile Landscape */
@media screen and (max-width: 768px) and (orientation: landscape) {
    /* Hide portrait message */
    #portrait-message.show {
        display: none !important;
    }

    /* Show landscape message if in portrait mode */
    .unity-mobile.unity-portrait #landscape-message {
        display: flex;
    }
}

/* Desktop - hide orientation messages */
@media screen and (min-width: 769px) {
    .orientation-message {
        display: none !important;
    }
}

/* PWA Standalone Mode */
@media (display-mode: standalone) {
    body {
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* iOS Safe Area Support */
@supports (padding: max(0px)) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* Prevent pull-to-refresh on mobile */
body {
    overscroll-behavior-y: contain;
}

/* Disable text selection */
canvas {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
