:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --danger-color: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --font-family: 'Noto Sans SC', sans-serif;
}

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

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

/* Dynamic Background Layer */
#bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background-color: var(--bg-color);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    transition: background-image 0.5s ease-in-out;
}

/* Dark Overlay to ensure text readability */
#bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: rgba(15, 23, 42, 0.4);
    /* Slight dark tint */
    backdrop-filter: blur(3px);
    /* Slight blur for focus */
}

/* Glassmorphism Container */
.container {
    background: var(--card-bg);
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    border-radius: 20px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    z-index: 10;
}

/* Floating Action Button for Background */
.btn-floating {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    z-index: 100;
}

.btn-floating:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(180deg);
}

header {
    text-align: center;
}

@keyframes gradient-flow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;

    /* Flowing Gradient */
    background: linear-gradient(45deg, #0cebeb, #20e3b2, #29ffc6, #ffd900, #ff5e00, #ff0055, #d900ff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradient-flow 5s ease infinite;
}

h1 {
    font-size: 2rem;
    margin-bottom: 0.2rem;

    /* Flowing Gradient */
    background: linear-gradient(45deg, #00dbde, #fc00ff, #00dbde);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradient-flow 3s linear infinite;
}

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

/* Recorder Section */
.recorder-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--secondary-color);
    border-radius: 50%;
    transition: background-color 0.3s;
}

.status-indicator.recording .status-dot {
    background-color: var(--danger-color);
    box-shadow: 0 0 10px var(--danger-color);
    animation: pulse-red 1s infinite;
}

@keyframes pulse-red {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

.visualizer {
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.bar {
    width: 4px;
    height: 4px;
    /* Default height */
    background-color: var(--primary-color);
    border-radius: 2px;
    transition: height 0.1s ease;
}

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

.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    color: white;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #2563eb);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-danger {
    background: var(--danger-color);
    opacity: 0.8;
}

.btn-danger:hover:not(:disabled) {
    opacity: 1;
}

.btn-danger:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.btn-icon {
    background: transparent;
    color: var(--text-muted);
    padding: 0.4rem;
}

.btn-icon:hover {
    color: var(--primary-color);
}

/* Result Section */
.result-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

textarea {
    width: 100%;
    height: 120px;
    background: transparent;
    border: none;
    resize: none;
    color: var(--text-main);
    font-size: 1rem;
    line-height: 1.6;
    outline: none;
}

textarea::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

footer {
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 1rem;
}