:root {
    --bg-deep: #070b14;
    --bg-card: rgba(18, 24, 38, 0.72);
    --border: rgba(255, 255, 255, 0.08);
    --text: #e8edf7;
    --muted: #94a3b8;
    --accent: #22d3ee;
    --accent-dim: rgba(34, 211, 238, 0.15);
    --violet: #818cf8;
    --radius: 16px;
    --font: "Instrument Sans", system-ui, -apple-system, sans-serif;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background: radial-gradient(1200px 600px at 10% -10%, rgba(129, 140, 248, 0.18), transparent 55%),
        radial-gradient(900px 500px at 90% 20%, rgba(34, 211, 238, 0.12), transparent 50%),
        var(--bg-deep);
    line-height: 1.55;
}

.bg-grid {
    position: fixed;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    z-index: 0;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

.glow {
    position: fixed;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.35;
    pointer-events: none;
    z-index: 0;
}

.glow-a {
    top: -120px;
    left: 10%;
    background: #6366f1;
}

.glow-b {
    bottom: -80px;
    right: 5%;
    background: #06b6d4;
}

.site-header {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 2.25rem 1.25rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 2rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--violet));
    box-shadow: 0 8px 24px rgba(34, 211, 238, 0.25);
}

.tagline {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.shell {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.25rem 3rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
    padding: 1.75rem 1.5rem;
}

.hero-title {
    margin: 0 0 0.5rem;
    font-size: clamp(1.55rem, 4vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.hero-lead {
    margin: 0 0 1.5rem;
    color: var(--muted);
    font-size: 1.02rem;
}

.hero-lead strong {
    color: var(--text);
    font-weight: 600;
}

.dropzone {
    border: 1px dashed rgba(148, 163, 184, 0.35);
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.2s, background 0.2s;
    outline: none;
}

.dropzone:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.dropzone-inner {
    text-align: center;
    cursor: pointer;
}

.drop-icon {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.drop-title {
    margin: 0 0 0.35rem;
    font-weight: 600;
}

.drop-hint {
    margin: 0;
    font-size: 0.88rem;
    color: var(--muted);
}

.preview-wrap {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.preview-img {
    max-width: min(100%, 420px);
    max-height: 280px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.25);
}

.controls {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

@media (min-width: 720px) {
    .controls {
        grid-template-columns: repeat(3, 1fr);
    }
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.select {
    appearance: none;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text);
    background: rgba(10, 14, 26, 0.85);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.65rem 2.25rem 0.65rem 0.75rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    cursor: pointer;
}

.select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.select:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 48px;
    padding: 0 1.75rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: #041018;
    background: linear-gradient(135deg, #22d3ee, #38bdf8);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 12px 40px rgba(34, 211, 238, 0.28);
    transition: transform 0.15s, filter 0.15s;
}

.btn-primary:hover:not(:disabled) {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(4, 16, 24, 0.25);
    border-top-color: #041018;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-ghost {
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--accent);
    background: transparent;
    border: 1px solid rgba(34, 211, 238, 0.35);
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-ghost:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.status {
    margin: 1rem 0 0;
    min-height: 1.4em;
    font-size: 0.92rem;
    color: var(--muted);
}

.status.error {
    color: #fca5a5;
}

.results {
    margin-top: 1.5rem;
}

.result-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 860px) {
    .result-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.result-panel {
    display: flex;
    flex-direction: column;
    min-height: 200px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(8, 12, 22, 0.55);
}

.result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.result-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.result-body {
    margin: 0;
    padding: 0.85rem;
    flex: 1;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
    font-size: 0.88rem;
    line-height: 1.55;
    color: #cbd5e1;
    overflow: auto;
    max-height: 420px;
}

.site-footer {
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.8rem;
    color: var(--muted);
}

.site-footer p {
    margin: 0;
}

.site-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem 1.15rem;
    margin-bottom: 1rem;
    font-size: 0.78rem;
    font-weight: 500;
}

.site-footer-links a {
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.site-footer-links a:hover {
    color: var(--accent);
    border-bottom-color: rgba(34, 211, 238, 0.45);
}

.hidden {
    display: none !important;
}

.ocr-shell {
    position: relative;
}

.result-body--blur {
    filter: blur(6px);
    user-select: none;
    pointer-events: none;
}

.scan-blur-cta {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(180deg, rgba(7, 11, 20, 0.06) 0%, rgba(7, 11, 20, 0.9) 100%);
    z-index: 2;
}

.scan-blur-cta.is-on {
    display: flex;
}

.scan-blur-cta__btn {
    display: block;
    width: 100%;
    max-width: 20rem;
    text-align: center;
    padding: 1rem 1.1rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #041018 !important;
    text-decoration: none !important;
    border-radius: 12px;
    background: linear-gradient(135deg, #22d3ee, #38bdf8);
    box-shadow: 0 6px 24px rgba(34, 211, 238, 0.35);
}

.scan-blur-cta__btn:active {
    transform: scale(0.98);
}

.scan-blur-cta__sub {
    margin: 0.55rem 0 0;
    font-size: 0.75rem;
    color: var(--muted);
    text-align: center;
}

.scan-blur-cta__alt {
    margin: 0.75rem 0 0;
    font-size: 0.78rem;
    text-align: center;
    max-width: 20rem;
    line-height: 1.4;
    color: var(--muted);
}

.scan-blur-cta__alt a {
    color: var(--accent);
    font-weight: 700;
}
