/* ====== ตัวช่วยเลือกกระบอก (ใช้ทั้งหน้าแรกและวิดเจ็ตฝังในเว็บหลัก) ====== */
.cfg { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(24px, 3vw, 48px); align-items: start; }
.cfg__stage {
  position: sticky; top: calc(var(--header-h) + 20px);
  background-color: var(--paper);
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 100% 28px, 28px 100%;
  background-position: 0 -1px, -1px 0;
  border: 1px solid var(--line); border-radius: 3px; padding: 26px 28px 30px;
}
.cfg__stage::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(250, 247, 241, 0.9), rgba(250, 247, 241, 0.6)); pointer-events: none; border-radius: 3px; }
.cfg__stage > * { position: relative; }
.cfg__stage-head { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; letter-spacing: 0.08em; margin-bottom: 26px; flex-wrap: wrap; }

.fitchart { display: grid; gap: 9px; margin-bottom: 34px; position: relative; --usable: 0%; }
.fit-row { display: grid; grid-template-columns: 34px 1fr 74px; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 11.5px; }
.fit-row__track { position: relative; height: 14px; }
.fit-row__long, .fit-row__short { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 1px; transition: background-color 0.5s, opacity 0.5s; }
.fit-row__long { background: rgba(25, 24, 21, 0.07); border: 1px dashed rgba(25, 24, 21, 0.25); }
.fit-row__short { background: rgba(25, 24, 21, 0.18); }
.fit-row.is-long .fit-row__long { background: rgba(77, 107, 60, 0.22); border-color: rgba(77, 107, 60, 0.5); }
.fit-row.is-long .fit-row__short, .fit-row.is-short .fit-row__short { background: rgba(77, 107, 60, 0.55); }
.fit-row__state { text-align: right; color: var(--ink-mute); font-size: 11px; white-space: nowrap; }
.fit-row.is-long .fit-row__state, .fit-row.is-short .fit-row__state { color: var(--ok); }
.fit-row.is-no { opacity: 0.55; }
.fitchart__usable { position: absolute; top: -10px; bottom: -14px; left: calc(46px + (100% - 46px - 86px) * var(--u)); width: 0; border-left: 1px solid var(--shu); transition: left 0.8s var(--ease); --u: 0; }
.fitchart__usable span { position: absolute; top: -8px; left: 6px; font-family: var(--font-mono); font-size: 10px; color: var(--shu); white-space: nowrap; }

.cfg__tube { display: flex; align-items: center; height: 70px; margin-left: 46px; margin-right: 86px; position: relative; }
.cfg__tube-body {
  height: var(--d, 22px); width: var(--w, 30%);
  background:
    repeating-linear-gradient(115deg, transparent 0 34px, rgba(110, 80, 45, 0.35) 34px 35px, transparent 35px 70px),
    linear-gradient(180deg, #a98256 0%, #d9be97 28%, #c7a479 55%, #9c7548 100%);
  transition: width 0.8s var(--ease), height 0.8s var(--ease);
  display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 10px 24px -12px rgba(60, 40, 15, 0.5);
}
.cfg__tube-body span { font-size: 10px; letter-spacing: 0.1em; color: rgba(40, 28, 12, 0.65); white-space: nowrap; }
.cfg__tube .cap { width: 9px; height: calc(var(--d, 22px) + 4px); background: linear-gradient(180deg, #3b3933, #121110 60%, #2a2825); border-radius: 2px; transition: height 0.8s var(--ease), background 0.5s, opacity 0.5s, width 0.5s; }
.cfg__tube[data-cap='white'] .cap { background: linear-gradient(180deg, #ffffff, #e9e5dd 60%, #d3cdc2); box-shadow: inset 0 0 0 1px #cfc8bb; }
.cfg__tube[data-cap='none'] .cap { width: 0; opacity: 0; }
.ruler { position: relative; height: 34px; margin: 8px 86px 0 46px; border-top: 1px solid var(--line-strong); }
.ruler::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 7px; background-image: repeating-linear-gradient(90deg, var(--line-strong) 0 1px, transparent 1px calc(100% / 34)); }
.ruler i { position: absolute; top: 0; height: 12px; width: 1px; background: var(--ink-soft); }
.ruler span { position: absolute; top: 15px; transform: translateX(-50%); font-family: var(--font-mono); font-size: 10px; color: var(--ink-mute); }
.cfg__xsec { display: flex; align-items: center; gap: 28px; margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--line); }
.cfg__xsec svg { width: 120px; height: 120px; flex: none; }
.cfg__xsec circle { transition: r 0.8s var(--ease); }
.cfg__xsec dl { display: grid; grid-template-columns: auto auto; gap: 6px 20px; margin: 0; font-size: 12px; }
.cfg__xsec dt { color: var(--ink-mute); letter-spacing: 0.08em; }
.cfg__xsec dd { margin: 0; }

.cfg__panel { display: grid; gap: 30px; }
.cfg__group { display: grid; gap: 14px; }
.cfg__label { font-size: 15px; font-weight: 500; display: flex; align-items: baseline; gap: 12px; }
.cfg__label .mono { font-size: 11px; color: var(--shu); letter-spacing: 0.1em; }
.cfg__label .muted { font-weight: 400; font-size: 13px; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg button {
  position: relative; display: grid; justify-items: start; gap: 2px; padding: 14px 16px; text-align: left;
  border: 1px solid var(--line); border-radius: 3px; background: var(--paper);
  transition: border-color 0.3s, background-color 0.3s, color 0.3s;
}
.seg button b { font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 1.1; }
.seg button small { font-size: 12px; color: var(--ink-mute); }
.seg button:hover { border-color: var(--line-strong); }
.seg button.is-active { background: var(--sumi); color: var(--washi); border-color: var(--sumi); }
.seg button.is-active small { color: rgba(242, 237, 227, 0.6); }
.seg button.is-active::after { content: ''; position: absolute; top: 12px; right: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--shu); }
.seg--tabs { grid-template-columns: repeat(3, auto); gap: 6px; padding: 5px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; }
.seg--tabs button { border: 0; border-radius: 999px; padding: 8px 22px; justify-items: center; background: transparent; font-size: 14px; }
.seg--tabs button.is-active::after { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  min-width: 56px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper);
  font-family: var(--font-mono); font-size: 13px; transition: border-color 0.3s, background-color 0.3s, color 0.3s;
}
.chips button:hover { border-color: var(--line-strong); }
.chips button.is-active { background: var(--sumi); color: var(--washi); border-color: var(--sumi); }
.chips button .fit { display: block; font-size: 9px; letter-spacing: 0.04em; color: var(--ink-mute); margin-top: -3px; }
.chips button.is-active .fit { color: rgba(242, 237, 227, 0.6); }
.chips button.has-fit { height: 46px; line-height: 1.25; }

.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.swatches button { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 3px; background: var(--paper); font-size: 14px; text-align: left; transition: border-color 0.3s, box-shadow 0.3s; }
.swatches button small { display: block; font-size: 11.5px; color: var(--ink-mute); }
.swatches button i { width: 26px; height: 26px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.swatches button.is-active { border-color: var(--sumi); box-shadow: inset 0 0 0 1px var(--sumi); }
.swatches button:disabled { opacity: 0.4; cursor: not-allowed; }
@media (max-width: 480px) { .swatches { grid-template-columns: 1fr; } }

.qty-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.qty--lg { height: 48px; border-radius: 24px; background: var(--paper); }
.qty--lg button { width: 46px; height: 46px; font-size: 18px; }
.qty--lg input { width: 84px; height: 46px; font-size: 16px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick button { height: 32px; padding: 0 12px; border-radius: 16px; font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow 0.3s, color 0.3s; }
.quick button:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }

.price-box { background: var(--paper); border: 1px solid var(--line); border-radius: 3px; padding: 26px 26px 22px; }
.price-box__top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; }
.price-box__unit { font-family: var(--font-display); font-weight: 300; font-size: clamp(48px, 5vw, 64px); line-height: 1; display: flex; align-items: baseline; gap: 8px; margin-top: 6px; }
.price-box__unit .num { font-family: var(--font-display); letter-spacing: -0.02em; }
.price-box__unit small { font-size: 14px; color: var(--ink-mute); font-family: var(--font-body); }
.price-box__total { font-size: 22px; margin-top: 4px; }
.ladder { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; align-items: end; height: 92px; margin: 26px 0 0; padding-bottom: 20px; position: relative; }
.ladder button { position: relative; height: 100%; display: flex; align-items: flex-end; }
.ladder button i { display: block; width: 100%; height: var(--h); background: var(--washi-2); border-radius: 1px; transition: height 0.8s var(--ease), background-color 0.4s; }
.ladder button:hover i { background: var(--kraft-light); }
.ladder button.is-active i { background: var(--shu); }
.ladder button.is-past i { background: rgba(25, 24, 21, 0.18); }
.ladder button span { position: absolute; left: 50%; bottom: -20px; transform: translateX(-50%); font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-mute); white-space: nowrap; }
.ladder button em { position: absolute; left: 50%; bottom: calc(var(--h) + 4px); transform: translateX(-50%); font-style: normal; font-family: var(--font-mono); font-size: 10px; opacity: 0; transition: opacity 0.3s, bottom 0.8s var(--ease); white-space: nowrap; }
.ladder button:hover em, .ladder button.is-active em { opacity: 1; }
.price-box__hint { min-height: 22px; margin-top: 16px; font-size: 14px; color: var(--shu); }
.price-box__actions { margin-top: 14px; }
@media (max-width: 1000px) {
  .cfg { grid-template-columns: 1fr; }
  .cfg__stage { position: relative; top: 0; padding: 20px 16px 24px; }
  .fit-row { grid-template-columns: 28px 1fr 64px; gap: 8px; }
  .cfg__tube { margin-left: 36px; margin-right: 72px; }
  .ruler { margin-left: 36px; margin-right: 72px; }
  .fitchart__usable { left: calc(36px + (100% - 36px - 72px) * var(--u)); }
}

/* โหมดฝังในเว็บอื่น (iframe) */
.cfg--embed .cfg__stage { position: relative; top: 0; }
