* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #ffffff;
    background-image: radial-gradient(ellipse at top, #eeeeee 0%, #ffffff 60%);
    color: #111111;
    font-family: Arial, sans-serif;
    min-height: 100vh;
}

/* --- Header --- */
header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 30px;
    border-bottom: 1px solid #dddddd;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo img { height: 44px; width: auto; }

#page-tabs { display: flex; gap: 4px; flex: 1; justify-content: center; }
.page-tab {
    background: transparent;
    border: none;
    color: #666;
    padding: 6px 14px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    text-decoration: none;
    font-family: 'Roboto', Arial, sans-serif;
    transition: color 0.15s, background 0.15s;
}
.page-tab:hover { color: #111; background: #f0f0f0; }
.page-tab.active { color: #111; font-weight: 600; }

.auth-buttons { display: flex; gap: 10px; margin-left: auto; }

header .site-title {
    font-size: 1.6rem;
    letter-spacing: 2px;
    color: #000000;
    font-weight: bold;
}

header .site-title a {
    color: inherit;
    text-decoration: none;
}

header .site-title a:hover {
    opacity: 0.8;
}

.back-link {
    color: #555555;
    text-decoration: none;
    font-size: 0.85rem;
}

.back-link:hover {
    color: #000000;
}

/* --- Auth Header --- */
.auth-buttons { display: flex; gap: 10px; }

.btn-signup {
    background: #000000;
    color: #ffffff;
    border: 1px solid #000000;
    border-radius: 6px;
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-signup:hover { background: #333333; }

.header-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e5e5e5;
    border: 1px solid #000000;
    font-size: 0.65rem;
    font-weight: bold;
    color: #000000;
    margin-right: 6px;
    vertical-align: middle;
    background-size: cover;
    background-position: center;
}

.user-menu { position: relative; }

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 5px 12px 5px 6px;
    color: #333333;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.user-menu-trigger:hover { border-color: #555; color: #000000; }

.user-menu-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: #e1e1e1;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
    min-width: 150px;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.user-dropdown.open { display: block; }

.user-dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: #333333;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.user-dropdown-item:hover { background: #d5d5d5; color: #000000; }

.user-dropdown-logout { border-top: 1px solid #d5d5d5; color: #555555; }
.user-dropdown-logout:hover { background: #e5e5e5; color: #333333; }


/* --- Layout --- */
#album-layout {
    display: flex;
    gap: 40px;
    max-width: 1100px;
    margin: 40px auto 60px;
    padding: 0 30px;
    align-items: flex-start;
}

#album-left {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

#album-right {
    flex: 1;
    min-width: 0;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

/* --- Hero --- */
#hero {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#hero-art {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    border: 1px solid #d5d5d5;
}

#hero-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#hero-title {
    font-size: 2rem;
    color: #000000;
    line-height: 1.2;
}

#hero-composer {
    font-size: 1rem;
    color: #555555;
}

.composer-link {
    color: #000000;
    text-decoration: none;
}

.composer-link:hover {
    text-decoration: underline;
}

.release-date {
    font-size: 0.8rem;
    color: #555555;
}

#rating-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-top: 4px;
}

#album-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.album-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #ccc;
    background: none;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    padding: 0;
}

.album-action-btn:hover:not(:disabled) {
    border-color: #888;
    color: #333;
}

.album-action-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.album-action-btn.listened-active {
    border-color: #1a7fd4;
    background: rgba(26,127,212,0.12);
}

.album-action-btn.listened-active svg {
    stroke: #1a7fd4;
}

.album-action-btn.favorite-active {
    border-color: #cc0000;
    background: rgba(204,0,0,0.1);
}

.album-action-btn.favorite-active svg {
    stroke: #cc0000;
    fill: #cc0000;
}

#favorite-btn:not(.favorite-active):hover:not(:disabled) {
    border-color: #cc0000;
    background: rgba(204,0,0,0.08);
    color: #cc0000;
}

#favorite-btn:not(.favorite-active):hover:not(:disabled) svg {
    stroke: #cc0000;
}

#favorite-btn.favorite-active:hover:not(:disabled) {
    border-color: #888888;
    background: rgba(0,0,0,0.12);
}

#favorite-btn.favorite-active:hover:not(:disabled) svg {
    stroke: #888888;
    fill: #888888;
}

html.dark #favorite-btn:not(.favorite-active):hover:not(:disabled) {
    border-color: #ff4444;
    background: rgba(255,68,68,0.12);
    color: #ff4444;
}

html.dark #favorite-btn:not(.favorite-active):hover:not(:disabled) svg {
    stroke: #ff4444;
}

html.dark #favorite-btn.favorite-active:hover:not(:disabled) {
    border-color: #aaaaaa;
    background: rgba(255,255,255,0.1);
}

html.dark #favorite-btn.favorite-active:hover:not(:disabled) svg {
    stroke: #aaaaaa;
    fill: #aaaaaa;
}

.list-btn-wrap {
    position: relative;
}

.list-modal {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 200;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 220px;
    max-height: 320px;
    flex-direction: column;
    overflow: hidden;
}

#list-modal-lists {
    overflow-y: auto;
    flex: 1;
    padding: 6px 0;
}

.list-modal-status {
    padding: 12px 14px;
    color: #888;
    font-size: 0.85rem;
    margin: 0;
}

.list-modal-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 0.9rem;
    color: #333;
    transition: background 0.1s;
}

.list-modal-item:hover {
    background: #f5f5f5;
}

.list-check-icon {
    flex-shrink: 0;
    opacity: 0;
}

.list-modal-item.in-list .list-check-icon {
    opacity: 1;
    stroke: #1a7fd4;
}

.list-modal-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid #eee;
}

.list-modal-footer input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
    background: #fff;
    color: #333;
}

.list-modal-footer input:focus {
    border-color: #888;
}

.list-modal-footer button {
    padding: 6px 12px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: background 0.15s;
}

.list-modal-footer button:hover {
    background: #555;
}

.list-modal-footer button:disabled {
    opacity: 0.5;
}

#stars {
    display: flex;
    gap: 4px;
    cursor: pointer;
}

.star-wrap {
    position: relative;
    display: inline-block;
    font-size: 2rem;
    line-height: 1;
    user-select: none;
    transition: transform 0.12s ease;
}

.star-wrap:hover {
    transform: scale(1.2);
}

.star-bg {
    display: block;
    color: #ddd;
    pointer-events: none;
    transition: color 0.15s;
}

.star-fg {
    position: absolute;
    top: 0;
    left: 0;
    color: #f5a623;
    clip-path: inset(0 100% 0 0);
    pointer-events: none;
    transition: clip-path 0.12s ease;
    filter: drop-shadow(0 0 4px rgba(245, 166, 35, 0.5));
}

.star-wrap.star-pop {
    animation: starPop 0.25s ease;
}

@keyframes starPop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.4); }
    100% { transform: scale(1); }
}

#rating-summary {
    font-size: 0.78rem;
    color: #555555;
    margin-top: 4px;
}

#streaming-links {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.streaming-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: opacity 0.2s, transform 0.2s;
}

.streaming-btn:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

.streaming-btn svg {
    width: 18px;
    height: 18px;
}

.apple-btn {
    background: #000000;
    color: #ffffff;
}

.spotify-btn {
    background: #1db954;
    color: #000000;
}

.text-btn {
    width: auto;
    height: 36px;
    border-radius: 18px;
    padding: 0 14px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #d5d5d5;
    color: #333;
    white-space: nowrap;
    text-decoration: none;
}


.detail-section h2 {
    font-size: 1rem;
    color: #000000;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dddddd;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.detail-section p {
    font-size: 0.85rem;
    color: #555555;
    line-height: 1.8;
}

.detail-section p.source-line {
    margin-top: 10px;
    font-size: 0.75rem;
    color: #555555;
}

.source-line a {
    color: #555555;
    text-decoration: none;
}

.source-line a:hover {
    color: #555555;
    text-decoration: underline;
}

/* --- Track List --- */
#tracklist {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#tracklist li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: #e5e5e5;
    border-radius: 4px;
    border: 1px solid #d5d5d5;
    font-size: 0.8rem;
    color: #333333;
}

#tracklist li:hover {
    border-color: #bbbbbb;
}

#tracklist .track-num {
    color: #555555;
    font-size: 0.75rem;
    min-width: 20px;
}

#tracklist .track-duration {
    margin-left: auto;
    color: #555555;
    font-size: 0.75rem;
}

/* --- Related Albums --- */
#related-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#related-list li {
    font-size: 0.85rem;
}

#related-list a {
    color: #000000;
    text-decoration: none;
}

#related-list a:hover {
    text-decoration: underline;
}

/* --- Sources --- */
#sources-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#sources-list li {
    font-size: 0.8rem;
    color: #555555;
}

#sources-list a {
    color: #000000;
    text-decoration: none;
}

#sources-list a:hover {
    text-decoration: underline;
}

/* --- Tags --- */
.tag { font-size: 0.7rem; font-weight: bold; padding: 4px 12px; border-radius: 20px; text-transform: uppercase; letter-spacing: 1px; display: inline-block; align-self: flex-start; }
.tag.game, .tag.anime, .tag.movie, .tag.tvshow { background: #e5e5e5; color: #000000; border: 1px solid #ccc; }

/* --- Responsive --- */
@media (max-width: 750px) {

    header {
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 6px;
    }
    .logo img { width: 28px; height: 28px; }
    .site-title { font-size: 1.2rem; letter-spacing: 1px; }
    .auth-buttons { gap: 6px; }
    .btn-login, .btn-signup { padding: 6px 11px; font-size: 0.78rem; }
    .theme-toggle { font-size: 1rem; }

    #album-layout {
        flex-direction: column;
        margin: 20px auto 40px;
        padding: 0 14px;
        gap: 24px;
    }

    #album-left {
        width: 100%;
        flex-direction: row;
        align-items: flex-start;
        gap: 16px;
    }

    #hero-art {
        width: 130px;
        height: 130px;
        aspect-ratio: 1 / 1;
        flex-shrink: 0;
        border-radius: 8px;
    }

    #hero-info { flex: 1; min-width: 0; }

    #hero-title { font-size: 1.3rem; }
    #hero-composer { font-size: 0.85rem; }
    #hero-release { font-size: 0.8rem; }
    .tag { font-size: 0.7rem; padding: 2px 8px; }

    .album-action-btn { width: 34px; height: 34px; font-size: 0.85rem; }

    #album-right {
        position: static;
        max-height: none;
        overflow-y: visible;
    }

    #tracklist li { padding: 10px 12px; }
    .track-num { min-width: 22px; font-size: 0.75rem; }
    .track-name { font-size: 0.85rem; }
    .track-duration { font-size: 0.75rem; }

    #comments-section { padding: 0 14px; }

    .modal-box {
        width: 94%;
        padding: 22px 16px;
    }
}

/* --- Comments --- */
#comments-section {
    max-width: 1100px;
    margin: 0 auto 60px;
    padding: 0 30px;
}

.comments-heading {
    font-size: 1rem;
    color: #000000;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dddddd;
    margin-bottom: 20px;
}

.comments-heading span {
    font-size: 0.8rem;
    color: #555;
    font-weight: normal;
    letter-spacing: 0;
    text-transform: none;
}

#comments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.comment {
    background: #ebebeb;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px 16px;
}

.comment-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 6px;
}

.comment-author {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333333;
}

.comment-time {
    font-size: 0.75rem;
    color: #555555;
}

.comment-text {
    font-size: 0.85rem;
    color: #555555;
    line-height: 1.6;
    white-space: pre-wrap;
}

.comments-empty,
.comments-loading {
    font-size: 0.85rem;
    color: #555555;
    margin-bottom: 20px;
}

#comment-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 600px;
}

#comment-input {
    width: 100%;
    background: #ebebeb;
    border: 1px solid #d5d5d5;
    border-radius: 6px;
    padding: 10px 14px;
    color: #111111;
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
    line-height: 1.5;
    transition: border-color 0.15s;
}

#comment-input:focus {
    outline: none;
    border-color: #bbb;
}

#comment-input::placeholder {
    color: #444;
}

.comment-submit-btn {
    align-self: flex-start;
    background: #000000;
    color: #ffffff;
    border: 1px solid #000000;
    border-radius: 6px;
    padding: 7px 20px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.comment-submit-btn:hover:not(:disabled) {
    background: #cccccc;
    border-color: #cccccc;
}

.comment-submit-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

#comment-login-prompt {
    font-size: 0.85rem;
    color: #555555;
}

.comment-login-link {
    color: #000000;
    text-decoration: none;
    cursor: pointer;
}

.comment-login-link:hover {
    text-decoration: underline;
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 30px;
    font-size: 0.75rem;
    color: #444444;
    border-top: 1px solid #dddddd;
}

/* --- Dark Mode --- */
.theme-toggle {
    background: transparent;
    border: 1px solid #cccccc;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: #555555;
    transition: border-color 0.2s, color 0.2s;
    display: flex;
    align-items: center;
}

.theme-toggle:hover {
    border-color: #000000;
    color: #000000;
}

html.dark {
    filter: invert(1);
}

html.dark img,
html.dark #hero-art,
html.dark .header-avatar {
    filter: invert(1);
}
