:root {
    --paper: #f3ecdf;
    --sheet: #fffaf2;
    --ink: #241c15;
    --muted: #6d6256;
    --line: #e2d5c3;
    --stamp: #9c341f;
    --stamp-deep: #7a2616;
    --good: #1f6b45;
    --shadow: 0 18px 50px rgba(56, 36, 18, 0.08);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(156, 52, 31, 0.08), transparent 32%),
        linear-gradient(180deg, #efe6d6 0%, var(--paper) 28%, #ebe3d4 100%);
    font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

.sheet {
    width: min(760px, calc(100% - 32px));
    margin: 48px auto 64px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--stamp);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-family: Palatino, "Palatino Linotype", "Iowan Old Style", Georgia, serif;
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 0.95;
}

.lede {
    max-width: 38rem;
    margin: 16px 0 28px;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.5;
}

.panel,
.result,
.notes {
    background: var(--sheet);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.panel { padding: 18px; }

.dropzone {
    display: grid;
    gap: 6px;
    place-items: center;
    min-height: 210px;
    padding: 28px 20px;
    text-align: center;
    border: 1.5px dashed #c9b59a;
    border-radius: 14px;
    background: #fbf6ee;
    cursor: pointer;
}

.dropzone:hover,
.dropzone.is-dragover,
.dropzone:focus-within {
    border-color: var(--stamp);
    background: #fff;
}

.dropzone input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.drop-kicker {
    font-family: Palatino, "Palatino Linotype", Georgia, serif;
    font-size: 1.7rem;
}

.drop-title { font-weight: 650; }

.drop-note {
    max-width: 28rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.chosen {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #f6efe4;
}

.chosen-name,
.chosen-size { margin: 0; }

.chosen-name {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.chosen-size {
    color: var(--muted);
    font-size: 0.92rem;
}

.target {
    margin-top: 14px;
    padding: 14px;
    border-radius: 12px;
    background: #f6efe4;
}

.target-current {
    margin: 0 0 10px;
    font-weight: 700;
}

.target-label {
    display: block;
    margin-bottom: 8px;
}

.target-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.target-row input {
    width: 7.5rem;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    background: #fff;
    font: inherit;
    font-size: 1.35rem;
}

.target-range {
    width: 100%;
    margin: 12px 0 0;
    accent-color: var(--stamp);
}

.target-hint {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.45;
}

.primary,
.text-button,
.download {
    font: inherit;
}

.primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 14px;
    padding: 14px 18px;
    border: 0;
    border-radius: 999px;
    color: #fffaf2;
    background: var(--stamp);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.primary:hover:not(:disabled) { background: var(--stamp-deep); }

.primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.text-button {
    border: 0;
    padding: 0;
    color: var(--stamp);
    background: transparent;
    font-weight: 700;
    cursor: pointer;
}

.status {
    min-height: 1.4em;
    margin: 12px 0 0;
    color: var(--muted);
}

.status.is-error { color: var(--stamp-deep); }

.result {
    margin-top: 18px;
    padding: 22px;
}

.result-kicker {
    margin: 0;
    color: var(--good);
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.result-kicker.is-short { color: var(--stamp); }

.sizes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
}

.sizes span {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
}

.sizes strong {
    display: block;
    margin-top: 4px;
    font-family: Palatino, "Palatino Linotype", Georgia, serif;
    font-size: 1.8rem;
}

.meter {
    height: 10px;
    margin-top: 16px;
    overflow: hidden;
    border-radius: 999px;
    background: #eadfce;
}

.meter span {
    display: block;
    height: 100%;
    width: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--good), #3e9a68);
}

.result-note {
    margin: 14px 0 0;
    color: var(--muted);
    line-height: 1.45;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
}

.download { width: auto; margin-top: 0; padding-inline: 22px; }

.notes {
    margin-top: 18px;
    padding: 22px 22px 8px;
}

.notes h2 {
    margin: 0 0 8px;
    font-family: Palatino, "Palatino Linotype", Georgia, serif;
    font-size: 1.4rem;
}

.notes ul {
    margin: 0;
    padding-left: 1.1rem;
}

.notes li { margin: 6px 0; }

.notes p {
    color: var(--muted);
    line-height: 1.5;
}

@media (max-width: 640px) {
    .sheet { margin-top: 28px; }
    .sizes { grid-template-columns: 1fr; }
    .result-actions { align-items: stretch; }
    .download { width: 100%; }
}
