:root {
    --bg-color: #262626;
    /* Dark Grey */
    --text-color: #e0f2f1;
    /* Light Mint Text */
    --accent-color: #1de9b6;
    /* Bright Teal Accent */
    --shadow-light: #333333;
    /* Lighter highlight */
    --shadow-dark: #1a1a1a;
    /* Darker shadow */
    --font-family: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.app-container {
    background-color: var(--bg-color);
    border-radius: 40px;
    padding: 1.5rem;
    width: 90%;
    max-width: 480px;

    /* Outer Shadow */
    box-shadow: 20px 20px 60px var(--shadow-dark),
        -20px -20px 60px var(--shadow-light);

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

header h1 {
    font-weight: 700;
    font-size: 2.5rem;
    color: var(--accent-color);
    margin-bottom: 0.75rem;
    /* Reduced bottom margin */
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 0.95rem;
    color: #78909c;
    margin-bottom: 0.5rem;
}

#creator-link {
    color: #0790ae;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

#creator-link:hover {
    color: #46ff6ba1;
    text-decoration: none;
}

header p:last-of-type {
    margin-top: 0.2rem;
    color: #b0bec5;
    font-size: 0.9rem;
    font-weight: 500;
}

.visualizer-container {
    width: 100%;
    height: 160px;
    border-radius: 25px;
    overflow: hidden;

    /* Inner Shadow */
    box-shadow: inset 8px 8px 16px var(--shadow-dark),
        inset -8px -8px 16px var(--shadow-light);

    background: var(--bg-color);
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.timer-display {
    margin-top: 1.95rem;
    margin-bottom: 1.75rem;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-color);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5),
        -1px -1px 2px rgba(255, 255, 255, 0.1);
}

.controls {
    display: flex;
    gap: 2rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    /* Allow wrapping on very small screens */
}

.control-btn {
    border: none;
    background: var(--bg-color);
    color: var(--text-color);
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;

    /* Neumorphic Shadow */
    box-shadow: 9px 9px 16px var(--shadow-dark),
        -9px -9px 16px var(--shadow-light);
}

.control-btn span {
    font-size: 0.75rem;
    margin-top: 5px;
    font-weight: 600;
    color: #b0bec5;
}

.control-btn svg {
    fill: var(--text-color);
    transition: fill 0.3s ease;
}

.control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;

    /* Pressed/Flat look for disabled */
    box-shadow: inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);

    color: #546e7a;
}

.control-btn:disabled svg {
    fill: #546e7a;
}

.control-btn:not(:disabled):active,
.control-btn.active-state {
    box-shadow: inset 6px 6px 10px 0 var(--shadow-dark),
        inset -6px -6px 10px 0 var(--shadow-light);
    transform: translateY(2px);
}

.control-btn:not(:disabled):hover {
    transform: translateY(-2px);
}

/* Specific Button Styles */
#record-btn {
    color: #ff5252;
}

#record-btn svg {
    fill: #ff5252;
}

#record-btn.recording {
    box-shadow: inset 6px 6px 10px 0 var(--shadow-dark),
        inset -6px -6px 10px 0 var(--shadow-light);
    animation: breathing 2s ease-in-out infinite;
}

#pause-btn {
    color: #ffb74d;
    /* Amber/Orange */
}

#pause-btn svg {
    fill: #ffb74d;
}

#pause-btn.paused {
    box-shadow: inset 6px 6px 10px 0 var(--shadow-dark),
        inset -6px -6px 10px 0 var(--shadow-light);
}

#save-btn svg {
    fill: none;
    stroke: var(--accent-color);
}

#save-btn span {
    color: var(--accent-color);
}

#reset-btn {
    color: #ef5350;
    /* Red for reset action */
}

#reset-btn svg {
    stroke: #ef5350;
}

/* Pause Button Icon Toggling */
#pause-btn .icon-play {
    fill: #ffb74d;
}

#status-message {
    font-size: 0.85rem;
    color: #78909c;
    font-weight: 500;
    margin-top: 1rem;
}

@keyframes breathing {
    0% {
        transform: scale(0.95);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(0.95);
        opacity: 0.9;
    }
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .app-container {
        padding: 2rem 1rem;
        border-radius: 35px;
        width: 95%;
        gap: 1.5rem;
    }

    header h1 {
        font-size: 2.25rem;
    }

    .visualizer-container {
        height: 120px;
    }

    .timer-display {
        font-size: 2rem;
        margin-top: 2rem;
        margin-bottom: 2rem;
    }

    .controls {
        gap: 1.5rem;
    }

    .control-btn {
        width: 65px;
        height: 65px;
    }

    .control-btn span {
        font-size: 0.65rem;
        margin-top: 3px;
    }

    .control-btn svg {
        width: 20px;
        height: 20px;
    }
}