:root {
    --gold-primary: #C8962E;
    --gold-light: #D4A843;
    --gold-bright: #E8B94A;
    --bronze-dark: #5C3D1A;
    --bronze-mid: #8B6914;
    --sun-white: #FFF5E0;
    --deep-charcoal: #1A1410;
    --bg-dark: #0F0D0A;
    --string-silver: #C0C0C0;
    --ghost-string: rgba(139, 125, 107, 0.4);
    --panel-bg: rgba(20, 17, 12, 0.92);
    --panel-border: rgba(200, 150, 46, 0.25);
    --glow-gold: rgba(200, 150, 46, 0.3);
}

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

body {
    background: var(--bg-dark);
    color: var(--sun-white);
    font-family: 'DM Sans', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    cursor: default;
}

#scene-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#scene-container canvas {
    display: block;
}

/* Top Bar */
#top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: linear-gradient(180deg, rgba(15, 13, 10, 0.95) 0%, rgba(15, 13, 10, 0) 100%);
    z-index: 100;
    pointer-events: none;
}

#top-bar > * {
    pointer-events: auto;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sun-icon {
    font-size: 24px;
    color: var(--gold-primary);
    filter: drop-shadow(0 0 8px var(--glow-gold));
    animation: sun-pulse 4s ease-in-out infinite;
}

@keyframes sun-pulse {
    0%, 100% { filter: drop-shadow(0 0 8px var(--glow-gold)); }
    50% { filter: drop-shadow(0 0 16px rgba(200, 150, 46, 0.6)); }
}

.title-group {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.app-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 22px;
    color: var(--gold-primary);
    letter-spacing: 2px;
    line-height: 1.1;
}

.app-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: 12px;
    color: var(--bronze-mid);
    letter-spacing: 1px;
}

.top-bar-right {
    display: flex;
    gap: 8px;
}

.top-btn {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    color: var(--gold-light);
    padding: 6px 14px;
    border-radius: 4px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.top-btn:hover {
    background: rgba(200, 150, 46, 0.15);
    border-color: var(--gold-primary);
}

/* Hint Overlay */
#hint-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 8, 5, 0.9);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    transition: opacity 0.5s;
}

#hint-overlay.dismissed {
    opacity: 0;
    pointer-events: none;
}

.hint-content {
    text-align: center;
    max-width: 480px;
    padding: 40px;
}

.hint-icon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: sun-pulse 2s ease-in-out infinite;
}

.hint-content h2 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 32px;
    color: var(--gold-primary);
    margin-bottom: 24px;
}

.hint-content p {
    font-size: 15px;
    color: var(--sun-white);
    margin-bottom: 10px;
    opacity: 0.85;
}

.hint-content strong {
    color: var(--gold-light);
}

.hint-keys {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 24px 0;
}

.hint-keys span {
    font-size: 12px;
    color: var(--sun-white);
    opacity: 0.6;
}

kbd {
    background: rgba(200, 150, 46, 0.15);
    border: 1px solid var(--panel-border);
    border-radius: 3px;
    padding: 2px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--gold-light);
}

.gold-btn {
    background: linear-gradient(135deg, var(--gold-primary), var(--bronze-mid));
    border: none;
    color: var(--sun-white);
    padding: 12px 36px;
    border-radius: 6px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 1px;
}

.gold-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 0 30px var(--glow-gold);
}

/* Info Panel */
#info-panel {
    position: fixed;
    inset: 0;
    background: rgba(10, 8, 5, 0.85);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    transition: opacity 0.3s;
}

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

.info-card {
    background: linear-gradient(135deg, rgba(30, 24, 15, 0.98), rgba(20, 16, 10, 0.98));
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 36px;
    position: relative;
}

.info-card h2 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 28px;
    color: var(--gold-primary);
    margin-bottom: 16px;
}

.info-card .poetic {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 16px;
    color: var(--sun-white);
    opacity: 0.8;
    line-height: 1.7;
    margin-bottom: 24px;
    border-left: 2px solid var(--gold-primary);
    padding-left: 16px;
}

.info-card h3 {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: var(--gold-light);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
    margin-top: 20px;
}

.info-card ul {
    list-style: none;
    padding: 0;
}

.info-card li {
    font-size: 13px;
    color: var(--sun-white);
    opacity: 0.75;
    padding: 4px 0;
    padding-left: 16px;
    position: relative;
}

.info-card li::before {
    content: '◈';
    position: absolute;
    left: 0;
    color: var(--gold-primary);
    font-size: 10px;
}

.info-card li strong {
    color: var(--gold-light);
}

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

.close-btn:hover {
    background: rgba(200, 150, 46, 0.2);
    border-color: var(--gold-primary);
}

/* Control Panel */
#control-panel {
    position: fixed;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 24px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    z-index: 100;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 1px rgba(200, 150, 46, 0.3);
    max-width: 95vw;
    overflow-x: auto;
    flex-wrap: nowrap;
}

.control-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex-shrink: 0;
}

.control-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--gold-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.control-sublabel {
    font-weight: 300;
    color: var(--bronze-mid);
    font-size: 9px;
    text-transform: none;
    letter-spacing: 0;
}

.display-label {
    font-size: 9px;
    font-weight: 500;
    color: var(--bronze-mid);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.pitch-readout {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

#note-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    font-weight: 500;
    color: var(--gold-bright);
    text-shadow: 0 0 12px var(--glow-gold);
}

#cents-offset {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--gold-light);
    opacity: 0.7;
}

#hz-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--bronze-mid);
}

.decay-readout {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: var(--gold-light);
    text-shadow: 0 0 8px var(--glow-gold);
}

/* Sliders */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 4px;
    background: rgba(200, 150, 46, 0.15);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gold-primary);
    box-shadow: 0 0 8px var(--glow-gold);
    cursor: pointer;
    transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.fine-slider {
    width: 90px;
}

/* Toggle Switch */
.toggle-container {
    display: flex;
    align-items: center;
}

.toggle-switch {
    position: relative;
    width: 60px;
    height: 26px;
    border-radius: 13px;
    background: rgba(200, 150, 46, 0.1);
    border: 1px solid var(--panel-border);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s;
}

.toggle-switch[data-active="true"] {
    background: rgba(200, 150, 46, 0.3);
    border-color: var(--gold-primary);
}

.toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bronze-mid);
    transition: all 0.3s;
}

.toggle-switch[data-active="true"] .toggle-knob {
    left: 36px;
    background: var(--gold-bright);
    box-shadow: 0 0 10px var(--glow-gold);
}

.toggle-label-off, .toggle-label-on {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    pointer-events: none;
}

.toggle-label-off {
    right: 6px;
    color: var(--bronze-mid);
}

.toggle-label-on {
    left: 6px;
    color: var(--gold-bright);
    opacity: 0;
}

.toggle-switch[data-active="true"] .toggle-label-on {
    opacity: 1;
}

.toggle-switch[data-active="true"] .toggle-label-off {
    opacity: 0;
}

/* Pick Track */
.pick-section {
    min-width: 100px;
}

.pick-track {
    position: relative;
    width: 100px;
    height: 20px;
}

.pick-track-bg {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    transform: translateY(-50%);
    background: linear-gradient(90deg, var(--bronze-dark), var(--gold-primary), var(--bronze-dark));
    border-radius: 2px;
}

.pick-sun {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(-50%, -50%);
    font-size: 16px;
    transition: left 0.1s;
    filter: drop-shadow(0 0 4px var(--glow-gold));
}

/* Footer */
#footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: rgba(15, 13, 10, 0.8);
    z-index: 50;
    font-size: 11px;
}

.footer-text {
    color: var(--bronze-mid);
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    letter-spacing: 1px;
}

.remix-link {
    color: var(--gold-primary);
    text-decoration: none;
    font-family: 'DM Sans', sans-serif;
    font-size: 10px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.remix-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* String vibration indicator */
.string-active {
    animation: string-glow 0.1s ease-out;
}

@keyframes string-glow {
    0% { filter: brightness(2); }
    100% { filter: brightness(1); }
}

/* Responsive */
@media (max-width: 768px) {
    #control-panel {
        bottom: 34px;
        padding: 10px 14px;
        gap: 12px;
        flex-wrap: wrap;
        justify-content: center;
        max-height: 50vh;
    }

    .control-section {
        min-width: 70px;
    }

    input[type="range"] {
        width: 80px;
    }

    .fine-slider {
        width: 60px;
    }

    .pick-section {
        min-width: 70px;
    }

    .pick-track {
        width: 70px;
    }

    .app-title {
        font-size: 18px;
    }

    .hint-content {
        padding: 24px;
    }

    .hint-content h2 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    #control-panel {
        gap: 8px;
        padding: 8px 10px;
    }

    .tuning-display {
        order: -1;
        width: 100%;
        text-align: center;
    }

    .pitch-readout {
        justify-content: center;
    }
}

/* Scrollbar for control panel */
#control-panel::-webkit-scrollbar {
    height: 3px;
}

#control-panel::-webkit-scrollbar-track {
    background: transparent;
}

#control-panel::-webkit-scrollbar-thumb {
    background: var(--panel-border);
    border-radius: 2px;
}