:root {
    color-scheme: light;
    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-strong: #f0f2f6;
    --text: #0a0e1a;
    --muted: #4a5266;
    --faint: #8b93a7;
    --line: #e6e8ee;
    --line-strong: #d8dce6;
    --accent: #2151ff;
    --accent-strong: #173dcc;
    --accent-soft: rgba(33, 81, 255, 0.08);
    --warning: #b45309;
    --danger: #b42318;
    --success: #047857;
    --shadow: 0 24px 80px -24px rgba(10, 14, 26, 0.18);
    --shadow-soft: 0 12px 40px -18px rgba(10, 14, 26, 0.16);
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --display: "Space Grotesk", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(rgba(10, 14, 26, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(10, 14, 26, 0.035) 1px, transparent 1px),
        radial-gradient(ellipse 60% 70% at 88% 4%, rgba(0, 212, 255, 0.14), transparent 58%),
        radial-gradient(ellipse 54% 62% at 12% 0%, rgba(33, 81, 255, 0.13), transparent 60%),
        var(--bg);
    background-size: 56px 56px, 56px 56px, auto, auto, auto;
}

button,
input,
select {
    font: inherit;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 24px 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    font-family: var(--display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    overflow: hidden;
    border-radius: 7px;
    background: transparent;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.server-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 48vw;
    overflow: hidden;
    padding: 9px 12px;
    border: 1px solid rgba(230, 232, 238, 0.86);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    font-size: 13px;
    font-family: var(--mono);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.server-pill span {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(4, 120, 87, 0.12);
}

.shell {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
    padding: 24px 0 64px;
}

.hero {
    margin-bottom: 26px;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 800;
}

h1 {
    max-width: 820px;
    margin: 0;
    font-family: var(--display);
    font-size: clamp(36px, 5vw, 64px);
    font-weight: 500;
    line-height: 1.04;
    letter-spacing: -0.03em;
}

.hero-copy {
    max-width: 720px;
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.65;
}

.workspace {
    display: block;
}

.converter,
.side-card {
    border: 1px solid rgba(230, 232, 238, 0.96);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.converter {
    overflow: hidden;
}

.mode-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    padding: 12px;
    background: rgba(240, 242, 246, 0.64);
    border-bottom: 1px solid var(--line);
}

.mode-tab {
    min-height: 72px;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 16px;
    color: var(--muted);
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.mode-tab span {
    display: block;
}

.mode-tab span {
    color: inherit;
    font-weight: 600;
}

.mode-tab.active {
    color: var(--text);
    border-color: rgba(33, 81, 255, 0.18);
    background: #ffffff;
    box-shadow: var(--shadow-soft);
}

.mode-panel {
    display: none;
    padding: 24px;
}

.mode-panel.active {
    display: block;
}

.dropzone {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 410px;
    padding: 48px 32px;
    border: 1.5px dashed var(--line-strong);
    border-radius: 20px;
    background:
        radial-gradient(ellipse 55% 80% at 80% 18%, rgba(0, 212, 255, 0.11), transparent 58%),
        radial-gradient(ellipse 55% 80% at 18% 82%, rgba(33, 81, 255, 0.10), transparent 58%),
        #fbfcff;
    text-align: center;
    cursor: pointer;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.dropzone:hover,
.dropzone:focus,
.dropzone.dragover {
    border-color: var(--accent);
    outline: none;
    background:
        radial-gradient(ellipse 55% 80% at 80% 18%, rgba(0, 212, 255, 0.16), transparent 58%),
        radial-gradient(ellipse 55% 80% at 18% 82%, rgba(33, 81, 255, 0.15), transparent 58%),
        #ffffff;
    box-shadow: inset 0 0 0 1px rgba(33, 81, 255, 0.12);
}

.dropzone.dragover {
    transform: translateY(-1px);
}

.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 18px;
    color: #ffffff;
    background: var(--text);
    font-size: 38px;
    font-weight: 300;
    line-height: 1;
    box-shadow: 0 22px 46px -24px rgba(10, 14, 26, 0.52);
}

.dropzone h2 {
    margin: 0;
    font-family: var(--display);
    font-size: 30px;
    font-weight: 500;
    line-height: 1.18;
}

.mobile-copy {
    display: none;
}

.dropzone p {
    max-width: 420px;
    margin: 12px auto 0;
    color: var(--muted);
    line-height: 1.6;
}

.dropzone .upload-note {
    max-width: 560px;
    margin-top: 8px;
    color: var(--faint);
    font-size: 14px;
}

.upload-formats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: 520px;
    margin: 22px auto 0;
    pointer-events: none;
}

.upload-formats span {
    padding: 8px 10px;
    border: 1px solid rgba(230, 232, 238, 0.9);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.74);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
}

.file-list {
    display: grid;
    gap: 10px;
    min-height: 0;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.file-list li {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #ffffff;
}

.file-name {
    overflow: hidden;
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.file-size {
    color: var(--muted);
    font-size: 13px;
}

.url-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 12px 14px;
    align-items: end;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(247, 248, 250, 0.78);
}

.url-card label,
.field-group label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.url-row input,
.url-card select,
.field-group input,
.field-group select {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    color: var(--text);
    background: #ffffff;
}

.url-row input:focus,
.field-group input:focus,
.field-group select:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(33, 81, 255, 0.12);
}

.settings {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(130px, 1fr)) auto auto auto;
    gap: 14px;
    align-items: end;
    padding: 20px 24px;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.92);
}

.field-group {
    display: grid;
    gap: 7px;
}

.url-card-tip {
    grid-column: 1 / -1;
    margin: 2px 0 0;
    padding-top: 4px;
    color: var(--faint);
    font-size: 13px;
    line-height: 1.45;
}

.toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--muted);
    background: rgba(247, 248, 250, 0.82);
    font-weight: 600;
    white-space: nowrap;
}

.toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 24px 24px;
    background: rgba(255, 255, 255, 0.92);
}

.status {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    color: var(--muted);
    background: rgba(240, 242, 246, 0.8);
    line-height: 1.4;
}

.status:empty {
    display: none;
}

.status.ok {
    color: var(--success);
    background: #ecfdf5;
}

.status.error {
    color: var(--danger);
    background: #fef3f2;
}

.status.busy {
    color: var(--warning);
    background: #fffbeb;
}

.primary,
.download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
}

.primary {
    min-width: 150px;
    padding: 0 22px;
    border: 0;
    color: #ffffff;
    background: var(--text);
    cursor: pointer;
    box-shadow: 0 18px 38px -22px rgba(10, 14, 26, 0.56);
}

.primary:hover {
    background: var(--accent);
}

.primary:disabled {
    cursor: wait;
    opacity: 0.68;
}

.download {
    margin: 0 24px 24px;
    padding: 0 18px;
    color: var(--accent);
    background: var(--accent-soft);
    cursor: pointer;
}

.stats-hero {
    margin-bottom: 18px;
}

.stats-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr)) auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid rgba(230, 232, 238, 0.96);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-soft);
}

.stats-filter label {
    display: grid;
    gap: 7px;
}

.stats-filter span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.stats-filter input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    color: var(--text);
    background: #ffffff;
}

.stats-filter input:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(33, 81, 255, 0.12);
}

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

.stats-card {
    min-height: 150px;
    padding: 24px;
    border: 1px solid rgba(230, 232, 238, 0.96);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-soft);
}

.stats-card span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.stats-card strong {
    display: block;
    margin-top: 18px;
    font-family: var(--display);
    font-size: clamp(36px, 5vw, 58px);
    font-weight: 500;
    line-height: 1;
}

.muted-card {
    background: rgba(247, 248, 250, 0.86);
}

.stats-table-wrap {
    margin-top: 20px;
    overflow-x: auto;
    border: 1px solid rgba(230, 232, 238, 0.96);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow);
}

.stats-table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
}

.stats-table th,
.stats-table td {
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.stats-table th {
    color: var(--muted);
    background: rgba(240, 242, 246, 0.64);
    font-size: 13px;
    font-weight: 700;
}

.stats-table td:not(:first-child),
.stats-table th:not(:first-child) {
    text-align: right;
}

.stats-table tbody tr:last-child td {
    border-bottom: 0;
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto 32px;
    padding: 22px 24px;
    border: 1px solid rgba(230, 232, 238, 0.96);
    border-radius: 24px;
    color: var(--muted);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(247, 248, 250, 0.82)),
        radial-gradient(ellipse 42% 120% at 88% 0%, rgba(0, 212, 255, 0.12), transparent 64%);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.footer-brand {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
}

.footer-brand .brand-mark {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
}

.site-footer strong {
    display: block;
    color: var(--text);
    font-family: var(--display);
    font-size: 18px;
    font-weight: 600;
}

.site-footer p {
    max-width: 640px;
    margin: 7px 0 0;
    line-height: 1.7;
}

.footer-meta {
    display: grid;
    justify-items: end;
    gap: 12px;
    flex: 0 0 auto;
}

.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px 18px;
}

.site-footer a {
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--accent);
}

.footer-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.footer-tags span {
    padding: 7px 10px;
    border: 1px solid rgba(230, 232, 238, 0.92);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 700;
}

.hidden {
    display: none !important;
}

@media (max-width: 980px) {
    .settings {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .topbar,
    .shell,
    .site-footer {
        width: min(100% - 24px, 1180px);
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding: 18px 0 10px;
    }

    .brand {
        font-size: 20px;
    }

    .shell {
        padding-top: 16px;
        padding-bottom: 40px;
    }

    .hero {
        margin-bottom: 18px;
    }

    h1 {
        font-size: 32px;
        line-height: 1.12;
    }

    .server-pill {
        max-width: 100%;
    }

    .site-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        margin-bottom: 24px;
        padding: 18px;
        border-radius: 18px;
    }

    .footer-brand {
        gap: 12px;
    }

    .footer-meta {
        justify-items: start;
    }

    .site-footer nav {
        justify-content: flex-start;
    }

    .footer-tags {
        justify-content: flex-start;
    }

    .mode-tabs,
    .url-card,
    .settings,
    .action-row,
    .stats-filter,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .mode-tabs {
        display: grid;
        padding: 8px;
    }

    .mode-tab {
        min-height: 54px;
        border-radius: 12px;
    }

    .mode-panel,
    .settings,
    .action-row,
    .stats-filter {
        padding-left: 16px;
        padding-right: 16px;
    }

    .converter,
    .stats-table-wrap {
        border-radius: 18px;
    }

    .dropzone {
        min-height: 320px;
        padding: 32px 18px;
        border-radius: 16px;
    }

    .dropzone h2 {
        font-size: 23px;
    }

    .desktop-copy {
        display: none;
    }

    .mobile-copy {
        display: inline;
    }

    .dropzone .upload-note {
        font-size: 13px;
    }

    .file-list li {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .action-row {
        display: grid;
    }

    .primary,
    .download {
        width: 100%;
    }

    .download {
        margin: 0 16px 16px;
        width: calc(100% - 32px);
    }

    .stats-card {
        min-height: 120px;
        padding: 20px;
    }

    .stats-table {
        min-width: 0;
        font-size: 13px;
    }

    .stats-table th,
    .stats-table td {
        padding: 12px 8px;
    }
}
