:root {
    --bg0: #101814;
    --bg1: #17241c;
    --surface: rgba(220, 245, 230, 0.06);
    --surface-strong: rgba(220, 245, 230, 0.1);
    --line: rgba(160, 210, 175, 0.2);
    --text: #eef7f1;
    --muted: #9fb8a8;
    --accent: #3d9b6a;
    --accent-deep: #2a704c;
    --ok: #7dbe74;
    --warn: #e0b06a;
    --err: #e07a6a;
    --radius: 18px;
    --font: "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(900px 500px at 10% -10%, rgba(61, 155, 106, 0.3), transparent 60%),
        radial-gradient(700px 420px at 100% 0%, rgba(30, 80, 50, 0.4), transparent 55%),
        linear-gradient(165deg, var(--bg1), var(--bg0) 55%, #0a100d);
}

.page {
    width: min(720px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2.5rem 0 3rem;
    display: grid;
    gap: 1.25rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.brand img {
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(61, 155, 106, 0.4);
}

.brand-home {
    display: block;
    line-height: 0;
    border-radius: 50%;
    text-decoration: none;
}

.brand-home:hover img {
    filter: brightness(1.08);
}

.brand-home:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.brand-name {
    margin: 0;
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
}

h1 {
    margin: 0.15rem 0 0;
    font-size: clamp(1.6rem, 4vw, 2.1rem);
    font-weight: 650;
    letter-spacing: -0.02em;
}

.lede {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
    max-width: 42rem;
}

.banner {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    line-height: 1.45;
}

.banner.warn {
    border-color: rgba(230, 179, 92, 0.45);
    background: rgba(230, 179, 92, 0.12);
    color: #f0d9a8;
}

.banner code {
    font-size: 0.9em;
    color: var(--text);
}

.dropzone {
    position: relative;
    border: 1.5px dashed rgba(61, 155, 106, 0.55);
    border-radius: var(--radius);
    background: var(--surface);
    min-height: 220px;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
    outline: none;
}

.dropzone:hover,
.dropzone:focus-visible {
    border-color: var(--accent);
    background: var(--surface-strong);
}

.dropzone.is-dragover {
    border-color: var(--accent);
    background: rgba(61, 155, 106, 0.16);
    transform: scale(1.01);
}

.dropzone.is-busy {
    pointer-events: none;
    cursor: progress;
}

.dropzone.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.dropzone-inner {
    text-align: center;
    padding: 2rem 1.25rem;
}

.drop-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 0.9rem;
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(85, 184, 130, 0.95), rgba(42, 112, 76, 0.9));
    position: relative;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}

.drop-icon::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 22px;
    height: 28px;
    transform: translate(-50%, -50%);
    border: 2px solid #eef7f1;
    border-radius: 3px;
    background: transparent;
}

.drop-icon::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 54%;
    width: 12px;
    height: 8px;
    transform: translate(-50%, -50%);
    border-top: 2px solid #eef7f1;
    border-bottom: 2px solid #eef7f1;
    background: transparent;
    box-shadow: 0 -5px 0 #eef7f1;
}

.drop-title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 600;
}

.drop-sub {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.preview {
    position: absolute;
    inset: 0.75rem;
    width: calc(100% - 1.5rem);
    height: calc(100% - 1.5rem);
    object-fit: contain;
    border-radius: 12px;
    pointer-events: none;
    opacity: 0.35;
}

.progress {
    position: absolute;
    inset: 0;
    display: none;
    place-content: center;
    gap: 0.55rem;
    padding: 1.5rem;
    background: rgba(10, 16, 13, 0.78);
    border-radius: inherit;
    backdrop-filter: blur(2px);
}

.progress.is-active {
    display: grid;
}

.progress-head {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.75rem;
}

.progress-pct {
    font-size: 1.1rem;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
}

.progress-track {
    width: min(280px, 70vw);
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), #8fd0b0);
    transition: width 0.2s ease;
}

.progress-bar.is-indeterminate {
    width: 40% !important;
    animation: slide 1.1s ease-in-out infinite;
}

@keyframes slide {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}

.progress-label {
    margin: 0;
    text-align: center;
    color: var(--muted);
}

.status {
    margin: 0;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
}

.status.is-error {
    border-color: rgba(224, 122, 106, 0.45);
    background: rgba(224, 122, 106, 0.12);
    color: #f2c2ba;
}

.status.is-ok {
    border-color: rgba(125, 190, 116, 0.4);
    background: rgba(125, 190, 116, 0.1);
    color: #c8e4c3;
}

.result {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 1rem 1.1rem 1.15rem;
    display: grid;
    gap: 0.75rem;
    animation: rise 0.35s ease;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.result-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.result-head h2 {
    margin: 0;
    font-size: 1.05rem;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.filename {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
    word-break: break-all;
}

.ocr-text {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.05rem;
    line-height: 1.55;
    max-height: min(50vh, 420px);
    overflow: auto;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.btn {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 0.55rem 1rem;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    color: #0a100d;
    background: linear-gradient(180deg, #55b882, var(--accent-deep));
}

.btn:hover { filter: brightness(1.06); }

.btn.secondary {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--line);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.14);
    filter: none;
}

.foot {
    margin-top: 0.5rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.foot a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.foot a:hover {
    color: var(--text);
    border-bottom-color: var(--accent);
}

@media (max-width: 560px) {
    .page { padding-top: 1.5rem; }
    .result-actions { width: 100%; }
    .btn { flex: 1 1 auto; text-align: center; }
}
