:root {
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --text-main: #0f172a;
    --text-soft: #475569;
    --text-muted: #64748b;
    --surface: rgba(255, 255, 255, 0.92);
    --border: rgba(148, 163, 184, 0.24);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    background: #f8fafc;
    color: var(--text-main);
    font-family: Inter, 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
}

h1:focus {
    outline: none;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

.surface-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
    backdrop-filter: blur(14px);
}

.btn {
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-primary,
.btn-primary:hover,
.btn-primary:focus {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-success,
.btn-success:hover,
.btn-success:focus {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}

.btn-outline-secondary {
    border-color: #cbd5e1;
    color: var(--text-main);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: var(--text-main);
}

.btn:focus,
.btn:active:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
    outline: none;
}

.form-control {
    border: 1px solid #dbe5f0;
    border-radius: 10px;
    color: var(--text-main);
    padding: 0.5rem 0.85rem;
    font-size: 0.95rem;
}

.form-control:focus {
    border-color: var(--accent);
}

.valid.modified:not([type=checkbox]) {
    border-color: #16a34a;
}

.invalid {
    border-color: #dc2626;
}

.validation-message {
    color: #dc2626;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

#blazor-error-ui {
    color-scheme: light only;
    background: #fef3c7;
    border-top: 1px solid #fcd34d;
    bottom: 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    color: #92400e;
    display: none;
    font-size: 0.875rem;
    left: 0;
    padding: 0.75rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
}

.blazor-error-boundary {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 14px;
    color: #991b1b;
    padding: 1rem 1.25rem 1rem 3.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23dc2626' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20A10 10 0 0 0 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 1rem center;
    background-size: 1.5rem;
}

.blazor-error-boundary::after {
    content: "Гэнэтийн алдаа гарлаа.";
}

.splash-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    background: #f8fafc;
}

.splash-logo {
    animation: splash-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.splash-logo svg {
    filter: drop-shadow(0 8px 24px rgba(79, 70, 229, 0.35));
}

.splash-dots {
    display: flex;
    gap: 0.55rem;
}

.splash-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: splash-bounce 1.1s ease-in-out infinite;
}

.splash-dots span:nth-child(2) { animation-delay: 0.18s; }
.splash-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes splash-pop {
    from { opacity: 0; transform: scale(0.7); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes splash-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40%            { transform: translateY(-10px); opacity: 1; }
}

.home-shell {
    display: grid;
    gap: 1.5rem;
    padding: 1rem 0 0;
}

.intro-block {
    max-width: 760px;
    padding: 1rem 0;
}

.eyebrow,
.panel-kicker {
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    margin: 0 0 0.8rem;
    text-transform: uppercase;
}

.intro-block h1,
.fallback-panel h1 {
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin: 0 0 0.75rem;
}

.lede,
.panel-head p,
.field-note,
.helper-panel,
.result-copy p,
.qr-caption,
.redirect-loader p,
.fallback-panel p,
.route-forward p {
    color: var(--text-soft);
    margin: 0;
}

.workspace-grid,
.result-grid {
    display: grid;
    gap: 1.5rem;
}

.workspace-grid {
    align-items: start;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 360px);
}

.form-panel,
.helper-panel,
.qr-card,
.result-copy,
.fallback-panel,
.redirect-loader,
.route-forward {
    padding: 1.5rem;
}

.form-panel {
    display: grid;
    gap: 1.2rem;
}

.panel-head {
    display: grid;
    gap: 0.35rem;
}

.panel-head h2,
.helper-panel h2,
.result-copy h2 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
}

.field-stack {
    display: grid;
    gap: 0.5rem;
}

.field-stack label {
    font-size: 0.92rem;
    font-weight: 600;
}

.field-note {
    font-size: 0.92rem;
}

.simple-steps {
    color: var(--text-main);
    display: grid;
    gap: 0.75rem;
    margin: 1rem 0 0;
    padding-left: 1.15rem;
}

.notice {
    border-radius: 18px;
    padding: 1rem 1.1rem;
}

.notice-warning {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
}

.result-grid {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
}

.qr-card,
.result-copy {
    display: grid;
    gap: 1rem;
}

.qr-card svg {
    background: #fff;
    border-radius: 20px;
    display: block;
    height: auto;
    padding: 1rem;
    width: 100%;
}

.qr-caption {
    font-size: 0.92rem;
}

.url-box {
    background: #f8fafc;
    border: 1px solid #dbe5f0;
    border-radius: 18px;
    color: #1e293b;
    font-family: 'JetBrains Mono', Consolas, 'Liberation Mono', monospace;
    font-size: 0.85rem;
    overflow-wrap: anywhere;
    padding: 1rem;
}

.result-actions,
.fallback-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.redirect-shell {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 70vh;
    padding: 1rem 0;
}

.redirect-loader,
.fallback-panel,
.route-forward {
    max-width: 560px;
}

.redirect-loader {
    color: var(--text-muted);
    display: grid;
    gap: 0.9rem;
    justify-items: center;
    text-align: center;
}

.redirect-loader h1,
.fallback-panel h1 {
    margin-bottom: 0;
}

.fallback-panel,
.route-forward {
    margin: 2rem auto;
    text-align: center;
}

.fallback-actions {
    justify-content: center;
    margin-top: 1rem;
}

.not-found-panel {
    max-width: 640px;
}

@media (max-width: 900px) {
    .workspace-grid,
    .result-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .intro-block h1,
    .fallback-panel h1 {
        font-size: clamp(1.35rem, 8vw, 1.9rem);
    }

    .form-panel,
    .helper-panel,
    .qr-card,
    .result-copy,
    .fallback-panel,
    .redirect-loader,
    .route-forward {
        padding: 1.2rem;
    }

    .result-actions,
    .fallback-actions {
        flex-direction: column;
    }

    .result-actions .btn,
    .fallback-actions .btn {
        width: 100%;
    }
}
