:root {
    /* Nuance Colors */
    --base-color: #fdfdfb;
    --card-color: #ffffff;
    --text-main: #2c3e50;
    --text-sub: #576574;
    --border-color: #e8e8e1;

    /* Accents */
    --accent-blue: #5d8aa8;
    --accent-rose: #c06c84;
    --accent-gold: #d4a373;
    --accent-header: #fafafa;

    /* Typography */
    --font-main: 'Noto Sans JP', sans-serif;
    --font-title: 'Montserrat', sans-serif;
    /* Changed for Solid look */
}

body {
    font-family: var(--font-main);
    background-color: var(--base-color);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    text-align: center;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    line-height: 1.6;
}

/* Header */
header {
    margin-bottom: 40px;
}

h1 {
    font-family: var(--font-title);
    font-weight: 700;
    /* Solid */
    font-style: normal;
    /* No Italic */
    font-size: 2.5rem;
    color: var(--text-main);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

p {
    color: var(--text-sub);
    font-size: 0.95rem;
}

/* Sound Wave Animation (Abstract) */
.sound-wave-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
    gap: 15px;
    /* Spacing between lines */
    margin-bottom: 10px;
}

.wave-line {
    width: 60px;
    height: 60px;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    background: linear-gradient(45deg, var(--accent-blue), var(--accent-rose));
    opacity: 0.6;
    animation: morph 4s ease-in-out infinite both alternate;
    mix-blend-mode: multiply;
}

.wave-line:nth-child(1) {
    animation-duration: 3.5s;
}

.wave-line:nth-child(2) {
    animation-duration: 4.2s;
    background: linear-gradient(45deg, var(--accent-gold), var(--accent-blue));
    animation-delay: -1s;
}

.wave-line:nth-child(3) {
    animation-duration: 3.8s;
    background: linear-gradient(45deg, var(--accent-rose), var(--accent-gold));
    animation-delay: -2s;
}

@keyframes morph {
    0% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
        transform: scale(0.9) rotate(0deg);
    }

    100% {
        border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%;
        transform: scale(1.1) rotate(180deg);
    }
}

/* Input Group */
.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    max-width: 400px;
    padding: 14px 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-main);
    background-color: var(--card-color);
    color: var(--text-main);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 4px 12px rgba(93, 138, 168, 0.15);
}

.input-group button {
    width: 100%;
    max-width: 150px;
    padding: 12px 24px;
    background-color: var(--accent-blue);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: var(--font-main);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(93, 138, 168, 0.2);
}

.input-group button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(93, 138, 168, 0.3);
}

/* PC Optimization */
@media (min-width: 601px) {
    .input-group {
        flex-direction: row;
        justify-content: center;
    }

    .input-group input {
        margin-bottom: 0;
    }
}

/* Ripple Loader */
.sound-ripple {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
    margin: 20px auto;
}

.sound-ripple div {
    position: absolute;
    border: 4px solid var(--accent-blue);
    opacity: 1;
    border-radius: 50%;
    animation: sound-ripple 1s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.sound-ripple div:nth-child(2) {
    animation-delay: -0.5s;
}

@keyframes sound-ripple {
    0% {
        top: 36px;
        left: 36px;
        width: 0;
        height: 0;
        opacity: 0;
    }

    4.9% {
        top: 36px;
        left: 36px;
        width: 0;
        height: 0;
        opacity: 0;
    }

    5% {
        top: 36px;
        left: 36px;
        width: 0;
        height: 0;
        opacity: 1;
    }

    100% {
        top: 0px;
        left: 0px;
        width: 72px;
        height: 72px;
        opacity: 0;
    }
}

/* Results Area */
#result {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
}

/* Card Component */
.card {
    background-color: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    /* Increased from 400px to allow longer filenames on PC */
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.4s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-12px);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.08);
}

.card-header {
    height: 8px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-rose));
    width: 100%;
}

.card-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-grow: 1;
}

.card h3 {
    margin: 0;
    font-family: var(--font-title);
    font-size: 1.2rem;
    color: var(--text-main);
    overflow-wrap: break-word;
    /* Prevent splitting extensions mid-word */
}

audio {
    width: 100%;
    margin-top: 10px;
    border-radius: 8px;
    /* Slightly rounded */
}

/* Buttons inside Card */
.btn-container {
    margin-top: auto;
    display: flex;
    justify-content: center;
}

.download-button {
    background: linear-gradient(135deg, var(--accent-rose), #9b4d66);
    /* Rose accent for distinction */
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    text-decoration: none;
    display: inline-block;
    font-weight: bold;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.download-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Footer */
footer {
    font-size: 0.8rem;
    color: var(--text-sub);
    margin-top: 60px;
    margin-bottom: 20px;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    body {
        padding: 16px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .wave-line {
        width: 40px;
        height: 40px;
    }

    .sound-wave-container {
        height: 40px;
    }
}