* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0052D9;
    --primary-hover: #003d9e;
    --success-color: #10b981;
    --info-color: #0052D9;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 0;
    margin: 0;
    color: var(--text-primary);
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    flex-direction: column;
}

body.dark-mode {
    --primary-color: #4a7cff;
    --primary-hover: #0052D9;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --bg-primary: #1f2937;
    --bg-secondary: #111827;
    --border-color: #374151;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    background: #0f172a;
}

.password-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.password-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
}

.password-box h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    text-align: center;
}

.password-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    margin-bottom: 15px;
}

.password-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.password-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.password-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.error-message {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 10px;
    text-align: center;
    display: none;
}

.container {
    max-width: 1280px;
    margin: 20px auto;
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    display: none;
    margin-bottom: 60px;
    flex: 1;
}

.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.header h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.header p {
    opacity: 0.9;
    font-size: 16px;
}

.table-container {
    padding: 30px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background: var(--bg-secondary);
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    background: #e9ecef;
}

th .sort-icon {
    margin-left: 5px;
    opacity: 0.5;
}

td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: var(--bg-secondary);
}

.country-code {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.country-code .flag-icon {
    width: 24px;
    height: 18px;
    border-radius: 3px;
    object-fit: cover;
}

.country-name {
    color: var(--text-primary);
    font-weight: 500;
}

.speed-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.type-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #e0e7ff;
    color: var(--primary-color);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.proxy-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.proxy-status .icon {
    width: 16px;
    height: 16px;
}

.ttl-badge {
    color: var(--text-secondary);
    font-size: 13px;
}

.ping-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
}

.ping-status.ping-fast {
    background: #d4edda;
    color: #155724;
}

.ping-status.ping-medium {
    background: #fff3cd;
    color: #856404;
}

.ping-status.ping-slow {
    background: #f8d7da;
    color: #721c24;
}

.ping-status.ping-testing {
    background: #e2e3e5;
    color: #383d41;
}

.ping-status.ping-error {
    background: #f8d7da;
    color: #721c24;
}

.ping-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.ping-indicator.fast {
    background: #28a745;
}

.ping-indicator.medium {
    background: #ffc107;
}

.ping-indicator.slow {
    background: #dc3545;
}

.ping-indicator.testing {
    background: #6c757d;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.purity-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
}

.purity-status.purity-pure {
    background: #d4edda;
    color: #155724;
}

.purity-status.purity-impure {
    background: #f8d7da;
    color: #721c24;
}

.purity-status.purity-testing {
    background: #e2e3e5;
    color: #383d41;
}

.purity-status.purity-unknown {
    background: #fff3cd;
    color: #856404;
}

.purity-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.purity-indicator.pure {
    background: #28a745;
}

.purity-indicator.impure {
    background: #dc3545;
}

.purity-indicator.testing {
    background: #6c757d;
    animation: pulse 1.5s infinite;
}

.purity-indicator.unknown {
    background: #ffc107;
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-info:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-ping {
    background: #6c757d;
    color: white;
    font-size: 12px;
    padding: 6px 12px;
}

.btn-ping:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #333;
}

.qr-container {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.qr-container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.qr-loading {
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
}

.config-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.config-info p {
    margin: 5px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.config-link {
    word-break: break-all;
    color: var(--primary-color);
    text-decoration: none;
}

.config-link:hover {
    text-decoration: underline;
}

.select-all {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.row-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.download-section {
    padding: 30px;
    background: var(--bg-secondary);
    border-top: 2px solid var(--border-color);
}

.download-section h2 {
    color: var(--text-primary);
    margin-bottom: 30px;
    font-size: 24px;
    text-align: center;
}

.download-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .download-grid {
        grid-template-columns: 1fr;
    }
}

.download-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-color);
}

.download-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 82, 217, 0.2);
}

.download-card h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.download-card .icon {
    font-size: 28px;
}

.download-info {
    margin-bottom: 15px;
}

.download-info p {
    margin: 8px 0;
    color: var(--text-primary);
    font-size: 14px;
}

.download-info .version {
    color: var(--primary-color);
    font-weight: 600;
}

.download-info .update-time {
    color: var(--text-secondary);
    font-size: 12px;
}

.download-description {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
}

.download-usage {
    background: #e0e7ff;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    border-left: 4px solid var(--primary-color);
}

.download-usage h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 14px;
}

.download-usage ol {
    margin-left: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.8;
}

.download-usage li {
    margin-bottom: 5px;
}

.download-btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.download-btn-group .btn {
    flex: 1;
    min-width: 140px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.download-btn-group .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.download-btn-group .btn-primary {
    background: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.download-btn-group .btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.download-btn-group .btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.download-btn-group .btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.download-btn-group .btn-info {
    background: var(--info-color);
    border: 2px solid var(--info-color);
}

.download-btn-group .btn-info:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.download-platform-section {
    margin-bottom: 40px;
}

.download-platform-section h3 {
    color: var(--text-primary);
    font-size: 20px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.download-platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.footer {
    background: #000000;
    color: #ffffff;
    padding: 40px 20px;
    text-align: center;
    margin-top: auto;
    width: 100%;
}

.footer-content {
    max-width: 1280px;
    margin: 0 auto;
}

.footer p {
    margin: 8px 0;
    color: #cccccc;
    font-size: 14px;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
}

.footer-links a {
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.1);
}

.footer-links a:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.footer-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 20px 0;
}

.footer a {
    color: #ffffff;
    text-decoration: none;
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 10px 8px;
    }

    .theme-toggle {
        position: static;
        margin-top: 10px;
    }
}
