:root {
    --bg-color-1: #9B5DE5;
    /* Purple */
    --bg-color-2: #F15BB5;
    /* Pink */
    --bg-color-3: #FF8833;
    /* Orange */
    --white: #FFFFFF;
    --cardBg: #FFF9F9;
    --textDark: #2A2A3A;
    --textLight: rgba(255, 255, 255, 0.85);
    --accentOrange: #FF7B54;
    --modalBg: rgba(40, 30, 60, 0.85);
}

* {
    box-sizing: border-box;
}

html,
body {
    max-width: 100vw;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color-1);
    color: var(--white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* --- Exact Android Background --- */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: linear-gradient(135deg, #FF6B35 0%, #E8527A 50%, #9B5DE5 100%);
}

.circle-top {
    position: absolute;
    top: -80px;
    right: -80px;
    width: 320px;
    height: 320px;
    background: #FFD700;
    border-radius: 50%;
    opacity: 0.15;
    z-index: -1;
}

.circle-bottom {
    position: absolute;
    bottom: -60px;
    left: -60px;
    width: 250px;
    height: 250px;
    background: #9B5DE5;
    border-radius: 50%;
    opacity: 0.12;
    z-index: -1;
}

.rotating-sun {
    position: absolute;
    top: 40px;
    left: 30px;
    font-size: 3rem;
    /* ~48sp */
    color: white;
    opacity: 0.25;
    z-index: -1;
    animation: rotateSun 20s linear infinite;
    line-height: 1;
}

@keyframes rotateSun {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* --- Top Bar (Buttons) --- */
.top-bar {
    display: flex;
    justify-content: flex-end;
    padding: 1.5rem 2rem 0;
    position: relative;
    z-index: 10;
}

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

.icon-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.icon-btn:active {
    transform: scale(0.95);
}

/* --- Header --- */
header {
    position: relative;
    z-index: 1;
    padding: 0 2rem 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.logo {
    font-size: 2.25rem;
    /* ~36sp */
    font-weight: 500;
    font-family: sans-serif-condensed, 'Outfit', sans-serif;
    letter-spacing: 0.05em;
    text-shadow: 2px 4px 8px rgba(0, 0, 0, 0.25);
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    animation: floatLogo 3s ease-in-out infinite;
}

@keyframes floatLogo {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-12px);
    }
}

.subtitle {
    font-size: 0.8rem;
    /* ~13sp */
    font-weight: 300;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.08em;
}

.now-playing {
    font-size: 0.7rem;
    /* ~11sp */
    color: rgba(255, 255, 255, 0.6);
    font-weight: 300;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

/* --- Main Card --- */
main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 2rem;
    position: relative;
    z-index: 1;
    perspective: 1000px;
}

.card-quote {
    background: var(--cardBg);
    border-radius: 30px;
    padding: 2.5rem 2rem 2rem;
    max-width: 360px;
    width: 100%;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-style: preserve-3d;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card-quote:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
}

.quote-icon {
    font-size: 4rem;
    color: var(--accentOrange);
    line-height: 0.5;
    margin-bottom: 1rem;
    font-family: serif;
    opacity: 0.8;
}

.quote-text {
    font-size: 1.35rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--textDark);
    margin-bottom: 1.5rem;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.divider {
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accentOrange), transparent);
    margin: 0 auto 1rem;
    border-radius: 2px;
}

.tap-hint {
    font-size: 0.85rem;
    color: var(--accentOrange);
    font-weight: 500;
    opacity: 0.8;
}

/* Card Animations */
.card-quote.animating-out {
    animation: flipOut 0.2s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}

.card-quote.animating-in {
    animation: flipIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes flipOut {
    from {
        transform: rotateX(0deg);
    }

    to {
        transform: rotateX(90deg);
    }
}

@keyframes flipIn {
    from {
        transform: rotateX(-90deg);
    }

    to {
        transform: rotateX(0deg);
    }
}

/* --- Footer --- */
footer {
    position: relative;
    z-index: 1;
    padding: 1.5rem;
    text-align: center;
}

.footer-text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
}

/* --- Modal (Quotes List) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modalBg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    display: flex;
    flex-direction: column;
    max-width: 600px;
    max-height: 90vh;
    /* Restrict height to allow scrolling */
    margin: auto;
    /* Center in the flex container */
    width: 90%;
    padding: 2.5rem 2rem;
    transform: translateY(30px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: rgba(35, 25, 55, 0.75);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.modal-overlay.open .modal-content {
    transform: translateY(0) scale(1);
}

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

.modal-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.9rem;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: var(--textDark);
}

/* Panels */
.tab-panel {
    display: none;
    margin-bottom: 1.5rem;
}

.tab-panel.active {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#panelSingle {
    flex-direction: row;
    align-items: center;
}

input[type="text"],
textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 1rem;
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
}

input[type="text"]:focus,
textarea:focus {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
}

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

.add-btn {
    background: linear-gradient(135deg, #ff758c, #ff7eb3);
    border: none;
    border-radius: 15px;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.add-btn:hover {
    transform: scale(1.05);
}

.batch-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hint-text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.add-btn-text {
    background: linear-gradient(135deg, #ff758c, #ff7eb3);
    border: none;
    border-radius: 20px;
    padding: 0.6rem 1.2rem;
    color: white;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Quotes List & Sounds Scroll */
.quotes-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 1rem 0.5rem 0.5rem;
    /* Add padding to prevent clipping shadows */
    margin: -0.5rem -1rem -0.5rem -0.5rem;
    /* Offset padding to keep scrollbar at the edge */
    min-height: 0;
    /* Crucial for flex child to scroll */
}

.quotes-scroll::-webkit-scrollbar {
    width: 6px;
}

.quotes-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5rem 0 1rem;
}

.section-header h3 {
    font-size: 1.1rem;
    font-weight: 500;
}

.badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
}

.quote-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.2rem 1.5rem;
    margin: 0.2rem 0.2rem 1rem 0.2rem;
    /* Provide margin for scaling and shadows */
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    color: rgba(255, 255, 255, 0.8);
}

.quote-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.quote-item-text {
    font-size: 0.95rem;
    line-height: 1.4;
    flex: 1;
}

.quote-item.active-track {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.15), rgba(232, 90, 37, 0.05));
    border: 1px solid var(--accentOrange);
    color: var(--white);
    transform: scale(1.01);
    /* Reduced scale slightly to avoid any clipping */
    box-shadow: 0 10px 25px rgba(255, 107, 53, 0.15);
}

.quote-item.active-track::before {
    content: '🎵';
    font-size: 1.1rem;
    animation: bounceIcon 2s infinite ease-in-out;
}

@keyframes bounceIcon {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-4px) rotate(5deg);
    }
}

.quote-num {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.delete-btn {
    background: rgba(255, 0, 0, 0.2);
    border: none;
    color: #ff9999;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
}

.delete-btn:hover {
    background: rgba(255, 0, 0, 0.4);
}

/* --- Sound Options Specifics --- */
.sound-controls-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.toggle-btn {
    flex: 1;
    background: linear-gradient(135deg, #ff758c, #ff7eb3);
    border: none;
    border-radius: 12px;
    padding: 0.8rem;
    color: white;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s, transform 0.2s;
}

.toggle-btn.off {
    opacity: 0.6;
    background: rgba(255, 255, 255, 0.2);
}

.toggle-btn:active {
    transform: scale(0.95);
}

.add-audio-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 1rem;
    color: white;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: background 0.2s;
}

.add-audio-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* --- Responsive Design --- */
@media (min-width: 768px) {
    .card-quote {
        max-width: 600px;
    }
}

@media (min-width: 1024px) {
    .card-quote {
        max-width: 850px;
    }
    .rotating-sun {
        font-size: 8rem;
        top: 60px;
        left: 60px;
    }
}