* {
    box-sizing: border-box;
}

:root {
    font-family: Tahoma, Arial, sans-serif;
    color: #222;
    font-size: 12px;
}

body {
    margin: 0;
    overflow: hidden;
    background: #3a91c8;
}

button {
    font: inherit;
    cursor: pointer;
}

.desktop {
    height: calc(100vh - 34px);
    padding: 18px;
    background: url("/images/background.png") center center / cover no-repeat fixed;
    position: relative;
}

.desktop::after {
    content: none;
}

.desktop-icons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 85px;
    position: relative;
    z-index: 1;
}

.desktop-icon {
    border: 0;
    color: white;
    background: transparent;
    text-shadow: 1px 1px 3px #123;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 5px;
}

.desktop-icon span {
    font-size: 30px;
}

.desktop-icon small {
    font-size: 12px;
}

.desktop-icon:hover {
    background: #ffffff35;
    outline: 1px dotted white;
}

.window {
    position: absolute;
    z-index: 2;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: min(1050px, calc(100vw - 145px));
    height: min(690px, 87%);
    min-height: 380px;
    background: #ece9d8;
    border: 1px solid #083b8c;
    border-radius: 8px 8px 0 0;
    box-shadow: 3px 4px 18px #163b5c85;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.titlebar {
    height: 34px;
    flex-shrink: 0;
    padding: 0 7px 0 11px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    background: linear-gradient(180deg, #3b83e6, #1458c5 48%, #2675dd);
    border-bottom: 1px solid #0d3e9c;
    text-shadow: 1px 1px #123c85;
}

.window-title {
    display: flex;
    gap: 7px;
    align-items: center;
    font-size: 13px;
}

.window-controls {
    display: flex;
    gap: 3px;
}

.window-controls button {
    color: white;
    font-weight: bold;
    width: 23px;
    height: 22px;
    border: 1px solid white;
    border-radius: 4px;
    background: linear-gradient(#83b6f4, #2866c9);
    line-height: 15px;
    font-size: 15px;
}

.window-controls .close-btn {
    background: linear-gradient(#f99b83, #d83b1e);
}

.menu-bar {
    height: 25px;
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 0 12px;
    background: #ece9d8;
    border-bottom: 1px solid #d4d0c2;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 43px;
    padding: 5px 9px;
    background: #f5f4ed;
    border-bottom: 1px solid #c7c4b8;
}

.toolbar button, .xp-button {
    border: 1px solid #aaa89e;
    border-radius: 3px;
    padding: 5px 10px;
    background: linear-gradient(#fff, #e5e3d8);
    color: #222;
}

.toolbar button:disabled {
    color: #999;
    cursor: default;
}

.address-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    color: #555;
}

.address-bar div {
    flex: 1;
    background: white;
    border: 1px solid #aaa;
    padding: 5px;
    color: #222;
}

.main-content {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: white;
}

.sidebar {
    width: 190px;
    flex-shrink: 0;
    padding: 12px 9px;
    overflow-y: auto;
    background: linear-gradient(90deg, #f1f5fc, #e4ecf8);
    border-right: 1px solid #c6d2e2;
}

.sidebar-section {
    margin-bottom: 13px;
    border: 1px solid #c4d5ed;
    border-radius: 5px;
    overflow: hidden;
    background: #f5f8fd;
}

.sidebar-heading {
    padding: 7px 9px;
    color: #15428b;
    font-weight: bold;
    background: linear-gradient(#e7f0fc, #cbdcf3);
}

.sidebar-section button,
.sidebar-place {
    display: block;
    width: 100%;
    padding: 8px;
    text-align: left;
    border: 0;
    color: #164b9b;
    background: transparent;
}

.sidebar-section button:hover {
    text-decoration: underline;
}

#sidebarDetails {
    padding: 10px;
    line-height: 1.6;
}

#sidebarDetails p {
    color: #555;
}

.content-area {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 18px;
}

.content-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #ddd;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.content-heading h1 {
    margin: 0 0 5px;
    font-size: 21px;
    font-weight: normal;
    color: #174b91;
}

.content-heading p {
    margin: 0;
    color: #666;
}

#itemCount {
    color: #777;
}

.playlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 20px;
}

.playlist-card {
    border: 1px solid transparent;
    padding: 9px;
    background: transparent;
    text-align: left;
    min-width: 0;
    color: #222;
}

.playlist-card:hover {
    border: 1px solid #9bbce5;
    background: #eaf2fc;
}

.playlist-card img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #dce5ef;
    border: 1px solid #c6c6c6;
    margin-bottom: 9px;
}

.playlist-card strong {
    display: block;
    font-size: 13px;
    color: #164b91;
    overflow-wrap: anywhere;
}

.playlist-card small {
    display: block;
    margin-top: 5px;
    color: #666;
}

.message {
    padding: 25px;
    text-align: center;
    color: #555;
}

.error {
    color: #a00;
}

.playlist-header {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 5px 0 18px;
    border-bottom: 1px solid #ddd;
    margin-bottom: 14px;
}

.playlist-header img {
    width: 115px;
    height: 115px;
    object-fit: cover;
    border: 1px solid #bbb;
    background: #eee;
}

.playlist-header h2 {
    margin: 0 0 8px;
    font-size: 20px;
    color: #174b91;
}

.playlist-header p {
    color: #666;
    margin: 5px 0;
}

.xp-button {
    margin-top: 8px;
    color: #164b91;
}

.track-heading, .track-row {
    display: grid;
    grid-template-columns: 32px minmax(120px, 2fr) minmax(90px, 1.5fr) 65px;
    gap: 9px;
    align-items: center;
}

.track-heading {
    padding: 8px;
    color: #555;
    font-weight: bold;
    background: linear-gradient(#f7f7f7, #e8e8e8);
    border: 1px solid #ddd;
}

.track-row {
    padding: 8px;
    min-height: 58px;
    border-bottom: 1px solid #e7e7e7;
    cursor: pointer;
}

.track-row:hover {
    background: #edf4fd;
}

.track-row.active {
    background: #dceafa;
}

.track-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.track-info img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    background: #ddd;
    flex-shrink: 0;
}

.track-info strong, .track-info small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-info small {
    margin-top: 4px;
    color: #777;
}

.track-album {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #555;
}

.track-duration {
    text-align: right;
    color: #666;
}

.player {
    flex-shrink: 0;
    min-height: 78px;
    padding: 8px 12px;
    display: grid;
    grid-template-columns: minmax(130px, 1fr) minmax(190px, 1.5fr) minmax(90px, .7fr);
    align-items: center;
    gap: 12px;
    background: linear-gradient(#f7f6ee, #e3e0d3);
    border-top: 1px solid #b9b6aa;
}

.now-playing {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.now-playing img {
    width: 45px;
    height: 45px;
    object-fit: cover;
    background: #ddd;
}

.now-text {
    min-width: 0;
}

.now-text strong, .now-text small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.now-text small {
    margin-top: 5px;
    color: #666;
}

.player-controls {
    min-width: 0;
}

.control-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 7px;
}

.control-buttons button {
    border: 1px solid #aaa;
    border-radius: 4px;
    background: linear-gradient(white, #ddd);
    min-width: 30px;
    height: 25px;
}

.control-buttons .play-button {
    min-width: 43px;
    color: #164b91;
    font-weight: bold;
}

.progress-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    color: #555;
}

input[type="range"] {
    accent-color: #2865c7;
    min-width: 0;
}

#seekBar {
    flex: 1;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

#volumeBar {
    width: 100%;
}

.statusbar {
    height: 22px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    color: #555;
    background: #ece9d8;
    border-top: 1px solid #ccc;
}

.taskbar {
    position: fixed;
    z-index: 10;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 34px;
    display: flex;
    align-items: center;
    background: linear-gradient(#245edb, #1748b5 55%, #245edb);
    border-top: 1px solid #6b9bea;
    box-shadow: 0 -2px 5px #234c7b55;
}

.start-button {
    height: 34px;
    padding: 0 18px 0 12px;
    color: white;
    font-size: 15px;
    font-weight: bold;
    font-style: italic;
    border: 0;
    border-radius: 0 15px 15px 0;
    background: linear-gradient(#78c85b, #258a27 50%, #176d20);
    text-shadow: 1px 1px #246024;
}

.start-button span {
    font-size: 19px;
}

.taskbar-divider {
    height: 24px;
    width: 2px;
    margin: 0 8px;
    background: #8eace6;
}

.taskbar-window {
    height: 27px;
    width: 180px;
    text-align: left;
    padding-left: 10px;
    color: white;
    border: 1px solid #6689d0;
    border-radius: 3px;
    background: linear-gradient(#386ed0, #194aaf);
}

.system-tray {
    margin-left: auto;
    height: 100%;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    background: linear-gradient(#3985e2, #245bb9);
    border-left: 1px solid #17469d;
}

.start-menu {
    position: fixed;
    z-index: 20;
    bottom: 34px;
    left: 0;
    width: 260px;
    padding: 0 0 10px;
    background: #fff;
    border: 2px solid #245edb;
    border-radius: 7px 7px 0 0;
    box-shadow: 3px -3px 12px #0005;
}

.start-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    color: white;
    font-size: 15px;
    background: linear-gradient(#4e91ed, #1551b9);
}

.start-header span {
    font-size: 25px;
}

.start-menu button {
    display: block;
    width: 100%;
    padding: 12px;
    text-align: left;
    border: 0;
    background: white;
}

.start-menu button:hover {
    background: #dceafa;
}

.start-footer {
    padding: 10px;
    text-align: right;
    color: white;
    background: linear-gradient(#2866cf, #1749a6);
}

[hidden] {
    display: none !important;
}

.window.maximized {
    top: 0;
    width: calc(100vw - 20px);
    height: calc(100vh - 34px);
    border-radius: 0;
}

.window.minimized {
    display: none;
}

@media (max-width: 650px) {
    .desktop {
        padding: 0;
    }

    .desktop-icons {
        display: none;
    }

    .window {
        top: 0;
        left: 0;
        transform: none;
        width: 100%;
        height: calc(100% - 0px);
        border-radius: 0;
    }

    .sidebar {
        display: none;
    }

    .content-area {
        padding: 12px;
    }

    .playlist-grid {
        grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
        gap: 8px;
    }

    .player {
        grid-template-columns: 1fr 1.3fr;
        gap: 6px;
    }

    .volume-control {
        display: none;
    }

    .track-heading, .track-row {
        grid-template-columns: 25px minmax(110px, 2fr) 65px;
    }

    .track-heading span:nth-child(3),
    .track-row .track-album {
        display: none;
    }

    .playlist-header img {
        width: 85px;
        height: 85px;
    }

    .menu-bar {
        gap: 12px;
        font-size: 11px;
    }
}


/* Reliable Windows-style hide and close behaviour */
[hidden] {
    display: none !important;
}

.window.minimized {
    display: none !important;
}


/* Panamis listening statistics */
.most-played-section {
    margin: 0 0 20px;
}

.most-played-heading {
    margin-bottom: 10px;
}

.most-played-heading h2 {
    margin: 0 0 4px;
    font-size: 16px;
    color: #17365d;
}

.most-played-heading p {
    margin: 0;
    color: #666;
    font-size: 11px;
}

.most-played-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 8px;
}

.most-played-card {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    padding: 10px;
    min-width: 0;
    text-align: left;
    color: #222;
    background: linear-gradient(#fff, #edf4fc);
    border: 1px solid #b7c9dc;
    border-radius: 4px;
}

.most-played-rank {
    font-size: 17px;
    font-weight: bold;
    color: #3169a5;
    text-align: center;
}

.most-played-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.most-played-info strong,
.most-played-info small {
    overflow-wrap: anywhere;
}

.most-played-info strong {
    font-size: 12px;
}

.most-played-info small {
    font-size: 10px;
    color: #555;
}

.most-played-info .most-played-stats {
    color: #245b91;
    font-weight: bold;
}

/* Panamis Most Streamed tab */
.ranking-section {
    margin: 18px 0 24px;
}

.ranking-section h3 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #17365d;
}

