@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap");

:root {
    --bg-1: #050f2c;
    --bg-2: #08163f;
    --line: rgba(80, 150, 255, 0.22);
    --panel: rgba(16, 24, 54, 0.78);
    --soft-border: rgba(132, 177, 255, 0.28);
    --text: #f5f7ff;
    --muted: #b5c4e8;
    --accent: #ff8b2c;
}

body {
    font-family: "Poppins", sans-serif;
    color: var(--text);
    min-height: 100vh;
    background: radial-gradient(circle at center, #0a1a35 0%, #071022 50%, #020617 100%);
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
}

body::before {
    z-index: -2;
    background:
        linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 64px,
        linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 64px 100%;
    opacity: 0.15;
}

body::after {
    z-index: -1;
    background:
        radial-gradient(circle at 18% 20%, rgba(65, 118, 255, 0.22) 0%, transparent 34%),
        radial-gradient(circle at 86% 16%, rgba(255, 139, 44, 0.14) 0%, transparent 34%),
        radial-gradient(circle at 50% 82%, rgba(40, 155, 255, 0.12) 0%, transparent 40%);
}

.topbar {
    max-width: 1260px;
    margin: 10px auto 0;
    padding: 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 167, 109, 0.24);
    background: rgba(30, 40, 70, 0.5);
    backdrop-filter: blur(12px);
    box-shadow: 0 0 22px rgba(255, 150, 60, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 10px;
    z-index: 30;
}

.brand {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1;
    color: #ffffff;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.nav::-webkit-scrollbar {
    display: none;
}

.nav a,
.drop-btn {
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    border-radius: 999px;
    text-decoration: none;
    padding: 12px 14px;
    border: none;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
}

.nav a:hover,
.drop-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 15px rgba(255, 150, 60, 0.26);
}

.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 320px;
    background: rgba(16, 22, 45, 0.96);
    border: 1px solid var(--soft-border);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 30px 45px rgba(5, 10, 28, 0.56);
    z-index: 40;
}

.dropdown-menu a {
    display: block;
    padding: 12px 14px;
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    border-radius: 0;
}

.dropdown-menu a:hover {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.page {
    max-width: 1160px;
    margin: 32px auto;
    padding: 0 18px 22px;
}

.title {
    text-align: center;
    font-size: clamp(30px, 4vw, 44px);
    font-weight: 800;
    line-height: 1.12;
    margin-bottom: 14px;
}

.subtitle {
    text-align: center;
    max-width: 960px;
    margin: 0 auto 28px;
    color: var(--muted);
    font-size: clamp(16px, 2vw, 20px);
    line-height: 1.6;
}

.card {
    background: var(--panel);
    border: 1px solid var(--soft-border);
    border-radius: 22px;
    padding: 26px 22px;
    box-shadow: 0 20px 40px rgba(5, 14, 38, 0.34);
}

.upload-box {
    margin: 0 auto;
    max-width: 680px;
    border: 1.5px dashed rgba(127, 172, 255, 0.7);
    border-radius: 16px;
    padding: 34px 20px;
    text-align: center;
    background: rgba(10, 18, 44, 0.66);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.upload-box:hover,
.upload-box.dragover {
    background: rgba(13, 24, 54, 0.92);
    border-color: rgba(255, 138, 61, 0.88);
    transform: translateY(-1px);
}

.upload-title {
    font-size: 30px;
    margin-bottom: 10px;
    color: #9bc1ff;
}

.upload-hint {
    color: #c0d2f4;
    font-size: 16px;
}

.controls {
    margin-top: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

button {
    border-radius: 999px;
    border: 1px solid rgba(122, 166, 248, 0.34);
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.06);
    color: #e7efff;
}

button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-primary {
    background: transparent;
    color: var(--accent);
    border: 1px solid #ff8a3d;
    cursor: pointer;
    min-width: 120px;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.btn-primary:hover {
    background: #ff8a3d;
    color: #ffffff;
    box-shadow: 0 0 18px rgba(255, 140, 70, 0.42);
    transform: translateY(-1px);
}

.result-wrap {
    margin-top: 24px;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 22px;
}

.preview,
.result {
    background: rgba(9, 18, 46, 0.72);
    border: 1px solid rgba(107, 151, 255, 0.22);
    border-radius: 16px;
    padding: 14px;
}

.preview h3,
.result h3 {
    margin-bottom: 10px;
    font-size: 18px;
    color: #ffffff;
}

.preview img {
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(126, 166, 255, 0.26);
}

.preview p {
    color: var(--muted);
}

#result {
    min-height: 260px;
    max-height: 410px;
    overflow: auto;
    white-space: pre-wrap;
    background: rgba(7, 14, 34, 0.86);
    border: 1px solid rgba(126, 166, 255, 0.26);
    border-radius: 12px;
    padding: 14px;
    font-size: 16px;
    line-height: 1.6;
    color: #edf3ff;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.actions form {
    margin: 0;
}

.actions button:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.file-name {
    margin-top: 9px;
    color: #9fc0f9;
    font-size: 14px;
}

.result-wrap.hidden {
    display: none;
}

@media (max-width: 980px) {
    .topbar {
        margin: 8px 14px 0;
        border-radius: 20px;
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .brand {
        font-size: 22px;
    }

    .nav a,
    .drop-btn {
        font-size: 15px;
        padding: 10px 12px;
    }

    .dropdown-menu {
        min-width: 250px;
    }

    .result-wrap {
        grid-template-columns: 1fr;
    }

    #result {
        min-height: 220px;
    }
}

@media (max-width: 680px) {
    .page {
        padding: 0 12px 18px;
    }

    .title {
        font-size: clamp(24px, 8.5vw, 32px);
    }

    .subtitle {
        font-size: 15px;
    }

    .card {
        border-radius: 16px;
        padding: 16px 12px;
    }

    .upload-box {
        padding: 24px 14px;
        border-radius: 12px;
    }

    .upload-title {
        font-size: 24px;
    }

    .upload-hint {
        font-size: 14px;
    }

    .preview,
    .result {
        border-radius: 12px;
    }

    #result {
        font-size: 14px;
        line-height: 1.55;
    }
}
