body {
    margin: 0;
    background: black;
    overflow: hidden;
    font-family: Arial;
    -webkit-tap-highlight-color: transparent;
}

/* HOME */
#home {
    position: fixed;
    inset: 0;
    background: url("background.png") center/cover ;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
}

#home::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

#homeContent {
    position: relative;
    z-index: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#homeArtistName {
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 3;
    font-size: 12px;
    color: white;
    opacity: 0.85;
    max-width: calc(100% - 32px);
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

#home input {
    padding: 10px;
    width: 240px;
    border-radius: 6px;
    border: none;
}

.tagInputWrapper {
    position: relative;
    display: block;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    text-align: left;
}

.tagInputWrapper input {
    width: 100%;
    box-sizing: border-box;
}

.suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    background: rgba(15, 15, 20, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    max-height: 200px;
    overflow: hidden;
    z-index: 30;
    display: none;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
}

.suggestions.active {
    display: block;
}

.suggestionItem {
    display: block;
    width: 100%;
    padding: 8px 12px;
    text-align: left;
    cursor: pointer;
    color: #e9e9e9;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 14px;
    line-height: 1.5;
}

.suggestionItem:last-child {
    border-bottom: none;
}

.suggestionItem:hover,
.suggestionItem.selected {
    background: rgba(255, 255, 255, 0.08);
}

#home button {
    margin-top: 10px;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    background: rgb(43, 83, 142);
}

#mediaSwitch {
    display: inline-flex;
    gap: 8px;
    margin-bottom: 10px;
}

#mediaSwitch button {
    width: 46px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
    padding: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.18);
}

#mediaSwitch button.active {
    background: rgba(255, 255, 255, 0.38);
}

#homeLibraryButtons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

#homeLibraryButtons button {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
    padding: 0;
    border-radius: 50%;
}

/* FEED */
#feed {
    position: fixed;
    inset: 0;
    display: none;
}

/* MEDIA */
video,
#feed img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: black;
}

/* UI */
#ui {
    position: fixed;
    right: 10px;
    bottom: 140px;
    display: none;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
}

body.feedActive #ui {
    display: flex;
}

#homeBtn {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 12;
    width: 46px;
    height: 46px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}

body.feedActive #homeBtn {
    display: inline-flex;
}

button {
    padding: 12px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 18px;
}

#ui button,
#volumeContainer button {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* VOLUME */
#volumeContainer {
    position: fixed;
    right: 10px;
    bottom: 10px;
    display: none;
    gap: 8px;
    z-index: 15;
}

body.feedActive #volumeContainer {
    display: flex;
}

#volume {
    width: 120px;
}

/* INFO */
#info {
    position: fixed;
    bottom: 0;
    width: 100%;
    padding: 15px;
    color: white;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    display: none;
}

body.feedActive #info {
    display: block;
}

#progressBar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 12px;
    background: transparent;
    cursor: pointer;
    z-index: 14;
    touch-action: none;
    display: none;
}

#progressFill {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.55);
    transform: scaleX(0);
    transform-origin: left;
    transition: height 0.15s ease, background 0.15s ease;
}

#progressBar::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
}

#progressBar:hover #progressFill,
#progressBar:focus-visible #progressFill {
    height: 5px;
    background: rgba(255, 255, 255, 0.72);
}

/* OVERLAY */
#overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 20;
}

#overlayBox {
    background: #111;
    padding: 20px;
    border-radius: 12px;
    max-width: 80%;
}

.linkItem {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
}

.linkItem img {
    width: 20px;
}

#closeBtn {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 0%;
}

#libraryOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: none;
    justify-content: flex-end;
    align-items: stretch;
    z-index: 25;
}

#libraryBox {
    width: min(420px, 100%);
    background: #101010;
    color: white;
    padding: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#libraryHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

#libraryHeader button,
.libraryTab,
.libraryItem,
#clearLibraryBtn {
    border-radius: 6px;
    font-size: 14px;
}

#libraryTabs {
    display: flex;
    gap: 8px;
    margin: 16px 0;
}

.libraryTab {
    flex: 1;
    padding: 10px;
}

.libraryTab.active {
    background: rgba(255, 255, 255, 0.35);
}

#clearLibraryBtn {
    width: 100%;
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(255, 80, 80, 0.22);
}

#clearLibraryBtn:disabled {
    cursor: default;
    opacity: 0.45;
}

#libraryList {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: auto;
    padding-right: 4px;
}

.libraryItem {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px;
    text-align: left;
}

.libraryItem small,
.emptyLibrary {
    color: rgba(255, 255, 255, 0.65);
}

.emptyLibrary {
    padding: 20px 4px;
}

@media (pointer: coarse), (max-width: 900px) {
    #homeContent {
        width: min(88vw, 420px);
    }

    #home input {
        box-sizing: border-box;
        width: 100%;
        min-height: 48px;
        font-size: 16px;
    }

    #home button {
        min-height: 48px;
        font-size: 16px;
    }

    #mediaSwitch {
        width: 100%;
    }

    #mediaSwitch button {
        flex: 1;
        height: 52px;
        font-size: 22px;
    }

    #homeLibraryButtons button {
        width: 58px;
        height: 58px;
        font-size: 22px;
    }

    #homeLibraryButtons {
        bottom: calc(22px + env(safe-area-inset-bottom));
    }

    #ui {
        right: max(12px, env(safe-area-inset-right));
        bottom: calc(170px + env(safe-area-inset-bottom));
        gap: 12px;
    }

    #homeBtn {
        top: calc(14px + env(safe-area-inset-top));
        right: max(14px, env(safe-area-inset-right));
        width: 58px;
        height: 58px;
        font-size: 22px;
    }

    #ui button,
    #volumeContainer button {
        width: 58px;
        height: 58px;
        font-size: 22px;
    }

    #volumeContainer {
        left: max(12px, env(safe-area-inset-left));
        right: max(12px, env(safe-area-inset-right));
        bottom: calc(22px + env(safe-area-inset-bottom));
        align-items: center;
        gap: 12px;
    }

    #volume {
        flex: 1;
        width: auto;
        height: 36px;
    }

    #ui button[onclick="prev()"],
    #ui button[onclick="next()"] {
        display: none;
    }

    #info {
        box-sizing: border-box;
        padding: 18px 84px 22px 16px;
        font-size: 16px;
    }

    #progressBar {
        height: 28px;
        bottom: env(safe-area-inset-bottom);
    }

    #progressFill,
    #progressBar::before {
        height: 6px;
    }

    #progressBar:hover #progressFill,
    #progressBar:focus-visible #progressFill {
        height: 8px;
    }

    #libraryBox {
        width: 100%;
        padding: 18px;
    }

    #libraryHeader button,
    .libraryTab,
    .libraryItem,
    #clearLibraryBtn {
        min-height: 46px;
        font-size: 16px;
    }
}

body.touchDevice #progressBar {
    height: 28px;
}

body.touchDevice #progressFill,
body.touchDevice #progressBar::before {
    height: 6px;
}

body.touchDevice #volumeContainer {
    left: auto;
    right: max(12px, env(safe-area-inset-right));
    width: auto;
}

body.touchDevice #volume {
    display: none;
}

#warningModal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.88);
    z-index: 40;
}

#warningBox {
    background: #111;
    color: white;
    padding: 24px;
    width: min(420px, 92vw);
    border-radius: 16px;
    text-align: center;
}

#warningBox h2 {
    margin-top: 0;
}

#warningBox p {
    margin: 16px 0;
    line-height: 1.5;
}

.modalActions {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.modalActions button {
    padding: 12px 18px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.14);
    color: white;
    cursor: pointer;
}

.modalActions button:first-child {
    background: rgba(43, 83, 142, 0.95);
}

.modalActions button:last-child {
    background: rgba(255, 50, 50, 0.85);
}

/* RECENT SEARCHES */
#recentSearches .searchTag {
    padding: 6px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
    border: none;
}

#recentSearches .searchTag:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* PATCHNOTE MODAL */
#patchnoteModal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.88);
    z-index: 35;
}

#patchnoteBox {
    background: linear-gradient(135deg, #3f1061, #560c9b);
    color: white;
    padding: 24px;
    width: min(500px, 92vw);
    border-radius: 16px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

#patchnoteBox::before {
    content: "✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    font-size: 20px;
    line-height: 30px;
    color: rgba(255, 255, 255, 0.3);
    pointer-events: none;
    z-index: -1;
}

#patchnoteBox h2 {
    margin-top: 0;
    font-size: 24px;
}

#patchnoteBox ul {
    text-align: left;
    margin: 20px 0;
    padding-left: 20px;
}

#patchnoteBox li {
    margin-bottom: 8px;
    line-height: 1.5;
}

#patchnoteHeader {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
}

#patchnoteHeader h2 {
    margin: 0;
    font-size: 24px;
}

#patchnoteSelect {
    padding: 10px 12px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px;
    cursor: pointer;
    min-width: 200px;
    transition: all 0.2s ease;
}

#patchnoteSelect:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

#patchnoteSelect:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.7);
}

#patchnoteSelect option {
    background: #3f1061;
    color: white;
}

#patchnoteContent {
    max-height: 300px;
    overflow-y: auto;
    text-align: left;
}

#patchnoteContent h3 {
    margin: 15px 0 10px 0;
    font-size: 18px;
}

#patchnoteContent ul {
    margin: 10px 0;
    padding-left: 20px;
}

#patchnoteContent li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* ACCOUNT MODAL */
#accountModal {
    display: none !important;
}

#accountModal.show {
    display: flex !important;
}

#accountContent {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#accountContent input,
#accountContent button {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 14px;
}

#accountContent input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#accountContent button {
    cursor: pointer;
    background: rgb(43, 83, 142);
    border: none;
    margin-top: 8px;
}

#accountContent button:hover {
    background: rgb(53, 103, 162);
}

.accountSection {
    padding: 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}

#backgroundPostIdInput,
#blacklistInput {
    width: 100%;
    box-sizing: border-box;
}

#backgroundPreview {
    background: rgba(255, 255, 255, 0.06);
    padding: 10px;
    border-radius: 10px;
}

#backgroundPreview img {
    width: 100%;
    height: auto;
    border-radius: 10px;
}

.accountSection h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 14px;
}

.tagBadge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    font-size: 12px;
    margin: 3px;
}
