:root {
  --canvas: #f5f7fa;
  --surface: #fff;
  --sunken: #edf1f6;
  --border-subtle: #d8e0e9;
  --text-primary: #202b38;
  --text-secondary: #526174;
  --accent-blue: #5223c5;
  font-family: Nunito, system-ui, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #151b25;
  --surface: #1d2532;
  --sunken: #111722;
  --border-subtle: #354154;
  --text-primary: #f2f5f9;
  --text-secondary: #bac6d5;
  --accent-blue: #bba6ff;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--text-primary); }
[hidden] { display: none !important; }
.frame { width: min(1120px, calc(100% - 2rem)); margin-inline: auto; }
.masthead { background: var(--surface); border-bottom: 1px solid var(--border-subtle); }
.bar { display: flex; align-items: center; justify-content: space-between; min-height: 68px; }
.brand { display: flex; align-items: center; gap: .6rem; font-size: 1.25rem; font-weight: 900; }
main { padding-block: clamp(2rem, 6vw, 4rem); }
h1 { font-size: clamp(2.25rem, 6vw, 3.65rem); letter-spacing: -.045em; margin: 0; }
h2 { font-size: 1.35rem; margin: 0 0 1.25rem; }
.workspace { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 1.25rem; align-items: start; }
.output { display: grid; gap: 1.25rem; }
.spectral-card { padding: clamp(1rem, 3vw, 1.6rem); background: var(--surface); border: 1px solid var(--border-subtle); border-radius: 14px; }
fieldset { margin: 0 0 1.3rem; padding: 0; border: 0; min-inline-size: 0; }
legend, summary { font-weight: 800; padding: 0; }
legend { margin-bottom: .55rem; }
legend span { margin-left: .35rem; color: var(--text-secondary); font-weight: 600; }
.dimensions, .pair { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: grid; gap: .3rem; font-size: .875rem; font-weight: 700; }
input, select { width: 100%; min-width: 0; min-height: 44px; padding: .45rem .6rem; border-radius: 9px; border: 1px solid var(--border-interactive, #76869a); color: inherit; background: var(--sunken); font: inherit; }
select { appearance: none; padding-right: 1.8rem; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-size: 5px 5px; background-position: right 15px center, right 10px center; background-repeat: no-repeat; }
summary { cursor: pointer; }
details .pair { margin-top: .75rem; }
.actions { display: grid; grid-template-columns: 1fr 1.2fr; align-items: end; gap: .7rem; border-top: 1px solid var(--border-subtle); margin-top: 1.5rem; padding-top: 1.15rem; }
.actions button { min-height: 44px; }
canvas { display: block; width: 100%; background: var(--sunken); border-radius: 12px; }
#measurements { text-align: center; margin: .9rem 0 0; color: var(--text-secondary); }
.result p { color: var(--text-secondary); margin: 0; overflow-wrap: anywhere; }
.result .button, .result button { display: inline-flex; align-items: center; margin-top: 1rem; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 3px; }
@media (max-width: 740px) { .workspace { grid-template-columns: 1fr; } }
#preview { display: block; width: 100%; height: auto; margin-top: 1rem; border-radius: 12px; background: #f5f7fa; }
#loader { height: 4px; margin-top: .85rem; background-color: var(--accent-blue); }
.print-hero {
  margin-block: 1rem 2rem;
  padding: clamp(1.25rem, 4vw, 2.75rem);
  border-radius: 20px;
  background: radial-gradient(ellipse at 10% 0%, #4a2a82, transparent 70%), #221437;
  color: #fbf8ff;
}
.print-hero-intro { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: .9rem; margin-bottom: 1.35rem; }
.print-hero-intro img { grid-row: 1 / 3; }
.print-hero h2 { margin: 0 0 .35rem; font-size: clamp(1.85rem, 4.3vw, 3rem); letter-spacing: -.035em; }
.print-hero p { margin: 0; color: #e5d8f8; font-size: 1rem; }
.feature-gallery { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .75rem; }
.feature-gallery figure { min-width: 0; margin: 0; overflow: hidden; border: 1px solid #8e76b552; border-radius: 12px; background: #161024; }
.feature-gallery img { display: block; width: 100%; height: auto; aspect-ratio: 1; border-bottom: 1px solid #8e76b552; }
.feature-gallery figcaption { display: grid; gap: .25rem; padding: .65rem; }
.feature-gallery figcaption span { color: #e5d8f8; font-size: .875rem; line-height: 1.4; }
@media (max-width: 960px) { .feature-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .feature-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .print-hero-intro img { grid-row: auto; width: 40px; height: 40px; }
  .print-hero-intro p { grid-column: 1 / -1; }
}
.site-footer { border-top: 1px solid var(--border-subtle); }
.footer-links { display: flex; flex-wrap: wrap; gap: .65rem 1.5rem; padding-block: 1.25rem; }
.footer-links a { color: var(--accent-blue); text-underline-offset: .2em; }
.units { max-width: 14rem; margin-bottom: 1.3rem; }
#dimension-limits { margin: 0 0 .65rem; font-size: .875rem; color: var(--text-secondary); }
input[aria-invalid="true"] { border-color: var(--status-error, #c52e3b); }
.field-error { color: var(--status-error, #c52e3b); font-size: .875rem; line-height: 1.3; overflow-wrap: anywhere; }
:root[data-theme="dark"] .field-error { color: var(--status-error, #ffbac1); }
.field-error:empty { position: absolute; }
.sketch-summary { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
