/* ===== Reset & Variables ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
    list-style: none;
}

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --accent: #4FC3F7;
    --accent-glow: rgba(79, 195, 247, 0.15);
    --accent-green: #66BB6A;
    --accent-green-glow: rgba(102, 187, 106, 0.15);
    --accent-red: #EF5350;
    --accent-red-glow: rgba(239, 83, 80, 0.15);
    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b0;
    --text-muted: #6a6a7a;
    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(79, 195, 247, 0.4);
    --radius: 16px;
    --radius-sm: 10px;
    --font-cn: 'Noto Sans SC', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-en: 'Orbitron', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-cn);
    line-height: 1.7;
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Loading Screen ===== */
#loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-content {
    text-align: center;
    color: #fff;
}

ul.loading-ul {
    position: relative;
    display: flex;
    justify-content: center;
    gap: 8px;
}

ul li.loading-li {
    list-style: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: loadPulse 1.6s ease-in-out infinite;
}

@keyframes loadPulse {
    0%, 40%, 100% { transform: scale(0.3); opacity: 0.3; }
    20% { transform: scale(1); opacity: 1; }
}

ul li.loading-li:nth-child(1) { animation-delay: -1.4s; background: #ffff00; box-shadow: 0 0 20px rgba(255, 255, 0, 0.5); }
ul li.loading-li:nth-child(2) { animation-delay: -1.2s; background: #76FF03; box-shadow: 0 0 20px rgba(118, 255, 3, 0.5); }
ul li.loading-li:nth-child(3) { animation-delay: -1.0s; background: #F06292; box-shadow: 0 0 20px rgba(240, 98, 146, 0.5); }
ul li.loading-li:nth-child(4) { animation-delay: -0.8s; background: #4FC3F7; box-shadow: 0 0 20px rgba(79, 195, 247, 0.5); }
ul li.loading-li:nth-child(5) { animation-delay: -0.6s; background: #BA68C8; box-shadow: 0 0 20px rgba(186, 104, 200, 0.5); }
ul li.loading-li:nth-child(6) { animation-delay: -0.4s; background: #F57C00; box-shadow: 0 0 20px rgba(245, 124, 0, 0.5); }
ul li.loading-li:nth-child(7) { animation-delay: -0.2s; background: #673AB7; box-shadow: 0 0 20px rgba(103, 58, 183, 0.5); }

/* ===== Background Decoration ===== */
.bg-decoration {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
}

.bg-glow-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(79, 195, 247, 0.12), transparent 70%);
    top: -200px;
    right: -100px;
}

.bg-glow-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(103, 58, 183, 0.08), transparent 70%);
    bottom: -150px;
    left: -100px;
}

.bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

/* ===== Back Link ===== */
.back-link {
    position: fixed;
    top: 28px;
    left: 28px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: rgba(10, 10, 15, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s ease;
    z-index: 100;
}

.back-link:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
}

.back-link:hover svg { transform: translateX(-2px); }
.back-link svg { transition: transform 0.3s ease; }

/* ===== Main Content ===== */
#main-content {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
}

.page-wrapper {
    width: 100%;
    max-width: 520px;
    animation: fadeInUp 0.6s ease both;
}

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

/* ===== Page Header ===== */
.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.brand-logo {
    font-family: var(--font-en);
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 6px;
    display: block;
    margin-bottom: 16px;
}

.page-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.page-desc {
    font-size: 14px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* ===== Query Card ===== */
.query-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 36px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.query-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.6;
}

/* ===== Form ===== */
.query-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 4px;
}

.label-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.label-required {
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.3s ease;
}

.input-wrapper input {
    width: 100%;
    height: 48px;
    padding: 0 16px 0 44px;
    font-family: var(--font-cn);
    font-size: 14px;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: all 0.3s ease;
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
    font-size: 13px;
}

.input-wrapper input:focus {
    border-color: var(--border-focus);
    background: rgba(79, 195, 247, 0.03);
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.08);
}

.input-wrapper input:focus ~ .input-icon,
.input-wrapper:focus-within .input-icon {
    color: var(--accent);
}

/* ===== Search Button ===== */
#search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 50px;
    margin-top: 8px;
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-cn);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#search-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 32px rgba(79, 195, 247, 0.3);
}

#search-btn:hover::before { opacity: 1; }

#search-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 16px rgba(79, 195, 247, 0.2);
}

#search-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#search-btn.loading span { opacity: 0; }

#search-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(10, 10, 15, 0.2);
    border-top-color: var(--bg-primary);
    border-radius: 50%;
    animation: btnSpin 0.6s linear infinite;
}

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

/* ===== Result Container ===== */
#result-container {
    display: none;
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
    animation: fadeInUp 0.4s ease both;
}

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

.result-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.success-icon {
    background: var(--accent-green-glow);
    color: var(--accent-green);
    border: 1px solid rgba(102, 187, 106, 0.2);
}

.fail-icon {
    background: var(--accent-red-glow);
    color: var(--accent-red);
    border: 1px solid rgba(239, 83, 80, 0.2);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: btnSpin 0.8s linear infinite;
    background: none;
}

.result-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.result-title.success { color: var(--accent-green); }
.result-title.fail { color: var(--accent-red); }

.result-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.result-message {
    color: var(--text-muted);
    font-size: 14px;
}

/* Result Details */
.result-details {
    background: rgba(102, 187, 106, 0.04);
    border: 1px solid rgba(102, 187, 106, 0.1);
    border-radius: var(--radius-sm);
    padding: 20px 24px;
    margin: 20px 0;
    text-align: left;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 14px;
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 500;
}

.result-note {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 1px;
}

.result-note.success { color: var(--accent-green); }

/* Fail Reasons */
.result-reasons {
    background: rgba(239, 83, 80, 0.04);
    border: 1px solid rgba(239, 83, 80, 0.1);
    border-radius: var(--radius-sm);
    padding: 20px 24px;
    margin-top: 20px;
    text-align: left;
}

.reasons-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.result-reasons ul {
    list-style: none;
}

.result-reasons li {
    padding: 4px 0 4px 20px;
    font-size: 13px;
    color: var(--text-muted);
    position: relative;
    line-height: 1.8;
}

.result-reasons li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 5px;
    height: 5px;
    background: var(--accent-red);
    border-radius: 50%;
    transform: translateY(-50%);
    opacity: 0.6;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(239, 83, 80, 0.2);
    border-radius: 100px;
    color: var(--accent-red);
    font-size: 13px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== Page Footer ===== */
.page-footer {
    text-align: center;
    margin-top: 40px;
}

.page-footer p {
    font-family: var(--font-en);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    #main-content { padding: 80px 16px 40px; }

    .query-card { padding: 28px 20px; }

    .input-wrapper input { height: 44px; font-size: 13px; }

    #search-btn { height: 46px; font-size: 14px; }

    .back-link {
        top: 16px;
        left: 16px;
        padding: 6px 14px;
        font-size: 12px;
    }

    .detail-row { flex-direction: column; align-items: flex-start; gap: 2px; }
}
