@font-face {
  font-family: Manrope;
  src: url('/assets/manrope.woff2') format('woff2');
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: Manrope, system-ui, sans-serif;
  color: #211d2c;
  background: #f7f6f2;
  --ink: #211d2c;
  --muted: #625c6c;
  --line: #ded9e3;
  --purple: #5d3db0;
  --lime: #d8f782;
  --dark: #20192f;
  --dark-text: #e8e0f5;
  accent-color: var(--purple);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-underline-offset: 0.22em; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, label[for] { touch-action: manipulation; }
::selection { color: var(--ink); background: #e9dfff; }
:focus-visible { outline: 3px solid #7651ca; outline-offset: 4px; }
.result :focus-visible { outline-color: var(--lime); }
.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.7rem 1rem;
  background: white;
  border-radius: 0.5rem;
}
.skip-link:focus { transform: none; }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner {
  position: relative;
  min-height: 4.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  white-space: nowrap;
}
.brand img { width: 2.25rem; height: 2.25rem; }
.site-nav { display: flex; align-items: center; gap: 1.25rem; font-size: 0.875rem; font-weight: 750; }
.site-nav a { text-decoration: none; }
.site-nav a:hover { text-decoration: underline; }
.share-button {
  min-height: 2.75rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid #ccc2d9;
  border-radius: 0.55rem;
  color: var(--ink);
  background: transparent;
  font-weight: 800;
  white-space: nowrap;
}
.share-button:hover { background: #eee8f7; }
.share-popover {
  position: absolute;
  z-index: 2;
  top: calc(100% + 0.4rem);
  right: 0;
  width: min(23rem, 100%);
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: #fff;
}
.share-popover label { display: block; margin-bottom: 0.5rem; font-weight: 800; }
.share-popover input { width: 100%; padding: 0.6rem; border: 1px solid var(--line); border-radius: 0.4rem; }
.share-popover p { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.875rem; }

.intro { padding-block: 3rem 2rem; }
.intro h1 {
  margin: 0;
  font-size: 3.65rem;
  line-height: 1.02;
  letter-spacing: -0.04em;
  font-weight: 800;
}
.intro h1 em { color: var(--purple); font-style: normal; }
.intro p { max-width: 46ch; margin: 1rem 0 0; color: var(--muted); line-height: 1.6; }
.wide-break { display: none; }
.notice { padding: 0.8rem 1rem; background: #eee8f7; border-radius: 0.5rem; }

.workspace { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 1.15rem; align-items: stretch; }
.controls, .result { min-width: 0; padding: 1.45rem; border-radius: 1rem; }
.controls { border: 1px solid var(--line); background: #fff; }
.field-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.55rem; gap: 0.5rem; }
.field-heading span, .field label, .text-button { font-size: 0.9rem; font-weight: 800; }
.text-button {
  margin: -0.45rem -0.5rem -0.45rem 0;
  padding: 0.45rem 0.5rem;
  min-height: 2.75rem;
  border: 0;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--purple);
}
.text-button:hover:not(:disabled) { text-decoration: underline; }
.text-button:disabled { color: var(--muted); }

.dropzone {
  position: relative;
  display: flex;
  min-height: 8.3rem;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 0.7rem;
  text-align: center;
  border: 1px dashed #a595bd;
  border-radius: 0.75rem;
  background: #f7f3fc;
}
.dropzone.dragging, .dropzone:has(input:not(:disabled)):hover { border-color: var(--purple); background: #f0e9fb; }
.dropzone:has(input:focus-visible) { outline: 3px solid #7651ca; outline-offset: 3px; }
.dropzone:has(input:not(:disabled)) .file-button { cursor: pointer; }
.dropzone:has(input:disabled) .file-button { color: var(--muted); }
.upload-icon {
  position: relative;
  display: block;
  width: 1.7rem;
  height: 1.45rem;
  border: 2px solid #7757b9;
  border-radius: 0.3rem;
}
.upload-icon::before {
  position: absolute;
  content: '';
  width: 0.26rem;
  height: 0.26rem;
  top: 0.22rem;
  left: 0.25rem;
  background: #7757b9;
  border-radius: 50%;
}
.upload-icon::after {
  position: absolute;
  content: '';
  bottom: 0.2rem;
  right: 0.17rem;
  width: 1.05rem;
  height: 0.55rem;
  background: #7757b9;
  clip-path: polygon(0 100%, 35% 42%, 51% 64%, 75% 0, 100% 100%);
}
.file-button { font-size: 0.95rem; line-height: 1.2; font-weight: 800; color: var(--purple); }
.file-button::after { position: absolute; content: ''; inset: 0; }
#file-hint { color: var(--muted); font-size: 0.8rem; }
.selected-file { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.82rem; overflow-wrap: anywhere; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin-top: 1.1rem; }
.field { min-width: 0; display: grid; gap: 0.45rem; align-content: start; }
.field input, .field select {
  display: block;
  width: 100%;
  min-height: 2.85rem;
  padding: 0.55rem 0.7rem;
  color: var(--ink);
  border: 1px solid #cfc7d9;
  border-radius: 0.55rem;
  background: #fff;
  font-weight: 750;
}
.field input[aria-invalid='true'] { border-color: #a33344; }
.field input:disabled, .field select:disabled { background: #f7f5f9; }
.unit-input { position: relative; }
.unit-input input { appearance: textfield; padding-right: 2.65rem; font-variant-numeric: tabular-nums; }
.unit-input input::-webkit-inner-spin-button, .unit-input input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.unit-input span { position: absolute; top: 50%; right: 0.7rem; transform: translateY(-50%); color: var(--muted); font-size: 0.81rem; pointer-events: none; }
.presets { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.7rem; }
.presets button {
  min-height: 2.75rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  color: var(--ink);
  background: #fff;
  font-size: 0.82rem;
  font-weight: 750;
  white-space: nowrap;
}
.presets button[aria-pressed='true'], .presets button:hover:not(:disabled) { background: #f0e9fb; color: #4a2f8b; border-color: #b7a4dc; }
.primary, .download-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 2.9rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  font-size: 0.92rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease;
}
.primary { width: 100%; margin-top: 1rem; color: #fff; background: #5635a4; }
.primary:hover:not(:disabled) { background: #492b90; }
.primary:disabled { color: #615574; background: #eee8f6; }
.problem { margin: 0.7rem 0 0; color: #8e2337; font-size: 0.86rem; }

.result { display: flex; flex-direction: column; justify-content: space-between; gap: 1.15rem; background: var(--dark); color: white; }
.result-header { display: flex; justify-content: space-between; align-items: center; gap: 0.7rem; }
.result-header h2 { margin: 0; font-size: 1.04rem; line-height: 1.3; font-weight: 800; }
.result-target {
  flex: none;
  padding: 0.45rem 0.7rem;
  border: 1px solid #6a597f;
  border-radius: 0.45rem;
  color: var(--dark-text);
  font-size: 0.82rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
.comparison figure { margin: 0; }
.image-frame {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 0.83;
  border-radius: 0.65rem;
  background: #2b233c;
}
.image-frame img { position: absolute; width: 100%; height: 100%; object-fit: contain; }
.frame-corners { position: absolute; inset: 20%; color: #8e7da5; background:
  linear-gradient(currentColor, currentColor) left top / 14px 2px,
  linear-gradient(currentColor, currentColor) left top / 2px 14px,
  linear-gradient(currentColor, currentColor) right top / 14px 2px,
  linear-gradient(currentColor, currentColor) right top / 2px 14px,
  linear-gradient(currentColor, currentColor) left bottom / 14px 2px,
  linear-gradient(currentColor, currentColor) left bottom / 2px 14px,
  linear-gradient(currentColor, currentColor) right bottom / 14px 2px,
  linear-gradient(currentColor, currentColor) right bottom / 2px 14px;
  background-repeat: no-repeat;
}
.image-frame img + .frame-corners { display: none; }
.output-frame .frame-corners { inset: 28%; color: #a59ab5; }
.comparison figcaption { min-width: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 0.35rem; margin-top: 0.5rem; color: var(--dark-text); font-size: 0.81rem; }
.comparison strong { color: #fff; font-size: 0.88rem; font-variant-numeric: tabular-nums; text-align: right; }
.output-frame ~ figcaption strong { color: var(--lime); }
.result-footer { min-height: 2.9rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; }
.result-footer p { margin: 0; color: var(--dark-text); font-size: 0.85rem; line-height: 1.55; }
.download-button { background: var(--lime); color: #272e15; }
.download-button:hover { background: #e9faa9; }

.guide { max-width: 47rem; padding-block: 3rem; scroll-margin-top: 1rem; }
.guide h2 { margin: 0 0 0.85rem; font-size: 1.5rem; line-height: 1.25; 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.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); }
.questions details { border-top: 1px solid var(--line); }
.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(--line); }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.65rem 1rem; padding-block: 1.1rem; color: var(--muted); font-size: 0.81rem; }

@media (max-width: 66rem) {
  .wide-break { display: inline; }
}
@media (max-width: 51rem) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .wrap { max-width: 41rem; }
  .intro h1 { font-size: 3.15rem; }
  .intro { padding-block: 2.3rem 1.6rem; }
}
@media (max-width: 30rem) {
  .wrap { width: calc(100% - 1.6rem); }
  .header-inner { min-height: 3.8rem; }
  .site-nav { gap: 0.55rem; }
  .site-nav a { display: none; }
  .intro h1 { font-size: 2.55rem; }
  .controls, .result { padding: 1rem; }
  .comparison { gap: 0.55rem; }
  .comparison figcaption { flex-wrap: wrap; }
  .guide { padding-block: 2.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
