:root {
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #171714;
  background: #ebe9e3;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-height: 100vh; background: radial-gradient(circle at 80% 0%, #f8f7f2 0%, #ebe9e3 42%, #e4e1d9 100%); }
button, input { font: inherit; }
button { color: inherit; }

.app-shell {
  width: min(1480px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  border: 1px solid rgba(38, 37, 31, 0.12);
  background: rgba(250, 249, 245, 0.72);
  backdrop-filter: blur(18px);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(60, 56, 45, 0.12);
}

.control-panel {
  padding: 34px 32px 30px;
  background: rgba(250, 249, 245, 0.93);
  border-right: 1px solid rgba(38, 37, 31, 0.1);
  overflow-y: auto;
  max-height: calc(100vh - 32px);
}

.brand-row, .section-heading, .accuracy-topline, .viewer-toolbar, .summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow, .section-kicker {
  margin: 0 0 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
  color: #7e7b70;
}

h1 { margin: 0; font-size: 30px; line-height: 1; letter-spacing: -.055em; font-weight: 780; }
h1 span { color: #9e9a8a; font-weight: 560; }
h2 { margin: 0; font-size: 17px; letter-spacing: -.03em; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border-radius: 999px;
  background: #f0eee8;
  border: 1px solid #dfdcd3;
  font-size: 11px;
  font-weight: 700;
  color: #68655c;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #6c8b68; box-shadow: 0 0 0 4px rgba(108,139,104,.12); }

.intro {
  margin: 24px 0 30px;
  font-size: 13px;
  line-height: 1.65;
  color: #6f6c63;
}

.section-heading { margin-bottom: 14px; }
.text-button {
  border: 0;
  padding: 6px 0;
  background: transparent;
  color: #7f7c72;
  font-size: 12px;
  cursor: pointer;
}
.text-button:hover { color: #22211e; }

.measurement-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
  padding: 12px 13px 10px;
  background: #f4f2ec;
  border: 1px solid transparent;
  border-radius: 14px;
  transition: .2s ease;
}
.field:focus-within { background: #fff; border-color: #c9c5b7; box-shadow: 0 0 0 3px rgba(180,174,157,.12); }
.field label { grid-column: 1 / -1; color: #747167; font-size: 11px; font-weight: 650; }
.field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: #191816;
  font-size: 19px;
  font-weight: 690;
  letter-spacing: -.035em;
}
.field .unit { color: #9a9689; font-size: 11px; font-weight: 700; }

.advanced-toggle {
  width: 100%;
  margin: 18px 0 0;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #dedbd2;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}
.advanced-toggle small { display: block; color: #9a968b; font-size: 9px; letter-spacing: .16em; margin-bottom: 3px; }
.chevron { font-size: 22px; color: #8c887d; transition: transform .2s ease; }
.advanced-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.advanced-panel { padding-top: 11px; }

.accuracy-card, .note-card {
  margin-top: 18px;
  padding: 15px 16px;
  border-radius: 16px;
  background: #22221f;
  color: #f5f3ec;
}
.accuracy-topline { font-size: 12px; }
.accuracy-topline span { color: #aaa79c; }
.progress-track { height: 5px; margin: 12px 0 10px; border-radius: 999px; background: #3a3933; overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 56%; border-radius: inherit; background: #e9e5d7; transition: width .35s ease; }
.accuracy-card p { margin: 0; color: #aaa79c; font-size: 11px; line-height: 1.55; }
.note-card { background: #efede6; color: #4d4a42; border: 1px solid #dfdcd2; }
.note-card strong { font-size: 12px; }
.note-card p { margin: 6px 0 0; font-size: 10.5px; line-height: 1.6; color: #77736a; }

.viewer-panel { position: relative; min-height: 760px; overflow: hidden; background: linear-gradient(160deg, #edece7 0%, #e4e2db 100%); }
.viewer-toolbar { position: absolute; z-index: 4; left: 28px; right: 28px; top: 26px; pointer-events: none; }
.view-tabs, .icon-button { pointer-events: auto; }
.view-tabs { display: flex; gap: 3px; padding: 4px; border-radius: 13px; background: rgba(250,249,245,.78); border: 1px solid rgba(60,58,51,.09); backdrop-filter: blur(15px); }
.view-tab, .icon-button { border: 0; cursor: pointer; }
.view-tab { padding: 8px 12px; border-radius: 9px; background: transparent; color: #858176; font-size: 11px; font-weight: 750; }
.view-tab.active { background: #22221f; color: #f6f4ee; }
.icon-button { width: 38px; height: 38px; border-radius: 12px; background: rgba(250,249,245,.78); border: 1px solid rgba(60,58,51,.09); backdrop-filter: blur(15px); font-size: 17px; }
.viewer { position: absolute; inset: 0; }
.viewer canvas { display: block; width: 100%; height: 100%; }
.viewer-hint { position: absolute; z-index: 3; left: 50%; bottom: 114px; transform: translateX(-50%); padding: 8px 12px; border-radius: 999px; background: rgba(250,249,245,.72); color: #858176; font-size: 10px; font-weight: 650; backdrop-filter: blur(8px); white-space: nowrap; pointer-events: none; }

.summary-card {
  position: absolute;
  z-index: 3;
  left: 26px;
  right: 26px;
  bottom: 24px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(250,249,245,.8);
  border: 1px solid rgba(60,58,51,.1);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 30px rgba(60,56,45,.08);
  pointer-events: none;
}
.summary-label { display: block; color: #8f8b7f; font-size: 9px; font-weight: 800; letter-spacing: .12em; margin-bottom: 3px; }
#summaryHeadline { font-size: 14px; letter-spacing: -.02em; }
.summary-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.summary-chip { padding: 6px 8px; border-radius: 8px; background: rgba(226,223,214,.75); color: #68655c; font-size: 9.5px; font-weight: 700; }

@media (max-width: 920px) {
  body { background: #eeece6; }
  .app-shell { width: 100%; margin: 0; min-height: 100vh; border: 0; border-radius: 0; grid-template-columns: 1fr; }
  .control-panel { order: 2; max-height: none; border: 0; border-top: 1px solid rgba(38,37,31,.1); padding: 26px 20px 32px; }
  .viewer-panel { order: 1; min-height: 68vh; }
  .summary-card { bottom: 18px; left: 16px; right: 16px; align-items: flex-start; }
  .summary-chips { max-width: 55%; }
}

@media (max-width: 520px) {
  .measurement-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .field { padding: 11px; }
  .viewer-panel { min-height: 590px; }
  .viewer-toolbar { left: 14px; right: 14px; top: 14px; }
  .viewer-hint { bottom: 120px; }
  .summary-card { flex-direction: column; gap: 10px; }
  .summary-chips { justify-content: flex-start; max-width: 100%; }
}

/* v4 additions */
.gender-card {
  margin: -10px 0 24px;
  padding: 14px;
  border: 1px solid #dedbd2;
  border-radius: 16px;
  background: #f5f3ed;
}
.gender-heading, .check-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.gender-heading > span, .check-heading > span {
  color: #969185;
  font-size: 10px;
  font-weight: 700;
}
.gender-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 12px;
  padding: 4px;
  border-radius: 12px;
  background: #e9e6de;
}
.gender-button {
  border: 0;
  border-radius: 9px;
  padding: 9px 12px;
  cursor: pointer;
  background: transparent;
  color: #777269;
  font-size: 12px;
  font-weight: 760;
}
.gender-button.active {
  background: #22221f;
  color: #f7f5ef;
  box-shadow: 0 3px 9px rgba(36,35,31,.12);
}
.gender-card > p {
  margin: 9px 2px 0;
  color: #827e74;
  font-size: 10.5px;
  line-height: 1.55;
}

.measurement-check-card {
  margin-top: 18px;
  padding: 15px 16px;
  border-radius: 16px;
  background: #f4f2ec;
  border: 1px solid #dfdcd2;
}
.check-heading strong {
  font-size: 12px;
}
.check-rows {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}
.check-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
}
.check-row span { color: #716d64; }
.check-row strong { font-size: 10.5px; color: #2c2a25; }
.check-row em {
  min-width: 48px;
  padding: 4px 6px;
  border-radius: 999px;
  font-style: normal;
  text-align: center;
  font-size: 8.5px;
  font-weight: 760;
}
.check-row em.ok { background: #e1eadf; color: #52714e; }
.check-row em.warn { background: #f1e5d8; color: #8a6542; }
.proportion-note {
  margin: 11px 0 0;
  padding-top: 10px;
  border-top: 1px solid #dedbd2;
  color: #878276;
  font-size: 9.5px;
  line-height: 1.5;
}

/* v5 additions */
.toolbar-actions { display: flex; align-items: center; gap: 7px; pointer-events: auto; }
.debug-button {
  height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(60,58,51,.09);
  border-radius: 12px;
  background: rgba(250,249,245,.78);
  backdrop-filter: blur(15px);
  color: #777269;
  font-size: 10px;
  font-weight: 760;
  cursor: pointer;
}
.debug-button.active { background: #22221f; color: #f6f4ee; }
.status-pill.busy .status-dot { background: #b08b58; animation: pulse-dot .8s ease-in-out infinite alternate; }
@keyframes pulse-dot { from { opacity: .45; } to { opacity: 1; } }

/* v8 body-type additions */
.subsection-title {
  margin: 22px 0 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.subsection-title span {
  color: #969185;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .16em;
}
.subsection-title strong {
  color: #4b4841;
  font-size: 12px;
}

.type-result-card {
  margin-top: 20px;
  padding: 17px;
  border-radius: 18px;
  background: linear-gradient(145deg, #242420 0%, #30302a 100%);
  color: #f6f3eb;
  box-shadow: 0 12px 24px rgba(35, 34, 30, .12);
}
.type-result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.result-kicker {
  display: block;
  margin-bottom: 5px;
  color: #9f9b90;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .16em;
}
#bodyTypeLabel {
  display: block;
  font-size: 20px;
  letter-spacing: -.04em;
}
.cup-badge {
  min-width: 74px;
  padding: 9px 11px;
  border-radius: 13px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.09);
  text-align: right;
}
.cup-badge span {
  display: block;
  color: #a9a59a;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .14em;
}
.cup-badge strong { font-size: 16px; }
.cup-badge.muted { opacity: .48; }
#bodyTypeReason {
  margin: 11px 0 14px;
  color: #aaa69a;
  font-size: 10.5px;
  line-height: 1.55;
}
.type-bars { display: grid; gap: 8px; }
.type-bar-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  font-size: 9.5px;
  color: #c7c3b8;
}
.type-bar-row > div {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
}
.type-bar-row i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #ebe6d9;
  transition: width .35s ease;
}
.type-bar-row b {
  color: #e9e5da;
  font-size: 9px;
  text-align: right;
}

#accuracyBar { width: 94%; }

@media (max-width: 520px) {
  .type-result-card { padding: 15px; }
  #bodyTypeLabel { font-size: 18px; }
}


/* v8.3 female-only + guide */
.female-only-card {
  margin: -10px 0 24px;
  padding: 16px;
  border: 1px solid #dedbd2;
  border-radius: 16px;
  background: linear-gradient(180deg, #f6f4ee 0%, #f1eee7 100%);
}
.female-only-card > p {
  margin: 10px 2px 0;
  color: #7d786f;
  font-size: 10.8px;
  line-height: 1.62;
}
.guide-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  background: #22221f;
  color: #f7f5ef;
  font-size: 11px;
  font-weight: 760;
}
.guide-link:hover { opacity: .92; }

.guide-page {
  min-height: 100vh;
  padding: 20px;
  background: radial-gradient(circle at 20% 0%, #f8f7f2 0%, #ebe9e3 45%, #e4e1d9 100%);
}
.guide-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px;
  border: 1px solid rgba(38, 37, 31, 0.12);
  background: rgba(250, 249, 245, 0.78);
  backdrop-filter: blur(18px);
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(60, 56, 45, 0.12);
}
.guide-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.guide-header h1 { font-size: 28px; }
.guide-backlink {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid #dedbd2;
  background: #f4f2ec;
  color: #605d55;
  font-size: 11px;
  font-weight: 760;
}
.guide-lead {
  margin: 18px 0 0;
  color: #6f6c63;
  font-size: 13px;
  line-height: 1.7;
}
.guide-alert {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #f5f3ed;
  border: 1px solid #dedbd2;
  color: #706b61;
  font-size: 11px;
  line-height: 1.65;
}
.diagram-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 22px;
}
.diagram-card, .measure-copy-card, .step-card {
  padding: 18px;
  border-radius: 20px;
  background: #f7f5ef;
  border: 1px solid #dfdcd2;
}
.diagram-card h2, .measure-copy-card h2, .step-card h2 {
  margin: 0 0 8px;
  font-size: 16px;
}
.diagram-card p, .measure-copy-card p, .step-card p {
  margin: 0;
  color: #77736a;
  font-size: 11px;
  line-height: 1.6;
}
.diagram-wrap {
  margin-top: 16px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, #f1eee7 0%, #ece8df 100%);
  border: 1px solid #e3dfd6;
}
.diagram-wrap svg { display: block; width: 100%; height: auto; }
.diagram-legend {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  color: #706b61;
  font-size: 10px;
  line-height: 1.5;
}
.diagram-legend span::before {
  content: '• ';
  color: #8a7d6a;
  font-weight: 800;
}
.measure-copy-card { margin-top: 20px; }
.measure-copy-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.measure-item {
  padding: 14px;
  border-radius: 16px;
  background: #f2efe8;
  border: 1px solid #e2ded4;
}
.measure-item strong {
  display: block;
  font-size: 12px;
  color: #302e29;
}
.measure-item em {
  display: block;
  margin-top: 7px;
  color: #8a867c;
  font-style: normal;
  font-size: 10px;
  font-weight: 760;
}
.measure-item p {
  margin: 4px 0 0;
  color: #6f6c63;
  font-size: 10.5px;
  line-height: 1.58;
}
.step-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.step {
  padding: 14px;
  border-radius: 16px;
  background: #f2efe8;
  border: 1px solid #e2ded4;
}
.step b {
  display: inline-flex;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #22221f;
  color: #f7f5ef;
  font-size: 11px;
}
.step h3 { margin: 10px 0 6px; font-size: 12px; }
.step p { margin: 0; font-size: 10.5px; line-height: 1.58; }
@media (max-width: 980px) {
  .diagram-grid, .measure-copy-grid, .step-grid { grid-template-columns: 1fr; }
  .guide-header { flex-direction: column; }
}


/* v8.4 in-page measurement guide */
body.guide-open { overflow: hidden; }
.guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(35, 33, 29, .30);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.guide-overlay.open { opacity: 1; pointer-events: auto; }
.guide-modal {
  width: min(1180px, 100%);
  max-height: calc(100vh - 44px);
  overflow: hidden;
  border-radius: 26px;
  background: #f8f6f1;
  border: 1px solid rgba(55, 51, 45, .14);
  box-shadow: 0 30px 90px rgba(36, 33, 28, .24);
  transform: translateY(14px) scale(.985);
  transition: transform .22s ease;
}
.guide-overlay.open .guide-modal { transform: translateY(0) scale(1); }
.guide-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 26px 20px;
  border-bottom: 1px solid #e0dcd3;
  background: rgba(250, 249, 245, .94);
}
.guide-modal-head h2 { margin: 0; font-size: 24px; letter-spacing: -.045em; }
.guide-modal-head p:not(.eyebrow) { margin: 8px 0 0; color: #777268; font-size: 11px; line-height: 1.6; }
.guide-close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid #ddd8cf;
  border-radius: 13px;
  background: #f1eee7;
  color: #5f5a51;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}
.guide-scroll {
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  padding: 22px 26px 28px;
}
.guide-tipbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #ede9e1;
  color: #6c675e;
  font-size: 10.5px;
}
.guide-tipbar strong { color: #2d2b27; white-space: nowrap; }
.guide-figure-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}
.guide-figure-card {
  overflow: hidden;
  border: 1px solid #e0dcd3;
  border-radius: 20px;
  background: #f2efe8;
}
.guide-figure-copy { padding: 16px 17px 10px; }
.guide-figure-copy span {
  color: #918b80;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .16em;
}
.guide-figure-copy h3 { margin: 5px 0 3px; font-size: 15px; letter-spacing: -.025em; }
.guide-figure-copy p { margin: 0; color: #817c72; font-size: 10px; line-height: 1.5; }
.guide-figure-card img {
  display: block;
  width: 100%;
  max-height: 610px;
  object-fit: contain;
  border-top: 1px solid #e4e0d8;
  background: #f7f5f0;
}
.guide-key-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 10px;
  margin-top: 18px;
}
.guide-key-card {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 12px;
  border-radius: 15px;
  background: #f1eee7;
  border: 1px solid #e0dcd3;
}
.guide-key-card > b, .guide-key-card > span {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #2e2d29;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}
.guide-key-card > span { font-size: 8px; background: #81786f; }
.guide-key-card strong { display: block; font-size: 11px; color: #312f2a; }
.guide-key-card p { margin: 4px 0 0; color: #777268; font-size: 9.7px; line-height: 1.52; }
.weight-card { background: #ebe7df; }
@media (max-width: 900px) {
  .guide-overlay { padding: 0; }
  .guide-modal { width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; }
  .guide-scroll { max-height: calc(100vh - 108px); padding: 16px; }
  .guide-modal-head { padding: 18px 16px; }
  .guide-modal-head h2 { font-size: 20px; }
  .guide-figure-grid { grid-template-columns: 1fr; }
  .guide-key-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
  .guide-key-grid { grid-template-columns: 1fr; }
  .guide-tipbar { align-items: flex-start; flex-direction: column; gap: 4px; }
}


/* v8.5 guide figure update */
.single-guide-figure { grid-template-columns: 1fr; }
.reference-figure-card img { max-height: 980px; background: #ffffff; }
.guide-note-box {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #f2efe8;
  border: 1px solid #e0dcd3;
}
.guide-note-box strong { display: block; font-size: 12px; color: #2f2d28; }
.guide-note-box p { margin: 6px 0 0; color: #726d64; font-size: 10.4px; line-height: 1.62; }
.guide-key-section { margin-top: 18px; }
.guide-subhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.guide-subhead span { color: #948e82; font-size: 8.5px; font-weight: 800; letter-spacing: .16em; }
.guide-subhead h3 { margin: 0; font-size: 15px; letter-spacing: -.025em; }
.basic-guide-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
.numbered-guide-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.accent-card { background: #f5f1e9; }
.accent-card > b { background: #b87432; }
@media (max-width: 900px) { .basic-guide-grid, .numbered-guide-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 540px) { .basic-guide-grid, .numbered-guide-grid { grid-template-columns: 1fr; } }


/* v8.6 iliac-crest breadth semantics */
.plain-guide-card > span {
  min-width: 32px;
  width: auto;
  padding: 0 6px;
  border-radius: 9px;
  background: #777168;
  font-size: 8px;
  letter-spacing: .02em;
}

/* v8.7 — body-type reasoning + page index + bottom reference */
html { scroll-behavior: smooth; }

.quick-index {
  margin: -10px 0 24px;
  padding: 13px 14px 14px;
  border: 1px solid #dedbd2;
  border-radius: 16px;
  background: #f5f3ed;
}
.quick-index-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.quick-index-head strong { font-size: 11.5px; }
.quick-index-head span {
  color: #969185;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .16em;
}
.quick-index-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.quick-index-links a {
  display: inline-flex;
  align-items: center;
  min-height: 31px;
  padding: 7px 10px;
  border-radius: 999px;
  text-decoration: none;
  background: #e9e6de;
  border: 1px solid #dfdbd1;
  color: #625e55;
  font-size: 9.5px;
  font-weight: 760;
  transition: .18s ease;
}
.quick-index-links a:hover {
  background: #22221f;
  color: #f7f5ef;
  border-color: #22221f;
}

.decision-card {
  margin-top: 18px;
  padding: 17px;
  border-radius: 18px;
  background: #f4f2ec;
  border: 1px solid #dfdcd2;
}
.decision-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.decision-heading > div > span {
  display: block;
  margin-bottom: 4px;
  color: #969185;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .16em;
}
.decision-heading > div > strong {
  font-size: 14px;
  letter-spacing: -.025em;
}
.decision-heading > b {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  background: #22221f;
  color: #f7f5ef;
  font-size: 9px;
}
.decision-summary {
  margin: 11px 0 14px;
  color: #6e6a61;
  font-size: 10.5px;
  line-height: 1.62;
}
.decision-summary b { color: #2f2d28; }
.decision-factor-list { display: grid; gap: 9px; }
.decision-factor {
  padding: 12px 12px 11px;
  border-radius: 14px;
  background: #fbfaf7;
  border: 1px solid #e4e0d7;
}
.decision-factor.natural-factor {
  background: #efede7;
  border-color: #ddd9cf;
}
.decision-factor-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.decision-factor-top > div { min-width: 0; }
.decision-factor-top strong {
  display: block;
  color: #302e29;
  font-size: 10.8px;
}
.decision-factor-top span {
  display: block;
  margin-top: 3px;
  color: #8b867b;
  font-size: 8.8px;
  line-height: 1.4;
}
.factor-tag {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  font-style: normal;
  font-size: 8px;
  font-weight: 800;
}
.factor-tag.wave { background: #eee5da; color: #8a6546; }
.factor-tag.straight { background: #e4e8df; color: #5d7256; }
.factor-tag.natural { background: #e4e2ea; color: #625d76; }
.factor-tag.neutral { background: #e9e7e1; color: #777269; }
.factor-tag.muted { background: #eceae5; color: #938e84; }
.decision-factor-values {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin-top: 9px;
  padding: 7px 8px;
  border-radius: 10px;
  background: #f0ede7;
  color: #817c72;
  font-size: 8.4px;
}
.decision-factor-values b { color: #47443e; }
.decision-factor > p {
  margin: 8px 1px 0;
  color: #777269;
  font-size: 9.4px;
  line-height: 1.55;
}
.decision-factor > p b { color: #514d45; }
.decision-method-note {
  margin-top: 11px;
  padding: 12px;
  border-radius: 14px;
  background: #22221f;
  color: #eeeae0;
}
.decision-method-note > strong { font-size: 10.5px; }
.decision-method-note p {
  margin: 6px 0 0;
  color: #aaa69b;
  font-size: 9.2px;
  line-height: 1.6;
}
.decision-method-note p b { color: #e9e5da; }

.body-type-library {
  scroll-margin-top: 18px;
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto 30px;
}
.body-type-library-inner {
  padding: 32px;
  border: 1px solid rgba(38, 37, 31, 0.12);
  border-radius: 28px;
  background: rgba(250, 249, 245, .92);
  box-shadow: 0 22px 60px rgba(60, 56, 45, .09);
}
.library-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
.library-head h2 {
  margin: 0;
  max-width: 820px;
  font-size: 25px;
  letter-spacing: -.045em;
}
.library-head > div > p:not(.eyebrow) {
  max-width: 900px;
  margin: 11px 0 0;
  color: #726e65;
  font-size: 11.5px;
  line-height: 1.7;
}
.back-to-top {
  flex: 0 0 auto;
  padding: 9px 11px;
  border-radius: 11px;
  border: 1px solid #dedbd2;
  background: #f2efe8;
  text-decoration: none;
  color: #666158;
  font-size: 9.5px;
  font-weight: 760;
}
.type-info-card {
  scroll-margin-top: 18px;
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  margin-top: 14px;
  padding: 22px;
  border-radius: 22px;
  border: 1px solid #dfdcd3;
  background: #f7f5ef;
}
.type-info-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.type-info-title > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #262521;
  color: #f8f5ee;
  font-size: 9px;
  font-weight: 800;
}
.type-info-title p {
  margin: 1px 0 3px;
  color: #979185;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .16em;
}
.type-info-title h3 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -.04em;
}
.type-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.type-info-grid > div {
  padding-left: 18px;
  border-left: 1px solid #dedad1;
}
.type-info-grid h4 {
  margin: 0 0 9px;
  font-size: 11px;
}
.type-info-grid ul {
  margin: 0;
  padding-left: 18px;
  color: #706c63;
  font-size: 10.4px;
  line-height: 1.65;
}
.type-info-grid li + li { margin-top: 4px; }
.type-info-grid li b { color: #46433d; }
.wave-info { background: linear-gradient(135deg, #faf7f1 0%, #f4eee6 100%); }
.straight-info { background: linear-gradient(135deg, #f8f8f3 0%, #eef1e9 100%); }
.natural-info { background: linear-gradient(135deg, #f8f7f4 0%, #efedf2 100%); }
.methodology-card {
  margin-top: 14px;
  padding: 22px;
  border-radius: 22px;
  background: #22221f;
  color: #f4f1e9;
}
.methodology-card h3 { margin: 0; font-size: 15px; }
.methodology-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.methodology-grid > div {
  padding: 13px;
  border-radius: 14px;
  background: #302f2a;
}
.methodology-grid b { font-size: 10px; }
.methodology-grid p {
  margin: 6px 0 0;
  color: #aaa69b;
  font-size: 9.4px;
  line-height: 1.6;
}

@media (max-width: 1000px) {
  .body-type-library { width: 100%; margin-bottom: 0; }
  .body-type-library-inner { border-radius: 0; border-left: 0; border-right: 0; padding: 26px 20px; }
  .type-info-card { grid-template-columns: 1fr; gap: 16px; }
  .type-info-grid { gap: 16px; }
  .methodology-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .library-head { flex-direction: column; }
  .library-head h2 { font-size: 21px; }
  .type-info-grid { grid-template-columns: 1fr; }
  .type-info-grid > div { padding: 0; border-left: 0; }
  .type-info-grid > div + div { padding-top: 14px; border-top: 1px solid #dedad1; }
  .methodology-grid { grid-template-columns: 1fr; }
  .quick-index-links a { font-size: 9px; }
}


/* v8.8 layout refinements */
.measurement-guide-button {
  width: 100%;
  margin: -2px 0 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #dedbd2;
  border-radius: 14px;
  background: #f4f2ec;
  color: #4f4c45;
  cursor: pointer;
  text-align: left;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.measurement-guide-button:hover {
  background: #fff;
  border-color: #c9c5b7;
  transform: translateY(-1px);
}
.measurement-guide-button span { min-width: 0; }
.measurement-guide-button b { display: block; font-size: 11.5px; }
.measurement-guide-button small { display: block; margin-top: 3px; color: #8b877d; font-size: 9.5px; font-weight: 600; }
.measurement-guide-button i { flex: 0 0 auto; color: #767168; font-size: 10px; font-style: normal; font-weight: 760; }
.decision-method-note { margin: 0 0 9px; }

/* v10.0 — site/content UI only. 3D body geometry is untouched. */

/* 1. Measurement guide CTA: black background, white text. */
.measurement-guide-button {
  background: #20201d;
  border-color: #20201d;
  color: #fff;
  box-shadow: 0 8px 18px rgba(31, 30, 27, .10);
}
.measurement-guide-button small { color: #bdb8ad; }
.measurement-guide-button i { color: #f1ede4; }
.measurement-guide-button:hover {
  background: #11110f;
  border-color: #11110f;
  color: #fff;
}

/* 2. Decision order takes the old frame-card tone. */
.decision-method-note {
  margin: 0 0 9px;
  padding: 12px;
  border: 1px solid #ddd9cf;
  background: #efede7;
  color: #302e29;
}
.decision-method-note > strong { color: #302e29; }
.decision-method-note p { color: #716d64; }
.decision-method-note p b { color: #3f3c36; }

/* 3. Skeleton frame card now matches the regular white W/S factor cards. */
.decision-factor.natural-factor {
  background: #fbfaf7;
  border-color: #e4e0d7;
}

/* New B/W/H silhouette result card. */
.shape-result-card {
  margin-top: 12px;
  padding: 17px;
  border-radius: 18px;
  background: #fbfaf7;
  border: 1px solid #dfdcd2;
}
.shape-result-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.shape-result-top > div > strong {
  display: block;
  font-size: 19px;
  letter-spacing: -.04em;
}
.shape-method-badge {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  background: #ece8df;
  color: #69645b;
  font-size: 8.5px;
}
#silhouetteShapeReason {
  margin: 11px 0 12px;
  color: #6f6b62;
  font-size: 10.5px;
  line-height: 1.6;
}
.shape-ratio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 7px;
}
.shape-ratio-grid > div {
  min-width: 0;
  padding: 9px;
  border-radius: 12px;
  background: #f0ede7;
}
.shape-ratio-grid span {
  display: block;
  color: #8a857b;
  font-size: 8px;
  line-height: 1.35;
}
.shape-ratio-grid b {
  display: block;
  margin-top: 3px;
  color: #33302b;
  font-size: 13px;
}
.shape-result-note {
  margin: 10px 1px 0;
  color: #918c82;
  font-size: 8.8px;
  line-height: 1.55;
}

/* 4/5. Clean current-estimate card. app.js legacy outputs remain hidden for compatibility. */
.legacy-summary-output { display: none !important; }
.current-estimate-card {
  display: block;
  padding: 15px 18px 16px;
  background: #fff;
  color: #111;
  border: 1px solid rgba(17,17,17,.10);
  box-shadow: 0 10px 28px rgba(28,27,24,.08);
  backdrop-filter: none;
  pointer-events: none;
}
.current-estimate-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.current-estimate-card .summary-label {
  margin: 0;
  color: #111;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .12em;
}
.current-estimate-head > strong {
  color: #686868;
  font-size: 9px;
  font-weight: 600;
}
.current-estimate-line {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  min-width: 0;
}
.current-estimate-line > span {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}
.current-estimate-line small {
  color: #777;
  font-size: 8.5px;
  font-weight: 700;
  white-space: nowrap;
}
.current-estimate-line b {
  min-width: 0;
  color: #111;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.current-estimate-line > i {
  width: 1px;
  height: 14px;
  flex: 0 0 1px;
  background: #ddd;
}
.current-estimate-line .current-cup b { white-space: nowrap; }

/* New explanation, FAQ and privacy sections. */
.silhouette-guide {
  scroll-margin-top: 18px;
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid #dfdcd3;
}
.secondary-library-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
.secondary-library-head h2 {
  margin: 0;
  max-width: 860px;
  font-size: 24px;
  letter-spacing: -.042em;
}
.secondary-library-head > div > p:not(.eyebrow) {
  max-width: 920px;
  margin: 10px 0 0;
  color: #726e65;
  font-size: 11.5px;
  line-height: 1.72;
}
.shape-explain-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 10px;
}
.shape-explain-card {
  position: relative;
  min-width: 0;
  padding: 18px;
  border: 1px solid #e1ddd4;
  border-radius: 18px;
  background: #f7f5ef;
}
.shape-explain-card > span,
.safety-grid article > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #262521;
  color: #f8f5ee;
  font-size: 8px;
  font-weight: 800;
}
.shape-explain-card h3,
.safety-grid h3 {
  margin: 11px 0 7px;
  font-size: 14px;
  letter-spacing: -.025em;
}
.shape-explain-card h3 small {
  display: block;
  margin-top: 2px;
  color: #9a958a;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.shape-explain-card p,
.safety-grid p {
  margin: 0;
  color: #736f66;
  font-size: 10px;
  line-height: 1.65;
}
.shape-explain-card.boundary { background: #f1efe9; }
.shape-rule-card {
  display: grid;
  grid-template-columns: minmax(0,1.5fr) minmax(250px,.7fr);
  gap: 18px;
  margin-top: 12px;
  padding: 19px;
  border-radius: 19px;
  background: #22221f;
  color: #f4f1e9;
}
.shape-rule-card h3 { margin: 0 0 7px; font-size: 13px; }
.shape-rule-card p { margin: 0; color: #aaa69b; font-size: 9.8px; line-height: 1.65; }
.shape-rule-formulas { display: grid; gap: 7px; align-content: center; }
.shape-rule-formulas span { padding: 9px 10px; border-radius: 10px; background: #302f2a; color: #c7c2b8; font-size: 9px; }
.shape-rule-formulas b { color: #fff; }
.reference-note {
  margin: 11px 2px 0;
  color: #8a857b;
  font-size: 8.8px;
  line-height: 1.6;
}
.reference-note a { color: #5c574f; text-underline-offset: 2px; }

.info-library {
  scroll-margin-top: 18px;
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto 30px;
}
.info-library-inner {
  padding: 32px;
  border: 1px solid rgba(38,37,31,.12);
  border-radius: 28px;
  background: rgba(250,249,245,.92);
  box-shadow: 0 22px 60px rgba(60,56,45,.08);
}
.faq-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.faq-grid details {
  padding: 15px 16px;
  border-radius: 16px;
  border: 1px solid #e0dcd3;
  background: #f7f5ef;
}
.faq-grid summary {
  cursor: pointer;
  color: #34312c;
  font-size: 11px;
  font-weight: 760;
  line-height: 1.45;
}
.faq-grid details p {
  margin: 9px 0 0;
  color: #746f66;
  font-size: 9.8px;
  line-height: 1.65;
}
.safety-library { margin-bottom: 34px; }
.safety-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px;
}
.safety-grid article {
  padding: 17px;
  border-radius: 18px;
  border: 1px solid #e0dcd3;
  background: #f7f5ef;
}
.policy-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.policy-links a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 11px;
  background: #22221f;
  color: #f7f5ef;
  text-decoration: none;
  font-size: 9.5px;
  font-weight: 760;
}
.legal-note {
  margin: 12px 2px 0;
  color: #8b867b;
  font-size: 8.8px;
  line-height: 1.65;
}

/* Tablet: stack the 3D viewer and controls earlier so 1024px-class devices are not cramped. */
@media (max-width: 1180px) {
  body { background: #eeece6; }
  .app-shell {
    width: 100%;
    margin: 0;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    grid-template-columns: 1fr;
  }
  .control-panel {
    order: 2;
    max-height: none;
    border: 0;
    border-top: 1px solid rgba(38,37,31,.1);
    padding: 28px clamp(20px, 4vw, 44px) 34px;
  }
  .viewer-panel { order: 1; min-height: 650px; }
  .body-type-library, .info-library { width: 100%; margin-bottom: 0; }
  .body-type-library-inner, .info-library-inner {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    padding: 28px clamp(20px, 4vw, 44px);
  }
  .shape-explain-grid { grid-template-columns: 1fr 1fr; }
  .safety-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .viewer-panel { min-height: min(640px, 78vh); }
  .viewer-toolbar { left: 14px; right: 14px; top: 14px; }
  .view-tab { min-height: 42px; padding-inline: 13px; }
  .icon-button { width: 42px; height: 42px; }
  .viewer-hint {
    bottom: 138px;
    max-width: calc(100% - 32px);
    white-space: normal;
    text-align: center;
    line-height: 1.4;
  }
  .summary-card { left: 14px; right: 14px; bottom: 14px; }
  .current-estimate-head { align-items: flex-start; flex-direction: column; gap: 2px; }
  .current-estimate-line { gap: 10px; }
  .secondary-library-head { flex-direction: column; gap: 12px; }
  .secondary-library-head h2 { font-size: 21px; }
  .shape-rule-card { grid-template-columns: 1fr; }
  .faq-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .control-panel { padding: 24px 16px 30px; }
  .brand-row { align-items: flex-start; }
  .status-pill { padding: 7px 9px; font-size: 9px; }
  h1 { font-size: 28px; }
  .intro { margin: 20px 0 24px; }
  .quick-index { margin-top: -6px; }
  .quick-index-links { display: grid; grid-template-columns: 1fr 1fr; }
  .quick-index-links a { justify-content: center; text-align: center; }
  .measurement-grid { grid-template-columns: 1fr; }
  .field { min-height: 66px; }
  .field input { font-size: 20px; }
  .shape-ratio-grid { grid-template-columns: 1fr 1fr 1fr; }
  .viewer-panel { min-height: 570px; }
  .viewer-hint { display: none; }
  .current-estimate-grid { grid-template-columns: 1fr; gap: 6px; }
  .current-estimate-grid > div {
    display: grid;
    grid-template-columns: 72px 1fr;
    align-items: center;
    gap: 8px;
  }
  .current-estimate-grid b { margin-top: 0; }
  .shape-explain-grid, .safety-grid { grid-template-columns: 1fr; }
  .body-type-library-inner, .info-library-inner { padding: 24px 16px; }
  .type-info-card { padding: 18px; }
  .guide-modal-head { padding-top: max(18px, env(safe-area-inset-top)); }
  .policy-links { display: grid; }
  .policy-links a { justify-content: center; }
}

/* Standalone privacy / usage pages */
.policy-page {
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(circle at 80% 0%, #f8f7f2 0%, #ebe9e3 45%, #e4e1d9 100%);
}
.policy-shell {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid rgba(38,37,31,.12);
  border-radius: 26px;
  background: rgba(250,249,245,.94);
  box-shadow: 0 24px 70px rgba(60,56,45,.10);
}
.policy-shell h1 { margin-top: 8px; font-size: clamp(28px, 5vw, 40px); }
.policy-lead { margin: 18px 0 26px; color: #6f6b62; font-size: 13px; line-height: 1.75; }
.policy-shell section { padding: 18px 0; border-top: 1px solid #e1ddd4; }
.policy-shell section h2 { font-size: 15px; }
.policy-shell section p { margin: 8px 0 0; color: #716d64; font-size: 11px; line-height: 1.75; }
.policy-back { display: inline-flex; margin-bottom: 18px; color: #57534b; font-size: 10px; font-weight: 760; text-decoration: none; }
.policy-callout { margin-top: 18px; padding: 15px 16px; border-radius: 15px; background: #22221f; color: #c2bdb2; font-size: 10px; line-height: 1.7; }
@media (max-width: 600px) {
  .policy-page { padding: 0; }
  .policy-shell { min-height: 100vh; border: 0; border-radius: 0; padding: 28px 18px; }
}


/* v10.2 bilingual navigation */
.language-switch {
  display:inline-flex; align-items:center; justify-content:center; min-width:42px; min-height:30px; padding:6px 10px;
  margin-left:auto; border:1px solid rgba(38,37,31,.18); border-radius:999px; background:#fff; color:#25231f;
  font-size:9px; font-weight:800; letter-spacing:.06em; text-decoration:none; white-space:nowrap;
}
.brand-row .language-switch + .status-pill { margin-left:8px; }
.policy-language-switch { float:right; margin-top:-46px; }
@media (max-width:520px){ .language-switch{min-height:34px;} .brand-row .language-switch{margin-left:6px;} .policy-language-switch{float:none;margin:0 0 16px auto;width:max-content;} }

/* English version: cup-size results are intentionally hidden. */
.en-no-cup .english-hidden-cup,
.en-no-cup .english-hidden-cup-separator { display: none !important; }
.en-no-cup .current-estimate-line { justify-content: center; }
.en-no-cup .type-result-top { align-items: flex-start; }
