:root {
    /* Color Palette derived from the book cover */
    --color-primary-dark: #3A2228;
    --color-primary-accent: #8B2C69;
    --color-secondary-accent: #C95F63;
    --color-pastel-pink: #DCA7C1;
    --color-pastel-peach: #F8D1AE;
    --color-lime-accent: #D5DB67;
    
    --bg-color: #FAFAFA;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 8px 32px 0 rgba(58, 34, 40, 0.1);
}

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

body {
    font-family: 'Noto Sans Thai', 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--color-primary-dark);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
    overflow-x: hidden;
    position: relative;
}

/* Dynamic Background Shapes */
.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite alternate ease-in-out;
}

.shape-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background-color: var(--color-pastel-peach);
    animation-delay: 0s;
}

.shape-2 {
    bottom: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background-color: var(--color-pastel-pink);
    animation-delay: -5s;
}

.shape-3 {
    top: 30%;
    left: 60%;
    width: 30vw;
    height: 30vw;
    background-color: var(--color-secondary-accent);
    opacity: 0.3;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(5%, 10%) scale(1.1); }
    100% { transform: translate(-5%, -5%) scale(0.9); }
}

/* Main Container */
.app-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    width: 100%;
    max-width: 600px;
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.header {
    text-align: center;
}

.logo {
    font-family: 'Noto Sans Thai', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--color-primary-dark);
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background-color: var(--color-primary-dark);
    color: white;
    border-radius: 8px;
    transform: rotate(-2deg);
}

.title {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--color-primary-accent);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    color: var(--color-primary-dark);
    opacity: 0.8;
}

/* Controls / Upload Segment */
.controls-section {
    display: flex;
    justify-content: center;
}

.upload-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--color-primary-accent), var(--color-secondary-accent));
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 1rem 2rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(201, 95, 99, 0.3);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 95, 99, 0.4);
}

.upload-btn:active {
    transform: translateY(1px);
}

/* Playlist Section */
.playlist-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(139, 44, 105, 0.1);
    padding-bottom: 0.5rem;
}

.playlist-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-primary-dark);
}

.playlist-header span {
    background-color: var(--color-lime-accent);
    color: var(--color-primary-dark);
    font-size: 0.85rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-weight: 700;
}

.playlist {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom Scrollbar for playlist */
.playlist::-webkit-scrollbar {
    width: 6px;
}

.playlist::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.playlist::-webkit-scrollbar-thumb {
    background: rgba(139, 44, 105, 0.3);
    border-radius: 10px;
}

.playlist::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 44, 105, 0.5);
}

/* Audio Item */
.audio-item {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.audio-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    border-color: rgba(213, 219, 103, 0.5); /* Lime accent border on hover */
}

.audio-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.audio-title {
    font-weight: 600;
    color: var(--color-primary-dark);
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.audio-langtag {
    font-size: 0.75rem;
    background-color: rgba(139, 44, 105, 0.1);
    color: var(--color-primary-accent);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-weight: 500;
}

.audio-player audio {
    width: 100%;
    height: 40px;
    outline: none;
}

/* Audio native player styling tweaks (webkit) */
audio::-webkit-media-controls-panel {
    background-color: var(--color-pastel-peach);
}
audio::-webkit-media-controls-play-button,
audio::-webkit-media-controls-mute-button {
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
}

@media (max-width: 480px) {
    .app-container {
        padding: 1.5rem;
    }
    
    .title {
        font-size: 1.75rem;
    }

    .upload-btn {
        width: 100%;
        justify-content: center;
    }
}
