/* ---------- RESET & GLOBAL ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body {
    background: radial-gradient(circle at 20% 30%, #0a0f1e, #03060c);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    padding: 20px;
    margin: 0;
    position: relative;
}

/* Animated scanline effect */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 255, 255, 0.02) 0px,
        rgba(0, 255, 255, 0.02) 2px,
        transparent 2px,
        transparent 6px
    );
    pointer-events: none;
    z-index: 2;
}

/* Vignette effect */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0) 40%, rgba(0,0,0,0.5) 100%);
    pointer-events: none;
    z-index: 1;
}

/* ========== GAME DESCRIPTION BLURB - FULLY RESPONSIVE ========== */
.game-description {
    width: 90%;
    max-width: 900px;
    margin-bottom: 24px;
    text-align: center;
    background: rgba(8, 12, 25, 0.7);
    backdrop-filter: blur(12px);
    border-radius: 28px;
    border: 1px solid rgba(0, 200, 255, 0.25);
    padding: 18px 28px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 0 15px rgba(0, 180, 255, 0.15);
    transition: all 0.3s ease;
}

.game-description:hover {
    border-color: rgba(0, 220, 255, 0.5);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 0 0 20px rgba(0, 200, 255, 0.25);
}

.description-content h1 {
    font-size: clamp(1.2rem, 5vw, 1.8rem);
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #ffffff, #7ad0ff, #00e0ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 12px;
}

.description-content p {
    color: #ccddee;
    font-size: clamp(0.8rem, 3vw, 0.95rem);
    line-height: 1.5;
    margin-bottom: 8px;
}

.description-content .challenge {
    margin-top: 8px;
    font-weight: 600;
    color: #ffcc66;
    font-size: clamp(0.85rem, 3.5vw, 1rem);
}

.description-content .highscore {
    background: linear-gradient(135deg, #ffaa44, #ff6600);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 800;
    font-size: clamp(0.9rem, 4vw, 1.1rem);
    text-shadow: 0 0 10px rgba(255, 100, 0, 0.5);
}

/* Main container — glassmorphism style */
#unity-container {
    position: relative;
    border-radius: 42px;
    background: rgba(12, 20, 30, 0.35);
    backdrop-filter: blur(8px);
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(66, 220, 255, 0.15) inset, 0 0 20px rgba(0, 180, 255, 0.2);
    transition: all 0.3s ease;
    z-index: 5;
}

/* Desktop mode - centered */
#unity-container.unity-desktop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    left: auto;
    top: auto;
    transform: none;
    border-radius: 42px;
    width: fit-content;
    max-width: 95vw;
}

/* Canvas wrapper for rounded corners */
.canvas-wrapper {
    border-radius: 32px;
    overflow: hidden;
    box-shadow: 0 20px 35px -12px black;
    transition: all 0.2s ease;
}

#unity-canvas {
    display: block;
    background: #0a0c15;
    width: auto;
    height: auto;
    transition: all 0.2s ease;
    outline: none;
    object-fit: contain;
}

/* Loading bar — sleek neon design */
#unity-loading-bar {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    border-radius: 60px;
    padding: 24px 48px;
    z-index: 20;
    border: 1px solid rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.3);
    min-width: 280px;
}

#unity-logo {
    width: 154px;
    height: 130px;
    background: url('unity-logo-dark.png') no-repeat center;
    background-size: contain;
    filter: drop-shadow(0 0 6px cyan);
}

/* Modern progress bar */
#unity-progress-bar-empty {
    width: 260px;
    height: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    margin-top: 8px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.33);
}

#unity-progress-bar-full {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #00c6ff, #0072ff, #a0e9ff);
    border-radius: 20px;
    transition: width 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    box-shadow: 0 0 8px #00a6ff;
}

.loading-status {
    font-size: 0.75rem;
    font-family: 'Inter', monospace;
    letter-spacing: 2px;
    color: #b0f0ff;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 16px;
    border-radius: 30px;
    font-weight: 600;
}

/* Footer styling - FULLY RESPONSIVE */
#unity-footer {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: rgba(8, 12, 20, 0.7);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 255, 255, 0.25);
    border-radius: 0 0 36px 36px;
    gap: 20px;
    flex-wrap: wrap;
}

.unity-mobile #unity-footer {
    display: flex;
    border-radius: 0;
    padding: 10px 16px;
}

#unity-logo-title-footer {
    width: 102px;
    height: 38px;
    background: url('unity-logo-title-footer.png') no-repeat center;
    background-size: contain;
    opacity: 0.85;
    transition: opacity 0.2s;
}

#unity-build-title {
    font-family: 'Inter', monospace;
    font-weight: 800;
    font-size: clamp(0.8rem, 4vw, 1.2rem);
    letter-spacing: 3px;
    background: linear-gradient(135deg, #ffffff, #7ad0ff, #00e0ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 8px rgba(0, 180, 255, 0.5);
    flex: 1;
    text-align: center;
}

#unity-fullscreen-button {
    cursor: pointer;
    width: 40px;
    height: 40px;
    background: url('fullscreen-button.png') no-repeat center;
    background-size: 70%;
    filter: drop-shadow(0 0 4px cyan) brightness(1.1);
    transition: all 0.2s ease;
    border-radius: 40px;
    background-color: rgba(20, 30, 55, 0.6);
    backdrop-filter: blur(4px);
    flex-shrink: 0;
}

#unity-fullscreen-button:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 0 12px cyan);
    background-color: rgba(0, 200, 255, 0.2);
}

/* Warning banner */
#unity-warning {
    position: absolute;
    left: 50%;
    top: 5%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(16px);
    border-radius: 40px;
    padding: 8px 18px;
    display: none;
    z-index: 30;
    font-family: 'Inter', monospace;
    font-weight: 500;
    font-size: 0.85rem;
    border-left: 4px solid #ffbb44;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    max-width: 85vw;
    text-align: center;
    color: #f0f0f0;
}

/* ========== GAME INFO PANEL STYLES - FULLY RESPONSIVE ========== */
#game-info-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
    background: rgba(8, 12, 25, 0.85);
    backdrop-filter: blur(16px);
    border-radius: 24px;
    border: 1px solid rgba(0, 200, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 180, 255, 0.2);
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', monospace;
}

#game-info-panel.game-info-collapsed .info-content {
    display: none;
}

#game-info-panel.game-info-expanded .info-content {
    display: block;
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    cursor: pointer;
    background: rgba(0, 20, 40, 0.6);
    border-radius: 24px;
    transition: all 0.2s ease;
}

.info-header:hover {
    background: rgba(0, 60, 100, 0.5);
}

.info-title {
    font-weight: 800;
    font-size: clamp(0.7rem, 3vw, 0.85rem);
    letter-spacing: 1.5px;
    background: linear-gradient(135deg, #fff, #7ad0ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.info-toggle-icon {
    color: #00ccff;
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.info-content {
    padding: 16px 18px;
    max-height: 70vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #00ccff #1a2a3a;
}

.info-content::-webkit-scrollbar {
    width: 4px;
}

.info-content::-webkit-scrollbar-track {
    background: #1a2a3a;
    border-radius: 10px;
}

.info-content::-webkit-scrollbar-thumb {
    background: #00ccff;
    border-radius: 10px;
}

.info-section {
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0, 200, 255, 0.2);
    padding-bottom: 16px;
}

.info-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.info-section h3 {
    font-size: clamp(0.65rem, 2.5vw, 0.75rem);
    font-weight: 800;
    letter-spacing: 2px;
    color: #7ad0ff;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.encounter-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.encounter-item {
    display: flex;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    transition: all 0.2s;
}

.encounter-item.blue {
    border-left: 3px solid #3a86ff;
}
.encounter-item.dark {
    border-left: 3px solid #6c47ff;
}
.encounter-item.tree {
    border-left: 3px solid #2d6a4f;
}

.encounter-icon {
    font-size: clamp(1.2rem, 5vw, 1.8rem);
    min-width: 45px;
    text-align: center;
}

.encounter-desc {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: clamp(0.65rem, 2.5vw, 0.75rem);
}

.encounter-desc strong {
    color: #fff;
    font-weight: 700;
}

.encounter-desc span {
    color: #aaa;
}

.penalty, .game-over {
    font-size: clamp(0.6rem, 2vw, 0.7rem);
    color: #ff8866 !important;
}

.game-over {
    color: #ff5555 !important;
    font-weight: 600;
}

.tip-text {
    font-size: clamp(0.6rem, 2.5vw, 0.7rem);
    color: #ffcc66;
    margin-top: 12px;
    padding: 6px 10px;
    background: rgba(255, 200, 0, 0.1);
    border-radius: 12px;
    text-align: center;
}

.controls-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.control-key {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 12px;
    border-radius: 40px;
}

.control-key kbd {
    background: #1a1a2e;
    border: 1px solid #00ccff;
    border-radius: 8px;
    padding: 4px 10px;
    font-weight: 800;
    font-size: 0.8rem;
    color: #00ccff;
    font-family: monospace;
}

.control-key span {
    font-size: clamp(0.6rem, 2.5vw, 0.7rem);
    color: #ccc;
}

.mobile-controls-desc {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-control-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 30px;
    flex-wrap: wrap;
}

.gear-icon, .flash-icon {
    font-weight: 700;
    font-size: clamp(0.6rem, 2.5vw, 0.7rem);
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(0, 200, 255, 0.2);
    color: #00ccff;
}

.landscape-tip {
    background: rgba(0, 100, 150, 0.2);
    border: 1px dashed #00ccff;
}

.roadmap-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.roadmap-list span {
    font-size: clamp(0.6rem, 2.5vw, 0.7rem);
    padding: 4px 10px;
    background: rgba(100, 100, 200, 0.15);
    border-radius: 20px;
    color: #bbbbff;
}

/* ========== RESPONSIVE BREAKPOINTS ========== */

/* Tablet and smaller desktop */
@media (max-width: 1024px) {
    body {
        padding: 15px;
    }
    
    .game-description {
        width: 95%;
        margin-bottom: 20px;
        padding: 14px 22px;
    }
    
    #game-info-panel {
        width: 320px;
    }
}

/* Mobile landscape */
@media (max-width: 900px) and (orientation: landscape) {
    body {
        padding: 10px;
    }
    
    .game-description {
        margin-bottom: 10px;
        padding: 10px 16px;
    }
    
    .description-content h1 {
        margin-bottom: 6px;
    }
    
    .description-content p {
        margin-bottom: 4px;
    }
    
    #game-info-panel {
        width: 280px;
        bottom: 10px;
        right: 10px;
    }
    
    .info-header {
        padding: 8px 14px;
    }
    
    .info-content {
        padding: 12px 14px;
        max-height: 60vh;
    }
}

/* Mobile portrait */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }
    
    .game-description {
        width: 100%;
        margin-bottom: 16px;
        padding: 12px 18px;
        border-radius: 20px;
    }
    
    #unity-container.unity-desktop {
        max-width: 100%;
    }
    
    .canvas-wrapper {
        border-radius: 20px;
    }
    
    #unity-container {
        border-radius: 28px;
    }
    
    #unity-footer {
        padding: 8px 16px;
        gap: 12px;
    }
    
    #unity-build-title {
        letter-spacing: 2px;
    }
    
    #unity-fullscreen-button {
        width: 36px;
        height: 36px;
    }
    
    #game-info-panel {
        bottom: 10px;
        right: 10px;
        width: 300px;
    }
    
    .info-header {
        padding: 10px 16px;
    }
    
    .info-title {
        font-size: 0.7rem;
    }
    
    .encounter-icon {
        font-size: 1.4rem;
        min-width: 35px;
    }
    
    .control-key kbd {
        padding: 3px 8px;
        font-size: 0.7rem;
    }
    
    #unity-progress-bar-empty {
        width: 200px;
    }
    
    #unity-loading-bar {
        padding: 16px 32px;
        min-width: 240px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    .game-description {
        padding: 10px 14px;
        border-radius: 18px;
        margin-bottom: 12px;
    }
    
    .description-content .challenge {
        margin-top: 4px;
    }
    
    #unity-footer {
        padding: 6px 12px;
        gap: 8px;
    }
    
    #unity-logo-title-footer {
        width: 70px;
        height: 28px;
    }
    
    #unity-build-title {
        letter-spacing: 1px;
    }
    
    #unity-fullscreen-button {
        width: 32px;
        height: 32px;
    }
    
    .loading-status {
        font-size: 0.6rem;
        padding: 4px 12px;
    }
    
    #game-info-panel {
        width: 280px;
    }
    
    .info-header {
        padding: 8px 12px;
    }
    
    .info-content {
        padding: 10px 12px;
    }
    
    .encounter-item {
        padding: 6px 10px;
        gap: 8px;
    }
    
    .encounter-icon {
        min-width: 30px;
    }
    
    .mobile-control-item {
        padding: 6px 10px;
    }
}

/* Mobile container overrides */
#unity-container.unity-mobile {
    position: relative;
    width: 100%;
    height: auto;
    border-radius: 20px;
    background: rgba(12, 20, 30, 0.35);
    backdrop-filter: blur(8px);
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(66, 220, 255, 0.15) inset, 0 0 20px rgba(0, 180, 255, 0.2);
}

.unity-mobile .canvas-wrapper {
    border-radius: 16px;
}

.unity-mobile #unity-canvas {
    width: 100% !important;
    height: auto !important;
}

/* Desktop hover effect */
@media (min-width: 1025px) {
    #unity-container.unity-desktop:hover {
        box-shadow: 0 30px 50px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(0, 220, 255, 0.3) inset, 0 0 28px rgba(0, 200, 255, 0.5);
        transform: scale(1.01);
        transition: all 0.25s ease;
    }
}

/* Fullscreen overrides */
:-webkit-full-screen #unity-canvas {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
}

:-moz-full-screen #unity-canvas {
    width: 100% !important;
    height: 100% !important;
}

:fullscreen #unity-canvas {
    width: 100% !important;
    height: 100% !important;
}

:-webkit-full-screen .canvas-wrapper {
    border-radius: 0 !important;
}

:fullscreen .canvas-wrapper {
    border-radius: 0 !important;
}

/* Orientation hint for mobile */
.orientation-hint {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    color: #ffaa44;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-family: 'Inter', monospace;
    z-index: 100;
    pointer-events: none;
    font-weight: 500;
    transition: opacity 0.5s ease;
    white-space: nowrap;
}

@media (orientation: portrait) and (max-width: 768px) {
    .orientation-hint {
        display: block;
    }
}

@media (orientation: landscape) {
    .orientation-hint {
        display: none;
    }
}