/* Tailwind CSS CDN */
@import url('https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css');
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700;900&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

/* ===================== CSS Variables ===================== */
:root {
    --primary-gold: #D4A853;
    --primary-gold-dark: #C49B3C;
    --primary-gold-deep: #8B6914;
    --bg-deep: #0A0E1A;
    --bg-card: #111827;
    --bg-card-light: #1A1F35;
    --text-light: #F5F0E8;
    --text-muted: #9CA3AF;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --glass-bg: rgba(17, 24, 39, 0.75);
    --glass-border: rgba(212, 168, 83, 0.15);
    --shadow-gold: 0 0 30px rgba(212, 168, 83, 0.15);
}

/* ===================== Reset & Base ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-deep);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ===================== Typography ===================== */
h1, h2, h3, h4 {
    font-family: 'Noto Serif SC', serif;
    font-weight: 700;
    color: var(--primary-gold);
}

h1 { font-size: 2.5rem; letter-spacing: 0.05em; }
h2 { font-size: 1.75rem; letter-spacing: 0.03em; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.1rem; color: var(--text-light); }

p { color: var(--text-muted); line-height: 1.8; }

/* ===================== Background ===================== */
.starfield-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(ellipse at 20% 50%, #1a1a3e 0%, #0a0e1a 50%, #050810 100%);
    z-index: -1;
}

.starfield-bg::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image:
        radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 30% 60%, rgba(255,255,255,0.4) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 50% 10%, rgba(212,168,83,0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 70% 80%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 90% 40%, rgba(255,255,255,0.3) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 15% 90%, rgba(212,168,83,0.4) 0%, transparent 100%),
        radial-gradient(1px 1px at 45% 45%, rgba(255,255,255,0.4) 0%, transparent 100%),
        radial-gradient(1px 1px at 80% 15%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(2px 2px at 60% 70%, rgba(212,168,83,0.3) 0%, transparent 100%);
    animation: twinkle 8s ease-in-out infinite alternate;
}

@keyframes twinkle {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* ===================== Glass Card ===================== */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-gold);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 40px rgba(212, 168, 83, 0.25);
}

/* ===================== Navigation ===================== */
.nav-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: rgba(10, 14, 26, 0.85);
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-family: 'Noto Serif SC', serif;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary-gold);
    position: relative;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.1), rgba(212, 168, 83, 0.05));
    border: 1px solid rgba(212, 168, 83, 0.2);
    transition: all 0.3s ease;
}

.nav-brand:hover {
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.15), rgba(212, 168, 83, 0.1));
    border-color: rgba(212, 168, 83, 0.4);
    box-shadow: 0 0 20px rgba(212, 168, 83, 0.2);
    transform: translateY(-1px);
}

/* Logo image styles */
.nav-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    filter: drop-shadow(0 0 5px rgba(212, 168, 83, 0.3));
    transition: all 0.3s ease;
}

.nav-brand:hover .nav-logo {
    transform: scale(1.05) rotate(5deg);
    filter: drop-shadow(0 0 8px rgba(212, 168, 83, 0.5));
}

.nav-brand svg { width: 32px; height: 32px; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
    position: relative;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary-gold);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0; right: 0;
    height: 2px;
    background: var(--primary-gold);
    border-radius: 1px;
}

/* Mobile menu toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--primary-gold);
    font-size: 1.5rem;
    cursor: pointer;
}

/* User menu */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 0.3rem 0.8rem;
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.user-menu-btn:hover {
    border-color: var(--primary-gold);
    color: var(--primary-gold);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: 110%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    min-width: 140px;
    overflow: hidden;
    box-shadow: var(--shadow-gold);
}

.user-dropdown.show { display: block; }

.user-dropdown a {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background 0.2s, color 0.2s;
}

.user-dropdown a:hover {
    background: var(--bg-card-light);
    color: var(--primary-gold);
}

/* ===================== Buttons ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.5rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-dark));
    color: var(--bg-deep);
    box-shadow: 0 4px 15px rgba(212, 168, 83, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 25px rgba(212, 168, 83, 0.5);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-gold);
    color: var(--primary-gold);
}

.btn-outline:hover {
    background: rgba(212, 168, 83, 0.1);
}

/* Disabled button state */
.btn.disabled,
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
}

.btn.disabled:hover,
.btn:disabled:hover {
    background: var(--primary-gold);
    transform: none !important;
}

.btn-outline.disabled,
.btn-outline:disabled {
    border-color: rgba(212, 168, 83, 0.3);
    color: rgba(212, 168, 83, 0.6);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: var(--primary-gold);
    background: rgba(255, 255, 255, 0.05);
}

.btn-sm { padding: 0.4rem 1rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 2rem; font-size: 1rem; }

/* ===================== Form Inputs ===================== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.form-input {
    width: 100%;
    padding: 0.65rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-light);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
    outline: none;
}

.form-input:focus {
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.15);
}

.form-input::placeholder { color: rgba(255, 255, 255, 0.3); }

/* 表单提示文字 */
.input-hint {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.8;
    line-height: 1.4;
}

/* 复选框标签样式 */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
}

/* ===================== Modal ===================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), var(--shadow-gold);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-card {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 1rem; right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover { color: var(--danger); }

/* ===================== Tabs ===================== */
.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 1.5rem;
}

.tab-item {
    padding: 0.6rem 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-item:hover { color: var(--text-light); }
.tab-item.active {
    color: var(--primary-gold);
    border-bottom-color: var(--primary-gold);
}

/* ===================== Toast Notification ===================== */
.toast-container {
    position: fixed;
    top: 80px; right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    font-size: 0.85rem;
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    max-width: 320px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }

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

/* ===================== Loading Spinner ===================== */
.spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(212, 168, 83, 0.2);
    border-top-color: var(--primary-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===================== Page Load Animation ===================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.6s ease-out forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* ===================== Section Container ===================== */
.section-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    opacity: 1;
}

.section-container.visible {
    opacity: 1;
    transition: opacity 0.6s ease;
}

.page-wrapper {
    padding-top: 80px;
    min-height: 100vh;
}

/* ===================== Scrollbar ===================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(212, 168, 83, 0.3);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(212, 168, 83, 0.5); }

/* ===================== Responsive ===================== */
@media (max-width: 768px) {
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.4rem; }

    .nav-toggle { display: block; }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%; left: 0; right: 0;
        background: rgba(10, 14, 26, 0.95);
        border-bottom: 1px solid var(--glass-border);
        flex-direction: column;
        padding: 1rem;
        gap: 0.5rem;
    }

    .nav-links.show { display: flex; }

    .nav-links a {
        padding: 0.6rem 1rem;
        border-radius: 8px;
    }

    .section-container { padding: 1.5rem 1rem; }
    .modal-card { padding: 1.5rem; margin: 1rem; }
}

/* ===================== Captcha Cache Type Label ===================== */
.cache-type-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    vertical-align: middle;
    line-height: 1.4;
    letter-spacing: 0.3px;
    margin-left: 4px;
    position: relative;
    top: -1px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.cache-type-badge.R {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.35));
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
}
.cache-type-badge.内 {
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.2), rgba(251, 146, 60, 0.35));
    color: #fb923c;
    border: 1px solid rgba(251, 146, 60, 0.4);
}
