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;
}

#season-timer {
    margin-top: 10px;
    font-size: 14px;
    /* Reduced from 18px */
    color: #ffeb3b;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 15px;
    border-radius: 20px;
    display: block;
    width: fit-content;
}

.beta-notice {
    margin-top: 5px;
    font-size: 11px;
    color: #aaa;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 10px;
    display: block;
    width: fit-content;
}

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: 170px;
    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;
}

/* Modern Auth Header */
#auth-header {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 15px;
    align-items: center;
    background: rgba(10, 15, 25, 0.6);
    backdrop-filter: blur(12px);
    padding: 8px 16px;
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

#auth-header:hover {
    background: rgba(10, 15, 25, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#login-btn,
.glass-btn {
    text-decoration: none;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    font-weight: 600;
    font-size: 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

#login-btn:hover,
.glass-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

#user-info {
    display: none;
    align-items: center;
    gap: 12px;
}

#user-nickname {
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease-out;
}

.glass-panel {
    background: rgba(20, 25, 35, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border-radius: 24px;
    padding: 30px;
    color: #fff;
    animation: scaleIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 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;
    }

    /* Ranking Board Adjustment (Horizontal) */
    #ranking-board {
        top: 145px !important;
        left: 10px !important;
        width: calc(100% - 20px) !important;
        padding: 8px 12px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        gap: 8px;
        /* Reduced from 15px */
        overflow-x: auto;
        white-space: nowrap;
        background: rgba(10, 15, 25, 0.95) !important;
    }

    #ranking-board h3 {
        font-size: 11px;
        margin: 0 !important;
        padding-bottom: 0 !important;
        border-bottom: none !important;
        /* Remove separator */
        margin-right: 0 !important;
        /* Removed double spacing (was 15px) */
        flex-shrink: 0;
        /* Prevent text clipping/overlap */
        width: auto !important;
        text-align: center;
        /* Align 2-line text */
        line-height: 1.2;
    }

    #ranking-list {
        display: flex !important;
        flex-direction: row !important;
        gap: 15px;
        font-size: 10px;
        margin: 0 !important;
        padding: 0 !important;
        flex: 1;
    }

    #ranking-list li {
        width: auto !important;
        min-width: auto !important;
        padding: 0 8px !important;
        border-bottom: none !important;
        display: flex !important;
        align-items: center;
        gap: 5px;
    }

    /* Mobile Interaction Optimization */
    .subscribe-btn {
        padding: 16px !important;
        font-size: 18px !important;
    }

    .form-group input,
    .form-group select {
        padding: 12px !important;
        font-size: 16px !important;
        /* Prevent iOS auto-zoom */
    }

    /* Side Panel -> Bottom Sheet */
    #side-panel {
        top: auto !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        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 */

}

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

    to {
        transform: translateY(0);
    }
}

/* --- Activity Ticker --- */
#activity-ticker {
    position: fixed;
    bottom: 80px;
    /* Above Status Bar (which is at 20px) */
    left: 20px;
    /* transform: translateX(-50%); REMOVED Center Align */
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    width: 300px;
    align-items: flex-start;
    /* Align Left */
}

.ticker-item {
    background: rgba(10, 15, 25, 0.9);
    /* Slightly darker */
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 212, 255, 0.3);
    padding: 10px 16px;
    border-radius: 8px;
    /* Less rounded for a more technical look? Or keep 20px */
    border-radius: 20px;
    font-size: 13px;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    /* Slide in from Left instead of Up */
    animation: tickerSlideRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), fadeOut 0.5s ease-in 4.5s forwards;
    display: flex;
    align-items: center;
    gap: 8px;
}

@keyframes tickerSlideRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@media (max-width: 768px) {
    #activity-ticker {
        bottom: 80px;
        /* Move up on mobile to avoid bottom sheet overlap */
        width: 90%;
    }
}

/* --- Notice Modal Tabs --- */
.notice-tab {
    background: none;
    border: none;
    color: #888;
    padding: 8px 10px;
    /* Reduced from 10px 15px */
    cursor: pointer;
    font-size: 13px;
    /* Reduced from 14px */
    font-weight: bold;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
    white-space: nowrap;
    /* Prevent wrapping */
}

.notice-tab:hover {
    color: #ccc;
}

.notice-tab.active {
    color: #00d4ff;
    border-bottom: 2px solid #00d4ff;
}

.notice-content {
    animation: fadeIn 0.3s ease-out;
}

/* --- Language Switcher --- */
#lang-switcher {
    transition: all 0.3s;
}

#lang-switcher:hover {
    background: rgba(0, 212, 255, 0.4);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}