:root {
    --primary-color: #3b82f6;
    /* Brighter Blue for Dark Mode */
    --secondary-color: #94a3b8;
    --accent-color: #38bdf8;
    --bg-color: #020617;
    /* Very Dark Blue/Black */
    --container-bg: #0f172a;
    --text-color: #f8fafc;
    /* White text */
    --success-color: #10b981;
    --warning-color: #fbbf24;
    --danger-color: #ef4444;
    --glow-color: rgba(255, 255, 255, 0.8);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* Mobile First Layout - Fullscreen Card style */
.app-container {
    width: 100%;
    max-width: 480px;
    /* Mobile Friendly Width */
    height: 100vh;
    /* Full screen height */
    max-height: 900px;
    background: var(--container-bg);
    padding: 2rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    /* Optional: rounded corners if on desktop */
    border-radius: 0;
}

@media (min-width: 500px) {
    .app-container {
        height: auto;
        min-height: 95vh;
        /* Taller on desktop */
        max-height: 1000px;
        border-radius: 2rem;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
        border: 1px solid #1e293b;
    }
}

main {
    width: 100%;
    flex: 1;
    /* Key fix: stretches main to fill remaining height */
    display: flex;
    flex-direction: column;
}

header {
    margin-bottom: 2rem;
    /* Fixed spacing instead of auto */
    width: 100%;
    flex-shrink: 0;
    /* Header doesn't shrink */
}

/* ... existing styles ... */

.controls {
    width: 100%;
    display: flex;
    flex-direction: row;
    /* Horizontal */
    justify-content: center;
    gap: 10px;
    margin-bottom: 1rem;
    margin-top: auto;
    /* Push to bottom */
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: white;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #cbd5e1;
}

#phase-badge {
    color: white;
    border: none;
    /* Phase badges use colored backgrounds */
}

/* Glowing Avatar - Center Stage */
.examiner-avatar {
    position: relative;
    margin: auto auto 2rem;
    /* Center vertically */
    width: 140px;
    height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.avatar-circle {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 20px var(--glow-color), 0 0 60px var(--glow-color);
    z-index: 10;
    position: relative;
    transition: all 0.3s ease;
}

/* While Speaking: Avatar gets brighter/larger */
.pulsing .avatar-circle {
    transform: scale(1.1);
    box-shadow: 0 0 30px white, 0 0 80px white;
}

/* The Rings */
.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid white;
    opacity: 0;
    z-index: 0;
}

.pulsing .pulse-ring {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        width: 60px;
        height: 60px;
        opacity: 0.8;
        border-width: 2px;
    }

    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
        border-width: 0px;
    }
}

/* Mic Interaction Area */
.interaction-area {
    margin: auto 0;
    width: 100%;
}

.mic-container {
    margin: 2rem 0;
    cursor: pointer;
    transition: transform 0.2s;
}

.mic-icon {
    font-size: 3rem;
    color: #475569;
    transition: color 0.3s;
}

.listening .mic-icon {
    color: var(--danger-color);
    /* Red for Recording */
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
    animation: bounce 1s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.mic-status {
    margin-top: 1rem;
    font-weight: 500;
    color: var(--secondary-color);
    font-size: 0.9rem;
    padding: 0 1rem;
    line-height: 1.5;
    /* allow wrapping */
    white-space: normal;
    overflow: visible;
}

.controls {
    width: 100%;
    display: flex;
    flex-direction: row;
    /* Horizontal */
    justify-content: center;
    gap: 10px;
    margin-bottom: 1rem;
}

.controls button {
    padding: 1rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 1rem;
    width: auto;
    flex: 1;
    /* Equal width, fill space */
    margin: 0;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.primary-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

.primary-btn:disabled {
    background: #334155;
    color: #64748b;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.secondary-btn {
    background: transparent;
    border: 1px solid #334155 !important;
    color: #cbd5e1;
}

.secondary-btn:hover {
    background: #1e293b;
}

.transcript-log {
    margin-top: 1rem;
    text-align: left;
    max-height: 100px;
    overflow-y: auto;
    font-size: 0.8rem;
    background: #020617;
    padding: 1rem;
    border-radius: 0.5rem;
    display: none;
    border: 1px solid #1e293b;
    color: #94a3b8;
}

/* Modal Dark Theme */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
}

.modal-content {
    background: var(--container-bg);
    color: white;
    padding: 2rem;
    border-radius: 1.5rem;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid #334155;
    max-height: 85vh;
    overflow-y: auto;
}

.timer-large {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--accent-color);
    text-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
    margin: 1.5rem 0;
    font-variant-numeric: tabular-nums;
}

/* Result Styles */
.band-score {
    width: 120px;
    height: 120px;
    background: transparent;
    border: 4px solid var(--primary-color);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.2);
    color: white;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 auto 1.5rem;
}

#total-band {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

#feedback-details {
    text-align: left;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.score-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #334155;
    padding-bottom: 0.25rem;
    color: #cbd5e1;
}

.score-item span:last-child {
    color: white;
    font-weight: 600;
}