:root {
    --bg: #ffffff;
    --panel: #ffffff;
    --muted-bg: #f5f6f8;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --accent: #2563eb;
    --accent-weak: #eff4ff;
    --ok: #15803d;
    --error: #b91c1c;
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
}

.site-header {
    text-align: center;
    padding: 56px 16px 28px;
    border-bottom: 1px solid var(--border);
}

.site-header h1 {
    margin: 0;
    font-size: 1.7rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.tagline {
    color: var(--muted);
    margin-top: 8px;
    font-size: 0.95rem;
}

main {
    max-width: 860px;
    margin: 0 auto;
    padding: 36px 16px 72px;
}

.tools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.tool-card {
    display: flex;
    gap: 14px;
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.tool-card:hover {
    border-color: var(--accent);
    background: var(--accent-weak);
}

.tool-card.active {
    border-color: var(--accent);
    background: var(--accent-weak);
    box-shadow: 0 0 0 1px var(--accent) inset;
}

.tool-card.active .tool-icon {
    background: #ffffff;
    color: var(--accent);
}

.tool-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--muted-bg);
    color: #374151;
    display: grid;
    place-items: center;
    flex: none;
    transition: background 0.15s, color 0.15s;
}

.tool-card:hover .tool-icon {
    background: #ffffff;
    color: var(--accent);
}

.tool-icon svg {
    width: 22px;
    height: 22px;
}

.tool-card h3 {
    margin: 0 0 2px;
    font-size: 1rem;
    font-weight: 600;
}

.tool-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.4;
}

.workspace {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    margin-top: 32px;
    scroll-margin-top: 20px;
}

.workspace-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.workspace-head h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.ws-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--muted-bg);
    color: var(--accent);
    display: grid;
    place-items: center;
    flex: none;
}

.ws-icon svg {
    width: 21px;
    height: 21px;
}

.dropzone {
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 46px 20px;
    text-align: center;
    color: var(--muted);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-weak);
}

.file-list {
    list-style: none;
    padding: 0;
    margin: 14px 0 0;
}

.file-list li {
    background: var(--muted-bg);
    border-radius: 8px;
    padding: 8px 10px 8px 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
}

.file-list li .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-list li .file-meta {
    color: var(--muted);
    flex: none;
}

.file-list li.dragging {
    opacity: 0.45;
}

.file-list li.drag-over {
    border: 1px dashed var(--accent);
    background: var(--accent-weak);
}

.file-handle {
    color: var(--muted);
    cursor: grab;
    touch-action: none;
    user-select: none;
    display: grid;
    place-items: center;
    padding: 6px 4px;
    border-radius: 6px;
    flex: none;
}

.file-handle:hover {
    color: var(--accent);
    background: var(--accent-weak);
}

.file-handle:active {
    cursor: grabbing;
}

.file-pos {
    color: var(--muted);
    font-size: 0.85rem;
    min-width: 18px;
    text-align: right;
    flex: none;
}

.file-remove {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    padding: 6px 8px;
    border-radius: 6px;
    flex: none;
}

.file-remove:hover {
    color: var(--error);
    background: #fef2f2;
}

.file-actions {
    margin-top: 2px;
    text-align: right;
}

.file-actions button {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 6px 0;
}

.file-actions button:hover {
    color: var(--error);
}

.options {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.options label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.88rem;
    color: var(--muted);
}

.options input,
.options select {
    background: var(--panel);
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    color: var(--text);
    padding: 10px 12px;
    font-size: 16px;
    min-height: 44px;
}

.options input:focus,
.options select:focus {
    outline: none;
    border-color: var(--accent);
}

.quality-label {
    flex: 1;
    min-width: 260px;
}

.quality-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quality-row input[type="range"] {
    flex: 1;
    min-height: 32px;
    padding: 0;
    border: none;
    accent-color: var(--accent);
}

.quality-value {
    color: var(--text);
    font-weight: 600;
    min-width: 44px;
    text-align: right;
}

.quality-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 2px;
}

.quality-hint {
    color: var(--accent);
    font-size: 0.85rem;
    margin-top: 6px;
}

.convert {
    margin-top: 22px;
    width: 100%;
    min-height: 48px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s;
}

.convert:hover:not(:disabled) {
    background: #1d4ed8;
}

.convert:disabled {
    background: var(--muted-bg);
    color: var(--muted);
    cursor: not-allowed;
}

.progress {
    margin-top: 22px;
}

.progress-head {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 8px;
}

.progress-track {
    height: 8px;
    background: var(--muted-bg);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.result {
    margin-top: 22px;
    text-align: center;
}

.result .status {
    color: var(--muted);
    margin: 0 0 12px;
    font-size: 0.9rem;
}

.result a {
    display: inline-block;
    background: var(--ok);
    color: #ffffff;
    font-weight: 600;
    text-decoration: none;
    padding: 13px 22px;
    border-radius: 10px;
    min-height: 44px;
}

.error {
    margin-top: 16px;
    color: var(--error);
    text-align: center;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 9px;
    padding: 12px;
    font-size: 0.9rem;
}

.privacy {
    margin-top: 36px;
    text-align: center;
    color: var(--muted);
    font-size: 0.83rem;
}

@media (max-width: 600px) {
    .site-header {
        padding: 36px 16px 20px;
    }

    .site-header h1 {
        font-size: 1.4rem;
    }

    main {
        padding: 24px 14px 56px;
    }

    .tools {
        grid-template-columns: 1fr;
    }

    .workspace {
        padding: 18px;
        border-radius: 14px;
    }

    .workspace-head h2 {
        font-size: 1.15rem;
    }

    .dropzone {
        padding: 34px 14px;
    }

    .options {
        flex-direction: column;
        gap: 12px;
    }

    .options label,
    .options input,
    .options select {
        width: 100%;
    }
}
