:root {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --accent: #06b6d4;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --folder-accent: #fbbf24;
    --border-radius: 10px;
    --shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 0 20px rgba(6, 182, 212, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

body {
    font-family: "Inter", "Microsoft YaHei", sans-serif;
    background: var(--bg-main);
    min-height: 100vh;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.server-dashboard {
    width: 100%;
    max-width: 1200px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 25px 20px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.owner-header {
    text-align: center;
    margin: 0 auto 35px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    max-width: 500px;
}

.owner-icon {
    display: none;
}

.owner-title {
    font-size: 24px;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 5px;
}

.owner-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius);
    font-size: 14px;
}

.breadcrumb-item,
.breadcrumb-current,
.breadcrumb-separator {
    flex-shrink: 0;
}

.breadcrumb-item {
    color: var(--text-secondary);
    cursor: pointer;
}

.breadcrumb-item:hover {
    color: var(--accent);
}

.breadcrumb-separator {
    color: var(--text-secondary);
}

.breadcrumb-current {
    color: var(--accent);
    font-weight: 500;
}

.breadcrumb-root {
    color: var(--accent);
    font-weight: 600;
}

.nav-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-btn:hover:not(:disabled) {
    background: var(--accent);
    color: var(--bg-main);
}

.nav-btn:disabled {
    opacity: 0.3;
    filter: grayscale(100%);
    cursor: not-allowed;
}

.nav-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 18px;
    max-width: 1000px;
    margin: 0 auto;
}

.download-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius);
    padding: 22px 15px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.07);
    cursor: pointer;
}

.download-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

.download-card:active {
    transform: translateY(-2px) scale(0.98);
}

.download-card.folder {
    border-color: rgba(251, 191, 36, 0.3);
}

.download-card.folder:hover {
    border-color: var(--folder-accent);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}

.download-card.folder .file-size {
    background: rgba(251, 191, 36, 0.15);
    color: var(--folder-accent);
}

.download-icon {
    width: 45px;
    height: 45px;
    margin: 0 auto 12px;
    background-color: var(--accent);
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-position: center;
    background-repeat: no-repeat;
    background-position: center;
}

.icon-91 {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cpath d='M10.5 15.5 9 17l3 3 3-3-1.5-1.5'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cpath d='M10.5 15.5 9 17l3 3 3-3-1.5-1.5'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E");
}

.icon-folder {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
    background-color: var(--folder-accent);
}

.file-name {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
    width: 100%;
    display: block;
}

.file-size {
    font-size: 12px;
    color: var(--accent);
    background: rgba(6, 182, 212, 0.1);
    padding: 3px 8px;
    border-radius: 12px;
    display: inline-block;
}

.back-link {
    text-align: center;
    margin: 15px auto 0;
    font-size: 14px;
}

.back-link a {
    color: var(--text-secondary);
    text-decoration: none;
    margin: 0 10px;
}

.back-link a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.backup-btn {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
    margin: 0 10px;
    transition: all 0.2s ease;
}

.backup-btn:hover {
    background: var(--accent);
    color: var(--bg-main);
}

.copyright {
    text-align: center;
    margin: 35px auto 0;
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.7;
    max-width: 500px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(6, 182, 212, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    text-align: center;
    padding: 40px;
    color: #ef4444;
}

.error-message .retry-btn {
    margin-top: 15px;
    padding: 8px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.error-message .retry-btn:hover {
    opacity: 0.8;
}

.empty-message {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.source-badge {
    display: none;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    padding: clamp(15px, 4vw, 30px);
    max-width: 420px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-title {
    font-size: clamp(16px, 4vw, 18px);
    color: var(--text-primary);
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
}

.modal-file-name,
.modal-file-size {
    width: 100%;
    display: block;
    text-align: center;
    line-height: 1.4;
}

.modal-file-name {
    font-size: clamp(12px, 3vw, 14px);
    color: var(--text-secondary);
    margin-bottom: 8px;
    word-break: break-all;
}

.modal-file-size {
    font-size: clamp(11px, 2.5vw, 12px);
    color: var(--accent);
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    gap: clamp(8px, 2vw, 12px);
    justify-content: center;
    width: 100%;
}

.modal-btn {
    flex: 1;
    min-width: 0;
    max-width: 180px;
    padding: clamp(10px, 2.5vw, 14px) clamp(12px, 3vw, 20px);
    border-radius: 8px;
    font-size: clamp(13px, 3vw, 14px);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: clamp(4px, 1vw, 8px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-btn svg {
    width: clamp(16px, 4vw, 18px);
    height: clamp(16px, 4vw, 18px);
    flex-shrink: 0;
}

.modal-btn span,
.modal-btn-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-btn-preview {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent);
    border: 1px solid var(--accent);
}

.modal-btn-preview:hover {
    background: var(--accent);
    color: var(--bg-main);
}

.modal-btn-download {
    background: var(--accent);
    color: var(--bg-main);
    border: 1px solid var(--accent);
}

.modal-btn-download:hover {
    background: #0891b2;
    border-color: #0891b2;
}

.modal-hint {
    font-size: clamp(10px, 2.5vw, 11px);
    color: var(--text-secondary);
    text-align: center;
    margin-top: 15px;
    opacity: 0.7;
    line-height: 1.4;
}

@media (min-width: 768px) {
    .download-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 22px;
    }
    .server-dashboard {
        padding: 30px 25px;
    }
}

@media (min-width: 1024px) {
    .download-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 25px;
    }
    .download-card {
        padding: 25px 15px;
    }
    .owner-title {
        font-size: 26px;
    }
}

@media (max-width: 360px) {
    .modal-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    .modal-btn {
        max-width: 100%;
        justify-content: center;
    }
}

@media (min-width: 361px) and (max-width: 768px) {
    .modal-btn {
        max-width: 160px;
    }
}

@media (min-width: 1200px) {
    .modal-content {
        max-width: 480px;
    }
    .modal-btn {
        max-width: 200px;
        padding: 14px 24px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .modal-overlay {
        align-items: center;
        padding: 10px;
    }
    .modal-content {
        padding: 15px 20px;
        max-width: 380px;
    }
    .modal-title {
        margin-bottom: 10px;
    }
    .modal-file-size {
        margin-bottom: 15px;
    }
}
