
:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --text: #0f172a;
    --card: #ffffff;
    --number-bg: #e2e8f0;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --shadow: rgba(15, 23, 42, 0.12);
    --toggle-bg: #e2e8f0;
    --toggle-fg: #0f172a;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b0f19;
    --text: #e6e9f0;
    --card: #111827;
    --number-bg: #1f2937;
    --accent: #7c3aed;
    --accent-hover: #5b21b6;
    --shadow: rgba(0, 0, 0, 0.35);
    --toggle-bg: #1f2937;
    --toggle-fg: #e6e9f0;
}

body {
    background: radial-gradient(circle at top, rgba(37, 99, 235, 0.15), transparent 45%), var(--bg);
    color: var(--text);
    font-family: "Manrope", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

.container {
    text-align: center;
    background: var(--card);
    padding: 2.5rem 3rem;
    border-radius: 20px;
    box-shadow: 0 20px 50px var(--shadow);
    min-width: 320px;
}

.controls {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
}

.lang-toggle {
    display: inline-flex;
    background: var(--toggle-bg);
    border-radius: 999px;
    padding: 0.2rem;
    gap: 0.2rem;
}

.lang-btn {
    background: transparent;
    color: var(--toggle-fg);
    border: none;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: none;
}

.lang-btn[aria-pressed="true"] {
    background: var(--accent);
    color: #ffffff;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

h1 {
    font-size: 3rem;
    margin: 0;
    letter-spacing: -0.02em;
}

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

.number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--number-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 8px 16px var(--shadow);
}

button {
    background-color: var(--accent);
    color: #ffffff;
    border: none;
    padding: 1rem 2rem;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    box-shadow: 0 12px 24px var(--shadow);
}

button:hover {
    background-color: var(--accent-hover);
}

.secondary {
    background: var(--number-bg);
    color: var(--text);
    box-shadow: none;
}

.secondary:hover {
    background: var(--toggle-bg);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    background: var(--toggle-bg);
    color: var(--toggle-fg);
    font-weight: 600;
    box-shadow: none;
}

.theme-toggle:hover {
    background: var(--number-bg);
}

.toggle-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.animal-test {
    text-align: left;
}

.section-header h2 {
    margin: 0 0 0.4rem;
    font-size: 1.8rem;
}

.section-subtext {
    margin: 0 0 1.6rem;
    color: rgba(15, 23, 42, 0.7);
}

html[data-theme="dark"] .section-subtext {
    color: rgba(230, 233, 240, 0.7);
}

.test-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.camera-card,
.result-card {
    background: var(--bg);
    border-radius: 16px;
    padding: 1.2rem;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

html[data-theme="dark"] .camera-card,
html[data-theme="dark"] .result-card {
    box-shadow: inset 0 0 0 1px rgba(230, 233, 240, 0.08);
}

.camera-stage {
    background: var(--number-bg);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

#webcam,
#snapshot {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#snapshot {
    display: none;
}

.camera-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1rem 0 0.8rem;
}

.upload {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text);
}

.upload input {
    display: none;
}

.result-card {
    display: grid;
    gap: 0.8rem;
    align-content: start;
}

.result-header {
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: rgba(15, 23, 42, 0.6);
}

html[data-theme="dark"] .result-header {
    color: rgba(230, 233, 240, 0.6);
}

.result-emoji {
    font-size: 3rem;
}

.result-text {
    font-size: 1.2rem;
    font-weight: 700;
}

.result-confidence {
    font-size: 0.95rem;
    color: rgba(15, 23, 42, 0.7);
}

html[data-theme="dark"] .result-confidence {
    color: rgba(230, 233, 240, 0.7);
}

.hint {
    font-size: 0.85rem;
    color: rgba(15, 23, 42, 0.55);
}

html[data-theme="dark"] .hint {
    color: rgba(230, 233, 240, 0.55);
}

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--number-bg), transparent);
    margin: 2rem 0;
}

.contact {
    text-align: left;
}

.contact h2 {
    margin: 0 0 0.4rem;
    font-size: 1.6rem;
}

.contact-subtext {
    margin: 0 0 1.2rem;
    color: rgba(15, 23, 42, 0.7);
}

html[data-theme="dark"] .contact-subtext {
    color: rgba(230, 233, 240, 0.7);
}

.contact-form {
    display: grid;
    gap: 0.9rem;
}

.contact-form label {
    display: grid;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    background: var(--number-bg);
    color: var(--text);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 0.7rem 0.9rem;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.contact-form button {
    justify-self: start;
    padding: 0.9rem 1.6rem;
}

@media (max-width: 720px) {
    body {
        height: auto;
        padding: 2rem 1.5rem;
    }

    .container {
        width: 100%;
        padding: 2rem;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .controls {
        width: 100%;
        justify-content: space-between;
    }

    h1 {
        font-size: 2.4rem;
    }

    .camera-controls {
        flex-direction: column;
        align-items: stretch;
    }
}
