body {
    margin: 0;
    overflow: hidden;
    background-color: #05070a;
    font-family: 'Pretendard', sans-serif;
    color: white;
}

canvas {
    display: block;
    cursor: grab;
    will-change: transform;
    transform: translateZ(0);
}

canvas:active {
    cursor: grabbing;
}

/* UI Layer */
#ui-container {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    pointer-events: none;
}

.panel {
    background: rgba(10, 15, 25, 0.9);
    backdrop-filter: blur(15px);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid rgba(0, 212, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

/* Header */
#header {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
}

h1 {
    margin: 0;
    font-size: 24px;
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

#container {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
}

/* Subscription Panel (Side Panel) */
#side-panel {
    position: absolute;
    top: 70px;
    right: 20px;
    width: 280px;
    display: none;
    z-index: 100;
}

.subscribe-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(45deg, #00d4ff, #0055ff);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 16px;
    margin-top: 15px;
    transition: 0.3s;
}

.subscribe-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 212, 255, 0.4);
}

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    font-size: 12px;
    margin-bottom: 5px;
    color: #aaa;
}

.form-group input,
.form-group select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 8px;
    color: white;
    font-size: 14px;
}

.form-group select option {
    background-color: #0a0f19;
    color: white;
}

/* Status Bar */
#status-bar {
    position: absolute;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 10px;
    z-index: 90;
}

.tag {
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
}

/* Minimap */
#minimap-container {
    position: fixed;
    /* Fixed is better than absolute for UI overlay */
    bottom: 20px;
    right: 20px;
    width: 150px;
    height: 150px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
    z-index: 90;
    /* Ensure visibility */
}

#minimap-view {
    position: absolute;
    border: 1px solid #00d4ff;
    background: rgba(0, 212, 255, 0.1);
}

/* Ranking Board */
#ranking-board {
    position: absolute;
    top: 80px;
    left: 20px;
    width: 220px;
    padding: 15px;
    background: rgba(10, 15, 25, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(0, 212, 255, 0.2);
    z-index: 90;
    display: block;
}

#ranking-board h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #00d4ff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
    display: flex;
    justify-content: space-between;
}

#ranking-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 13px;
}

/* Auth Header */
#auth-header {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 15px;
    align-items: center;
}

#login-btn {
    text-decoration: none;
    padding: 10px 20px;
    background: #4285F4;
    /* Google Blue */
    color: white;
    font-weight: bold;
    font-size: 14px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.3);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

#login-btn:hover {
    background: #357ae8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.5);
}

#user-info {
    display: none;
    /* Default hidden */
    align-items: center;
    gap: 15px;
    background: rgba(10, 15, 25, 0.8);
    backdrop-filter: blur(10px);
    padding: 5px 15px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#user-nickname {
    color: #00d4ff;
    font-weight: bold;
    font-size: 14px;
}

#user-info a {
    text-decoration: none;
    color: #ff4d4d;
    font-size: 12px;
    border: 1px solid rgba(255, 77, 77, 0.5);
    padding: 4px 10px;
    border-radius: 15px;
    transition: 0.2s;
}

#user-info a:hover {
    background: rgba(255, 77, 77, 0.1);
    color: #ff6666;
}

/* Mobile Controls */
#mobile-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
}

#mobile-mode-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(10, 15, 25, 0.9);
    border: 2px solid #00d4ff;
    color: #00d4ff;
    font-weight: bold;
    font-size: 12px;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

/* Help Modal */
#help-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    /* High z-index */
    align-items: center;
    justify-content: center;
}

#help-modal .panel {
    width: 400px;
    max-width: 90%;
    position: relative;
}

.help-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.help-modal-header h2 {
    margin: 0;
    color: #00d4ff;
    font-size: 20px;
}

#close-help {
    cursor: pointer;
    font-size: 24px;
    color: #aaa;
}

#help-modal ul {
    list-style: none;
    padding: 0;
    margin: 0;
    color: #ddd;
    font-size: 14px;
    line-height: 2;
}

.help-item {
    display: flex;
    justify-content: space-between;
}

.help-item span:last-child {
    color: #00d4ff;
}

.help-item-footer {
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
}

/* --- Mobile Responsiveness (The Fix) --- */
@media (max-width: 768px) {

    /* Header Adjustment */
    #container h1 {
        font-size: 16px;
    }

    #container div {
        font-size: 10px;
    }

    /* Ranking Board Adjustment */
    #ranking-board {
        top: 60px !important;
        left: 10px !important;
        width: 140px !important;
        /* Smaller width */
        padding: 8px !important;
    }

    #ranking-board h3 {
        font-size: 11px;
    }

    #ranking-list {
        font-size: 10px;
    }

    #ranking-list li {
        padding: 4px 0 !important;
    }

    /* Mobile Controls - REMOVED as requested */
    #mobile-controls {
        display: none !important;
    }

    /* Side Panel -> Bottom Sheet */
    #side-panel {
        /* display: none; Handled by JS */
        top: auto !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        /* Force width */
        max-height: 50vh;
        overflow-y: auto;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
        box-sizing: border-box;
        animation: slideUp 0.3s ease-out;
    }

    /* Adjust Minimap */
    #minimap-container {
        width: 80px !important;
        /* Smaller minimap on mobile */
        height: 80px !important;
        bottom: 20px !important;
        /* Lower since controls are gone */
        right: 10px !important;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}