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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f8f9fa;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2d3748;
    line-height: 1.6;
    background-image:
        radial-gradient(circle at 25% 25%, rgba(74, 85, 104, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(74, 85, 104, 0.02) 0%, transparent 50%);
}

.container {
    background: white;
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
    text-align: center;
    max-width: 600px;
    width: 90%;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4a5568, #718096, #a0aec0);
}

h1 {
    color: #1a202c;
    margin-bottom: 1.5rem;
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

#loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    position: relative;
}

.loading-circle {
    width: 80px;
    height: 80px;
    border: 6px solid #e2e8f0;
    border-top: 6px solid #4a5568;
    border-radius: 50%;
    animation: spin 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    margin-bottom: 2rem;
    position: relative;
}

/* Success state styling */
#loading-container.success .loading-circle {
    border-color: #48bb78;
    border-top-color: #48bb78;
    animation: none;
}

#loading-container.success .loading-circle::before {
    border-color: transparent;
    border-top-color: rgba(72, 187, 120, 0.3);
    animation: none;
}

#loading-container.success .loading-text {
    color: #48bb78;
}

/* Failed state styling */
#loading-container.failed .loading-circle {
    border-color: #e53e3e;
    border-top-color: #e53e3e;
    animation: none;
}

#loading-container.failed .loading-circle::before {
    border-color: transparent;
    border-top-color: rgba(229, 62, 62, 0.3);
    animation: none;
}

#loading-container.failed .loading-text {
    color: #e53e3e;
}

.loading-circle::before {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border: 6px solid transparent;
    border-top: 6px solid rgba(74, 85, 104, 0.3);
    border-radius: 50%;
    animation: spin-reverse 2s linear infinite;
}

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

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

.loading-text {
    color: #4a5568;
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    margin-bottom: 1rem;
}

.loading-subtitle {
    color: #718096;
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.8;
    margin-bottom: 2rem;
}

.progress-dots {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.progress-dots span {
    width: 8px;
    height: 8px;
    background: #cbd5e0;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

.progress-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.progress-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

#content {
    margin-top: 2rem;
}

#content p {
    color: #4a5568;
    margin-bottom: 1.5rem;
    line-height: 1.7;
    font-size: 1.1rem;
}

.hidden {
    display: none !important;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.show {
    display: block !important;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease;
}

/* Documentation and Test Section Styles */
.docs-section, .test-section, .features-section {
    margin: 2.5rem 0;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.docs-section h2, .test-section h2, .features-section h2 {
    color: #2d3748;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.endpoint {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #4a5568;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.endpoint:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.endpoint h3 {
    color: #1a202c;
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.endpoint p {
    color: #4a5568;
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.code-block {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 8px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Droid Sans Mono', 'Source Code Pro', monospace;
    font-size: 0.9rem;
    color: #2d3748;
    border: 1px solid #cbd5e0;
    line-height: 1.5;
}

.code-block code {
    background: #e2e8f0;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 0.875rem 2rem;
    border: 2px solid #4a5568;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-block;
    letter-spacing: 0.025em;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(74, 85, 104, 0.1), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: #4a5568;
    color: white;
    border-color: #4a5568;
}

.btn-primary:hover {
    background: #2d3748;
    border-color: #2d3748;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74, 85, 104, 0.3);
}

.btn-secondary {
    background: transparent;
    color: #4a5568;
    border-color: #4a5568;
}

.btn-secondary:hover {
    background: #4a5568;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74, 85, 104, 0.2);
}

.test-results {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-top: 1.5rem;
}

.test-results h3 {
    color: #1a202c;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    font-weight: 600;
}

#results-content {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Droid Sans Mono', 'Source Code Pro', monospace;
    font-size: 0.9rem;
    color: #2d3748;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    line-height: 1.5;
}

.features-section ul {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.features-section li {
    padding: 1rem;
    color: #4a5568;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    position: relative;
    padding-left: 3rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.features-section li:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.features-section li::before {
    content: "✓";
    color: #48bb78;
    font-weight: bold;
    font-size: 1.2rem;
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

/* Smooth scrolling and improved interactions */
html {
    scroll-behavior: smooth;
}

* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Add subtle glow effect on focus for accessibility */
.btn:focus, .endpoint:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 85, 104, 0.1);
}

/* Loading state improvements */
#loading-container.show {
    animation: slideInFade 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInFade {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Enhanced button ripple effect */
.btn:active {
    transform: translateY(0) scale(0.98);
}

/* Captcha Styles */
.captcha-container {
    margin-top: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    text-align: center;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.captcha-question {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: #2d3748;
}

.captcha-question strong {
    color: #4a5568;
    display: block;
    margin-bottom: 0.5rem;
}

#captcha-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 1rem;
    transition: border-color 0.3s ease;
}

#captcha-input:focus {
    outline: none;
    border-color: #4a5568;
    box-shadow: 0 0 0 3px rgba(74, 85, 104, 0.1);
}

.captcha-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.captcha-submit, .captcha-cancel {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.captcha-submit {
    background: #4a5568;
    color: white;
}

.captcha-submit:hover {
    background: #2d3748;
    transform: translateY(-1px);
}

.captcha-cancel {
    background: #e2e8f0;
    color: #4a5568;
}

.captcha-cancel:hover {
    background: #cbd5e0;
    transform: translateY(-1px);
}

.captcha-error {
    color: #e53e3e;
    font-size: 0.9rem;
    font-weight: 500;
}

.retry-button {
    margin-top: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: #e2e8f0;
    color: #4a5568;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.retry-button:hover {
    background: #cbd5e0;
    border-color: #a0aec0;
    transform: translateY(-1px);
}

/* Improved mobile responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 2rem;
        margin: 1rem;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        text-align: center;
        padding: 1rem 2rem;
    }

    .docs-section, .test-section, .features-section {
        padding: 1.5rem;
        margin: 1rem 0;
    }

    .features-section ul {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    h1 {
        font-size: 2.2rem;
    }

    .loading-circle {
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    .endpoint {
        padding: 1rem;
    }

    .docs-section, .test-section, .features-section {
        padding: 1rem;
    }
}
