/* CSS Variables & Theme */
:root {
    --bg-color: #050608;
    --card-bg: rgba(20, 22, 30, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);

    --accent-gold: #D4AF37;
    --accent-gold-glow: rgba(212, 175, 55, 0.3);

    --text-main: #FFFFFF;
    --text-muted: #A0A0A0;

    --success: #4CAF50;
    --warning: #FFC107;
    --danger: #F44336;

    --font-heading: 'Cinzel', serif;
    --font-body: 'Inter', sans-serif;

    --transition-speed: 0.3s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    /* Premium Piano Background with Dark Overlay */
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.85)),
        url('../img/piano_bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;

    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    text-align: center;
    margin-bottom: 3rem;
    margin-top: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo .icon {
    font-size: 2.5rem;
    color: var(--accent-gold);
    text-shadow: 0 0 15px var(--accent-gold-glow);
}

.logo h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 2px;
}

.tagline {
    color: var(--text-muted);
    font-size: 1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Views & Transitions */
.view {
    opacity: 0;
    position: absolute;
    width: 100%;
    pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease;
    transform: translateY(20px);
    display: none;
    /* Actually hide it to prevent layout overlap */
}

.view.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
    position: relative;
    display: block;
}

.view.hidden {
    display: none;
}

/* Cards */
/* Cards */
.card {
    background: rgba(20, 22, 30, 0.4);
    /* More transparent */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    /* Top highlight */
    border-radius: 20px;
    padding: 2.5rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5),
        0 5px 15px rgba(0, 0, 0, 0.2);
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Subtle inner glow for cards */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.card h2 {
    font-family: var(--font-heading);
    margin-bottom: 1rem;
    color: var(--accent-gold);
}

.intro-card p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Instruction Steps */
.instruction-steps {
    display: flex;
    justify-content: space-around;
    margin-bottom: 2.5rem;
    text-align: left;
    gap: 1rem;
}

.step {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.step-num {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--accent-gold);
    margin-bottom: 0.5rem;
}

.step p {
    font-size: 0.9rem;
    margin: 0;
}

/* Buttons */
.btn {
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    border: none;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-gold) 0%, #b89628 100%);
    color: #000;
    box-shadow: 0 4px 15px var(--accent-gold-glow);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-gold-glow);
    filter: brightness(1.1);
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
    margin-left: 1rem;
}

.secondary-btn:hover {
    background: rgba(212, 175, 55, 0.1);
}

/* Recording Visualizer */
.visualizer-container {
    position: relative;
    width: 100%;
    height: 300px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#audio-visualizer {
    width: 100%;
    height: 100%;
}

.status-overlay {
    position: absolute;
    text-align: center;
    pointer-events: none;
}

#recording-status {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Processing */
.loader {
    width: 80px;
    height: 80px;
    margin: 0 auto 2rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--accent-gold);
    animation: pulse 2s infinite;
}

.loader .icon {
    font-size: 2rem;
    color: var(--accent-gold);
    font-family: serif;
    font-style: italic;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    margin: 0;
    /* Reset generic card margin */
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.metric-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.metric-header h3 {
    font-size: 1rem;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-weight: 400;
    margin: 0;
}

.info-tooltip {
    background: rgba(255, 255, 255, 0.1);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: help;
}

.metric-value {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
    line-height: 1;
}

.metric-value .unit {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 5px;
}

.metric-bar-container {
    width: 100%;
    margin-bottom: 0.5rem;
}

.metric-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
    position: relative;
}

.metric-bar-fill {
    height: 100%;
    background: var(--accent-gold);
    border-radius: 3px;
    transition: width 1s ease-out;
}

.labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.status-tag {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--warning);
    margin-top: 0.5rem;
}

/* Advice */
.advice-card {
    text-align: left;
}

.advice-list {
    list-style: none;
    padding-left: 0;
}

.advice-list li {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-main);
}

.advice-list li::before {
    content: "•";
    color: var(--accent-gold);
    position: absolute;
    left: 0;
    font-size: 1.2rem;
    line-height: 1;
}

/* Responsive */
@media (max-width: 600px) {
    .results-grid {
        grid-template-columns: 1fr;
    }

    .instruction-steps {
        flex-direction: column;
    }
}

/* Sound Wave Decoration */
.sound-wave-decoration {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 30px;
    gap: 6px;
    margin-top: 1.5rem;
}

.sound-wave-decoration .bar {
    width: 6px;
    height: 10px;
    background: var(--accent-gold);
    border-radius: 3px;
    animation: wave 1.2s infinite ease-in-out alternate;
    box-shadow: 0 0 10px var(--accent-gold-glow);
}

.sound-wave-decoration .bar:nth-child(1) {
    animation-delay: 0.0s;
    height: 15px;
}

.sound-wave-decoration .bar:nth-child(2) {
    animation-delay: 0.2s;
    height: 30px;
}

.sound-wave-decoration .bar:nth-child(3) {
    animation-delay: 0.4s;
    height: 20px;
}

.sound-wave-decoration .bar:nth-child(4) {
    animation-delay: 0.1s;
    height: 35px;
}

.sound-wave-decoration .bar:nth-child(5) {
    animation-delay: 0.3s;
    height: 25px;
}

@keyframes wave {
    0% {
        transform: scaleY(0.8);
        opacity: 0.7;
    }

    100% {
        transform: scaleY(1.5);
        opacity: 1;
        filter: brightness(1.2);
    }
}