:root {
    --bg: #f5f7fa;
    --card: #ffffff;
    --line: #e5e9ef;

    --text: #202632;
    --muted: #858e9c;
    --soft: #a1a9b5;

    --primary: #6675e8;
    --primary-dark: #5867dc;

    --success: #23966c;
    --danger: #d6525e;

    --shadow:
        0 8px 28px rgba(30, 42, 62, .055);
}


* {
    box-sizing: border-box;
}


html,
body {
    margin: 0;
    min-height: 100%;
}


body {
    background: var(--bg);

    color: var(--text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "PingFang SC",
        "Microsoft YaHei",
        sans-serif;
}


button,
select,
input {
    font: inherit;
}


button {
    cursor: pointer;
}


/* =========================================================
   APP
========================================================= */

.converter-app {
    min-height: 100vh;
}


/* =========================================================
   HEADER
========================================================= */

.converter-header {
    height: 62px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 28px;

    background: #ffffff;

    border-bottom: 1px solid var(--line);
}


.header-left {
    display: flex;
    align-items: center;
    gap: 13px;
}


.back-link {
    display: flex;
    align-items: center;
    gap: 4px;

    color: #717b8b;

    font-size: 11px;

    text-decoration: none;
}


.back-link span {
    font-size: 19px;
    line-height: 1;
}


.back-link:hover {
    color: var(--primary);
}


.header-divider {
    width: 1px;
    height: 18px;

    background: #e5e8ed;
}


.page-title {
    color: #313946;

    font-size: 13px;
    font-weight: 700;
}


.ffmpeg-status {
    display: flex;
    align-items: center;
    gap: 7px;

    padding: 6px 9px;

    border-radius: 7px;

    font-size: 9px;
    font-weight: 600;
}


.ffmpeg-status.checking {
    color: #858e9c;
    background: #f4f6f8;
}


.ffmpeg-status.ok {
    color: #17805b;
    background: #edf9f4;
}


.ffmpeg-status.error {
    color: #c3414c;
    background: #fff0f2;
}


.status-dot {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: currentColor;
}


/* =========================================================
   MAIN
========================================================= */

.converter-main {
    width: min(1280px,
            calc(100% - 48px));

    margin: 0 auto;

    padding: 34px 0 60px;
}


/* =========================================================
   INTRO
========================================================= */

.page-intro {
    margin-bottom: 25px;
}


.eyebrow {
    margin-bottom: 6px;

    color: #6977df;

    font-size: 9px;
    font-weight: 800;

    letter-spacing: .13em;
}


.page-intro h1 {
    margin: 0 0 7px;

    font-size: 27px;
    line-height: 1.2;

    letter-spacing: -.025em;
}


.page-intro p {
    margin: 0;

    color: var(--muted);

    font-size: 11px;
    line-height: 1.7;
}


/* =========================================================
   ALERT
========================================================= */

.ffmpeg-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;

    margin-bottom: 15px;
    padding: 15px;

    border: 1px solid #f0d5d8;
    border-radius: 10px;

    background: #fff8f8;
}


.ffmpeg-alert.hidden {
    display: none;
}


.alert-icon {
    width: 27px;
    height: 27px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 auto;

    border-radius: 50%;

    background: var(--danger);
    color: #ffffff;

    font-size: 13px;
    font-weight: 800;
}


.alert-content strong {
    color: #9d303b;

    font-size: 11px;
}


.alert-content p {
    margin: 5px 0 7px;

    color: #996d73;

    font-size: 9px;
    line-height: 1.6;
}


.alert-content code {
    display: inline-block;

    padding: 4px 6px;

    border-radius: 5px;

    background: #fff0f1;

    color: #a54a54;

    font-family: Consolas, monospace;

    font-size: 9px;
}


/* =========================================================
   WORKSPACE
========================================================= */

.workspace {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr) 270px;

    gap: 17px;

    align-items: start;
}


.left-column {
    min-width: 0;

    display: flex;
    flex-direction: column;

    gap: 14px;
}


.right-column {
    display: flex;
    flex-direction: column;

    gap: 14px;

    position: sticky;
    top: 15px;
}


/* =========================================================
   PANEL
========================================================= */

.panel {
    padding: 19px;

    background: var(--card);

    border: 1px solid var(--line);
    border-radius: 11px;

    box-shadow: var(--shadow);
}


.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    margin-bottom: 15px;
}


.panel-head h2 {
    margin: 0;

    font-size: 13px;
    font-weight: 700;
}


.panel-head p {
    margin: 4px 0 0;

    color: #9aa2ae;

    font-size: 9px;
}


/* =========================================================
   DROP ZONE
========================================================= */

.drop-zone {
    min-height: 190px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 6px;

    border: 1px dashed #cbd2dc;
    border-radius: 9px;

    background: #fafbfc;

    transition:
        border-color .15s ease,
        background .15s ease;
}


.drop-zone:hover,
.drop-zone.dragover {
    border-color: #8d97e8;

    background: #f7f8ff;
}


.upload-icon {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 3px;

    border-radius: 10px;

    background: #eceeff;

    color: var(--primary);

    font-size: 20px;
}


.drop-zone strong {
    font-size: 12px;
}


.drop-zone>span {
    color: #a2a9b4;

    font-size: 9px;
}


.secondary-button {
    height: 30px;

    margin-top: 7px;
    padding: 0 13px;

    border: 1px solid #dce1e8;
    border-radius: 7px;

    background: #ffffff;

    color: #596372;

    font-size: 10px;
    font-weight: 600;
}


.secondary-button:hover {
    background: #f7f8fa;
}


/* =========================================================
   FILE INFO
========================================================= */

.file-info {
    display: grid;

    grid-template-columns:
        minmax(240px, 40%) minmax(0, 1fr);

    gap: 17px;
}


.file-info.hidden {
    display: none;
}


.video-preview {
    aspect-ratio: 16 / 9;

    overflow: hidden;

    border-radius: 8px;

    background: #11151b;
}


.video-preview video {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: contain;
}


.file-details {
    min-width: 0;
}


.file-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    padding-bottom: 11px;

    border-bottom: 1px solid #edf0f4;
}


.file-name-wrap {
    min-width: 0;

    display: flex;
    align-items: center;

    gap: 8px;
}


.file-name-wrap strong {
    overflow: hidden;

    color: #394251;

    font-size: 11px;

    text-overflow: ellipsis;
    white-space: nowrap;
}


.file-type-icon {
    flex: 0 0 auto;

    padding: 4px 5px;

    border-radius: 4px;

    background: #eef0ff;

    color: #6675e8;

    font-size: 7px;
    font-weight: 800;
}


.remove-button {
    flex: 0 0 auto;

    border: 0;

    background: transparent;

    color: #9da5b0;

    font-size: 9px;
}


.remove-button:hover {
    color: var(--danger);
}


.file-meta {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 1px;

    margin-top: 7px;
}


.meta-item {
    display: flex;
    flex-direction: column;

    gap: 4px;

    padding: 9px 3px;
}


.meta-item span {
    color: #a0a8b3;

    font-size: 8px;
}


.meta-item b {
    color: #4b5462;

    font-size: 10px;
}


/* =========================================================
   SETTINGS
========================================================= */

.settings-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 13px;
}


.field {
    min-width: 0;

    display: flex;
    flex-direction: column;

    gap: 6px;
}


.field>span {
    color: #6d7685;

    font-size: 9px;
    font-weight: 600;
}


.field select {
    width: 100%;
    height: 34px;

    padding: 0 9px;

    border: 1px solid #dfe3e9;
    border-radius: 7px;

    outline: none;

    background: #ffffff;

    color: #434c5a;

    font-size: 10px;
}


.field select:focus {
    border-color: #8b94e7;

    box-shadow:
        0 0 0 3px rgba(102, 117, 232, .08);
}


.field select:disabled {
    background: #f5f6f8;

    color: #a3aab5;

    cursor: not-allowed;
}


.settings-tip {
    display: flex;
    align-items: flex-start;

    gap: 7px;

    margin-top: 15px;
    padding: 9px 10px;

    border-radius: 7px;

    background: #f8f9fb;

    color: #939ba7;

    font-size: 8px;
    line-height: 1.65;
}


.tip-icon {
    width: 14px;
    height: 14px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 auto;

    border-radius: 50%;

    background: #e8ebf0;

    color: #7f8794;

    font-size: 8px;
    font-weight: 700;
}


/* =========================================================
   EXPORT
========================================================= */

.summary {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    margin-bottom: 14px;

    border: 1px solid #edf0f4;
    border-radius: 8px;

    overflow: hidden;
}


.summary-item {
    display: flex;
    flex-direction: column;

    gap: 5px;

    padding: 10px 12px;

    border-right: 1px solid #edf0f4;
}


.summary-item:last-child {
    border-right: 0;
}


.summary-item span {
    color: #9da5b0;

    font-size: 8px;
}


.summary-item strong {
    color: #48515f;

    font-size: 10px;
}


.export-row {
    display: flex;
    justify-content: flex-end;
}


.primary-button {
    min-width: 116px;
    height: 35px;

    padding: 0 16px;

    border: 0;
    border-radius: 7px;

    background: var(--primary);

    color: #ffffff;

    font-size: 10px;
    font-weight: 700;

    box-shadow:
        0 5px 13px rgba(102, 117, 232, .2);

    transition:
        background .15s ease,
        transform .1s ease,
        opacity .15s ease;
}


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


.primary-button:active {
    transform: translateY(1px);
}


.primary-button:disabled {
    cursor: not-allowed;

    opacity: .45;

    box-shadow: none;
}


/* =========================================================
   PROGRESS
========================================================= */

.progress-panel {
    margin-top: 14px;
    padding: 12px;

    border: 1px solid #e7eaf0;
    border-radius: 8px;

    background: #fafbfc;
}


.progress-panel.hidden {
    display: none;
}


.progress-head {
    display: flex;
    justify-content: space-between;

    margin-bottom: 8px;

    color: #737c8b;

    font-size: 9px;
}


.progress-head strong {
    color: #5d6bdd;
}


.progress-track {
    height: 5px;

    overflow: hidden;

    border-radius: 5px;

    background: #e7eaf0;
}


.progress-bar {
    width: 0;
    height: 100%;

    border-radius: inherit;

    background: var(--primary);

    transition: width .2s ease;
}


.progress-message {
    margin-top: 6px;

    color: #9ca4b0;

    font-size: 8px;
}


/* =========================================================
   RESULT
========================================================= */

.result-panel {
    display: flex;
    align-items: center;

    gap: 10px;

    margin-top: 13px;
    padding: 11px;

    border: 1px solid #ccebdd;
    border-radius: 8px;

    background: #f2fbf7;
}


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


.result-check {
    width: 27px;
    height: 27px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 auto;

    border-radius: 50%;

    background: #27a774;

    color: #ffffff;

    font-size: 12px;
    font-weight: 700;
}


.result-info {
    min-width: 0;

    display: flex;
    flex-direction: column;

    gap: 3px;

    flex: 1;
}


.result-info strong {
    color: #187b58;

    font-size: 10px;
}


.result-info span {
    overflow: hidden;

    color: #719487;

    font-size: 8px;

    text-overflow: ellipsis;
    white-space: nowrap;
}


.download-button {
    flex: 0 0 auto;

    padding: 7px 10px;

    border-radius: 6px;

    background: #27a774;

    color: #ffffff;

    font-size: 8px;
    font-weight: 700;

    text-decoration: none;
}


.download-button:hover {
    background: #208f64;
}


/* =========================================================
   LOG
========================================================= */

.log-details {
    margin-top: 13px;

    border-top: 1px solid #edf0f4;
}


.log-details summary {
    padding-top: 11px;

    color: #929aa6;

    cursor: pointer;

    font-size: 9px;
}


.log-details pre {
    max-height: 220px;

    margin: 9px 0 0;
    padding: 10px;

    overflow: auto;

    border-radius: 7px;

    background: #171a20;

    color: #c8ced8;

    font-family:
        Consolas,
        "SFMono-Regular",
        monospace;

    font-size: 8px;
    line-height: 1.55;

    white-space: pre-wrap;
    word-break: break-word;
}


/* =========================================================
   SIDE CARDS
========================================================= */

.side-card {
    padding: 15px;

    border: 1px solid var(--line);
    border-radius: 10px;

    background: #ffffff;

    box-shadow: var(--shadow);
}


.side-card-title {
    margin-bottom: 12px;

    color: #555f6f;

    font-size: 10px;
    font-weight: 700;
}


/* =========================================================
   PREVIEW
========================================================= */

.preview-summary {
    display: grid;

    grid-template-columns:
        1fr 24px 1fr;

    align-items: center;

    gap: 5px;

    margin-bottom: 13px;
}


.preview-format {
    padding: 12px 5px;

    border: 1px solid #e5e8ed;
    border-radius: 7px;

    background: #fafbfc;

    color: #66707e;

    font-size: 11px;
    font-weight: 700;

    text-align: center;
}


.preview-format.output {
    border-color: #e0e3fb;

    background: #f3f4ff;

    color: #6472db;
}


.preview-arrow {
    color: #a0a8b3;

    font-size: 14px;

    text-align: center;
}


.preview-list {
    display: flex;
    flex-direction: column;

    border-top: 1px solid #edf0f4;
}


.preview-list>div {
    display: flex;
    justify-content: space-between;

    padding: 9px 0;

    border-bottom: 1px solid #edf0f4;
}


.preview-list>div:last-child {
    border-bottom: 0;
}


.preview-list span {
    color: #9ca4b0;

    font-size: 8px;
}


.preview-list strong {
    color: #596271;

    font-size: 9px;
}


/* =========================================================
   FORMAT LIST
========================================================= */

.format-list {
    display: flex;
    flex-direction: column;
}


.format-list>div {
    display: flex;
    justify-content: space-between;

    padding: 8px 0;

    border-bottom: 1px solid #edf0f4;
}


.format-list>div:last-child {
    border-bottom: 0;
}


.format-list b {
    color: #535d6b;

    font-size: 9px;
}


.format-list span {
    color: #a0a7b2;

    font-size: 8px;
}


/* =========================================================
   INFO
========================================================= */

.info-side-card p {
    margin: 7px 0;

    color: #929aa6;

    font-size: 8px;
    line-height: 1.7;
}


/* =========================================================
   TOAST
========================================================= */

.toast {
    position: fixed;

    left: 50%;
    bottom: 24px;

    z-index: 100;

    padding: 8px 12px;

    border: 1px solid #e0e4eb;
    border-radius: 7px;

    background: #ffffff;

    color: #4c5564;

    font-size: 9px;

    box-shadow:
        0 8px 30px rgba(31, 42, 61, .14);

    opacity: 0;
    pointer-events: none;

    transform:
        translate(-50%, 12px);

    transition:
        opacity .2s ease,
        transform .2s ease;
}


.toast.show {
    opacity: 1;

    transform:
        translate(-50%, 0);
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1000px) {

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


    .right-column {
        position: static;

        display: grid;

        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

}


@media (max-width: 800px) {

    .settings-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }


    .right-column {
        grid-template-columns: 1fr;
    }


    .file-info {
        grid-template-columns: 1fr;
    }

}


@media (max-width: 560px) {

    .converter-header {
        padding: 0 15px;
    }


    .converter-main {
        width: calc(100% - 24px);

        padding-top: 23px;
    }


    .header-divider,
    .page-title {
        display: none;
    }


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


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


    .summary-item {
        border-right: 0;

        border-bottom:
            1px solid #edf0f4;
    }


    .summary-item:last-child {
        border-bottom: 0;
    }


    .result-panel {
        align-items: flex-start;

        flex-wrap: wrap;
    }


    .download-button {
        width: 100%;

        text-align: center;
    }

}