:root {
  color-scheme: light;
  font: 100%/1.5 system-ui, sans-serif;
  color: #18312b;
  background: #f0f5f2;
  --green: #17473b;
  --muted: #4e625b;
  --line: #d9e4dc;
}

* { box-sizing: border-box; }
body, h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
.masthead { background: var(--green); color: white; }
.masthead-inner, main { width: min(100% - 48px, 1180px); margin-inline: auto; }
.masthead-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 70px; padding-block: 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.125rem; font-weight: 750; }
.brand img { border-radius: 10px; }
.intro { padding-block: 36px 27px; }
h1 { font-size: clamp(1.9rem, 4.4vw, 3.2rem); line-height: 1.13; letter-spacing: -0.045em; }
.intro p { color: var(--muted); margin-top: 9px; }
.workspace { display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); align-items: start; gap: 20px; }
.card { padding: clamp(18px, 2.4vw, 27px); background: white; border: 1px solid var(--line); border-radius: 20px; }
h2 { font-size: 1.25rem; line-height: 1.25; letter-spacing: -0.02em; margin-bottom: 17px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.fields .wide { grid-column: 1 / -1; }
label { display: block; font-size: 0.94rem; font-weight: 650; }
label small, .optional { color: var(--muted); font-size: 0.875rem; font-weight: 400; }
input, select, button { min-height: 47px; font: inherit; border-radius: 9px; }
input, select { display: block; width: 100%; min-width: 0; margin-top: 6px; padding: 9px 10px; border: 1px solid #a9bcb0; background-color: #fbfdfb; color: #18312b; font-size: 1rem; }
input[type=color] { padding: 5px; cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch, input[type=color]::-moz-color-swatch { border: 1px solid #a9bcb0; border-radius: 5px; }
select { appearance: none; padding-right: 29px; background-image: linear-gradient(45deg, transparent 48%, var(--green) 51%), linear-gradient(135deg, var(--green) 48%, transparent 51%); background-position: right 16px center, right 10px center; background-size: 6px 6px; background-repeat: no-repeat; }
button { padding: 9px 16px; border: 1px solid var(--green); background: var(--green); color: white; font-weight: 700; cursor: pointer; }
button:hover { background: #225c4d; }
button:disabled { opacity: 0.55; cursor: default; }
button.secondary { border-color: #9dbcae; }
:focus-visible { outline: 3px solid #287b62; outline-offset: 3px; }
.masthead :focus-visible { outline-color: white; }
.results { display: grid; gap: 16px; min-width: 0; }
.stage { display: grid; place-items: center; padding: 18px; min-height: 230px; height: clamp(230px, 26vw, 306px); border-radius: 13px; background-color: #e8f0eb; background-image: radial-gradient(#a8c1b3 0.8px, transparent 0.8px); background-size: 14px 14px; }
canvas { display: block; width: min(100%, 440px); height: 100%; max-height: 256px; min-height: 0; object-fit: contain; filter: drop-shadow(0 6px 5px #17473b37); }
.measurements { display: flex; gap: 10px 22px; flex-wrap: wrap; margin-top: 15px; }
.measurements span { display: block; font-size: 0.875rem; color: var(--muted); }
.measurements strong { font-size: 0.96rem; }
.notice { margin-top: 13px; padding: 10px 13px; background: #fff2d6; color: #65420b; border-radius: 8px; }
.filament { margin-bottom: 14px; padding: 11px 14px; border: 1px solid #bdd7cb; border-radius: 9px; background: #edf8f2; }
.filament p { margin-top: 3px; color: var(--muted); }
#export { width: 100%; }
#status:not(:empty), #download { margin-top: 10px; }
#download { display: inline-block; color: var(--green); }
details { color: var(--muted); }
summary { display: flex; align-items: center; gap: 8px; min-height: 44px; color: var(--green); font-weight: 650; cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::before { content: '+'; font-weight: 750; }
details[open] > summary::before { content: '−'; }
details ol { margin-top: 0; padding-left: 24px; }
details li + li, details p + p { margin-top: 7px; }
footer { margin-block: 23px 35px; color: var(--muted); }

@media (max-width: 800px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .results { display: contents; }
  .preview-card { grid-row: 1; }
  .intro { padding-block: 25px 18px; }
  .masthead-inner, main { width: min(100% - 30px, 620px); }
}

@media (max-width: 390px) {
  .masthead-inner { flex-wrap: wrap; }
  .fields { gap: 12px; }
  .stage { min-height: 175px; height: 190px; }
}
