:root {
  color-scheme: light;
  --paper: #f7f2ea;
  --ink: #17201b;
  --muted: #637067;
  --line: #d8d0c5;
  --panel: #fffdfa;
  --panel-strong: #fbf6ef;
  --accent: #2f6f5e;
  --accent-strong: #235548;
  --gold: #b0782d;
  --rose: #bd5b54;
  --shadow: 0 18px 45px rgba(40, 32, 22, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(135deg, rgba(47, 111, 94, 0.08), transparent 34%),
    radial-gradient(circle at 85% 8%, rgba(176, 120, 45, 0.12), transparent 28%),
    var(--paper);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 750;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button.secondary {
  background: #eadfd1;
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid rgba(216, 208, 197, 0.78);
  background: rgba(247, 242, 234, 0.88);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #f7f2ea;
  font-size: 0.78rem;
  font-weight: 850;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.05;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

nav {
  display: flex;
  gap: 8px;
}

nav a {
  padding: 9px 11px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

nav a:hover {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

main {
  display: grid;
  gap: 24px;
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.tool-switcher {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(216, 208, 197, 0.9);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.92);
  box-shadow: var(--shadow);
}

.tool-switcher button {
  display: grid;
  gap: 3px;
  min-height: 66px;
  padding: 12px;
  border: 1px solid transparent;
  background: #eadfd1;
  color: var(--ink);
  text-align: left;
}

.tool-switcher button.active {
  border-color: rgba(47, 111, 94, 0.35);
  background: var(--accent);
  color: #fff;
}

.tool-switcher span {
  color: inherit;
  font-size: 0.86rem;
  font-weight: 550;
  opacity: 0.82;
}

[hidden] {
  display: none !important;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(340px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.tool-panel,
.preview-panel,
.guide-section,
.privacy-section {
  border: 1px solid rgba(216, 208, 197, 0.9);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.92);
  box-shadow: var(--shadow);
}

.tool-panel,
.preview-panel {
  padding: clamp(16px, 2.2vw, 24px);
}

.section-heading {
  display: grid;
  gap: 5px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 11ch;
  font-size: clamp(2.1rem, 5vw, 4.35rem);
  line-height: 0.96;
}

h2 {
  font-size: clamp(1.35rem, 3vw, 2.2rem);
  line-height: 1.04;
}

.upload-zone {
  position: relative;
  margin: 20px 0;
  border: 1.5px dashed #bfb4a5;
  border-radius: 8px;
  background: var(--panel-strong);
}

.upload-zone.dragging {
  border-color: var(--accent);
  background: #eef5f1;
}

.upload-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-zone label {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 92px;
  padding: 18px;
}

.upload-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: #dfe9e4;
  color: var(--accent-strong);
  font-size: 1.7rem;
  font-weight: 550;
  line-height: 1;
}

.upload-zone strong,
.upload-zone small {
  display: block;
}

.upload-zone small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.preset-grid {
  display: grid;
  gap: 8px;
}

.preset-grid label {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.preset-grid label:has(input:checked) {
  border-color: var(--accent);
  background: #eef5f1;
}

.preset-grid span,
.preset-grid small {
  grid-column: 2;
}

.preset-grid input {
  grid-row: 1 / span 2;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.preset-grid small {
  margin-top: 3px;
  color: var(--muted);
}

.select-block {
  display: grid;
  gap: 8px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.select-block select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  font-weight: 650;
}

.preset-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.file-support-note {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.controls-grid label,
.fine-controls label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.controls-grid input,
.controls-grid select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

.fine-controls {
  display: grid;
  gap: 12px;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 760;
}

.inline-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

input[type="range"] {
  accent-color: var(--accent);
}

.button-row,
.export-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.local-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.warning-note {
  padding: 11px;
  border: 1px solid rgba(189, 91, 84, 0.24);
  border-radius: 8px;
  background: rgba(189, 91, 84, 0.07);
  color: #82413b;
}

.preview-panel {
  display: grid;
  gap: 15px;
}

.preview-controls {
  display: grid;
  gap: 13px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.preview-shell {
  position: relative;
  display: grid;
  min-height: 470px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, #f2eee7 25%, transparent 25%),
    linear-gradient(-45deg, #f2eee7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f2eee7 75%),
    linear-gradient(-45deg, transparent 75%, #f2eee7 75%);
  background-color: #fffdfa;
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
}

canvas {
  display: block;
  max-width: min(100%, 620px);
  max-height: 70vh;
  border: 1px solid rgba(23, 32, 27, 0.15);
  background: white;
  box-shadow: 0 10px 30px rgba(23, 32, 27, 0.16);
}

.empty-preview {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

.empty-preview strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.empty-preview.hidden {
  display: none;
}

.result-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.result-strip div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-right: 1px solid var(--line);
}

.result-strip div:last-child {
  border-right: 0;
}

.result-strip span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.result-strip strong {
  min-width: 0;
  font-size: clamp(0.78rem, 2vw, 0.98rem);
  overflow-wrap: anywhere;
}

.export-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 0;
}

.export-grid button {
  min-width: 0;
  padding-inline: 10px;
}

.ideal-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ideal-card strong {
  display: block;
  margin-bottom: 5px;
}

.ideal-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.ideal-diagram {
  position: relative;
  width: 86px;
  height: 112px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
}

.ideal-head,
.ideal-shoulders,
.ideal-line {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.ideal-head {
  top: 23px;
  width: 34px;
  height: 42px;
  border-radius: 48%;
  background: rgba(47, 111, 94, 0.28);
  border: 2px solid rgba(47, 111, 94, 0.7);
}

.ideal-shoulders {
  bottom: 15px;
  width: 62px;
  height: 38px;
  border-radius: 40px 40px 12px 12px;
  background: rgba(176, 120, 45, 0.18);
  border: 2px solid rgba(176, 120, 45, 0.6);
}

.ideal-line {
  width: 72px;
  height: 1px;
  border-top: 1px dashed rgba(189, 91, 84, 0.85);
}

.ideal-line.top {
  top: 16px;
}

.ideal-line.bottom {
  top: 76px;
}

.guide-section,
.privacy-section,
.document-section {
  padding: clamp(16px, 2.2vw, 24px);
}

.document-section {
  border: 1px solid rgba(216, 208, 197, 0.9);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.92);
  box-shadow: var(--shadow);
}

.document-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(240px, 0.55fr);
  gap: 16px;
  align-items: stretch;
}

.document-upload {
  display: flex;
  align-items: center;
  min-height: 110px;
  margin: 0;
  padding: 18px;
  cursor: pointer;
}

.document-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.document-actions {
  display: grid;
  gap: 10px;
  align-content: stretch;
}

.document-actions label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.document-actions input,
.document-actions select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.guide-grid article {
  display: grid;
  gap: 9px;
  align-content: start;
  min-height: 142px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.guide-grid strong {
  font-size: 1rem;
}

.guide-grid p,
.privacy-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.privacy-section {
  display: grid;
  gap: 12px;
}

.privacy-section .disclaimer {
  padding: 12px;
  border: 1px solid rgba(189, 91, 84, 0.3);
  border-radius: 8px;
  background: rgba(189, 91, 84, 0.08);
  color: #82413b;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  h1 {
    max-width: 14ch;
  }

  .preview-shell {
    min-height: 360px;
  }

  .guide-grid,
  .document-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    width: 100%;
    justify-content: space-between;
  }

  nav a {
    padding-inline: 8px;
  }

  main {
    width: min(100% - 20px, 1180px);
    margin-top: 12px;
  }

  .controls-grid,
  .button-row,
  .export-grid,
  .result-strip,
  .tool-switcher,
  .guide-grid,
  .document-grid {
    grid-template-columns: 1fr;
  }

  .ideal-card {
    grid-template-columns: 1fr;
  }

  .result-strip div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .result-strip div:last-child {
    border-bottom: 0;
  }

  .preview-shell {
    min-height: 310px;
  }
}
