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

:root {
    --bg-color: #0a0a0a;
    --primary-white: #ffffff;
    --accent-orange: #ea580c;
    --border-color: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--primary-white);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.bg-gradient {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, #171717 0%, #000 100%);
    pointer-events: none;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    opacity: 0.05;
    background-image: 
        linear-gradient(to right, #404040 1px, transparent 1px),
        linear-gradient(to bottom, #404040 1px, transparent 1px);
    background-size: 80px 80px;
    pointer-events: none;
}

#active-game-area {
    position: absolute;
    inset: 0;
    z-index: 10;
}

.hidden {
    display: none !important;
}

/* HUD Styles */
#hud {
    position: absolute;
    inset: 0;
    z-index: 20;
    pointer-events: none;
}

.top-info {
    position: absolute;
    top: 2rem;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.progress-bar-container {
    width: 180px;
    height: 2px;
    background: rgba(255,255,255,0.1);
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
}

#progress-bar {
    position: absolute;
    height: 100%;
    background: white;
    box-shadow: 0 0 10px white;
    width: 0%;
    transition: width 0.5s linear;
}

.bottom-left, .bottom-right {
    position: absolute;
    bottom: 3rem;
    pointer-events: none;
}

.bottom-left {
    left: 1.5rem;
    border-left: 2px solid var(--accent-orange);
    padding-left: 1rem;
}

.bottom-right {
    right: 1.5rem;
    border-right: 2px solid var(--accent-orange);
    padding-right: 1rem;
}

.hud-label {
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #737373;
    margin-bottom: 0.25rem;
}

.hud-value {
    font-size: 1.875rem;
    font-weight: 900;
    font-style: italic;
}

.hud-value.orange {
    color: var(--accent-orange);
}

.bottom-center {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.perfect-mode-label {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5em;
    margin-bottom: 0.25rem;
}

.separator {
    width: 96px;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.2), transparent);
}

#mute-toggle {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    pointer-events: auto;
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    padding: 0.5rem;
}

#mute-toggle:hover {
    color: white;
}

/* Overlay Base */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 2rem;
    text-align: center;
}

#failed-overlay {
    background: rgba(0,0,0,0.95);
    z-index: 40; /* Sit behind game area as requested */
}

.overlay-content {
    width: 100%;
    max-width: 400px;
}

.logo-box {
    width: 80px;
    height: 80px;
    border: 4px solid white;
    transform: rotate(45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
}

.logo-box i {
    transform: rotate(-45deg);
}

.title {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    margin-bottom: 1rem;
}

.description {
    color: #a3a3a3;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 2rem;
}

.selector-group {
    margin-bottom: 2rem;
    text-align: left;
}

.selector-group .label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #737373;
    margin-bottom: 0.5rem;
}

.difficulty-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.diff-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 0.5rem 0;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.diff-btn.active {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
    box-shadow: 0 0 15px rgba(234, 88, 12, 0.4);
}

.track-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 140px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.track-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.5rem 1rem;
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.track-item.active {
    background: white;
    color: black;
    font-weight: 900;
    border-color: white;
}

.track-item .artist {
    opacity: 0.4;
    font-style: italic;
}

.main-btn {
    width: 100%;
    padding: 1.25rem;
    background: white;
    color: black;
    border: none;
    font-weight: 900;
    font-size: 1.125rem;
    font-style: italic;
    cursor: pointer;
    margin-bottom: 1.5rem;
    border-radius: 2px;
    transition: transform 0.1s;
}

.main-btn:active {
    transform: scale(0.98);
}

.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s;
}

.upload-btn:hover {
    background: rgba(255,255,255,0.05);
}

/* Failed Overlay Content */
.fail-title {
    font-size: 4rem;
    color: #dc2626;
    margin-bottom: 0.5rem;
}

.fail-reason {
    color: #dc2626;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 12px;
    margin-bottom: 2rem;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(23, 23, 23, 0.5);
    border: 1px solid #262626;
    padding: 1.5rem;
    border-radius: 1rem;
}

.stat-card.full {
    grid-column: span 2;
}

.stat-label {
    font-size: 10px;
    font-weight: 700;
    color: #737373;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 900;
}

.outline-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 1rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.outline-btn:hover {
    opacity: 1;
}

/* COUNTDOWN */
.instruction-text {
    animation: fadeInOut 1s ease-in-out forwards;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: scale(0.9); }
    20% { opacity: 1; transform: scale(1); }
    80% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.1); }
}

.countdown-number {
    font-size: 8rem;
    font-weight: 900;
    font-style: italic;
    animation: countdownPulse 1s infinite;
}

@keyframes countdownPulse {
    0% { transform: scale(0.5); opacity: 0; }
    20% { transform: scale(1.2); opacity: 1; }
    80% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* SQUARES */
.square {
    position: absolute;
    pointer-events: none;
    transform: translate(-50%, -50%);
    will-change: transform, left, top, opacity;
}

.square-inner {
    width: 100%;
    height: 100%;
    border: 4px solid rgba(255,255,255,0.2);
    background-color: rgba(255,255,255,0.05);
    border-radius: 1rem;
    transition: all 0.1s linear;
}

.square.glowing .square-inner {
    border-color: rgba(255,255,255,0.6);
    background-color: rgba(255,255,255,0.1);
    box-shadow: 0 0 30px white;
}

.square.collectible .square-inner {
    border-color: white;
    background-color: rgba(255,255,255,0.5);
    box-shadow: 0 0 50px white;
    transform: scale(1.1);
}

.square.post-collect .square-inner {
    filter: grayscale(1) opacity(0.5);
}

/* Custom Scrollbar */
.track-list::-webkit-scrollbar {
    width: 4px;
}
.track-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}
