@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

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

:root {
    --primary: #00ff88;
    --secondary: #00ccff;
    --bg: #000000;
    --surface: rgba(0, 0, 0, 0.8);
    --border: rgba(0, 255, 136, 0.2);
    --text: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.6);
}

body.light-mode {
    --primary: #00cc66;
    --secondary: #0099ff;
    --bg: #f5f5f5;
    --surface: rgba(255, 255, 255, 0.9);
    --border: rgba(0, 204, 102, 0.3);
    --text: #1a1a1a;
    --text-dim: rgba(0, 0, 0, 0.6);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
}

#canvas {
    width: 100vw;
    height: 100vh;
    display: block;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s;
}

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

.loading-logo {
    width: 80px;
    height: 80px;
    border: 3px solid var(--primary);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-top: 20px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-dim);
}

/* Menu Button */
.menu-button {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s;
}

.menu-button:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.menu-button span {
    width: 20px;
    height: 2px;
    background: var(--text);
    transition: all 0.3s;
}

.menu-button.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-button.active span:nth-child(2) {
    opacity: 0;
}

.menu-button.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Menu Panel */
.menu-panel {
    position: fixed;
    top: 70px;
    left: 20px;
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 999;
}

.menu-panel.active {
    display: flex;
}

.menu-panel button {
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 14px;
}

.menu-panel button:hover {
    background: var(--border);
}

/* Search */
.search-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    max-width: calc(100% - 180px);
    z-index: 999;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 24px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
}

.search-input:focus {
    border-color: var(--primary);
}

.search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    stroke: var(--text-dim);
    pointer-events: none;
}

/* Stats */
.stats-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 12px;
    z-index: 998;
}

.stat-card {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 20px;
    min-width: 100px;
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 4px;
}

/* Cube Details */
.cube-details {
    position: fixed;
    top: 50%;
    right: -320px;
    transform: translateY(-50%);
    width: 300px;
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    transition: right 0.3s;
    z-index: 1001;
}

.cube-details.active {
    right: 20px;
}

.cube-details h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
}

.close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 24px;
    height: 24px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--bg);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-row span:last-child {
    font-size: 13px;
    font-weight: 500;
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 998;
}

.dpad {
    display: grid;
    grid-template-columns: repeat(3, 44px);
    gap: 4px;
    padding: 8px;
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.dpad-btn {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.dpad-btn:active {
    background: var(--primary);
    transform: scale(0.95);
}

.dpad-btn.center {
    opacity: 0;
    pointer-events: none;
}

/* Mobile */
@media (max-width: 768px) {
    .mobile-controls {
        display: block;
    }
    
    .cube-details.active {
        right: 50%;
        transform: translate(50%, -50%);
    }
    
    .search-container {
        width: calc(100% - 100px);
        left: 70px;
        transform: none;
    }
}
