:root {
  --purple: #6E00FF;
  --accent: #BC00FF;
  --purple-dark: #1A0033;
  --purple-fill: #F0D9FF;
  --bg: #DED9E5;
  --white: #ffffff;
  --font-heading: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-lead: "Sora", -apple-system, "Segoe UI", Arial, sans-serif;
  --font-body: "Sora", -apple-system, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  font-family: var(--font-body);
  font-weight: 300;
  color: var(--purple-dark);
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 80px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.language-switcher {
  display: flex;
  justify-content: flex-end;
  margin-bottom: -8px;
}

.language-switcher select {
  border: 1px solid var(--purple);
  border-radius: 0;
  background: var(--white);
  color: var(--purple-dark);
  font-family: var(--font-lead);
  font-weight: 500;
  font-size: 13px;
  padding: 4px 8px;
  cursor: pointer;
}

h2 {
  margin: 0 0 12px;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 26px;
  color: var(--purple);
}

h3 {
  margin: 0 0 10px;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 20px;
  color: var(--purple);
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  vertical-align: middle;
  border: 1px solid var(--purple);
  border-radius: 50%;
  background: var(--white);
  color: var(--purple);
  font-size: 11px;
  font-style: italic;
  font-family: var(--font-heading);
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.info-tooltip {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 12px;
  line-height: 1.4;
  color: var(--purple-dark);
  background: var(--white);
  border: 1px solid var(--purple);
  border-radius: 0;
  padding: 8px 10px;
  margin-bottom: 10px;
}

.info-tooltip[hidden] {
  display: none;
}

.info-tooltip p {
  margin: 0 0 8px;
}

.info-tooltip p:last-child {
  margin-bottom: 0;
}

.diff-warning {
  background: #FCA5A5;
  color: #7F1D1D;
}

.input-error {
  border-color: #DC2626 !important;
}

.validation-message {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 12px;
  line-height: 1.4;
  color: #7F1D1D;
  background: #FEE2E2;
  border: 1px solid #DC2626;
  border-radius: 0;
  padding: 6px 10px;
  margin: -2px 0 6px;
}

.validation-message[hidden] {
  display: none;
}

.pdf-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pdf-button {
  border: none;
  border-radius: 0;
  background: var(--accent);
  color: var(--white);
  font-family: var(--font-lead);
  font-weight: 500;
  font-size: 14px;
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--purple);
}

.pdf-button:hover {
  background: var(--purple);
}

.box {
  border: 2px solid var(--purple);
  border-radius: 0;
  padding: 14px;
  background: var(--white);
  box-shadow: 5px 5px 0 var(--purple);
}

.box.inner {
  margin-top: 12px;
  background: transparent;
  box-shadow: none;
}

.field {
  margin-bottom: 10px;
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 14px;
  display: grid;
  grid-template-columns: 210px auto;
  align-items: center;
  column-gap: 8px;
  row-gap: 4px;
}

.field.compact {
  grid-template-columns: max-content auto;
  column-gap: 6px;
}

input[type="number"] {
  padding: 4px 6px;
  border: 1px solid var(--purple);
  border-radius: 0;
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 14px;
  width: 100%;
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

output {
  display: inline-block;
  background: var(--purple-fill);
  border-radius: 0;
  font-family: var(--font-lead);
  font-weight: 500;
  padding: 4px 6px;
  font-size: 14px;
  text-align: center;
}

/* Wraps an input/output with a unit label shown inside the field */
.unit-field {
  position: relative;
  display: inline-flex;
  width: 72px;
}

.unit-field.wide {
  width: 100px;
}

.unit-field.extra-wide {
  width: 150px;
}

.unit-field.narrow {
  width: 60px;
}

.unit-field input,
.unit-field output {
  width: 100%;
  padding-right: 30px;
}

.unit-field.wide input,
.unit-field.wide output {
  padding-right: 44px;
}

.unit-field.extra-wide input,
.unit-field.extra-wide output {
  padding-right: 54px;
}

.unit-field.narrow input,
.unit-field.narrow output {
  padding-right: 22px;
}

.unit-field .unit {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--purple);
  pointer-events: none;
  white-space: nowrap;
}

.swatch-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.swatch-row .field {
  flex: 1;
  margin-bottom: 0;
}

.swatch {
  width: 70px;
  height: 70px;
  background: var(--purple);
  border-radius: 0;
  flex-shrink: 0;
  box-shadow: 3px 3px 0 var(--accent);
}

.diagram {
  border: 2px solid var(--purple);
  border-radius: 0;
  padding: 10px;
  background: var(--white);
  box-shadow: 5px 5px 0 var(--purple);
}

.diagram img {
  display: block;
  width: 100%;
  height: auto;
}

.measure-table {
  margin-bottom: 14px;
}

.measure-header {
  display: grid;
  grid-template-columns: 20px 90px 90px;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.measure-header span {
  text-align: center;
}

.measure-row {
  display: grid;
  grid-template-columns: 20px 90px 90px;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.measure-row .unit-field {
  width: 100%;
}

.percent-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
}

.percent-row label {
  flex: none;
  width: 110px;
}

.percent-row > output {
  flex: none;
  width: 90px;
}

.raglan-position-diagram {
  display: block;
  width: 140px;
  margin: 0 auto 10px;
}
