:root {
    --bg-gradient: linear-gradient(135deg, #1a1c2c 0%, #4a192c 100%);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --font-main: 'Outfit', sans-serif;

    /* Zen Palette Defaults */
    --c-primary: #8e44ad;
    --c-accent: #f39c12;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-main);
    background: var(--bg-gradient);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Ambient Background */
.ambient-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    z-index: 0;
    animation: pulse-bg 10s infinite alternate;
}

@keyframes pulse-bg {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Glass Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem;
    z-index: 10;
}

/* Header */
.top-bar {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.level-info h1 {
    font-weight: 300;
    font-size: 1.5rem;
    letter-spacing: 1px;
}

.level-info p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.controls {
    display: flex;
    gap: 1rem;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    opacity: 0.8;
    transition: all 0.3s ease;
    padding: 8px;
    border-radius: 50%;
}

.icon-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* Main Area */
.mandala-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
    padding: 20px;
}

.mandala-svg {
    max-height: 80vh;
    max-width: 80vw;
    filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.3));
    transition: transform 0.5s ease;
}

.mandala-path {
    stroke: rgba(255, 255, 255, 0.8);
    /* Light stroke for dark mode */
    stroke-width: 1px;
    /* Thinner stroke for elegance */
    fill: transparent;
    /* Initially transparent/bg color */
    cursor: pointer;
    transition: fill 0.4s ease, stroke-width 0.3s;
}

.mandala-path:hover {
    stroke-width: 2px;
    stroke: white;
    fill: rgba(255, 255, 255, 0.05);
}

.mandala-path.locked {
    cursor: not-allowed;
    opacity: 0.5;
}

.mandala-path.filled {
    stroke: rgba(255, 255, 255, 0.5);
}

/* Footer Palette */
.bottom-bar {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    min-width: 300px;
    /* Ensure enough width for colors */
    display: flex;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 50px;
    /* Pill shape */
}

.palette-scroll {
    display: flex;
    gap: 15px;
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
}

.color-swatch:hover {
    transform: scale(1.2);
}

.color-swatch.active {
    border-color: white;
    transform: scale(1.1);
}

/* Modal and Overlay */
.modal,
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.hidden {
    display: none !important;
}

.modal-content,
.victory-content {
    background: #2d3436;
    /* Fallback */
    background: rgba(30, 30, 40, 0.9);
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

.track-list {
    list-style: none;
    margin: 20px 0;
    text-align: left;
}

.track-item {
    padding: 10px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.track-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.track-item.playing {
    color: var(--c-accent);
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(45deg, #FF6B6B, #FF8E53);
    border: none;
    padding: 12px 30px;
    color: white;
    border-radius: 30px;
    font-size: 1.1rem;
    cursor: pointer;
    margin-top: 20px;
    transition: transform 0.2s;
}

.btn-primary:hover {
    transform: scale(1.05);
}

.btn-text {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--text-muted);
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 20px;
}

.btn-text:hover {
    border-color: white;
    color: white;
}

/* Mobile responsive tweak */
@media (max-width: 600px) {
    .mandala-svg {
        max-width: 95vw;
    }

    .palette-scroll {
        gap: 10px;
    }

    .color-swatch {
        width: 30px;
        height: 30px;
    }
}

/* Stats and Quotes Styles */
.info-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stats-row {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

.stat-value {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--c-accent);
}

.zen-quote {
    font-style: italic;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 5px;
    min-width: 300px;
}

/* Update Header height to accommodate new content if needed */
.top-bar {
    height: auto;
    min-height: 80px;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .zen-quote {
        display: none;
    }

    .stats-row {
        gap: 10px;
    }
}

.zen-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    /* Fade in */
    transition: opacity 2s ease;
    z-index: -1;
    filter: brightness(0.4);
    /* Darken for "dark zen" feel */
}

/* Records Panel */
.records-side-panel {
    position: absolute;
    right: 20px;
    top: 100px;
    /* Below header */
    width: 150px;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    padding: 15px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.records-side-panel h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    color: var(--text-muted);
}

.records-table {
    width: 100%;
    font-size: 0.9rem;
    border-collapse: collapse;
}

.records-table th {
    text-align: center;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-weight: 400;
}

.records-table td {
    text-align: center;
    padding: 5px 0;
    color: white;
}

@media (max-width: 800px) {
    .records-side-panel {
        display: none;
        /* Hide on small screens for now to avoid clutter */
    }
}

/* Controls Container Layout */
.controls-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Volume Controls */
.volume-controls {
    display: flex;
    flex-direction: column;
    /* Vertical stack for space efficiency or horizontal? Prefer Horizontal now */
    gap: 8px;
    margin-right: 15px;
}

.vol-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vol-icon {
    font-size: 0.9rem;
    opacity: 0.8;
}

input[type=range] {
    -webkit-appearance: none;
    /* Hides the slider so that custom slider can be made */
    width: 80px;
    /* Specific width */
    background: transparent;
    /* Otherwise white in Chrome */
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 12px;
    width: 12px;
    border-radius: 50%;
    background: var(--c-accent);
    cursor: pointer;
    margin-top: -4px;
    /* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

input[type=range]:focus {
    outline: none;
}

@media (max-width: 600px) {
    .volume-controls {
        display: none;
        /* Hide volume sliders on mobile to save space, or move into modal later */
    }
}