@font-face {
  font-family: Manrope;
  src: url('/assets/manrope.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}
:root {
  color-scheme: light;
  font-family: Manrope, system-ui, sans-serif;
  background: #f2f5f8;
  color: #1b2b42;
  --ink: #1b2b42;
  --muted: #536378;
  --stroke: #ccd7e3;
  --blue: #214e8c;
  --panel: #172c49;
  --panel-text: #d8e6fa;
  --paper: #fff;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-underline-offset: 0.22em; }
::selection { color: var(--ink); background: #d7e9fe; }
:focus-visible { outline: 3px solid #306db6; outline-offset: 4px; }
.wrap { width: min(70rem, calc(100% - 3rem)); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; z-index: 3; top: 0.7rem; left: 0.7rem; transform: translateY(-200%); padding: 0.75rem 1rem; border-radius: 0.5rem; background: var(--paper); }
.skip-link:focus { transform: none; }

.site-header { border-bottom: 1px solid var(--stroke); }
.header-inner { position: relative; display: flex; min-height: 4.6rem; justify-content: space-between; align-items: center; gap: 0.8rem; }
.brand { display: inline-flex; align-items: center; gap: 0.65rem; font-size: 1.14rem; font-weight: 800; text-decoration: none; }
.brand img { flex: none; }
.nav { display: flex; align-items: center; gap: 1rem; font-size: 0.875rem; font-weight: 800; }
.nav a { text-decoration: none; white-space: nowrap; }
.nav a:hover { text-decoration: underline; }
.outline, .primary, .download { display: inline-flex; min-height: 2.75rem; justify-content: center; align-items: center; padding: 0.55rem 0.9rem; border: 1px solid #b3c3d5; border-radius: 0.55rem; color: var(--ink); background: var(--paper); font-size: 0.875rem; font-weight: 800; white-space: nowrap; }
.outline:hover { background: #e5eef9; }
.share-panel { position: absolute; z-index: 2; top: calc(100% + 0.4rem); right: 0; width: min(23rem, 100%); padding: 1rem; border: 1px solid var(--stroke); border-radius: 0.8rem; background: var(--paper); }
.share-panel label { display: block; margin-bottom: 0.5rem; font-weight: 800; }
.share-panel input { width: 100%; padding: 0.65rem; border: 1px solid #b3c3d5; border-radius: 0.45rem; color: var(--ink); background: var(--paper); }
.intro { padding-block: 2.8rem 1.9rem; }
.intro h1 { margin: 0; font-size: clamp(2.65rem, 6vw, 3.9rem); font-weight: 800; line-height: 1.04; letter-spacing: -0.04em; }
.intro h1 em { font-style: normal; color: var(--blue); }
.intro p { max-width: 52ch; margin: 0.9rem 0 0; color: var(--muted); line-height: 1.65; }
.notice { padding: 0.75rem 1rem; background: #e2ecf7; border-radius: 0.55rem; }

.workspace { display: grid; grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr); gap: 1.15rem; }
.controls, .preview-panel { min-width: 0; padding: 1.25rem; border-radius: 1rem; }
.controls { align-self: start; border: 1px solid var(--stroke); background: var(--paper); }
.field-heading { display: flex; justify-content: space-between; align-items: center; gap: 0.65rem; margin-bottom: 0.4rem; }
.field-heading span, legend, .format { font-size: 0.91rem; font-weight: 800; }
.text-button { min-height: 2.75rem; padding: 0.45rem 0.55rem; border: 0; border-radius: 0.4rem; color: var(--blue); background: transparent; font-size: 0.86rem; font-weight: 800; }
.text-button:hover:not(:disabled) { text-decoration: underline; }
.text-button:disabled { color: var(--muted); }
.dropzone { position: relative; display: grid; justify-items: center; align-content: center; gap: 0.38rem; min-height: 6.5rem; padding: 0.8rem; text-align: center; border: 1px dashed #849eb9; border-radius: 0.7rem; background: #edf4fc; }
.dropzone.dragging, .dropzone:has(input:not(:disabled)):hover { border-color: var(--blue); background: #e3effc; }
.dropzone:has(input:focus-visible) { outline: 3px solid #306db6; outline-offset: 3px; }
.dropzone label { color: var(--blue); font-size: 0.94rem; font-weight: 800; cursor: pointer; }
.dropzone:has(input:disabled) label { color: var(--muted); cursor: default; }
.dropzone label::after { position: absolute; content: ''; inset: 0; }
.dropzone > span:last-child, .file-name { color: var(--muted); font-size: 0.8rem; }
.file-name { margin: 0.45rem 0 0; overflow-wrap: anywhere; }
.file-icon { position: relative; display: block; width: 1.65rem; height: 1.35rem; border: 2px solid #496a94; border-radius: 0.3rem; }
.file-icon::before { position: absolute; content: ''; top: 16%; left: 19%; width: 21%; aspect-ratio: 1; border-radius: 50%; background: #496a94; }
.file-icon::after { position: absolute; content: ''; inset: 39% 14% 13%; background: #496a94; clip-path: polygon(0 100%, 35% 31%, 53% 58%, 75% 0, 100% 100%); }
.dimensions, .placement { min-inline-size: 0; margin: 1rem 0 0; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: 0.48rem; }
.dimension-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.3rem 0.65rem; }
.dimension-fields label { font-size: 0.84rem; font-weight: 750; }
.unit { color: var(--muted); }
.dimension-fields input, .format select { min-width: 0; width: 100%; min-height: 2.7rem; padding: 0.5rem 0.7rem; border: 1px solid #b3c3d5; border-radius: 0.55rem; color: var(--ink); background: var(--paper); font-weight: 750; }
.dimension-fields input { appearance: textfield; font-variant-numeric: tabular-nums; }
.dimension-fields input::-webkit-inner-spin-button, .dimension-fields input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.dimension-fields input[aria-invalid='true'] { border-color: #a23434; }
.presets { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; }
.presets button { min-height: 2.75rem; padding: 0.4rem 0.55rem; border: 1px solid var(--stroke); border-radius: 0.48rem; color: var(--ink); background: var(--paper); font-size: 0.79rem; font-weight: 800; }
.presets button[aria-pressed='true'], .presets button:hover:not(:disabled) { border-color: #90acd0; color: #21446f; background: #e7f1fe; }
.fit-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; }
.fit-options label { position: relative; display: flex; }
.fit-options label span { display: grid; align-content: center; width: 100%; min-height: 2.75rem; padding: 0.45rem 0.55rem; text-align: center; border: 1px solid var(--stroke); border-radius: 0.55rem; font-size: 0.83rem; font-weight: 800; cursor: pointer; }
.fit-options input:checked + span { border-color: #90acd0; color: #21446f; background: #e7f1fe; }
.fit-options input:focus-visible + span { outline: 3px solid #306db6; outline-offset: 3px; }
.fit-options input:disabled + span { cursor: default; }
#fit-note { margin: 0.45rem 0 0; color: var(--muted); font-size: 0.82rem; }
.action-row { display: grid; grid-template-columns: minmax(0, 0.66fr) minmax(0, 1fr); align-items: end; gap: 0.65rem; margin-top: 0.85rem; }
.format { display: grid; gap: 0.35rem; }
.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.primary:hover:not(:disabled) { background: #183e72; }
.primary:disabled { background: #e3edf8; border-color: #d3dfef; color: #435c7b; }
.problem { margin: 0.75rem 0 0; color: #942b33; font-size: 0.85rem; }

.preview-panel { display: flex; flex-direction: column; gap: 0.9rem; background: var(--panel); color: #fff; }
.preview-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.65rem; }
.preview-heading h2 { margin: 0; font-size: 1.08rem; font-weight: 800; }
.aspect { padding: 0.48rem 0.7rem; border: 1px solid #5d779b; border-radius: 0.45rem; color: var(--panel-text); font-size: 0.82rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.preview-stage { display: grid; place-items: center; flex: 1; min-height: 14rem; padding: 0.8rem; overflow: hidden; border-radius: 0.7rem; background: #243d5e; }
.preview-stage canvas { display: block; max-width: 100%; max-height: 21rem; width: auto; height: auto; object-fit: contain; background-color: #fff; background-image: conic-gradient(#d8e0ea 25%, #fff 0 50%, #d8e0ea 0 75%, #fff 0); background-size: 20px 20px; }
.preview-empty { display: grid; justify-items: center; gap: 0.65rem; text-align: center; color: var(--panel-text); }
.preview-empty p { margin: 0; font-size: 0.88rem; line-height: 1.55; }
.frame-icon { display: block; width: 2.8rem; height: 2.8rem; border: 2px dashed #a9c6eb; border-radius: 0.4rem; }
.measurements { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin: 0; padding-top: 0.55rem; border-top: 1px solid #4b6386; }
.measurements dt, .result p { color: var(--panel-text); font-size: 0.83rem; }
.measurements dd { margin: 0.2rem 0 0; color: #fff; font-size: 0.9rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.result { display: flex; min-height: 2.75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.65rem; }
.result p { margin: 0; line-height: 1.55; }
.download { background: #c9f5e4; border-color: #c9f5e4; color: #163c36; text-decoration: none; }
.download:hover { background: #e0fcf1; }
.preview-panel :focus-visible { outline-color: #c9f5e4; }
.guide { max-width: 47rem; padding-block: 2.8rem; scroll-margin-top: 1rem; }
.guide h2 { margin: 0 0 0.85rem; font-size: 1.55rem; line-height: 1.3; letter-spacing: -0.025em; }
.guide ol { margin: 0; padding-left: 1.35rem; color: var(--muted); line-height: 1.65; }
.guide li + li { margin-top: 0.3rem; }
.guide strong { color: var(--ink); }
.questions { margin-top: 1.4rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--stroke); }
.questions details { border-top: 1px solid var(--stroke); }
.questions summary { padding: 0.85rem 0.75rem; cursor: pointer; font-size: 0.94rem; font-weight: 800; }
.questions p { margin: 0 0 0.9rem; padding-inline: 0.75rem; color: var(--muted); font-size: 0.94rem; line-height: 1.6; }
.site-footer { border-top: 1px solid var(--stroke); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 0.65rem 1rem; justify-content: space-between; padding-block: 1.1rem; color: var(--muted); font-size: 0.84rem; }
@media (max-width: 50rem) {
  .wrap { max-width: 41rem; }
  .intro { padding-block: 2.2rem 1.5rem; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 31rem) {
  .wrap { width: calc(100% - 1.6rem); }
  .header-inner { min-height: 3.8rem; }
  .brand { font-size: 0.96rem; gap: 0.45rem; }
  .brand img { width: 1.85rem; height: 1.85rem; }
  .nav a { display: none; }
  .controls, .preview-panel { padding: 0.95rem; }
  .guide { padding-block: 2.2rem; }
}
