:root {
    --ink: #191919;
    --muted: #65645f;
    --paper: #f4f1e9;
    --white: #fffefa;
    --line: #d8d4c9;
    --green: #217346;
    --green-dark: #175b37;
    --coral: #e76f51;
    --shadow: 0 20px 55px rgba(46, 43, 34, 0.1);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: "DM Sans", sans-serif;
    background-color: var(--paper);
    background-image:
        linear-gradient(rgba(49, 47, 41, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(49, 47, 41, 0.045) 1px, transparent 1px);
    background-size: 32px 32px;
}

.masthead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(1120px, calc(100% - 48px));
    margin: 0 auto;
    padding: 24px 0;
    border-bottom: 1px solid var(--line);
}

.brand { display: flex; gap: 11px; align-items: center; color: inherit; text-decoration: none; font-weight: 700; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; color: white; background: var(--green); }
.brand-mark svg { width: 19px; }
.format-note { color: var(--muted); font-size: 13px; font-weight: 600; }

main { width: min(920px, calc(100% - 48px)); margin: 0 auto; padding: 72px 0 56px; }
.intro { max-width: 740px; }
.eyebrow { margin: 0 0 15px; color: var(--green); font-size: 12px; font-weight: 700; text-transform: uppercase; }
h1 { margin: 0; font-family: "Instrument Serif", serif; font-size: clamp(54px, 9vw, 94px); font-weight: 400; line-height: 0.9; }
h1 em { color: var(--green); font-weight: 400; }
.lede { max-width: 670px; margin: 28px 0 0; color: var(--muted); font-size: 17px; line-height: 1.65; }

.converter { margin-top: 54px; padding: 18px; border: 1px solid var(--line); background: var(--white); box-shadow: var(--shadow); }
.drop-zone { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; min-height: 144px; padding: 28px; border: 1px dashed #aaa69b; cursor: pointer; transition: border-color 160ms ease, background 160ms ease; }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--green); background: #f2f8f4; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-icon { display: grid; width: 62px; height: 62px; place-items: center; color: var(--green); background: #e4f0e8; }
.drop-icon svg { width: 27px; height: 27px; }
.drop-copy { display: grid; gap: 7px; min-width: 0; }
.drop-copy strong { overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.drop-copy span { color: var(--muted); font-size: 13px; }
.choose-action { padding-bottom: 3px; border-bottom: 1px solid var(--ink); font-size: 13px; font-weight: 700; }

.action-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 10px 0; }
.status { display: flex; gap: 9px; align-items: center; min-width: 0; color: var(--muted); font-size: 13px; }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #aaa69b; }
.status.is-active .status-dot { background: var(--coral); animation: pulse 1s infinite alternate; }
.status.is-success .status-dot { background: var(--green); }
.status.is-error { color: #a1392f; }
.status.is-error .status-dot { background: #c84335; }

button, .download-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px; padding: 0 20px; border: 0; color: white; background: var(--green); font: 700 13px "DM Sans", sans-serif; text-decoration: none; cursor: pointer; }
button:hover, .download-button:hover { background: var(--green-dark); }
button:disabled { cursor: not-allowed; opacity: 0.45; }
button svg, .download-button svg { width: 17px; }
button.is-loading svg { animation: spin 900ms linear infinite; }

.result { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 18px; padding: 24px; border-left: 4px solid var(--green); background: #eaf4ed; }
.result[hidden] { display: none; }
.result-label { margin: 0 0 4px; color: var(--green); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.result strong { overflow-wrap: anywhere; }
.result p:last-child { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.payment-panel { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin-top: 18px; padding: 24px; border: 1px solid #bdd4c5; background: #f2f8f4; }
.payment-panel[hidden], .credit-notice[hidden] { display: none; }
.payment-copy { max-width: 590px; }
.payment-label { margin: 0 0 5px; color: var(--green); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.payment-copy > p:not(.payment-label, .payment-warning, .payment-info) { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.payment-warning { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 0; color: #8a4b20; font-size: 12px; line-height: 1.45; }
.payment-warning svg { width: 17px; height: 17px; flex: 0 0 auto; }
.payment-info { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.payment-info svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--green); }
.payment-button { display: inline-flex; min-height: 48px; flex: 0 0 auto; align-items: center; justify-content: center; gap: 9px; padding: 0 20px; color: white; background: var(--green); font-size: 13px; font-weight: 700; text-decoration: none; }
.payment-button:hover { background: var(--green-dark); }
.payment-button.is-disabled { cursor: not-allowed; opacity: 0.55; }
.payment-button.is-disabled:hover { background: var(--green); }
.payment-button svg { width: 18px; }
.payment-actions { display: grid; flex: 0 0 min(330px, 100%); gap: 14px; }
.payment-claim { display: grid; gap: 7px; }
.payment-claim label { color: var(--muted); font-size: 11px; line-height: 1.4; }
.payment-claim > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.payment-claim input { min-width: 0; height: 42px; padding: 0 11px; border: 1px solid var(--line); border-right: 0; background: var(--white); font: 500 12px "DM Sans", sans-serif; }
.payment-claim button { min-height: 42px; padding: 0 13px; }
#payment-claim-status { min-height: 17px; color: #a1392f; font-size: 11px; }
.credit-notice { display: flex; gap: 9px; align-items: center; margin-top: 18px; padding: 13px 16px; color: var(--green-dark); background: #eaf4ed; font-size: 13px; font-weight: 600; }
.credit-notice svg { width: 18px; flex: 0 0 auto; }
.signals { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.signals div { display: flex; gap: 9px; align-items: center; padding: 18px 12px; color: var(--muted); font-size: 12px; font-weight: 600; }
.signals div + div { border-left: 1px solid var(--line); }
.signals svg { width: 17px; color: var(--green); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { to { opacity: 0.35; } }

.conversions { border: 1px solid var(--line); background: var(--white); }
.conversions[hidden] { display: none; }
.conversions-title { margin: 0; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.conversions-warning { display: flex; gap: 9px; align-items: flex-start; margin: 0; padding: 14px 22px; color: #8a4b20; background: #fbf3e7; font-size: 12px; line-height: 1.5; border-bottom: 1px solid var(--line); }
.conversions-warning svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }
.conversions-list { display: grid; gap: 12px; margin: 0; padding: 18px 22px; list-style: none; max-height: 340px; overflow-y: auto; }
.conversions-item { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); background: var(--paper); }
.conversions-name { overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.conversions-meta { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.conversions-empty { padding: 8px 2px; color: var(--muted); font-size: 12px; }
.conversions-download { min-height: 40px; padding: 0 14px; font-size: 12px; }
.conversions-download svg { width: 15px; }
.conversions-credits { padding: 16px 22px 20px; border-top: 1px solid var(--line); background: #f7f5ef; }
.conversions-credits[hidden] { display: none; }
.conversions-credits-title { margin: 0 0 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--green); }
.credit-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13px; }
.credit-row span { color: var(--muted); }
.credit-row strong { font-weight: 700; }
.credit-history { margin: 10px 0 0; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 11px; }

/* Wide screens: full-height fixed sidebar on the right that reserves its own space. */
@media (min-width: 1100px) {
    body.with-panel { padding-right: 320px; }
    .with-panel .conversions {
        position: fixed;
        top: 0;
        right: 0;
        z-index: 20;
        display: flex;
        flex-direction: column;
        width: 320px;
        height: 100vh;
        margin: 0;
        border: 0;
        border-left: 1px solid var(--line);
        background: var(--white);
        box-shadow: -22px 0 55px rgba(46, 43, 34, 0.08);
    }
    .with-panel .conversions-title,
    .with-panel .conversions-warning,
    .with-panel .conversions-credits { flex: 0 0 auto; }
    .with-panel .conversions-list { flex: 1 1 auto; max-height: none; }
}
@media (max-width: 1099px) {
    .conversions { width: 100%; margin: 0 0 32px; box-shadow: var(--shadow); }
}

@media (max-width: 680px) {
    .masthead, main { width: min(100% - 28px, 920px); }
    main { padding-top: 48px; }
    h1 { font-size: 56px; }
    .lede { font-size: 15px; }
    .converter { margin-top: 36px; padding: 10px; }
    .drop-zone { grid-template-columns: auto 1fr; min-height: 128px; padding: 20px; }
    .choose-action { display: none; }
    .action-row, .result, .payment-panel { align-items: stretch; flex-direction: column; }
    .action-row button, .download-button, .payment-button { width: 100%; }
    .payment-actions { flex-basis: auto; }
    .signals { grid-template-columns: 1fr 1fr; }
    .signals div:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
    .signals div:nth-child(4) { border-top: 1px solid var(--line); }
}
