:root {
    color-scheme: dark;
    --bg: #0B0D10;
    --panel: #0F1418;
    --panel-2: #131A1F;
    --panel-3: #172027;
    --line: #232E36;
    --line-soft: #1A242B;
    --text: #E7EDF0;
    --muted: #8A99A3;
    --dim: #5E6D77;
    --lime: #C9F36B;
    --lime-dim: #8FAE43;
    --del: #FF8A80;
    --del-bg: rgba(255, 138, 128, 0.07);
    --ins: #8DE8B0;
    --ins-bg: rgba(141, 232, 176, 0.07);
    --mod: #FFD166;
    --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", monospace;
    --sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

h1,
h2,
p,
dl,
dd {
    margin: 0;
}

button,
input,
textarea {
    font: inherit;
}

button {
    color: inherit;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip {
    position: absolute;
    left: -999px;
    top: 0;
    z-index: 100;
    padding: 8px 12px;
    background: var(--lime);
    color: #0B0D10;
}

.skip:focus {
    left: 8px;
    top: 8px;
}

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex: none;
    height: 54px;
    padding: 0 22px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    min-height: 32px;
}

.brand-mark {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
    width: 20px;
    height: 20px;
    padding: 4px;
    border: 1px solid var(--line);
    background: var(--panel);
}

.brand-mark i {
    display: block;
}

.brand-mark i:first-child {
    background: var(--lime);
}

.brand-mark i:last-child {
    background: var(--dim);
}

.brand-name {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.version {
    padding: 2px 5px;
    border: 1px solid var(--line);
    color: var(--dim);
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.04em;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ghost {
    min-height: 32px;
    padding: 5px 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    font-size: 12.5px;
    cursor: pointer;
}

.ghost:hover {
    border-color: var(--line);
    background: var(--panel);
    color: var(--text);
}

.ghost:disabled {
    color: #46545D;
    cursor: default;
}

.ghost:disabled:hover {
    border-color: transparent;
    background: transparent;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 15px;
    cursor: pointer;
}

.icon-btn:hover {
    border-color: var(--lime-dim);
    color: var(--lime);
}

.workspace {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 10px;
    width: min(1600px, 100%);
    min-height: 0;
    margin: 0 auto;
    padding: 12px 22px 10px;
}

.toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    flex: none;
    min-height: 36px;
}

.modes {
    display: inline-flex;
    padding: 2px;
    border: 1px solid var(--line);
    background: var(--panel);
}

.mode {
    min-height: 28px;
    padding: 4px 12px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
}

.mode:hover {
    color: var(--text);
}

.mode.is-active {
    background: var(--lime);
    color: #101408;
    font-weight: 600;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
    user-select: none;
}

.check input {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--lime);
}

.check:hover {
    color: var(--text);
}

.toolbar-spacer {
    flex: 1;
    min-width: 8px;
}

.stats {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11.5px;
    white-space: nowrap;
}

.stats.is-bad {
    color: var(--del);
}

.stats .add {
    color: var(--ins);
}

.stats .del {
    color: var(--del);
}

.swap {
    white-space: nowrap;
}

.editors {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    flex: 0 0 34vh;
    min-height: 220px;
}

.pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--line);
    background: var(--panel);
}

.pane:focus-within {
    border-color: var(--lime-dim);
}

.pane.dragging {
    border-color: var(--lime);
    background: var(--panel-2);
}

.pane-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
    min-height: 34px;
    padding: 0 10px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
}

.pane-label {
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.pane-meta {
    color: var(--dim);
    font-family: var(--mono);
    font-size: 10.5px;
    white-space: nowrap;
}

.file-label {
    margin-left: auto;
    padding: 3px 7px;
    border: 1px dashed var(--line);
    color: var(--dim);
    font-size: 10.5px;
    cursor: pointer;
    white-space: nowrap;
}

.file-label:hover {
    border-color: var(--lime-dim);
    color: var(--lime);
}

.file-label input {
    display: none;
}

.editor {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    flex: 1;
    min-height: 0;
}

.gutter {
    overflow: hidden;
    border-right: 1px solid var(--line);
    background: #0C1115;
    user-select: none;
}

.gutter-inner {
    padding: 11px 8px 40px 0;
    color: var(--dim);
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.7;
    text-align: right;
}

.gutter-inner span {
    display: block;
    line-height: 1.7;
}

textarea {
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 11px 13px 40px;
    border: 0;
    outline: 0;
    resize: none;
    background: transparent;
    color: var(--text);
    caret-color: var(--lime);
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.7;
    tab-size: 2;
    white-space: pre;
    overflow: auto;
    scrollbar-color: var(--line) transparent;
}

textarea::placeholder {
    color: #4E5C65;
}

textarea:focus-visible {
    outline: 1px solid var(--lime-dim);
    outline-offset: -1px;
}

.result {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 140px;
    border: 1px solid var(--line);
    background: var(--panel);
}

.result-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex: none;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
}

.result-head h2 {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.hint {
    margin-top: 2px;
    color: var(--dim);
    font-size: 11px;
}

.result-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.diff {
    flex: 1;
    min-height: 0;
    overflow: auto;
    scrollbar-color: var(--line) transparent;
}

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 100%;
    padding: 26px 20px;
    color: var(--dim);
    text-align: center;
    font-size: 12px;
}

.empty strong {
    color: var(--muted);
    font-weight: 600;
}

.empty-mark {
    margin-bottom: 2px;
    color: var(--line);
    font-family: var(--mono);
    font-size: 42px;
    line-height: 1;
}

.empty kbd {
    padding: 1px 4px;
    border: 1px solid var(--line);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 10px;
}

.diff-row {
    display: grid;
    grid-template-columns: 45px 45px 18px minmax(0, 1fr);
    border-bottom: 1px solid var(--line-soft);
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.65;
}

.diff-row .ln {
    padding: 3px 7px;
    border-right: 1px solid var(--line-soft);
    color: #46545D;
    text-align: right;
    user-select: none;
}

.diff-row .mark {
    padding: 3px 0;
    color: var(--dim);
    text-align: center;
    user-select: none;
}

.diff-row .code {
    padding: 3px 10px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: #B9C4CB;
}

.diff-row.equal .code {
    color: #8E9CA5;
}

.diff-row.del {
    background: var(--del-bg);
}

.diff-row.del .mark {
    color: var(--del);
}

.diff-row.del .code {
    color: #E6B8B3;
}

.diff-row.ins {
    background: var(--ins-bg);
}

.diff-row.ins .mark {
    color: var(--ins);
}

.diff-row.ins .code {
    color: #B9E6C9;
}

.code del,
.word-diff del {
    background: rgba(255, 138, 128, 0.16);
    color: #FFC2BC;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 138, 128, 0.45);
}

.code ins,
.word-diff ins {
    background: rgba(141, 232, 176, 0.14);
    color: #B9F2D1;
    text-decoration: none;
    border-bottom: 1px solid rgba(141, 232, 176, 0.4);
}

.diff-gap {
    padding: 5px 10px;
    border-bottom: 1px solid var(--line-soft);
    background: #0C1115;
    color: #52616B;
    font-family: var(--mono);
    font-size: 10.5px;
    text-align: center;
}

.word-diff {
    padding: 16px 18px 40px;
    color: #B9C4CB;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.8;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.diff-message {
    padding: 18px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.diff-message .error-code {
    display: block;
    margin-top: 4px;
    color: var(--dim);
    font-family: var(--mono);
    font-size: 10.5px;
}

.foot {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: none;
    min-height: 34px;
    padding: 0 22px;
    border-top: 1px solid var(--line);
    color: var(--dim);
    font-family: var(--mono);
    font-size: 10.5px;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
}

.status::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--lime-dim);
}

.status.is-working::before {
    background: var(--mod);
}

.status.is-error::before {
    background: var(--del);
}

.privacy {
    color: #52616B;
}

.foot-right {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-left: auto;
}

.foot a {
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
}

.foot a:hover {
    color: var(--lime);
    border-bottom-color: var(--lime-dim);
}

.dot {
    color: #39464F;
}

.help {
    width: min(520px, calc(100% - 32px));
    padding: 0;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
}

.help::backdrop {
    background: rgba(3, 5, 7, 0.76);
}

.help-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.help-top h2 {
    font-size: 15px;
    font-weight: 600;
}

.help-body {
    padding: 16px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.65;
}

.help-body p + .keys {
    margin-top: 14px;
}

.keys {
    border-top: 1px solid var(--line);
}

.keys div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 18px;
    padding: 7px 0;
    border-bottom: 1px solid var(--line-soft);
}

.keys dt {
    color: var(--text);
    font-family: var(--mono);
    font-size: 11px;
}

.keys dd {
    text-align: right;
}

kbd {
    padding: 1px 4px;
    border: 1px solid var(--line);
    background: #0C1115;
    color: var(--text);
    font-family: var(--mono);
    font-size: 10px;
}

.help-note {
    margin-top: 14px;
    color: var(--dim);
    font-size: 11.5px;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 48px;
    z-index: 50;
    transform: translate(-50%, 8px);
    padding: 7px 12px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--text);
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease, transform 120ms ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.noscript {
    position: fixed;
    inset: auto 16px 16px;
    z-index: 60;
    padding: 10px 12px;
    border: 1px solid var(--del);
    background: var(--panel-2);
    color: var(--del);
    font-size: 12px;
}

:focus-visible {
    outline: 2px solid var(--lime);
    outline-offset: 2px;
}

button:focus-visible,
.file-label:focus-within {
    outline-offset: 1px;
}

@media (max-width: 900px) {
    body {
        height: auto;
        min-height: 100dvh;
        overflow: auto;
    }

    .workspace {
        width: 100%;
        padding: 10px 14px;
    }

    .editors {
        display: flex;
        flex-direction: column;
        flex: none;
        min-height: 0;
    }

    .pane {
        height: 230px;
    }

    .result {
        flex: none;
        min-height: 300px;
    }

    .diff {
        max-height: 58vh;
    }

    .top {
        padding: 0 14px;
    }

    .foot {
        padding: 0 14px;
    }
}

@media (max-width: 620px) {
    .top {
        height: 50px;
    }

    .version,
    .swap-label {
        display: none;
    }

    .toolbar {
        gap: 8px;
    }

    .toolbar-spacer {
        display: none;
    }

    .stats {
        order: 10;
        width: 100%;
        white-space: normal;
    }

    .result-head {
        flex-direction: column;
        gap: 8px;
    }

    .result-actions {
        justify-content: flex-start;
    }

    .diff-row {
        grid-template-columns: 34px 34px 16px minmax(0, 1fr);
    }

    .diff-row .ln {
        padding: 3px 4px;
    }

    .foot {
        gap: 10px;
        flex-wrap: wrap;
        padding-block: 7px;
    }

    .privacy {
        display: none;
    }

    .pane {
        height: 210px;
    }

    .empty {
        padding: 20px 14px;
    }
}

@media (max-height: 720px) and (min-width: 901px) {
    .editors {
        flex-basis: 30vh;
        min-height: 190px;
    }

    .workspace {
        padding-top: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
    }
}
