:root {
    --cream: #f4f1e8;
    --ink: #161513;
    --ink-soft: #4a4741;
    --red: #c1440e;
    --line: #dcd6c6;
    --paper: #fbf9f3;
}
* {
    box-sizing: border-box;
}
html,
body {
    margin: 0;
    padding: 0;
}
body {
    background: var(--cream);
    color: var(--ink);
    font-family: 'Fraunces', serif;
    -webkit-font-smoothing: antialiased;
}
.mono {
    font-family: 'IBM Plex Mono', monospace;
}
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px clamp(20px, 5vw, 64px);
    border-bottom: 1px solid var(--line);
}
.logo {
    font-weight: 900;
    font-size: 22px;
    letter-spacing: -0.02em;
}
.logo .dot {
    color: var(--red);
}
.burger {
    display: none;
}
.social-links {
    display: flex;
    gap: 22px;
    align-items: center;
}
.social-link {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: var(--ink);
    text-decoration: none;
    padding-bottom: 3px;
    border-bottom: 1px solid transparent;
    transition: color .15s ease, border-color .15s ease;
}
.social-link:hover {
    color: var(--red);
    border-color: var(--red);
}
.layout {
    max-width: 1400px;
    margin: 0 auto;
}
.hero {
    padding: 56px clamp(20px, 5vw, 64px) 40px;
}
.eyebrow {
    display: flex;
    gap: 14px;
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 28px;
}
.eyebrow .rule {
    width: 16px;
    border-top: 1px solid var(--ink-soft);
    height: 1px;
    margin-top: 11px;
}
h1 {
    font-size: clamp(46px, 6vw, 84px);
    line-height: 0.98;
    font-weight: 900;
    letter-spacing: -0.02em;
    margin: 0 0 26px;
}
h1 .accent {
    font-style: italic;
    font-weight: 600;
    color: var(--ink);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='12' viewBox='0 0 60 12'%3E%3Cpath d='M0 6 Q7.5 0 15 6 T30 6 T45 6 T60 6' stroke='%23c1440e' stroke-width='2.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-position: bottom 2px left;
    background-size: 60px 12px;
    padding-bottom: 14px;
    display: inline-block;
}
.lede {
    font-size: 19px;
    line-height: 1.65;
    color: var(--ink);
    max-width: 520px;
    margin: 0 0 30px;
}
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
}
.tag {
    font-size: 13px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 20px;
    color: var(--ink-soft);
    background: var(--paper);
}
hr.divider {
    border: none;
    border-top: 1px solid var(--line);
    margin: 8px clamp(20px, 5vw, 64px) 0;
}
.tool {
    padding: 48px clamp(20px, 5vw, 64px) 90px;
}
@media (min-width: 960px) {
    .layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
    .hero {
        padding: 64px 56px 40px clamp(20px, 5vw, 64px);
    }
    .tool {
        padding: 64px clamp(20px, 5vw, 64px) 90px 56px;
        border-left: 1px solid var(--line);
    }
    hr.divider {
        display: none;
    }
    .lede {
        max-width: none;
    }
}
.tool-label {
    font-size: 13px;
    color: var(--ink-soft);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.tool-label .rule {
    flex: 1;
    border-top: 1px dashed var(--line);
}
.mode-picker {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}
.mode-btn {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    padding: 9px 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--paper);
    cursor: pointer;
    color: var(--ink);
}
.mode-btn.selected {
    background: var(--ink);
    color: var(--cream);
    border-color: var(--ink);
}
.dropzone {
    border: 2px dashed var(--line);
    border-radius: 4px;
    padding: 60px 24px;
    text-align: center;
    cursor: pointer;
    background: var(--paper);
    transition: border-color .15s ease, background .15s ease;
}
.dropzone:hover,
.dropzone.drag {
    border-color: var(--red);
    background: #fbf1ea;
}
.dropzone .icon {
    font-size: 13px;
    color: var(--red);
    margin-bottom: 14px;
    display: block;
}
.dropzone p {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}
.dropzone .sub {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: var(--ink-soft);
    margin-top: 10px;
}
input[type=file] {
    display: none;
}
.stage {
    display: none;
}
.stage.active {
    display: block;
}
.frame {
    border: 1px solid var(--line);
    background: var(--paper);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.frame img {
    display: block;
    width: 100%;
    height: auto;
}
.controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 22px;
}
.scale-picker {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
    min-width: 220px;
}
.scale-picker span.mono {
    font-size: 12px;
    color: var(--ink-soft);
    white-space: nowrap;
}
.chip-btn {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--paper);
    cursor: pointer;
    color: var(--ink);
}
.chip-btn.selected {
    background: var(--ink);
    color: var(--cream);
    border-color: var(--ink);
}
input[type=range].res-slider {
    flex: 1;
    accent-color: var(--red);
}
.res-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    min-width: 34px;
    text-align: right;
}
.btn {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    background: var(--ink);
    color: var(--cream);
    border: 1px solid var(--ink);
    padding: 14px 26px;
    border-radius: 30px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background .15s ease, color .15s ease;
}
.btn:hover {
    background: var(--red);
    border-color: var(--red);
}
.btn.ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
}
.btn.ghost:hover {
    background: var(--paper);
    color: var(--ink);
    border-color: var(--ink);
}
.btn:disabled {
    opacity: .5;
    cursor: default;
    background: var(--ink);
    border-color: var(--ink);
}
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(22, 21, 19, 0.82);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--cream);
    gap: 16px;
}
.scan-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--red);
    box-shadow: 0 0 16px 2px rgba(193, 68, 14, 0.9);
    animation: scan 1.6s ease-in-out infinite;
}
@keyframes scan {
    0% {
        top: 0;
    }
    50% {
        top: 100%;
    }
    100% {
        top: 0;
    }
}
.progress-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    letter-spacing: .02em;
}
.progress-bar {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    letter-spacing: .05em;
}
.flavor {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: #c8c3b6;
    min-height: 16px;
}
.compare-wrap {
    margin-top: 8px;
}
.compare {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 4px;
    overflow: hidden;
    background: var(--paper);
    user-select: none;
}
.compare img {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
}
.before-wrap {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    overflow: hidden;
    width: 50%;
}
.before-wrap img {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: auto;
    max-width: none;
}
.compare-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    background: transparent;
    cursor: ew-resize;
}
.compare-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 1px;
    height: 1px;
}
.handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 0;
    pointer-events: none;
}
.handle .bar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 2px;
    background: var(--cream);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.handle .knob {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--cream);
    border: 1px solid var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: var(--ink);
}
.chip-label {
    position: absolute;
    top: 12px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    padding: 5px 10px;
    background: rgba(22, 21, 19, 0.75);
    color: var(--cream);
    border-radius: 20px;
    letter-spacing: .03em;
    pointer-events: none;
}
.chip-before {
    left: 12px;
}
.chip-after {
    right: 12px;
}
.result-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 22px;
    align-items: center;
}
.note {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: var(--ink-soft);
    margin-top: 16px;
}
.error-box {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    color: #8a2c0e;
    background: #fbe9e2;
    border: 1px solid #e3b6a2;
    padding: 14px 16px;
    border-radius: 4px;
    margin-top: 18px;
    display: none;
}
footer {
    padding: 30px clamp(20px, 5vw, 64px) 60px;
    color: var(--ink-soft);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    border-top: 1px solid var(--line);
}
footer span,
footer {
    max-width: 1400px;
}
@media (min-width: 1464px) {
    header,
    footer {
        padding-left: calc((100% - 1400px)/2 + 20px);
        padding-right: calc((100% - 1400px)/2 + 20px);
    }
}
@media (max-width: 520px) {
    .dropzone {
        padding: 40px 16px;
    }
    .controls {
        flex-direction: column;
        align-items: flex-start;
    }
}