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

.u-hidden { display: none !important; }

a, button, .btn, .button, [role="button"] {
    cursor: pointer;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-page);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.notification {
    position: fixed;
    top: 90px;
    right: 24px;
    padding: 12px 16px;
    border-radius: 8px;
    background: #111827;
    color: #f8fafc;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    z-index: 10000;
    transform: translateX(120%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 360px;
    border-left: 4px solid #3b82f6;
    opacity: 0;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-success,
.notification.success {
    border-left-color: #22c55e;
    background: linear-gradient(135deg, #0f172a 0%, #14532d 100%);
}

.notification-error,
.notification.error {
    border-left-color: #f43f5e;
    background: linear-gradient(135deg, #0f172a 0%, #7f1d1d 100%);
}

.notification-warning,
.notification.warning {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, #0f172a 0%, #78350f 100%);
}

.notification-info,
.notification.info {
    border-left-color: #3b82f6;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
}

.container {
    width: 100%;
    max-width: var(--container-max-width, 1600px);
    margin: 0 auto;
    padding: 0 var(--container-padding, 24px);
}

.main,
main.main {
    flex: 1 0 auto;
}

.main-content {
    min-height: calc(100vh - 200px);
    padding-top: calc(var(--header-height, 64px) + 16px);
}

@media (min-width: 1025px) and (max-width: 1366px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .main-content {
        padding-top: calc(var(--header-height, 64px) + 12px);
    }
}

@media (min-width: 1025px) and (max-width: 1280px) {
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }
}

body.home-page,
body.preorder-page,
body.releases-page,
body.charts-page,
body.chart_detail-page,
body.genres-page,
body.genre-page,
body.artists-page,
body.artist-page,
body.labels-page,
body.label-page,
body.track-page,
body.album-page,
body.cart-page,
body.checkout-page,
body.orders-page,
body.order-success-page,
body.profile-page,
body.library-page,
body.info-page,
body.notifications-page,
body.copyright-agreement-page,
body.auth-page {
    background: var(--bg-page);
}

/* PJAX：主区替换/卸页面 CSS 时避免出现白块与高度抖动（此前仅有 class 无对应样式） */
body.pjax-loading {
    cursor: progress;
}

body.pjax-loading main.main,
body.pjax-loading main.m-main {
    background-color: var(--bg-page);
    background-clip: padding-box;
}

/* 顶栏以下、底栏播放器以上：与壳层 z-index 协调，不盖住 header(1000) / player(1000) */
body.pjax-loading::after {
    content: '';
    position: fixed;
    left: 0;
    right: 0;
    top: var(--header-height, 64px);
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    z-index: 900;
    pointer-events: all;
    background-color: var(--bg-page);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-color, #0ea5e9);
    color: var(--text-inverse, #1e293b);
}

.btn-primary:hover {
    background-color: var(--primary-dark, #0284c7);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(14, 165, 233, 0.4);
    color: var(--text-inverse, #1e293b);
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
    text-decoration: none;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.card {
    background-color: var(--bg-card, #1e2332);
    border-radius: var(--radius-lg, 12px);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm, 0 1px 2px 0 rgba(0, 0, 0, 0.05));
    border: 1px solid var(--border-color, #3a4553);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
    background-color: var(--bg-hover, #2a3142);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary, #f8fafc);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color, #3a4553);
    border-radius: var(--radius-md, 8px);
    font-size: 1rem;
    background-color: var(--bg-primary, #0a0e1a);
    color: var(--text-primary, #f8fafc);
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color, #0ea5e9);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 2rem; }

.d-none { display: none; }
.hidden { display: none !important; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

@media (max-width: 768px) {
    body.mobile-app .container {
        padding: 0 0.5rem;
    }
    
    body.mobile-app .main-content {
        padding-top: 60px;
    }
    
    body.mobile-app .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }
    
    body.mobile-app .card {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    body.mobile-app .btn {
        width: 100%;
        justify-content: center;
    }
    
    body.mobile-app .btn-group {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    animation: spin 1s linear infinite;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.slide-out {
    animation: slideOut 0.3s ease-out;
}

.track-info-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: #cbd5f5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.track-info-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.35);
    color: #ffffff;
}

.track-price-cart .track-info-btn {
    margin-right: 8px;
}

.track-info-btn svg {
    pointer-events: none;
}

.track-info-popover {
    position: fixed;
    min-width: 220px;
    max-width: 280px;
    background: rgba(6, 11, 25, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
    color: #f8fafc;
    padding: 14px 18px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    font-size: 13px;
    line-height: 1.4;
}

.track-info-popover.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.track-info-popover .popover-header {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 10px;
}

.track-info-popover .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 12px;
}

.track-info-popover .info-row:last-child {
    margin-bottom: 0;
}

.track-info-popover .info-label {
    color: #94a3b8;
    font-size: 12px;
}

.track-info-popover .info-value {
    color: #e2e8f0;
    font-weight: 500;
    font-size: 13px;
    text-align: right;
    white-space: nowrap;
}

.preorder-info-popover {
    position: fixed;
    min-width: 220px;
    max-width: 280px;
    background: rgba(6, 11, 25, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
    color: #f8fafc;
    padding: 14px 18px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    font-size: 13px;
    line-height: 1.4;
}

.preorder-info-popover.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.preorder-info-popover .popover-header {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 10px;
}

.preorder-info-popover .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 12px;
}

.preorder-info-popover .info-row:last-child {
    margin-bottom: 0;
}

.preorder-info-popover .info-label {
    color: #94a3b8;
    font-size: 12px;
}

.preorder-info-popover .info-value {
    color: #e2e8f0;
    font-weight: 500;
    font-size: 13px;
    text-align: right;
    white-space: nowrap;
}

.back-to-top {
    position: fixed !important;
    bottom: 30px;
    right: 30px !important;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color, #22c55e), var(--primary-color-dark, #16a34a));
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 9998 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
    transition: bottom 0.3s ease, all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 20px rgba(34, 197, 94, 0.3),
        0 0 0 0 rgba(34, 197, 94, 0.4);
    backdrop-filter: blur(10px);
    pointer-events: none;
}

.back-to-top.visible {
    pointer-events: auto;
}

.back-to-top:hover {
    background: linear-gradient(135deg, var(--primary-color-dark, #16a34a), var(--primary-color, #22c55e));
    transform: translateY(-5px) scale(1.05);
    box-shadow: 
        0 8px 30px rgba(34, 197, 94, 0.5),
        0 0 0 4px rgba(34, 197, 94, 0.2);
    border-color: rgba(255, 255, 255, 0.2);
}

.back-to-top:active {
    transform: translateY(-3px) scale(1);
    box-shadow: 
        0 4px 20px rgba(34, 197, 94, 0.4),
        0 0 0 2px rgba(34, 197, 94, 0.3);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.back-to-top svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.back-to-top:hover svg {
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    body.mobile-app .back-to-top {
        width: 44px;
        height: 44px;
        bottom: 20px;
        right: 20px;
    }
    
    body.mobile-app .back-to-top svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    body.mobile-app .back-to-top {
        width: 40px;
        height: 40px;
        bottom: 15px;
        right: 15px;
    }
    
    body.mobile-app .back-to-top svg {
        width: 16px;
        height: 16px;
    }
}

.copyright-icon {
    margin-left: 6px;
    font-size: 1.1em;
    font-weight: 700;
    color: #60a5fa;
    vertical-align: baseline;
}