:root {
    --primary: #2563eb;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --accent: #3b82f6;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 1000px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

header {
    text-align: center;
}

header h1 {
    font-weight: 600;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

header p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.main-display {
    display: flex;
    justify-content: center;
}

.video-container {
    position: relative;
    width: 640px;
    height: 360px;
    background: #000;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
}

#webcam {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scaleX(-1);
    /* Mirror effect */
}

#output_canvas {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scaleX(-1);
    /* Mirror effect to match video */
}

#start-overlay,
#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.hidden {
    display: none !important;
}

#start-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

#start-btn:hover {
    background: #1d4ed8;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.controls-panel {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.control-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.control-card h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.value-display {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-variant-numeric: tabular-nums;
}

.label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.bar-container {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.1s ease-out;
}

.track-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
}

.song-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: none;
    color: white;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.9rem;
    transition: transform 0.1s, opacity 0.2s;
}

.song-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.song-btn:active {
    transform: translateY(0);
}

.btn-fack {
    background-color: #ef4444;
    /* Red */
}

.btn-anxiety {
    background-color: #8b5cf6;
    /* Violet */
}

.btn-crankthat {
    background-color: #f59e0b;
    /* Amber */
}

.btn-timeless {
    background-color: #10b981;
    /* Emerald */
}

input[type="file"] {
    display: none;
}

.file-btn {
    background: white;
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    color: var(--text);
}

.file-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

#current-track {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
    margin-left: 0.5rem;
}

/* Info Button & Modal */
#info-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 1px solid var(--border);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 100;
    transition: transform 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

#info-btn:hover {
    transform: scale(1.1);
    color: var(--primary);
    border-color: var(--primary);
}

#info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s;
}

#info-modal.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

#close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.5rem;
    line-height: 1;
}

#close-modal:hover {
    color: var(--text);
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--text);
}

.instruction-grid {
    display: grid;
    gap: 1.5rem;
}

.inst-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.inst-item .icon {
    font-size: 1.5rem;
    background: var(--bg);
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0.5rem;
    flex-shrink: 0;
}

.inst-item p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-light);
}

.inst-item strong {
    color: var(--text);
    display: block;
    margin-bottom: 0.25rem;
}