:root {
  --bg: #FBF7FC;
  --surface: #FFFFFF;
  --ink: #4A4058;
  --muted: #948AA3;
  --lavender: #C9B8ED;
  --lavender-deep: #A98FDB;
  --mint: #A9DDC9;
  --mint-deep: #6FBE9E;
  --peach: #F4C7B6;
  --peach-deep: #E39A80;
  --line: #EAE1F3;
  --chip-bg: #F1E9FA;
  --shadow: 0 6px 20px rgba(150, 120, 180, 0.10);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Nunito', ui-sans-serif, system-ui, sans-serif;
  line-height: 1.5;
}

h1, h2, .brand__name, .form-section-title {
  font-family: 'Quicksand', 'Nunito', sans-serif;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* header */
.site-header {
  background: linear-gradient(135deg, var(--lavender) 0%, var(--mint) 100%);
  padding: 28px 0;
  border-radius: 0 0 32px 32px;
  box-shadow: var(--shadow);
}
.site-header__inner { display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand__icon { font-size: 30px; }
.brand__name { font-size: 24px; font-weight: 700; color: #3E3350; }
.brand__tag { margin: 0; color: #4A4058; opacity: 0.75; font-size: 14px; }

/* intro */
.intro { padding: 32px 0 8px; }
.intro h1 { font-size: 26px; font-weight: 700; margin: 0 0 8px; }
.intro__text { color: var(--muted); max-width: 640px; margin: 0; font-size: 15px; }

/* garment tabs */
.garment-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0 28px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; border: 2px solid var(--line);
  background: var(--surface); color: var(--ink); font-family: 'Nunito', sans-serif;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.chip:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.chip--active { background: var(--lavender); border-color: var(--lavender-deep); color: #3E3350; }
.chip__emoji { font-size: 16px; }

/* layout */
.layout { display: grid; grid-template-columns: minmax(0, 340px) 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px 22px 26px;
}

.form-section { margin-top: 8px; }
.form-section-title {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--lavender-deep);
  margin: 22px 0 12px;
}
.form-section-title__icon { font-size: 16px; }
.form-section-title__hint { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 400; }

.field { display: block; margin-bottom: 12px; }
.field__label { display: block; font-size: 13px; color: var(--ink); margin-bottom: 4px; }
.field input[type="number"] {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: #FDFBFE; color: var(--ink);
  font-family: 'Nunito', sans-serif; font-size: 14px; outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input[type="number"]:focus { border-color: var(--lavender-deep); box-shadow: 0 0 0 3px rgba(169, 143, 219, 0.18); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-note { font-size: 12px; color: var(--muted); background: var(--chip-bg); border-radius: var(--radius-sm); padding: 8px 12px; margin-top: 6px; }

.segmented { display: flex; gap: 8px; }
.style-btn {
  flex: 1; padding: 10px 8px; border-radius: var(--radius-sm); border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); font-family: 'Nunito', sans-serif; font-size: 13px; font-weight: 600; cursor: pointer;
}
.style-btn--active { background: var(--mint); border-color: var(--mint-deep); }
.style-btn:disabled, .direction-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.neckline-btn, .silhouette-btn, .shoulder-btn, .direction-btn, .capmethod-btn, .curvetype-btn, .hoodstyle-btn {
  flex: 1; padding: 9px 6px; border-radius: var(--radius-sm); border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); font-family: 'Nunito', sans-serif; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.neckline-btn--active, .silhouette-btn--active, .shoulder-btn--active, .direction-btn--active, .capmethod-btn--active, .curvetype-btn--active, .hoodstyle-btn--active {
  background: var(--peach); border-color: var(--peach-deep);
}

.btn-tertiary {
  width: 100%; margin: 6px 0 12px; padding: 8px 0; border-radius: var(--radius-sm); border: 1.5px dashed var(--lavender-deep);
  background: transparent; color: var(--lavender-deep); font-family: 'Nunito', sans-serif; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.btn-tertiary:hover { background: var(--chip-bg); }

.validation-badge { font-size: 12px; border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 10px; }
.validation-ok { background: rgba(111, 190, 158, 0.14); color: var(--mint-deep); }
.validation-bad { background: rgba(227, 154, 128, 0.18); color: var(--peach-deep); }

.meta-header { font-size: 13px; color: var(--ink); background: var(--chip-bg); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 12px; }

.stitch-cell { outline: none; border-radius: 4px; padding: 0 3px; }
.stitch-cell:focus { background: rgba(169, 143, 219, 0.16); box-shadow: 0 0 0 2px rgba(169, 143, 219, 0.3); }

.results-toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.btn-secondary {
  padding: 9px 16px; border-radius: 999px; border: 1.5px solid var(--lavender-deep);
  background: var(--surface); color: var(--lavender-deep); font-family: 'Nunito', sans-serif;
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.btn-secondary:hover { background: var(--chip-bg); }

.direction-badge {
  font-size: 12px; color: var(--lavender-deep); background: var(--chip-bg);
  border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 12px;
}

.seo-block { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.seo-block h2 { font-size: 19px; font-weight: 700; margin-bottom: 14px; }
.seo-block h3 { font-size: 15px; font-weight: 700; margin: 18px 0 6px; color: var(--lavender-deep); }
.seo-block p { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0; }

@media print {
  .site-header, .garment-tabs, .form-card, .results-toolbar, .disclaimer, .seo-block, .site-footer { display: none !important; }
  body { background: #fff; }
  .layout { grid-template-columns: 1fr !important; }
  .results-grid { grid-template-columns: 220px 1fr !important; }
  .row-table__body { max-height: none !important; overflow: visible !important; }
}

.btn-primary {
  width: 100%; margin-top: 20px; padding: 14px 0; border: none; border-radius: 999px;
  background: linear-gradient(135deg, var(--lavender-deep), var(--mint-deep));
  color: #FFFFFF; font-family: 'Quicksand', sans-serif; font-size: 15px; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 18px rgba(169, 143, 219, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(169, 143, 219, 0.45); }

.is-hidden { display: none !important; }

/* results */
.placeholder {
  background: var(--surface); border: 2px dashed var(--line); border-radius: var(--radius-lg);
  padding: 56px 24px; text-align: center; color: var(--muted); font-size: 15px;
}

.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  padding: 9px 18px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); font-family: 'Nunito', sans-serif; font-size: 13px; font-weight: 600; cursor: pointer;
}
.tab--active { background: var(--ink); border-color: var(--ink); color: #FFF; }

.results-grid { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
@media (max-width: 640px) { .results-grid { grid-template-columns: 1fr; } }

.schema-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 16px 14px; text-align: center;
}
.schema-svg { width: 100%; max-width: 220px; }
.schema-axis { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.schema-shape { fill: rgba(169, 143, 219, 0.14); stroke: var(--lavender-deep); stroke-width: 1.4; stroke-linejoin: round; }
.schema-dims { font-size: 11px; color: var(--muted); margin-top: 10px; line-height: 1.6; }
.schema-rotated-tag { font-style: italic; opacity: 0.8; }

.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.legend__item { display: flex; align-items: center; gap: 6px; }
.legend__dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.legend__dot--inc { background: var(--mint-deep); }
.legend__dot--dec { background: var(--peach-deep); }
.legend__dot--short { background: var(--lavender-deep); }

.row-table {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow);
}
.row-table__head {
  display: grid; grid-template-columns: 90px 1fr 90px; padding: 10px 18px;
  font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line); background: var(--chip-bg);
}
.row-table__body { max-height: 460px; overflow-y: auto; }
.row-table__row {
  display: grid; grid-template-columns: 90px 1fr 90px; padding: 10px 18px;
  font-size: 13px; border-bottom: 1px solid var(--line);
}
.row-table__row--dec { background: rgba(227, 154, 128, 0.10); }
.row-table__row--inc { background: rgba(111, 190, 158, 0.10); }
.row-table__row--short { background: rgba(169, 143, 219, 0.12); }
.align-right { text-align: right; }
.mono { font-family: 'SFMono-Regular', ui-monospace, Menlo, monospace; }
.muted { color: var(--muted); }

.disclaimer { font-size: 12px; color: var(--muted); margin: 26px 0 10px; line-height: 1.6; }

/* footer */
.site-footer { margin-top: 30px; padding: 22px 0 40px; color: var(--muted); font-size: 13px; text-align: center; }
