* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
}

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

/* Inline SVG icons (Material Symbols Rounded). The drawings live in a <symbol>
   sprite generated into index.html by scripts/build-icons.mjs; each icon is a
   <svg><use href="#ic-…"></svg>. Sized in em so the existing font-size rules
   keep controlling each icon, and colored via currentColor. */
.material-symbols-rounded {
    font-size: 24px;
    width: 1em;
    height: 1em;
    fill: currentColor;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    user-select: none;
}

/* The inline <symbol> sprite: present in the DOM but never painted. A class
   (not a style attribute) keeps style-src free of 'unsafe-inline'. */
.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

:root {
    /* Declare support for both themes so Chrome's "Auto Dark Mode for Web
       Contents" leaves the page alone (otherwise it force-inverts our colors —
       e.g. white text on the status card). Mirrored by a <meta color-scheme>
       in <head> for an early, strong signal. Only the dark state pins
       `color-scheme: dark` (.is-dark); never declare `light` alone, since that
       re-advertises a light page and re-arms auto-dark. */
    color-scheme: light dark;

    /* Alucard (Dracula light) */
    --main-color: #A3144D;      /* pink accent */
    --secondary-color: #644AC9; /* purple accent */
    --control-color: var(--secondary-color); /* controls: purple (Alucard) / pink (Dracula) */
    --light-black: #1F1F1F;     /* primary text (foreground) */
    --white-color: #FFFBEB;     /* card / surface (background) */
    --dark-white: #CFCFDE;      /* subtle surfaces / borders (selection) */
    --muted: #6C664B;           /* muted text (comment) */
    --light-shadow: rgba(0, 0, 0, 0.15);
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--white-color);
    transition: .5s;
}

.wrapper {
    width: 380px;
    padding: 25px 30px;
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background-color: var(--white-color);
    box-shadow: 0px 0px 15px 15px var(--light-shadow);
}

[role="button"] {
    cursor: pointer;
}

.top-bar,
.progress-area .timer,
.controls,
.music-list .header,
.music-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.top-bar svg {
    font-size: 2.3rem;
    color: var(--light-black);
}

.top-bar span {
    font-size: 18px;
    color: var(--light-black);
}

.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 30px;
    left: 0;
    z-index: 2;
    padding: 5px 5px;
    border-radius: 13px;
    background: var(--white-color);
    box-shadow: 0px -5px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.14s ease;
    overflow: hidden;
    opacity: 0;
}

.dropdown-content a {
    color: var(--light-black);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    border-radius: 10px;
}

.dropdown-content a:hover {
    background-color: var(--dark-white);
}

.show-dropdown {
    display: block;
    opacity: 1;
}

.img-area {
    width: 100%;
    height: 256px;
    margin-top: 25px;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0px 0px 15px 10px var(--light-shadow);
}

.text-area {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--light-black);
    font-size: 20px;
    text-align: center;
}

.song-details {
    text-align: center;
    color: var(--light-black);
    margin: 30px 0;
}

.song-details .name {
    font-size: 21px;
}

.song-details .artist {
    font-size: 18px;
    opacity: 0.9;
}

/* Progress Area */
.progress-area {
    width: 100%;
    height: 6px;

    background: var(--dark-white);
    border-radius: 50px;
    cursor: pointer;
}

.progress-area .progress-bar {
    width: 0%;
    height: inherit;
    position: relative;
    border-radius: inherit;
    background: var(--control-color);
}

.progress-bar::before {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    background: #000;
    border-radius: inherit;
    top: 50%;
    right: -5px;
    transform: translateY(-50%);
    background: inherit;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.progress-area:hover .progress-bar::before {
    opacity: 1;
}

.progress-area .timer {
    margin-top: 2px;
}

.timer span {
    font-size: 13px;
    color: var(--light-black);
}

/* Visible focus for keyboard navigation */
.wrapper [role="button"]:focus-visible,
.dropdown-content a:focus-visible {
    outline: 2px solid var(--control-color);
    outline-offset: 3px;
    border-radius: 4px;
}

/* Icons Controls */
.controls {
    margin: 40px 0 5px 0;
}

.controls > svg {
    font-size: 30px;
    user-select: none;
    color: var(--control-color);
}

.controls > svg:nth-child(2),
.controls > svg:nth-child(4) {
    font-size: 43px;
}

.controls #prev {
    margin-right: -13px;
}

.controls #next {
    margin-left: -13px;
}

/* Loop toggle: accent color while active (looping), muted when off */
#repeat-plist[aria-pressed="false"] {
    color: var(--muted);
}

.controls .play-pause {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Single play_circle / pause_circle glyph — the circle is the button */
.play-pause svg {
    font-size: 73px;
    color: var(--control-color);
}

/* Play / pause crossfade — show one glyph at a time based on the playing state
   (the `playing` class is present on .wrapper while a song plays). */
.play-pause .icon-pause {
    display: none;
}

.wrapper.playing .play-pause .icon-play {
    display: none;
}

.wrapper.playing .play-pause .icon-pause {
    display: inline-block;
}

/* Music List */
.music-list {
    width: 100%;
    position: absolute;
    left: 0;
    bottom: -55%;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    padding: 15px 30px;
    border-radius: 15px;
    background: var(--white-color);
    box-shadow: 0px -5px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.14s ease;
}

/* Class used by the JS */
.music-list.show {
    bottom: 0;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.music-list .header .row {
    display: flex;
    align-items: center;
    font-size: 19px;
    color: var(--light-black);
}

.header .row svg {
    cursor: default;
}

.header .row span {
    margin-left: 5px;
}

.header #close {
    font-size: 22px;
    color: var(--light-black);
}

.music-list ul {
    margin: 10px 0;
    max-height: 260px;
    overflow-y: auto;
}

.music-list ul::-webkit-scrollbar {
    width: 0px;
}

.music-list ul li {
    list-style: none;
    padding-bottom: 10px;
    margin-bottom: 5px;
    color: var(--light-black);
    border-bottom: 1px solid var(--dark-white);
    cursor: pointer;
    position: relative;
}

/* Transparent <button> overlay that makes the whole row activatable and
   keyboard-focusable without changing how the row looks. */
.li-play {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.li-play:focus-visible {
    outline: 2px solid var(--control-color);
    outline-offset: 3px;
    border-radius: 4px;
}

.music-list ul li:last-child {
    border-bottom: 0px;
}

.music-list ul li .row span {
    font-size: 17px;
}

ul li .row p {
    opacity: 0.9;
}

ul li .audio-duration {
    font-size: 16px;
}

/* Dark Mode Button */
.dark-mode {
    display: flex;
    width: 40px;
    height: 40px;
    position: relative;
    background: var(--dark-white);
    border-radius: 50%;
    transition: .5s;
}

.dark-mode svg {
    position: absolute;
    top: 50%;
    left: 50%;
    font-size: 1.3rem;
    transform: translate(-50%, -50%);
    transition: .5s;
}

/* Scoped under .dark-mode so the color beats `.top-bar i`'s specificity */
.dark-mode .moon-light {
    color: var(--control-color);
}

.dark-mode .moon-dark {
    color: var(--light-black);
    opacity: 0;
    visibility: hidden;
}

.is-dark {
    color-scheme: dark;
    /* Dracula (dark) — override the theme tokens; component styles follow */
    --main-color: #FF79C6;      /* pink accent */
    --secondary-color: #BD93F9; /* purple accent */
    --control-color: var(--main-color); /* controls stay pink in Dracula */
    --muted: #6272A4;           /* comment */
    --dark-white: #44475A;      /* subtle surfaces / borders (selection) */
    --white-color: #282A36;     /* surface (background) */
    --light-black: #F8F8F2;     /* primary text (foreground) */
}

/* Dark-mode moon crossfade — visibility only; colors follow the tokens */
.is-dark .moon-light {
    opacity: 0;
    visibility: hidden;
}

.is-dark .moon-dark {
    opacity: 1;
    visibility: visible;
}

/* Timer muted in dark, but lightened to meet WCAG AA (4.5:1) on the surface */
.is-dark .timer span {
    color: #8b95c4;
}

/* Full screen on viewports up to 1024px (mobile and tablets) */
@media (max-width: 1024px) {
    .wrapper {
        display: inline-grid;
        align-items: center;
        width: 100%;
        height: 100vh;
        padding: 20px;
        padding-bottom: 50px;
        padding-top: 50px;
        box-shadow: none;
        border-radius: 0;
    }

    body {
        height: 100vh;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@media (orientation: landscape) and (max-width: 1024px) {
    .wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
        height: 100vh;
        padding: 20px;
        box-shadow: none;
        border-radius: 0;
    }

    body {
        height: 100vh;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .top-bar {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
    }

    .controls {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
    }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}