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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #2d3436;
    background: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #0066cc;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* ===== Navigation ===== */
.nav {
    background: #ffffff;
    border-bottom: 1px solid #e9ecef;
    padding: 0 1rem;
}

.nav-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    min-height: 56px;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: #2d3436;
    white-space: nowrap;
}
.nav-brand:hover {
    text-decoration: none;
    color: #0066cc;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 4px;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #2d3436;
    border-radius: 1px;
    transition: transform 0.2s;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}
.nav-links a {
    color: #636e72;
    font-size: 0.9rem;
    padding: 0.5rem 0;
}
.nav-links a:hover {
    color: #0066cc;
    text-decoration: none;
}

@media (max-width: 640px) {
    .nav-toggle {
        display: flex;
    }
    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0;
        padding: 0.5rem 0;
    }
    .nav-inner.open .nav-links {
        display: flex;
    }
    .nav-links a {
        padding: 0.75rem 0;
        border-top: 1px solid #f1f3f5;
    }
}

/* ===== Main ===== */
.main {
    flex: 1;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ===== Hero ===== */
.hero {
    text-align: center;
    margin-bottom: 2rem;
}
.hero h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3436;
    margin-bottom: 0.5rem;
}
.hero-sub {
    color: #636e72;
    font-size: 1.05rem;
    line-height: 1.5;
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.5rem;
    }
    .hero-sub {
        font-size: 0.95rem;
    }
}

/* ===== Cards ===== */
.card {
    background: #ffffff;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}
.card-wide {
    max-width: 800px;
}
.card-light {
    background: #ffffff;
}

.card h1 {
    font-size: 1.6rem;
    margin-bottom: 1rem;
    color: #2d3436;
}
.card h2 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    color: #2d3436;
}
.card h3 {
    font-size: 1.05rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #2d3436;
}

.card section {
    margin-bottom: 1.5rem;
}
.card section:last-child {
    margin-bottom: 0;
}

.card p {
    margin-bottom: 0.75rem;
}

.card ul, .card ol {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
}
.card li {
    margin-bottom: 0.4rem;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}
.form-group small {
    display: block;
    color: #636e72;
    font-size: 0.8rem;
    margin-top: 0.3rem;
}
.form-group code {
    background: #f1f3f5;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

input[type="file"],
input[type="password"],
input[type="number"],
input[type="text"] {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: #ffffff;
    transition: border-color 0.15s;
}
input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

input[type="file"] {
    padding: 0.5rem;
    cursor: pointer;
}

/* ===== CAPTCHA ===== */
.captcha-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.captcha-question {
    font-weight: 600;
    font-size: 1.1rem;
    white-space: nowrap;
    min-width: 100px;
}
.captcha-input {
    width: 100px !important;
    flex: 0 0 auto;
}
.btn-refresh {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.3rem;
    padding: 0.4rem 0.6rem;
    color: #636e72;
    transition: all 0.15s;
    flex: 0 0 auto;
}
.btn-refresh:hover {
    border-color: #0066cc;
    color: #0066cc;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-align: center;
}
.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: #0066cc;
    color: #ffffff;
    width: 100%;
}
.btn-primary:hover {
    background: #0052a3;
}
.btn-primary:active {
    transform: scale(0.98);
}

.btn-outline {
    background: transparent;
    color: #0066cc;
    border: 1px solid #0066cc;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
}
.btn-outline:hover {
    background: #0066cc;
    color: #ffffff;
}

/* ===== Alerts ===== */
.alert {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
}
.alert-error {
    background: #fff5f5;
    color: #c0392b;
    border: 1px solid #f5c6cb;
}
.alert-success {
    background: #f0fff4;
    color: #27ae60;
    border: 1px solid #c3e6cb;
}
.alert-warning {
    background: #fffdf0;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* ===== Feature Grid ===== */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin: 1rem 0;
}
.feature {
    background: #f8f9fa;
    padding: 0.6rem 0.85rem;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #2d3436;
}

@media (max-width: 480px) {
    .feature-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Example Links ===== */
.example-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

/* ===== Credits List ===== */
.credits-list li {
    margin-bottom: 0.75rem;
}

/* ===== Architecture List ===== */
.arch-list li {
    margin-bottom: 0.75rem;
}

/* ===== Footer ===== */
.footer {
    background: #ffffff;
    border-top: 1px solid #e9ecef;
    padding: 1.5rem 1rem;
    text-align: center;
}
.footer-inner {
    max-width: 960px;
    margin: 0 auto;
}
.footer p {
    color: #636e72;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}
.footer a {
    color: #636e72;
}
.footer a:hover {
    color: #0066cc;
}
.footer-note {
    font-size: 0.8rem !important;
    color: #adb5bd !important;
}

/* ===== Result Page ===== */
.result-icon {
    font-size: 3.5rem;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    font-weight: 700;
}
.result-success {
    background: #f0fff4;
    color: #27ae60;
    border: 2px solid #c3e6cb;
}
.result-error {
    background: #fff5f5;
    color: #c0392b;
    border: 2px solid #f5c6cb;
}
.result-note {
    color: #636e72;
    font-size: 0.9rem;
    margin-top: 0.75rem;
}

/* ===== Loading State ===== */
.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-loading::before {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Responsive Spacing ===== */
@media (max-width: 640px) {
    .card {
        padding: 1.25rem;
        border-radius: 8px;
    }
    .main {
        padding: 1rem 0.75rem;
    }
}
