/* [30 พ.ย. 2569] /bmi แบบใหม่ (.bm) — เจ้าของ "ทำ /bmi แบบสวยๆ" แบบร่าง artifact ADBKafAbi8wGzmciPvP2fc
   ต่อจาก pages-v2.css (tokens --g --g-d --g-l --g-b --ink --ink2 --line --bg2) และ tools.css (กล่องอีเมล/ร้าน/คำถาม/ที่มา)
   view app/Views/pages/tools/bmi.php · JS tools.js initBmi · ใช้เฉพาะหน้านี้ ไม่กระทบ /protein-calculator /exercise-calories
   มือถือ: หัว → ช่องกรอก 2 ช่องคู่กัน → หน้าปัด → อีเมล · เดสก์ท็อป: ช่องกรอกซ้าย (+อีเมลใต้) หน้าปัดขวา */
.bm .bm-w { max-width: 1080px; }
.bm-nw { display: inline-block; }
.bm-hero { padding: 18px 0 92px; background: #133a20; color: #fff; }
.bm-hero .art-crumb { margin-bottom: 6px; color: #a9c2a3; }
.bm-hero .art-crumb a { color: #e3f0dc; }
.bm-hero h1 { margin: 0; font-size: clamp(27px, 5.4vw, 44px); font-weight: 800; line-height: 1.22; letter-spacing: -.01em; color: #fff; text-wrap: balance; }
.bm-hero p { margin: 8px 0 0; max-width: 38em; font-size: 16px; line-height: 1.6; color: #cfe1c8; text-wrap: pretty; }

.bm-tool { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "i" "r" "l"; margin-top: -76px; border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: 0 18px 40px -26px rgba(19, 58, 32, .5); overflow: hidden; }
.bm-inp { grid-area: i; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 12px; padding: 18px 16px; background: var(--g-l); }
.bm-res { grid-area: r; padding: 20px 18px 18px; }
.bm-lead { grid-area: l; padding: 0 16px 18px; }
.bm-lead .tl-lead { margin: 0; }
.bm-f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bm-fh { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.bm-fh label { font-size: 15.5px; font-weight: 700; color: var(--ink); }
.bm-fh small { font-size: 13px; color: var(--ink2); white-space: nowrap; }
.bm-fr { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-items: center; }
.bm-step { display: none; height: 52px; border: 1.5px solid var(--g-b); border-radius: 14px; background: #fff; color: #133a20; font-family: inherit; font-size: 26px; font-weight: 700; line-height: 1; cursor: pointer; }
.bm-step:hover { border-color: var(--g); }
.bm-num { display: flex; align-items: center; gap: 6px; height: 54px; padding: 0 14px; border: 1.5px solid var(--g-b); border-radius: 14px; background: #fff; cursor: text; }
.bm-num:focus-within { border-color: var(--g); box-shadow: 0 0 0 3px rgba(0, 167, 85, .14); }
.bm-num input { flex: 1; width: 100%; min-width: 0; height: 50px; padding: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 24px; font-weight: 800; color: #133a20; text-align: center; font-variant-numeric: tabular-nums; }
.bm-num input::placeholder { font-size: 16px; font-weight: 500; color: #9aa592; }
.bm-num em { flex: none; font-style: normal; font-size: 15px; font-weight: 600; color: var(--ink2); }
.bm-f.is-err .bm-num { border-color: var(--red); background: #fffafa; }
.bm-step:focus-visible { outline: 3px solid rgba(0, 167, 85, .35); outline-offset: 2px; }
.bm .bm-num input:focus, .bm .bm-num input:focus-visible { outline: 0; box-shadow: none; }
.bm input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 2px 0 0; background: none; cursor: pointer; }
.bm input[type="range"]::-webkit-slider-runnable-track { height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--g) var(--p, 50%), var(--g-b) var(--p, 50%)); }
.bm input[type="range"]::-moz-range-track { height: 8px; border-radius: 999px; background: var(--g-b); }
.bm input[type="range"]::-moz-range-progress { height: 8px; border-radius: 999px; background: var(--g); }
.bm input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -9px; border: 4px solid #133a20; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.bm input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border: 4px solid #133a20; border-radius: 50%; background: #fff; }
.bm-err { grid-column: 1 / -1; margin: 0 !important; }
.bm-priv { grid-column: 1 / -1; display: flex; align-items: flex-start; gap: 6px; margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink2); }
.bm-priv .pv-ic { flex: none; margin-top: 2px; color: var(--g-d); }

.bm-dial { position: relative; max-width: 380px; margin: 0 auto; }
.bm-dial svg { display: block; width: 100%; height: auto; overflow: visible; }
.bm-dial text { font: 600 13px "Noto Sans Thai", sans-serif; fill: var(--ink2); }
.bm-knob { opacity: 0; transform-box: view-box; transform-origin: 170px 176px; transition: transform .7s cubic-bezier(.2, .8, .2, 1), opacity .2s; }
.bm.bm-has .bm-knob { opacity: 1; }
.bm-dn { position: absolute; left: 0; right: 0; bottom: 2px; text-align: center; }
.bm-dn span { font-size: 14px; font-weight: 600; color: var(--ink2); }
.bm-dn b { display: block; font-size: clamp(54px, 12vw, 72px); font-weight: 800; line-height: 1; letter-spacing: -.03em; color: #133a20; font-variant-numeric: tabular-nums; }
.bm-chip-r { margin: 10px 0 0; text-align: center; }
.bm-chip { display: inline-block; padding: 4px 16px; border-radius: 999px; background: #8a9585; color: #fff; font-size: 16px; font-weight: 700; }
.bm-out { display: none; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.bm.bm-has .bm-out { display: block; }
.bm-ih { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: 15px; }
.bm-ih b { font-size: 18px; color: #133a20; white-space: nowrap; }
.bm-rul { position: relative; display: block; height: 60px; margin-top: 10px; }
.bm-tr, .bm-ok { position: absolute; top: 24px; height: 12px; border-radius: 999px; }
.bm-tr { left: 0; right: 0; background: #e9ede4; }
.bm-ok { background: var(--g); }
.bm-me { position: absolute; top: 10px; width: 4px; height: 40px; margin-left: -2px; border-radius: 2px; background: #133a20; transition: left .6s ease; }
.bm-me em { position: absolute; bottom: 42px; left: 50%; transform: translateX(-50%); padding: 0 7px; border-radius: 6px; background: #133a20; color: #fff; font-style: normal; font-size: 13px; font-weight: 700; white-space: nowrap; }
.bm-lb { position: absolute; top: 42px; transform: translateX(-50%); font-size: 13px; color: var(--ink2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bm-gap { margin: 2px 0 0; font-size: 16.5px; font-weight: 700; color: #133a20; }
.bm-msg { margin: 10px 0 0; font-size: 15px; line-height: 1.65; color: var(--ink); }
.bm-basis { margin: 8px 0 0; font-size: 13px; color: var(--ink2); }
.bm-acts { display: grid; gap: 10px; margin-top: 16px; }
.bm-acts .pv-btn { font-size: 16px; }
.bm-alt { justify-self: center; font-weight: 700; color: var(--g-d); }

.bm-sec { margin-top: 44px; scroll-margin-top: 80px; }
.bm-sec h2, .bm-h3 { margin: 0 0 8px; font-size: clamp(22px, 3vw, 27px); font-weight: 800; line-height: 1.3; color: #133a20; text-wrap: balance; }
.bm-sec p { margin: 0 0 12px; font-size: 16.5px; line-height: 1.75; color: var(--ink); max-width: 46em; }
.bm-sec p a, .bm-waist a { color: var(--g-d); font-weight: 600; }
.bm-two { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); }
.bm-card { padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.bm-card h3 { margin: 0 0 4px; font-size: 17px; font-weight: 800; color: #133a20; }
.bm-card p { margin: 0; font-size: 15px; line-height: 1.65; color: var(--ink2); }
.bm-h3 { font-size: 20px; }
.bm .bm-formula { margin: 10px 0 0; padding: 14px 16px; border-radius: 14px; background: #133a20; color: #fff; font-size: 18px; font-weight: 700; text-align: center; max-width: none; }
.bm-calc { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; font-size: 15.5px; }
.bm-calc li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.bm-calc li > span { font-weight: 800; color: var(--g); }
.bm-calc b { font-variant-numeric: tabular-nums; }
.bm .bm-cap { margin: 8px 0 12px; font-size: 13.5px; line-height: 1.6; color: var(--ink2); }
.bm-scale { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.bm-scale li { display: grid; grid-template-columns: 10px 7.2em minmax(0, 1fr); gap: 4px 12px; align-items: center; padding: 11px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.bm-scale i { grid-row: 1 / span 2; width: 10px; height: 36px; border-radius: 5px; }
.bm-scale b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bm-scale span { font-weight: 600; }
.bm-scale small { grid-column: 2 / -1; font-size: 13.5px; color: var(--ink2); }
.bm-scale li.is-on { border-color: #133a20; box-shadow: 0 0 0 2px #133a20; }
.bm-scale li.is-on small::before { content: "คุณอยู่ตรงนี้ · "; font-weight: 700; color: #133a20; }
.bm-ex { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; }
.bm .bm-ex p { margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.bm-ex span { display: block; font-size: 14px; color: var(--ink2); }
.bm-ex b { font-size: 17px; color: #133a20; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bm-tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.bm-tw table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.bm-tw th { padding: 10px 12px; background: var(--g-l); color: var(--g-d); font-size: 14px; text-align: left; white-space: nowrap; }
.bm-tw td { padding: 10px 12px; border-top: 1px solid var(--line); white-space: nowrap; }
.bm-tw td.bm-n { font-weight: 700; color: var(--g-d); }
.bm-tw tr.is-on td { background: #fff4d6; font-weight: 700; }
.bm-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(15em, 1fr)); margin: 14px 0; }
.bm .bm-waist { padding: 14px 16px; border-radius: 14px; background: var(--g-l); font-size: 15.5px; max-width: none; }
.bm-next { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(15em, 1fr)); margin: 14px 0 0; padding: 0; list-style: none; }
.bm-next a { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; height: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: #fff; color: var(--ink) !important; text-decoration: none; }
.bm-next a:hover { border-color: var(--g); }
.bm-next b { font-size: 16.5px; color: #133a20; }
.bm-next span { grid-column: 1; font-size: 14px; color: var(--ink2); }
.bm-next .pv-ic { grid-column: 2; grid-row: 1 / span 2; color: var(--g-d); }
.bm-sec .tl-shop { margin-top: 18px; }
.bm-end { max-width: none; margin-top: 8px; }

@media (min-width: 860px) {
  .bm-hero { padding: 26px 0 100px; }
  .bm-tool { grid-template-columns: minmax(0, .95fr) minmax(0, 1.15fr); grid-template-areas: "i r" "l r"; }
  .bm-inp { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 28px 26px 14px; align-content: start; }
  .bm-lead { padding: 4px 26px 28px; background: var(--g-l); }
  .bm-res { padding: 26px 30px 24px; }
  .bm-fr { grid-template-columns: 52px minmax(0, 1fr) 52px; }
  .bm-step { display: block; }
  .bm-acts { grid-template-columns: auto auto; justify-content: start; align-items: center; gap: 18px; }
  .bm-two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 36px; }
  .bm-end { max-width: 860px; margin-left: 0; }
}
@media (max-width: 380px) {
  .bm-fh small { display: none; }
  .bm-ex { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .bm-knob, .bm-me { transition: none; }
}
