* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

body {
    font-family: 'Inter', sans-serif;
}

body.dark-mode {
    background-color: #121212;
    color: #f2f2f2;
}

.song-card {
    transition: transform 0.3s ease;
}

.song-card .card-body span {
    margin-right: 0.75rem;
}

.song-card:hover {
    transform: scale(1.02);
}

.wave-container {
    height: 64px;
    background: #e0e0e0;
    margin-bottom: 8px;
    border-radius: 8px;
}

.dark-mode .card {
    background-color: #1e1e1e;
    border-color: #333;
    color: #f2f2f2;
}

.dark-mode .card .card-text.text-muted {
    color: #bbb !important;
}

.card-title {
    color: #57d757;
    text-decoration: none;
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.card-title:hover {
    /* color: #2f802f; */
    opacity: 0.8;
}

.btn-like {
    background-color: #f7c8d0;
    border: 1px solid #f7c8d0;
    color: #800033;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-like:hover {
    background-color: #f4a9b8;
    border-color: #f4a9b8;
    color: white;
}

.btn-outline-secondary {
    color: #ccc;
    border-color: #666;
}

.btn-outline-secondary:hover {
    color: #fff;
    border-color: #aaa;
}

.song-card .btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
}

.song-card .card-body {
    padding: 1rem;
}


.dark-mode .btn-outline-info {
    color: #d1ecf1;
    border-color: #17a2b8;
}

.dark-mode .btn-outline-danger {
    color: #e5536d;
    border-color: #e5536d;
}

.btn-outline-danger:hover {
    background-color: #e5536d;
    color: white;
}

.btn-outline-danger {
    color: #ff6b81;
    border-color: #ff6b81;
}

.btn-outline-danger:hover {
    background-color: #ff6b81;
    color: white;
}

.dark-mode .btn-outline-success {
    color: #c3e6cb;
    border-color: #28a745;
}

/* === Dark Mode Button Fix === */
#themeToggle {
    transition: 0.3s ease;
    font-weight: 500;
    border-radius: 6px;
    padding: 0.45rem 1rem;
}

body.dark-mode #themeToggle {
    color: #fff;
    border-color: #999;
}

body:not(.dark-mode) #themeToggle {
    color: #222;
    border-color: #555;
}

/* Optional for clarity: apply outline style like Bootstrap */
body.dark-mode #themeToggle.btn {
    background-color: transparent;
}

body:not(.dark-mode) #themeToggle.btn {
    background-color: transparent;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.btn-toggle-dark {
    transition: 0.3s;
}

#wave {
    background-color: #e0e0e0;
    width: 100%;
    height: 80px;
    margin-bottom: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

body.dark-mode #wave {
    background-color: #1e1e1e;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.visually-hidden {
    display: none;
}

.song-stats {
    font-weight: 500;
    font-size: 0.95rem;
    color: #555;
    transition: color 0.3s;
}

body.dark-mode .song-stats {
    color: rgba(255, 255, 255, 0.7);
}

.song-stats-span {
    display: inline-flex;
    align-items: center;
    gap: 20px;
    transition: opacity 0.2s ease-in-out;
}

.song-stats-span span:hover {
    opacity: 0.9;
}

.lyrics-box {
    background: linear-gradient(145deg, #2c2c2c, #1b1b1b);
    border: 2px solid #8a2be2;
    color: #f2f2f2;
    padding: 1rem 1.5rem;
    font-family: 'Georgia', serif;
    font-size: 1.1rem;
    white-space: pre-line;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.5);
    transition: all 0.4s ease;
    max-height: 500px;
    overflow-y: auto;
    line-height: 0.9;
}

body:not(.dark-mode) .lyrics-box {
    background: #f4f0ff;
    color: #111;
    border-color: #d59fff;
    box-shadow: 0 0 12px rgba(160, 82, 255, 0.3);
}

.btn-success,
.btn-warning {
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease-in-out;
}

.btn-success:hover,
.btn-warning:hover {
    transform: scale(1.03);
}

.no-lyrics-message {
    font-style: italic;
    color: #444;
}

body.dark-mode .no-lyrics-message {
    color: #ccc;
}

.play-toggle-btn.playing {
    background-color: #198754;
    /* Bootstrap green */
    color: #fff;
    border-color: #198754;
}

.play-toggle-btn,
.copy-btn {
    min-width: 150px;
}


body.dark-mode .alert-warning {
    background-color: #332e00;
    color: #fce96b;
    border-color: #a68c00;
}

.btn-outline-info:hover,
.btn-outline-primary:hover {
    opacity: 0.9;
    transform: scale(1.05);
    transition: all 0.2s ease;
}

body.dark-mode .text-muted {
    color: rgba(255, 255, 255, 0.7) !important;
}

body.dark-mode .text-muted {
    color: rgba(255, 255, 255, 0.85) !important;
}

body.dark-mode input[type="text"],
body.dark-mode textarea {
    background-color: #2b2b2b;
    color: #f2f2f2;
    border: 1px solid #555;
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
    color: #aaa;
}

.wave-container {
    height: 64px;
    background: #e0e0e0;
    margin-bottom: 8px;
    border-radius: 8px;
}

.dark-mode .card {
    background-color: #1e1e1e;
    border-color: #333;
    color: #f2f2f2;
}

.dark-mode .btn-outline-info {
    color: #d1ecf1;
    border-color: #17a2b8;
}

.dark-mode .btn-outline-danger {
    color: #ff6b81;
    border-color: #ff6b81;
}

.dark-mode .btn-outline-danger:hover {
    background-color: #ff6b81;
    color: white;
}

.dark-mode .btn-outline-success {
    color: #c3e6cb;
    border-color: #28a745;
}

/* === Dark Mode Button Fix === */
#themeToggle {
    transition: 0.3s ease;
    font-weight: 500;
    border-radius: 6px;
    padding: 0.45rem 1rem;
}

body.dark-mode #themeToggle {
    color: #fff;
    border-color: #999;
}

.fantasy-box {
    background: #1b1b1b;
    border: 2px solid #a78bfa;
    color: #f2e9ff;
    font-family: 'Georgia', serif;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 0 15px rgba(167, 139, 250, 0.4);
    max-height: 500px;
    overflow-y: auto;
    transition: all 0.3s ease;
}

body.dark-mode .fantasy-box {
    background: linear-gradient(135deg, #1b1b1b, #0f0f0f);
    border-color: #c084fc;
    box-shadow: 0 0 15px rgba(192, 132, 252, 0.5);
}

.fantasy-box p {
    margin: 0 0 0.5rem;
}

body:not(.dark-mode) .fantasy-box {
    background-color: #252525;
    color: #fff;
}

.comment-item {
    padding: 15px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}

body.dark-mode .comment-item {
    background-color: #333;
    color: #f2f2f2;
    border: 1px solid #444;
}

body.dark-mode .comment-item p {
    color: #ddd;
}

.comment-item .username {
    font-weight: 600;
}

body.dark-mode .username {
    color: #fff;
}

.comment-item form {
    margin-left: 10px;
    align-self: start;
}

#comments-container {
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.dark-mode #comments-container {
    background-color: #333;
    border-color: #444;
}

body.dark-mode .comment-item:hover {
    background-color: #444;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-youtube {
    background-color: #a43c3c;
    color: #fff;
    border: none;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(255, 0, 0, 0.4);
    transition: all 0.2s ease-in-out;
}

.btn-youtube:hover {
    background-color: #cc0000;
    transform: scale(1.02);
    box-shadow: 0 3px 8px rgba(255, 0, 0, 0.6);
}

.age-limit-badge {
    background-color: #d3834a;
    color: #fff;
    font-weight: bold;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.dark-mode .age-limit-badge {
    background-color: #b98865;
}

/* Audio Controller Base */
.audio-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(230, 230, 230, 0.4);
    backdrop-filter: blur(4px);
    color: #111;
    font-weight: 500;
}

/* Volume area */
.volume-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Volume Icon */
.volume-icon {
    font-size: 1rem;
    color: #111;
}

/* Time labels */
.time-label {
    font-size: 0.9rem;
    font-family: monospace;
    color: #111;
    font-weight: bold;
}

/* Light Theme Specifics */
body:not(.dark-mode) .audio-controls {
    background-color: rgba(245, 245, 245, 0.8);
    color: #111;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

body:not(.dark-mode) .time-label,
body:not(.dark-mode) .volume-icon {
    color: #111;
}

/* Dark Mode */
body.dark-mode .audio-controls {
    background-color: #1e1e1e;
    border: 1px solid #333;
    color: #f2f2f2;
}

body.dark-mode .volume-icon,
body.dark-mode .time-label {
    color: #f2f2f2;
}

/* Volume Slider */
#audio-controls input[type="range"],
#volumeControl {
    accent-color: #0d6efd;
    width: 100px;
}

#loopToggle.btn-success {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

#player-cur-volume {
    min-width: 40px;
    display: inline-block;
    text-align: right;
}

.hidden-toggle {
    display: none;
}

.song-info-box {
    background-color: #fff;
    color: #111;
}

body.dark-mode .song-info-box {
    background-color: #1e1e1e;
    color: #f2f2f2;
}

body.dark-mode .alert-warning {
    background-color: #332e00;
    color: #fce96b;
    border-color: #a68c00;
}

.mini-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #222;
    color: white;
    z-index: 9999;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    padding: 0;
    /* Remove top-bottom padding so wave aligns clean */
}

#miniWave {
    height: 64px;
    background: #111;
    overflow: hidden;
}

/* Add clear separation between wave and controls */
.player-content {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
}

body.dark-mode .player-content {
    background-color: #222;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #f2f2f2;
}

.mini-player .song-info {
    font-size: 1rem;
    font-weight: 500;
    max-width: 70%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.player-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.player-controls button {
    margin-left: 6px;
    margin-right: 6px;
    background: #222;
    border: 1px solid #444;
    color: #f2f2f2;
    padding: 2px 12px 4px;
    border-radius: 6px;
    font-size: 1.2rem;
}

.player-controls button:hover {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

.mini-player .song-info {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    animation: scroll-title 10s linear infinite;
}

.marquee {
    position: absolute;
    bottom: 10px;
    left: 100%;
    white-space: nowrap;
    font-size: 2.85rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.1);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    animation: marquee-slide 12s linear infinite;
    pointer-events: none;
    color: #00ffe1;
    text-shadow: 0 0 8px #00ffe1, 0 0 12px #00ffe1;
    opacity: 0.04;
}

body.dark-mode .player-content {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background-color: #222;
    color: #f2f2f2;
}

/* Light mode button fixes */
body:not(.dark-mode) .player-controls button {
    background-color: white;
    color: #111;
    border: 1px solid #ccc;
}

body:not(.dark-mode) .player-controls button:hover {
    background-color: #f0f0f0;
    transform: scale(1.1);
}

.mini-player::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: linear-gradient(90deg, #00f, #0ff, #0f0, #f0f, #f00, #00f);
    background-size: 300%;
    animation: borderPulse 4s linear infinite;
}

.playing-glow {
    animation: pulse 1.2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(0, 255, 128, 0.3);
}

.floating-notes {
    position: absolute;
    bottom: 5%;
    left: 50%;
    font-size: 3rem;
    opacity: 0.08;
    transform: translateX(-50%);
    animation: floatUp 5s ease-in-out infinite;
    pointer-events: none;
    user-select: none;
    color: rgba(0, 0, 0, 0.08);
}

body.dark-mode .floating-notes {
    color: rgba(255, 255, 255, 0.08);
    /* for dark mode */
}

.mini-playlist {
    position: absolute;
    bottom: -120px;
    left: 0;
    right: 0;
    background: #111;
    color: white;
    text-align: center;
    padding: 10px;
    transition: bottom 0.4s ease;
    z-index: 9999;
}

.mini-player:hover .mini-playlist {
    bottom: 64px;
    /* height of player */
}

#miniWave {
    height: 64px;
    background: #e0e0e0;
    /* for light mode */
    overflow: hidden;
}

body.dark-mode #miniWave,
body.dark-mode #wave {
    background: #111;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.auto-next-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 20px;
    position: relative;
    transition: background-color 0.3s;
}

.slider::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 2px;
    width: 16px;
    height: 16px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

/* When checked */
.toggle-switch input:checked+.slider {
    background-color: #198754;
}

.toggle-switch input:checked+.slider::before {
    transform: translateX(20px);
}

/* Label text next to the switch */
.label-text {
    margin-left: 8px;
    font-weight: 500;
    color: #222;
}

/* Dark mode support */
body.dark-mode .slider {
    background-color: #555;
}

body.dark-mode .toggle-switch input:checked+.slider {
    background-color: #00c06f;
}

body.dark-mode .label-text {
    color: #eee;
}

.main-title {
    font-size: 2rem;
    /* Default for desktop */
    font-weight: 600;
}

#songs {
    margin-bottom: calc(2.7 * var(--bs-gutter-x));
}

.alert-note {
    display: none;
}

#shareArrow {
    display: inline-block;
    transition: transform 0.3s ease;
}

#shareArrow.rotate {
    transform: rotate(180deg);
}

.info-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-color: #007BFF;
    /* Bootstrap info blue */
    color: white;
    font-weight: bold;
    font-family: Arial, sans-serif;
    border-radius: 50%;
    text-align: center;
    line-height: 20px;
    cursor: help;
    /* Optional: shows '?' cursor */
    font-style: normal;
    /* Keeps it upright */
}


.like-btn {
    position: relative;
    overflow: visible;
}

.floating-heart {
    position: absolute;
    bottom: 100%;
    left: 50%;
    font-size: 24px;
    transform: translateX(-50%) translateY(0) scale(1);
    animation: floatUp 1.2s ease-out forwards;
    pointer-events: none;
    user-select: none;
    z-index: 10;
    opacity: 1;
    transform-origin: center bottom;
    background-color: rgba(255, 0, 0, 0.1);
    border-radius: 25px;
}

.age-alert-warning {
    width: 30%;
    background-color: #bd4747;
    border-radius: 7px;
    padding: 2px;
}

#miniProgressBar {
    height: 4px;
    width: 0%;
    background: linear-gradient(to right, #43e97b, #38f9d7);
    border-radius: 2px;
    box-shadow: 0 0 5px rgba(60, 220, 130, 0.8);
    animation: pulseShadow 1.5s ease-in-out infinite;
    transition: width 0.3s ease-out;
}

.btn-sm {
    min-width: 36px;
    height: 36px;
    padding: 6px 10px;
    font-size: 14px;
}

.btn:hover {
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.blink-highlight {
    animation: blinkHighlight 0.8s ease-in-out;
    animation-iteration-count: 4;
    /* Blinks 4 times */
}

.playing {
    animation: pulse 1.4s infinite;
}

.custom-tooltip {
    position: absolute;
    background-color: #333;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 9999;
    pointer-events: none;
}

.custom-tooltip.show {
    opacity: 1;
    pointer-events: auto;
}

/* Arrow styling */
.tooltip-arrow {
    position: absolute;
    top: -6px;
    /* above tooltip box */
    right: 17%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #333;
}


.dark-mode .label {
    font-weight: bold;
    color: #ccc;
}

.dark-mode .value {
    color: #fff;
}

.label {
    color: #1b1515
}

.value {
    color: #000;
}

.label, .value {
    transition: color 0.3s ease;
}


@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.01);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes blinkHighlight {

    0%,
    100% {
        box-shadow: 0 0 0px rgba(0, 123, 255, 0);
    }

    50% {
        box-shadow: 0 0 12px rgba(0, 123, 255, 0.9);
    }
}


@keyframes pulseShadow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(60, 220, 130, 0.5);
    }

    50% {
        box-shadow: 0 0 10px rgba(60, 220, 130, 1);
    }
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }

    20% {
        transform: translateX(-50%) translateY(-10px) scale(3);
        /* Big but not insane */
    }

    40% {
        transform: translateX(-50%) translateY(-30px) scale(1.5);
    }

    70% {
        transform: translateX(-50%) translateY(-50px) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-80px) scale(0.8);
    }
}



@keyframes sparkle {

    0%,
    100% {
        opacity: 0;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.3);
    }
}


@keyframes floatUp {
    0% {
        transform: translate(-50%, 0);
    }

    50% {
        transform: translate(-50%, -10px);
    }

    100% {
        transform: translate(-50%, 0);
    }
}


@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(0, 255, 128, 0.3);
    }

    50% {
        box-shadow: 0 0 18px rgba(0, 255, 128, 0.7);
    }
}


@keyframes borderPulse {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 100% 50%;
    }
}


@keyframes scroll-title {
    0% {
        transform: translateX(0%);
    }

    100% {
        transform: translateX(-100%);
    }
}

@keyframes marquee-slide {
    0% {
        left: 100%;
    }

    100% {
        left: -100%;
    }
}

@media (max-width: 576px) {
    .player-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .player-controls {
        width: 100%;
        display: flex;
        justify-content: space-around;
    }

    .mini-player .song-info {
        max-width: 100%;
    }

    .main-title {
        font-size: 1.2rem;
        /* Smaller for phones */
    }
}


/* Media queries for small, medium, and large screens */
@media (max-width: 768px) {

    .fantasy-box,
    .lyrics-box,
    .song-card {
        padding: 1rem;
        font-size: 1rem;
    }

    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    #themeToggle {
        width: 100%;
        text-align: center;
    }

    .wave-container,
    #wave {
        height: 56px;
    }

    .lyrics-box {
        font-size: 1rem;
        line-height: 1.2;
    }

    .song-stats {
        font-size: 1.1rem;
    }

    .container {
        max-width: 100%;
        padding: 0 10px;
        margin: 0 auto;
    }

}

@media (max-width: 576px) {
    .song-card {
        flex: 1 1 100%;
    }

    .top-bar {
        text-align: center;
    }

    .btn {
        font-size: 0.9rem;
        padding: 0.4rem 0.75rem;
    }

    .lyrics-box,
    .fantasy-box {
        font-size: 0.95rem;
        padding: 1rem;
    }
}

/* Make sure comments don't overflow or break layout on small screens */
@media (max-width: 600px) {
    .comment-item {
        font-size: 0.95rem;
        padding: 10px;
    }

    #comments-container {
        max-height: 400px;
        padding: 5px;
    }
}

@media (max-width: 576px) {

    .fantasy-box,
    .lyrics-box,
    .song-card {
        padding: 1rem;
        font-size: 1rem;
    }

    .action-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }

    .action-buttons .btn {
        width: 100%;
    }

    .song-stats {
        font-size: 1.05rem;
    }

    .song-card {
        padding: 0.8rem;
    }

    #wave {
        height: 80px;
    }

    #disclaimerBox {
        font-size: 13px;
    }
}

@media (max-width: 990.98px) {
    .container {
        max-width: 100% !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
        margin: 0 auto !important;
    }

    body {
        font-size: 1.3em;
    }

    .btn-header-control {
        font-size: 0.8em;
    }
}

@media (max-width: 767.98px) {
    body {
        font-size: 1.2em;
    }
}