* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, #dbeafe 0, transparent 35%),
        radial-gradient(circle at bottom right, #ede9fe 0, transparent 35%),
        linear-gradient(135deg, #f8fafc, #eef2ff);
    min-height: 100vh;
    color: #111827;
}

.page {
    max-width: 1050px;
    margin: 0 auto;
    padding: 28px 16px 60px;
}

.hero {
    text-align: center;
    margin-bottom: 28px;
}

.badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.12);
    color: #4338ca;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 14px;
    border: 1px solid rgba(79, 70, 229, 0.12);
}

.hero h1 {
    margin: 0;
    font-size: clamp(48px, 8vw, 82px);
    line-height: 0.95;
    letter-spacing: -3px;
    font-weight: 900;
}

.hero p {
    margin-top: 16px;
    color: #6b7280;
    font-size: 18px;
}

.card {
    background: rgba(255, 255, 255, 0.84);
    backdrop-filter: blur(14px);
    border-radius: 30px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow:
        0 10px 30px rgba(15, 23, 42, 0.06),
        0 2px 10px rgba(15, 23, 42, 0.04);
    margin-bottom: 22px;
}

.center {
    text-align: center;
}

.card h2 {
    margin-top: 0;
    margin-bottom: 18px;
    font-size: 24px;
    letter-spacing: -0.5px;
}

.model-card {
    margin-bottom: 20px;
}

.top-model-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: end;
}

.model-label {
    display: block;
    margin-bottom: 8px;
    color: #6b7280;
    font-size: 13px;
    font-weight: 800;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.stat {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    border-radius: 24px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.stat span {
    display: block;
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 8px;
}

.stat strong {
    display: block;
    font-size: 28px;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.model-status {
    background: #eef2ff;
    color: #312e81;
    border: 1px solid #c7d2fe;
    padding: 14px 18px;
    border-radius: 18px;
    margin-bottom: 18px;
    font-size: 14px;
}

.message {
    background: linear-gradient(135deg, #111827, #1f2937);
    color: white;
    padding: 18px 20px;
    border-radius: 22px;
    margin-bottom: 22px;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.18);
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

input,
select {
    width: 100%;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid #d1d5db;
    background: white;
    font-size: 16px;
    transition: all 0.15s ease;
    margin-bottom: 14px;
}

input:focus,
select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

button {
    border: none;
    border-radius: 18px;
    padding: 15px 22px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition:
        transform 0.12s ease,
        opacity 0.12s ease,
        box-shadow 0.12s ease;
}

button:hover {
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

.primary {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: white;
    box-shadow: 0 14px 30px rgba(79, 70, 229, 0.25);
}

.secondary {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    box-shadow: 0 14px 30px rgba(16, 185, 129, 0.2);
}

.ghost {
    background: white;
    color: #111827;
    border: 1px solid #e5e7eb;
}

.danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: white;
    box-shadow: 0 14px 30px rgba(239, 68, 68, 0.2);
}

.chat {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bubble {
    padding: 15px 18px;
    border-radius: 22px;
    max-width: 82%;
    line-height: 1.45;
    font-size: 15px;
    animation: fadeIn 0.18s ease;
}

.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: white;
    border-bottom-right-radius: 8px;
    box-shadow: 0 10px 22px rgba(79, 70, 229, 0.18);
}

.ai {
    align-self: flex-start;
    background: white;
    color: #111827;
    border-bottom-left-radius: 8px;
    border: 1px solid #e5e7eb;
}

.guess {
    align-self: center;
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    color: #9a3412;
    border: 1px solid #fed7aa;
    font-weight: 700;
}

.small-meta {
    margin-top: 8px;
    font-size: 13px;
    color: #4b5563;
}

.fallback-warning {
    color: #dc2626;
    font-weight: 800;
}

.error-box {
    margin-top: 10px;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13px;
}

.reasoning-box {
    margin-top: 14px;
    font-size: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 12px;
    background: white;
}

.reasoning-box summary {
    cursor: pointer;
    font-weight: 800;
}

.reasoning-box pre {
    white-space: pre-wrap;
    overflow-x: auto;
    background: #f9fafb;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
}

.actions {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 10px;
}

.muted {
    color: #6b7280;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 999px;
}

@media (max-width: 780px) {
    .grid,
    .stats,
    .top-model-form {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 52px;
    }

    .bubble {
        max-width: 100%;
    }

    .page {
        padding: 18px 12px 40px;
    }

    .card {
        padding: 20px;
        border-radius: 24px;
    }

    .stat strong {
        font-size: 24px;
    }

    .actions {
        flex-direction: column;
    }

    button {
        width: 100%;
    }

    .fallback-pill {
        margin-left: 0;
        margin-top: 8px;
    }
}