/* =========================================================
   SMART FARM IOT LAB 3D
   MOBILE-FIRST FOUNDATION
   Base styles target 320–767px. Larger layouts are enhancements.
   ========================================================= */

body.iot-lab-page{
  background:#03100f;
  color:#f4f1e9;
}

.iot-lab-page .site-header{
  position:fixed;
  background:rgba(2,14,13,.90);
  border-bottom-color:rgba(186,162,116,.18);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
}

.iot-lab-main{
  min-height:100vh;
  overflow:hidden;
  background:
    radial-gradient(circle at 50% 0%,rgba(57,113,74,.18),transparent 28rem),
    radial-gradient(circle at 100% 45%,rgba(186,162,116,.07),transparent 26rem),
    linear-gradient(180deg,#041311 0%,#020b0b 48%,#020808 100%);
}

/* Header เดิมสูงประมาณ 78px บนมือถือ
   ลดช่องว่างด้านบนเพื่อให้ 3D ขึ้นมาเร็วขึ้น */
.lab-page{
  padding:88px 0 48px;
}

.lab-container{
  width:calc(100% - 24px);
  max-width:1180px;
}

/* =========================================================
   01: COMPACT INTRO
   Mobile เป้าหมายคือให้ผู้ใช้เห็น 3D Viewer ภายในจอแรก
   ========================================================= */
.lab-intro{
  position:relative;
  padding:11px 13px 10px;
  overflow:hidden;
  border:1px solid rgba(143,179,106,.22);
  border-radius:14px;
  background:
    radial-gradient(circle at 100% 0%,rgba(87,145,94,.13),transparent 46%),
    linear-gradient(145deg,rgba(13,53,39,.68),rgba(5,22,20,.84));
}

.lab-intro::after{
  content:"";
  position:absolute;
  width:100px;
  height:100px;
  right:-50px;
  bottom:-58px;
  border:1px solid rgba(143,179,106,.10);
  border-radius:50%;
  pointer-events:none;
}

.lab-intro__copy{
  position:relative;
  z-index:1;
}

.lab-intro__meta{
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:6px;
}

.lab-kicker{
  display:inline-flex;
  align-items:center;
  min-height:22px;
  padding:0 8px;
  border:1px solid rgba(143,179,106,.36);
  border-radius:999px;
  color:#add47a;
  font-size:7px;
  font-weight:500;
  letter-spacing:.75px;
  white-space:nowrap;
}

/* ซ่อนบน Mobile เพื่อคืนพื้นที่ให้ 3D */
.lab-overline{
  display:none;
  margin:0;
  color:#788e86;
  font-size:8px;
  letter-spacing:1.2px;
}

.lab-intro h1{
  margin:0;
  color:#ead9ad;
  font-size:23px;
  font-weight:400;
  line-height:1.18;
  letter-spacing:-.25px;
}

.lab-intro h1 em{
  color:#97bd6d;
  font-style:normal;
}

.lab-lead{
  max-width:680px;
  margin:4px 0 0;
  color:#a8b5b0;
  font-size:10px;
  line-height:1.45;
}

.lab-tech-tags{
  position:relative;
  z-index:1;
  display:flex;
  flex-wrap:wrap;
  gap:4px;
  margin-top:7px;
}

.lab-tech-tags span{
  padding:3px 6px;
  border:1px solid rgba(255,255,255,.065);
  border-radius:999px;
  background:rgba(255,255,255,.018);
  color:#728780;
  font-size:6px;
  letter-spacing:.25px;
}

/* =========================================================
   SHARED SECTION HEADING
   ========================================================= */
.viewer-card,
.sensor-section,
.device-panel,
.experiment-section,
.logic-section,
.result-section,
.lab-actions-section{
  margin-top:9px;
  border:1px solid rgba(155,182,169,.16);
  border-radius:16px;
  background:linear-gradient(180deg,rgba(10,29,27,.92),rgba(5,18,18,.94));
}

.viewer-card{
  overflow:hidden;
  box-shadow:0 18px 50px rgba(0,0,0,.24);
}

.viewer-card__topbar,
.section-heading{
  min-height:60px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
}

.viewer-card__topbar>div,
.section-heading>div{
  min-width:0;
  display:flex;
  align-items:center;
  gap:9px;
}

.section-number{
  width:29px;
  height:29px;
  flex:0 0 29px;
  display:grid;
  place-items:center;
  border:1px solid rgba(186,162,116,.36);
  border-radius:50%;
  color:#d7b765;
  font-size:8px;
}

.section-eyebrow{
  margin:0 0 1px;
  color:#667c75;
  font-size:6px;
  letter-spacing:1.25px;
}

.viewer-card__topbar h2,
.section-heading h2{
  margin:0;
  color:#e9e7df;
  font-size:13px;
  font-weight:400;
  line-height:1.3;
}

.viewer-live,
.live-badge{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:5px;
  color:#82c466;
  font-size:7px;
  letter-spacing:.5px;
}

.viewer-live i,
.live-badge i{
  width:6px;
  height:6px;
  border-radius:50%;
  background:#7ac45a;
  box-shadow:0 0 10px rgba(122,196,90,.62);
}

/* =========================================================
   BROWSER CHROME
   ========================================================= */
.viewer-browser{
  height:34px;
  display:grid;
  grid-template-columns:auto minmax(0,1fr) 28px;
  align-items:center;
  gap:7px;
  padding:0 8px;
  border-top:1px solid rgba(255,255,255,.045);
  border-bottom:1px solid rgba(255,255,255,.055);
  background:#0a1617;
}

.viewer-browser__buttons{
  display:flex;
  gap:4px;
}

.viewer-browser__buttons span{
  width:5px;
  height:5px;
  border-radius:50%;
  background:#53645f;
}

.viewer-browser__address{
  min-width:0;
  height:22px;
  display:flex;
  align-items:center;
  padding:0 8px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.08);
  border-radius:999px;
  background:rgba(255,255,255,.025);
  color:#6f817c;
  font-size:7px;
  white-space:nowrap;
  text-overflow:ellipsis;
}

.viewer-browser__address b{
  margin-right:5px;
  color:#738983;
  font-size:5px;
}

.viewer-reset{
  width:28px;
  height:28px;
  border:0;
  border-radius:50%;
  background:transparent;
  color:#81928e;
  cursor:pointer;
}

/* =========================================================
   3D STAGE
   ========================================================= */
.viewer-stage{
  position:relative;
  width:100%;
  height:clamp(390px,118vw,540px);
  min-height:390px;
  overflow:hidden;
  background:radial-gradient(circle at 50% 28%,#2a4943,#071615 63%,#020a0a);
  touch-action:none;
  isolation:isolate;
}

#farmCanvas{
  display:block;
  width:100%;
  height:100%;
  touch-action:none;
  cursor:grab;
}

#farmCanvas:active{cursor:grabbing}

.viewer-loading{
  position:absolute;
  inset:0;
  z-index:20;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  background:radial-gradient(circle,#12312d,#061211 68%);
  transition:opacity .35s ease,visibility .35s ease;
}

.viewer-loading.is-hidden{
  opacity:0;
  visibility:hidden;
  pointer-events:none;
}

.viewer-loading strong{
  margin-top:12px;
  color:#e8e6df;
  font-size:12px;
  font-weight:400;
}

.viewer-loading small{
  color:#6c817b;
  font-size:8px;
}

.loader-ring{
  width:30px;
  height:30px;
  border:2px solid rgba(255,255,255,.10);
  border-top-color:#baa274;
  border-radius:50%;
  animation:labspin .8s linear infinite;
}

@keyframes labspin{to{transform:rotate(360deg)}}

.metric-chip{
  position:absolute;
  z-index:8;
  min-width:82px;
  padding:6px 7px;
  border:1px solid rgba(211,197,155,.34);
  border-radius:9px;
  background:rgba(5,20,20,.80);
  box-shadow:0 8px 22px rgba(0,0,0,.24);
  backdrop-filter:blur(9px);
  -webkit-backdrop-filter:blur(9px);
  pointer-events:none;
}

.metric-chip span{
  display:block;
  color:#aab7b3;
  font-size:6px;
  line-height:1.3;
  white-space:nowrap;
}

.metric-chip strong{
  display:block;
  margin-top:2px;
  color:#f3f1e9;
  font-size:16px;
  font-weight:500;
  line-height:1.1;
}

.metric-pump strong{color:#86ca60}
.metric-temp{top:3%;left:3%}
.metric-air{top:3%;right:3%}
.metric-soil{top:42%;left:2%}
.metric-water{top:44%;right:2%}
.metric-pump{right:3%;bottom:10%}

.viewer-status{
  position:absolute;
  z-index:8;
  left:50%;
  bottom:7px;
  max-width:86%;
  transform:translateX(-50%);
  padding:4px 8px;
  overflow:hidden;
  border-radius:999px;
  background:rgba(2,12,12,.66);
  color:#7f918b;
  font-size:6px;
  text-align:center;
  white-space:nowrap;
  text-overflow:ellipsis;
  pointer-events:none;
}

/* =========================================================
   GESTURES
   ========================================================= */
.viewer-gestures{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  border-top:1px solid rgba(255,255,255,.06);
  background:#081515;
}

.gesture-item{
  min-width:0;
  min-height:52px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:7px 4px;
  border-right:1px solid rgba(255,255,255,.055);
}

.gesture-item:last-child{border-right:0}

.gesture-icon{
  color:#e5e8e5;
  font-size:18px;
  font-weight:300;
}

.gesture-item>span:last-child{
  min-width:0;
  display:flex;
  flex-direction:column;
}

.gesture-item strong{
  color:#d6dcda;
  font-size:8px;
  font-weight:400;
  line-height:1.25;
}

.gesture-item small{
  color:#61736e;
  font-size:6px;
  line-height:1.25;
}

/* =========================================================
   SENSOR CARDS
   ========================================================= */
.sensor-section,
.device-panel,
.experiment-section,
.logic-section,
.result-section,
.lab-actions-section{
  padding:3px 0 13px;
}

.sensor-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
  padding:0 11px;
}

.sensor-card{
  width:100%;
  min-width:0;
  appearance:none;
  -webkit-appearance:none;
  font:inherit;
  color:inherit;
  text-align:left;
  cursor:pointer;
  touch-action:manipulation;
  transition:
    border-color .2s ease,
    background .2s ease,
    transform .15s ease,
    box-shadow .2s ease;
  min-width:0;
  min-height:103px;
  padding:10px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.065);
  border-radius:11px;
  background:rgba(255,255,255,.018);
}

.sensor-card__head{
  display:flex;
  align-items:center;
  gap:6px;
}

.sensor-card__head span{font-size:14px}
.sensor-card__head small{
  min-width:0;
  overflow:hidden;
  color:#7e918a;
  font-size:7px;
  white-space:nowrap;
  text-overflow:ellipsis;
}

.sensor-card>strong{
  display:block;
  margin-top:7px;
  color:#f0eee8;
  font-size:19px;
  font-weight:400;
  line-height:1.2;
}

.sensor-card svg{
  display:block;
  width:100%;
  height:25px;
  margin-top:6px;
}

.sensor-card svg polyline{
  fill:none;
  stroke:#7ab45a;
  stroke-width:2;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.sensor-card:nth-child(2) svg polyline,
.sensor-card:nth-child(4) svg polyline{stroke:#4b9ccc}
.sensor-card:nth-child(3) svg polyline{stroke:#c4833e}
.sensor-card--pump>strong{color:#86c966}
.sensor-card p{
  margin:6px 0 0;
  color:#647772;
  font-size:7px;
}
.sensor-card--status>strong{font-size:16px;color:#afc89f}

.sensor-card__action{
  display:block;
  margin-top:5px;
  color:#667c75;
  font-size:6px;
  line-height:1.3;
}

.sensor-card:active{
  transform:scale(.985);
}

.sensor-card.is-active{
  border-color:rgba(186,162,116,.72);
  background:linear-gradient(145deg,rgba(186,162,116,.10),rgba(143,179,106,.055));
  box-shadow:inset 0 0 0 1px rgba(186,162,116,.10);
}

.sensor-card.is-active .sensor-card__action{
  color:#d7b765;
}

.sensor-card:focus-visible,
.viewer-reset:focus-visible,
.lab-action:focus-visible{
  outline:2px solid #baa274;
  outline-offset:2px;
}

/* =========================================================
   DEVICE DETAIL
   ========================================================= */
.device-summary{
  display:grid;
  grid-template-columns:58px minmax(0,1fr) auto;
  align-items:center;
  gap:9px;
  margin:0 11px;
  padding:10px;
  border:1px solid rgba(255,255,255,.06);
  border-radius:11px;
  background:rgba(255,255,255,.017);
}

.device-visual{
  width:58px;
  height:58px;
  display:grid;
  place-items:center;
  border:1px solid rgba(80,142,150,.20);
  border-radius:10px;
  background:radial-gradient(circle,rgba(42,103,107,.24),rgba(255,255,255,.015));
  color:#75aeb4;
  font-size:9px;
  font-weight:500;
  letter-spacing:1px;
}

.device-identity{
  min-width:0;
  display:flex;
  flex-direction:column;
}

.device-identity span{
  color:#687b75;
  font-size:7px;
}

.device-identity strong{
  margin-top:2px;
  overflow:hidden;
  color:#e6e4dd;
  font-size:10px;
  font-weight:400;
  white-space:nowrap;
  text-overflow:ellipsis;
}

.device-identity small{
  margin-top:2px;
  color:#647772;
  font-size:8px;
}

.device-state{
  align-self:start;
  padding:3px 7px;
  border-radius:999px;
  background:rgba(122,196,90,.08);
  color:#84ca64;
  font-size:8px;
}

.device-details{
  display:grid;
  grid-template-columns:1fr;
  margin:9px 11px 0;
}

.device-details>div{
  min-width:0;
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:7px 2px;
  border-top:1px solid rgba(255,255,255,.055);
  font-size:9px;
}

.device-details dt{color:#63756f}
.device-details dd{
  min-width:0;
  margin:0;
  overflow:hidden;
  color:#b4bfbb;
  text-align:right;
  white-space:nowrap;
  text-overflow:ellipsis;
}

.device-hint{
  margin:8px 13px 0;
  color:#50635c;
  font-size:7px;
  line-height:1.55;
}

.device-data-mode{
  margin:7px 13px 0;
  padding:7px 8px;
  border:1px solid rgba(186,162,116,.12);
  border-radius:8px;
  background:rgba(186,162,116,.035);
  color:#796f57;
  font-size:6px;
  line-height:1.55;
}

.device-panel.is-updated .device-summary{
  animation:devicePulse .42s ease;
}

@keyframes devicePulse{
  0%{border-color:rgba(186,162,116,.55);background:rgba(186,162,116,.07)}
  100%{border-color:rgba(255,255,255,.06);background:rgba(255,255,255,.017)}
}



/* =========================================================
   EXPERIMENT
   ========================================================= */
.experiment-mode-badge,
.logic-state{
  flex:0 0 auto;
  padding:4px 8px;
  border:1px solid rgba(122,196,90,.28);
  border-radius:999px;
  background:rgba(122,196,90,.07);
  color:#91ce72;
  font-size:7px;
  letter-spacing:.6px;
}

.experiment-body{
  display:grid;
  gap:10px;
  padding:0 11px;
}

.experiment-mission{
  padding:10px;
  border:1px solid rgba(186,162,116,.16);
  border-radius:11px;
  background:linear-gradient(145deg,rgba(186,162,116,.055),rgba(143,179,106,.025));
}

.experiment-mission>span{
  display:block;
  color:#8b7b52;
  font-size:7px;
  letter-spacing:.6px;
}

.experiment-mission strong{
  display:block;
  margin-top:3px;
  color:#ded5bb;
  font-size:10px;
  font-weight:400;
}

.experiment-mission p{
  margin:4px 0 0;
  color:#667a73;
  font-size:7px;
  line-height:1.55;
}

.experiment-control{
  padding:10px;
  border:1px solid rgba(255,255,255,.06);
  border-radius:11px;
  background:rgba(255,255,255,.016);
}

.control-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.control-head label{
  color:#91a19c;
  font-size:9px;
}

.control-head output{
  color:#e5d6aa;
  font-size:16px;
  font-weight:500;
}

.lab-range{
  width:100%;
  height:30px;
  margin:5px 0 0;
  accent-color:#7eb35a;
  cursor:pointer;
  touch-action:manipulation;
}

.lab-range--threshold{
  accent-color:#baa274;
}

.range-scale{
  display:flex;
  justify-content:space-between;
  gap:8px;
  color:#52655f;
  font-size:6px;
}

.mode-selector{
  margin:0;
  padding:0;
  border:0;
}

.mode-selector legend{
  margin-bottom:6px;
  color:#71847e;
  font-size:8px;
}

.mode-selector__grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:7px;
}

.mode-option{
  position:relative;
  display:block;
  cursor:pointer;
}

.mode-option input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}

.mode-option span{
  min-height:52px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  padding:8px 9px;
  border:1px solid rgba(255,255,255,.065);
  border-radius:10px;
  background:rgba(255,255,255,.018);
  transition:border-color .2s ease,background .2s ease;
}

.mode-option strong{
  color:#dce2df;
  font-size:9px;
  font-weight:500;
}

.mode-option small{
  margin-top:2px;
  color:#60736d;
  font-size:6px;
}

.mode-option input:checked + span{
  border-color:rgba(143,179,106,.58);
  background:rgba(143,179,106,.075);
}

.mode-option input:focus-visible + span{
  outline:2px solid #baa274;
  outline-offset:2px;
}

.manual-control{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:9px 10px;
  border:1px solid rgba(255,255,255,.06);
  border-radius:10px;
  background:rgba(255,255,255,.015);
}

.manual-control>div:first-child{
  min-width:0;
  display:flex;
  flex-direction:column;
}

.manual-control span{
  color:#899b95;
  font-size:8px;
}

.manual-control small{
  margin-top:2px;
  color:#52645e;
  font-size:6px;
}

.manual-buttons{
  flex:0 0 auto;
  display:flex;
  gap:5px;
}

.manual-buttons button,
.experiment-start,
.experiment-reset{
  min-height:32px;
  border:1px solid rgba(255,255,255,.09);
  border-radius:8px;
  background:#0a1818;
  color:#879792;
  font-size:8px;
  cursor:pointer;
  touch-action:manipulation;
}

.manual-buttons button{
  min-width:44px;
}

.manual-buttons button.is-active{
  border-color:rgba(122,196,90,.54);
  background:rgba(122,196,90,.10);
  color:#91cf72;
}

.manual-buttons button:disabled{
  opacity:.34;
  cursor:not-allowed;
}

.experiment-actions{
  display:grid;
  grid-template-columns:minmax(0,1.35fr) minmax(0,.65fr);
  gap:7px;
}

.experiment-start,
.experiment-reset{
  width:100%;
}

.experiment-start{
  border-color:rgba(122,196,90,.35);
  background:linear-gradient(90deg,rgba(33,78,42,.88),rgba(25,62,34,.88));
  color:#a7d58d;
}

.experiment-start.is-running{
  border-color:rgba(186,162,116,.32);
  background:rgba(186,162,116,.07);
  color:#c7b57f;
}

.experiment-reset{
  color:#857a5e;
}

/* =========================================================
   AUTOMATION LOGIC
   ========================================================= */
.logic-state.is-false{
  border-color:rgba(197,125,80,.30);
  background:rgba(197,125,80,.07);
  color:#cf966f;
}

.logic-flow{
  display:grid;
  justify-items:center;
  gap:5px;
  padding:0 11px;
}

.logic-node{
  width:100%;
  padding:10px;
  border:1px solid rgba(143,179,106,.15);
  border-radius:11px;
  background:rgba(143,179,106,.025);
  text-align:center;
}

.logic-node small{
  display:block;
  color:#75906f;
  font-size:7px;
  letter-spacing:1px;
}

.logic-node strong{
  display:block;
  margin-top:2px;
  color:#dfe3df;
  font-size:10px;
  font-weight:400;
}

.logic-node strong span{
  color:#d1ad58;
}

.logic-node p{
  margin:5px 0 0;
  color:#73857f;
  font-size:7px;
  line-height:1.5;
}

.logic-node p b{
  color:#d4c599;
  font-weight:500;
}

.logic-node--result{
  border-color:rgba(186,162,116,.18);
  background:rgba(186,162,116,.03);
}

.logic-node--result strong b{
  color:#8dce6c;
}

.logic-arrow{
  color:#6d7d78;
  font-size:15px;
}

.logic-code{
  margin:8px 11px 0;
  padding:8px 9px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.055);
  border-radius:9px;
  background:#071313;
  color:#667973;
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;
  font-size:6px;
  white-space:nowrap;
  text-overflow:ellipsis;
}

.logic-code span{
  color:#b89b54;
}

/* =========================================================
   RESULT
   ========================================================= */
.result-status{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:5px;
  color:#84ca64;
  font-size:7px;
}

.result-status i{
  width:6px;
  height:6px;
  border-radius:50%;
  background:#7ac45a;
  box-shadow:0 0 9px rgba(122,196,90,.55);
}

.result-section.is-idle .result-status{
  color:#8b9995;
}

.result-section.is-idle .result-status i{
  background:#71817d;
  box-shadow:none;
}

.result-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:7px;
  padding:0 11px;
}

.result-item{
  min-width:0;
  padding:9px;
  border:1px solid rgba(255,255,255,.06);
  border-radius:10px;
  background:rgba(255,255,255,.016);
}

.result-item span{
  display:block;
  color:#61746e;
  font-size:6px;
}

.result-item strong{
  display:block;
  margin-top:3px;
  color:#e3e5e1;
  font-size:13px;
  font-weight:400;
}

.result-progress{
  margin:9px 11px 0;
  padding:9px;
  border:1px solid rgba(255,255,255,.055);
  border-radius:10px;
  background:rgba(255,255,255,.012);
}

.result-progress__head{
  display:flex;
  justify-content:space-between;
  gap:10px;
  color:#6c7e78;
  font-size:7px;
}

.result-progress__head b{
  color:#c7b682;
  font-weight:400;
}

.result-progress__track{
  position:relative;
  height:10px;
  margin-top:7px;
  border-radius:999px;
  background:#0c1c1b;
}

.result-progress__track span{
  display:block;
  height:100%;
  border-radius:inherit;
  background:linear-gradient(90deg,#4e843c,#79b458);
  transition:width .4s ease;
}

.result-progress__track i{
  position:absolute;
  top:-4px;
  width:2px;
  height:18px;
  background:#c3a454;
  transform:translateX(-1px);
  transition:left .25s ease;
}

.result-message{
  margin:8px 11px 0;
  padding:9px 10px;
  border-left:2px solid #739d56;
  background:rgba(115,157,86,.045);
  color:#7f938b;
  font-size:7px;
  line-height:1.55;
}

.experiment-log{
  max-height:100px;
  margin:8px 11px 0;
  overflow:auto;
  border-top:1px solid rgba(255,255,255,.05);
}

.experiment-log>div{
  display:grid;
  grid-template-columns:58px minmax(0,1fr);
  gap:7px;
  padding:7px 1px;
  border-bottom:1px solid rgba(255,255,255,.035);
  color:#62736e;
  font-size:6px;
}

.experiment-log time{
  color:#8d805e;
}

/* Pump-active visual state on the page */
.viewer-card.is-pump-running{
  border-color:rgba(83,149,80,.35);
}

.viewer-card.is-pump-running .metric-pump{
  border-color:rgba(122,196,90,.52);
  box-shadow:0 0 18px rgba(122,196,90,.10);
}


/* =========================================================
   ACTIONS
   ========================================================= */
.section-heading--simple{padding-bottom:8px}

.lab-actions{
  display:grid;
  gap:7px;
  padding:0 11px;
}

.lab-action{
  width:100%;
  min-height:57px;
  appearance:none;
  -webkit-appearance:none;
  font:inherit;
  text-decoration:none;
  touch-action:manipulation;
  transition:
    transform .15s ease,
    filter .2s ease,
    border-color .2s ease;
  display:grid;
  grid-template-columns:36px minmax(0,1fr) auto;
  align-items:center;
  gap:8px;
  padding:8px 11px;
  border:1px solid #334748;
  border-radius:11px;
  background:#091719;
  color:#c9d0cd;
  text-align:left;
  cursor:pointer;
}

.lab-action__icon{
  width:32px;
  height:32px;
  display:grid;
  place-items:center;
  border:1px solid rgba(255,255,255,.10);
  border-radius:8px;
  color:#d9dedb;
  font-size:16px;
}

.lab-action>span:nth-child(2){display:flex;flex-direction:column}
.lab-action strong{font-size:10px;font-weight:400}
.lab-action small{margin-top:1px;color:#657772;font-size:6px}
.lab-action>b{color:#8b9996;font-size:20px;font-weight:300}

.lab-action--primary{
  border-color:#ba8427;
  background:linear-gradient(90deg,#69450f,#946618);
  color:#f4dfa9;
}

.lab-action--sensor{
  border-color:#4f8438;
  background:linear-gradient(90deg,#12321b,#1b4725);
  color:#b9dba1;
}

.lab-action:active{
  transform:scale(.985);
}

.viewer-reset{
  transition:background .18s ease,color .18s ease,transform .15s ease;
}

.viewer-reset:active{
  transform:rotate(-25deg) scale(.92);
}

.viewer-card{
  scroll-margin-top:96px;
  transition:border-color .25s ease,box-shadow .25s ease;
}

.viewer-card.is-focused{
  border-color:rgba(186,162,116,.72);
  box-shadow:
    0 18px 50px rgba(0,0,0,.24),
    0 0 0 2px rgba(186,162,116,.10);
}

.device-panel,
.sensor-section{
  scroll-margin-top:96px;
}

.lab-browser-note{
  margin:14px auto 0;
  padding:0 11px;
  color:#50615c;
  font-size:7px;
  line-height:1.6;
  text-align:center;
}

/* =========================================================
   EXTRA SMALL MOBILE
   ========================================================= */
@media (max-width:360px){
  .lab-page{padding-top:86px}
  .lab-container{width:calc(100% - 20px)}
  .lab-intro{padding:10px 11px 9px}
  .lab-intro h1{font-size:21px}
  .lab-lead{font-size:9px}
  .lab-tech-tags span{font-size:5.5px}
  .viewer-stage{height:395px;min-height:395px}
  .metric-chip{min-width:76px;padding:6px}
  .metric-chip strong{font-size:14px}
}

/* =========================================================
   TABLET ENHANCEMENT
   ========================================================= */
@media (min-width:640px){
  .lab-page{padding-top:102px}
  .lab-container{width:calc(100% - 40px)}

  .lab-intro{
    padding:18px 20px 17px;
    border-radius:16px;
  }

  .lab-intro__meta{margin-bottom:8px}
  .lab-kicker{min-height:25px;padding:0 9px;font-size:8px}
  .lab-overline{display:block}
  .lab-intro h1{font-size:31px}
  .lab-lead{margin-top:7px;font-size:12px;line-height:1.6}
  .lab-tech-tags{gap:6px;margin-top:11px}
  .lab-tech-tags span{padding:4px 8px;font-size:7px}

  .viewer-card,
  .sensor-section,
  .device-panel,
  .experiment-section,
  .logic-section,
  .result-section,
  .lab-actions-section{margin-top:16px}

  .viewer-card__topbar,
  .section-heading{
    min-height:66px;
    padding-left:18px;
    padding-right:18px;
  }

  .viewer-card__topbar h2,
  .section-heading h2{font-size:16px}

  .viewer-browser{height:42px;padding:0 13px}
  .viewer-stage{height:min(68vw,570px);min-height:480px}

  .metric-chip{min-width:106px;padding:9px 10px}
  .metric-chip span{font-size:8px}
  .metric-chip strong{font-size:20px}

  .sensor-grid{
    grid-template-columns:repeat(3,minmax(0,1fr));
    padding:0 16px;
  }

  .sensor-card{min-height:115px}

  .device-details{
    grid-template-columns:repeat(2,minmax(0,1fr));
    column-gap:20px;
    margin-left:16px;
    margin-right:16px;
  }

  .device-summary{margin-left:16px;margin-right:16px}

  .lab-actions{
    grid-template-columns:repeat(3,minmax(0,1fr));
    padding:0 16px;
  }

  .lab-action{
    grid-template-columns:34px minmax(0,1fr) auto;
    padding:9px;
  }

  .experiment-body{
    grid-template-columns:repeat(2,minmax(0,1fr));
    padding:0 16px;
  }

  .experiment-mission,
  .mode-selector,
  .manual-control,
  .experiment-actions{
    grid-column:1 / -1;
  }

  .logic-flow{
    grid-template-columns:1fr auto 1fr;
    align-items:center;
    padding:0 16px;
  }

  .logic-arrow{
    transform:rotate(-90deg);
  }

  .logic-code,
  .result-progress,
  .result-message,
  .experiment-log{
    margin-left:16px;
    margin-right:16px;
  }

  .result-grid{
    grid-template-columns:repeat(4,minmax(0,1fr));
    padding:0 16px;
  }

}

/* =========================================================
   DESKTOP ENHANCEMENT
   DOM order remains mobile-first; layout is only expanded.
   ========================================================= */
@media (min-width:1024px){
  .lab-page{padding:116px 0 68px}

  .lab-container{
    display:grid;
    grid-template-columns:minmax(0,1.65fr) minmax(310px,.75fr);
    grid-template-areas:
      "intro intro"
      "viewer sensors"
      "viewer device"
      "experiment experiment"
      "logic result"
      "actions actions"
      "note note";
    gap:18px;
    align-items:start;
  }

  .lab-intro{
    grid-area:intro;
    margin:0;
    padding:20px 24px;
  }

  .lab-intro__copy{max-width:740px}
  .lab-intro h1{font-size:34px}
  .lab-lead{font-size:13px}

  .viewer-card{
    grid-area:viewer;
    margin:0;
    position:sticky;
    top:106px;
  }

  .sensor-section{grid-area:sensors;margin:0}
  .device-panel{grid-area:device;margin:0}
  .experiment-section{grid-area:experiment;margin:0}
  .logic-section{grid-area:logic;margin:0}
  .result-section{grid-area:result;margin:0}
  .lab-actions-section{grid-area:actions;margin:0}
  .lab-browser-note{grid-area:note;margin:0}

  .viewer-stage{height:570px;min-height:570px}

  .sensor-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
    padding:0 12px;
  }

  .sensor-card{min-height:105px}

  .device-details{
    grid-template-columns:1fr;
    margin-left:12px;
    margin-right:12px;
  }

  .lab-actions{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
}

@media (min-width:1280px){
  .lab-container{grid-template-columns:minmax(0,1.75fr) 350px}
  .viewer-stage{height:610px;min-height:610px}
  .sensor-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .sensor-card{min-height:112px}
}

/* =========================================================
   MOTION ACCESSIBILITY
   ========================================================= */
@media (hover:hover) and (pointer:fine){
  .sensor-card:hover{
    border-color:rgba(143,179,106,.32);
    background:rgba(143,179,106,.035);
  }

  .lab-action:hover{
    filter:brightness(1.08);
  }

  .viewer-reset:hover{
    background:rgba(255,255,255,.05);
    color:#d8dfdc;
  }
}

@media (prefers-reduced-motion:reduce){
  .loader-ring,
  .device-panel.is-updated .device-summary{
    animation:none;
  }

  .sensor-card,
  .lab-action,
  .viewer-reset,
  .viewer-card,
  .result-progress__track span,
  .result-progress__track i{
    transition:none;
  }

  *{scroll-behavior:auto!important}
}


/* =========================================================
   V5 THAI-FIRST EXPERIMENT / LOGIC / RESULT
   ========================================================= */

.experiment-note{
  display:grid;
  gap:3px;
  padding:9px 10px;
  border:1px solid rgba(186,162,116,.14);
  border-radius:10px;
  background:rgba(186,162,116,.035);
}

.experiment-note strong{
  color:#b9a56f;
  font-size:8px;
  font-weight:500;
}

.experiment-note span{
  color:#716b5b;
  font-size:7px;
  line-height:1.55;
}

.lab-range--stop{
  accent-color:#79a95c;
}

.lab-range--water{
  accent-color:#4b9ccc;
}

.lab-range--safe{
  accent-color:#c07c4d;
}

.rain-selector{
  margin:0;
  padding:0;
  border:0;
}

.rain-selector legend{
  margin-bottom:6px;
  color:#71847e;
  font-size:8px;
}

.rain-selector__grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:7px;
}

.rain-option{
  position:relative;
  display:block;
  cursor:pointer;
}

.rain-option input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}

.rain-option span{
  min-height:52px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  padding:8px 9px;
  border:1px solid rgba(255,255,255,.065);
  border-radius:10px;
  background:rgba(255,255,255,.018);
  transition:border-color .2s ease,background .2s ease;
}

.rain-option strong{
  color:#dce2df;
  font-size:9px;
  font-weight:500;
}

.rain-option small{
  margin-top:2px;
  color:#60736d;
  font-size:6px;
}

.rain-option input:checked + span{
  border-color:rgba(75,156,204,.50);
  background:rgba(75,156,204,.07);
}

.rain-option input:focus-visible + span{
  outline:2px solid #baa274;
  outline-offset:2px;
}

.logic-checks{
  display:grid;
  gap:7px;
  padding:0 11px;
}

.logic-check{
  min-width:0;
  display:grid;
  grid-template-columns:28px minmax(0,1fr) auto;
  align-items:center;
  gap:8px;
  padding:9px;
  border:1px solid rgba(255,255,255,.06);
  border-radius:10px;
  background:rgba(255,255,255,.015);
}

.logic-check__icon{
  width:28px;
  height:28px;
  display:grid;
  place-items:center;
  border:1px solid rgba(255,255,255,.08);
  border-radius:50%;
  color:#7e918a;
  font-size:8px;
}

.logic-check>div{
  min-width:0;
}

.logic-check small{
  display:block;
  color:#5e706a;
  font-size:6px;
}

.logic-check strong{
  display:block;
  margin-top:2px;
  color:#d5dcd9;
  font-size:9px;
  font-weight:400;
  line-height:1.35;
}

.logic-check p{
  margin:3px 0 0;
  color:#778982;
  font-size:7px;
  line-height:1.45;
}

.logic-check--result{
  border-color:rgba(186,162,116,.18);
  background:rgba(186,162,116,.028);
}

.check-badge{
  flex:0 0 auto;
  padding:3px 6px;
  border:1px solid rgba(255,255,255,.08);
  border-radius:999px;
  color:#8b9995;
  font-size:6px;
  font-weight:400;
  white-space:nowrap;
}

.check-badge.is-pass{
  border-color:rgba(122,196,90,.28);
  background:rgba(122,196,90,.06);
  color:#8fca72;
}

.check-badge.is-block{
  border-color:rgba(204,101,74,.28);
  background:rgba(204,101,74,.06);
  color:#d48b75;
}

.check-badge.is-info{
  border-color:rgba(75,156,204,.28);
  background:rgba(75,156,204,.06);
  color:#78afd0;
}

.check-badge.is-ready{
  border-color:rgba(186,162,116,.32);
  background:rgba(186,162,116,.06);
  color:#c7ae6c;
}

.logic-state{
  max-width:42%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.result-reason{
  margin:8px 11px 0;
  padding:9px 10px;
  border-left:2px solid #739d56;
  background:rgba(115,157,86,.045);
}

.result-reason strong{
  display:block;
  color:#a8b4af;
  font-size:7px;
  font-weight:500;
}

.result-reason p{
  margin:3px 0 0;
  color:#7f938b;
  font-size:7px;
  line-height:1.55;
}

.threshold-marker{
  position:absolute;
  top:-4px;
  width:2px;
  height:18px;
  transform:translateX(-1px);
  transition:left .25s ease;
}

.threshold-marker--start{
  background:#c3a454;
}

.threshold-marker--stop{
  background:#75a95b;
}

.progress-legend{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:7px;
  color:#596b65;
  font-size:6px;
}

.progress-legend span{
  display:flex;
  align-items:center;
  gap:4px;
}

.progress-legend i{
  width:7px;
  height:2px;
  display:inline-block;
}

.legend-start{background:#c3a454}
.legend-stop{background:#75a95b}

.experiment-start:disabled{
  opacity:.48;
  cursor:not-allowed;
}

.result-item strong{
  overflow-wrap:anywhere;
}

@media (min-width:640px){
  .experiment-note,
  .rain-selector{
    grid-column:1 / -1;
  }

  .logic-checks{
    padding:0 16px;
  }

  .result-reason{
    margin-left:16px;
    margin-right:16px;
  }
}


/* ให้ marker เกณฑ์เริ่ม/หยุดมีสีแยกกันชัดเจน */
.result-progress__track .threshold-marker--start{
  background:#c3a454;
}

.result-progress__track .threshold-marker--stop{
  background:#75a95b;
}


/* =========================================================
   V6 READABILITY PASS
   แก้ปัญหาตัวอักษรเล็กเกินไปทั้ง Mobile / Tablet / Desktop
   ไม่เปลี่ยน Logic ของ IoT Lab
   ========================================================= */

/* ---------- BASE / MOBILE ---------- */

.lab-kicker{font-size:11px}
.lab-overline{font-size:10px}
.lab-intro h1{font-size:30px}
.lab-lead{font-size:14px;line-height:1.65}
.lab-tech-tags span{font-size:10px;padding:5px 8px}

.section-number{font-size:10px}
.section-eyebrow{font-size:10px;color:#82958f}
.viewer-card__topbar h2,
.section-heading h2{font-size:16px}
.viewer-live,
.live-badge{font-size:10px}

.viewer-browser__address{font-size:10px}
.viewer-browser__address b{font-size:9px}
.viewer-loading strong{font-size:14px}
.viewer-loading small{font-size:11px}

.metric-chip{
  min-width:94px;
  padding:8px 9px;
}
.metric-chip span{font-size:10px;color:#b4c0bc}
.metric-chip strong{font-size:19px}
.viewer-status{
  padding:5px 10px;
  font-size:10px;
  color:#a0b0aa;
}

.gesture-item{
  min-height:60px;
  gap:8px;
}
.gesture-item strong{font-size:11px}
.gesture-item small{font-size:10px;color:#82938d}

.sensor-card{
  min-height:122px;
  padding:12px;
}
.sensor-card__head small{font-size:10px;color:#9aacA5}
.sensor-card>strong{font-size:21px}
.sensor-card p{font-size:10px;line-height:1.5;color:#82948d}
.sensor-card__action{font-size:10px;line-height:1.4;color:#82968e}
.sensor-card--status>strong{font-size:18px}

.device-visual{font-size:12px}
.device-identity span{font-size:10px;color:#879a93}
.device-identity strong{font-size:13px}
.device-identity small{font-size:10px;color:#82938c}
.device-status{font-size:10px}
.device-details>div{font-size:11px}
.device-hint{font-size:10px;color:#788c84}
.device-note{font-size:10px;line-height:1.6}
.device-panel .live-badge{font-size:10px}

.experiment-state{font-size:10px}
.experiment-mission>span{font-size:10px}
.experiment-mission strong{font-size:13px}
.experiment-mission p{font-size:11px;color:#82958d}
.control-head label{font-size:12px}
.control-head output{font-size:18px}
.range-scale{font-size:10px}
.mode-selector legend{font-size:11px}
.mode-option strong{font-size:12px}
.mode-option small{font-size:10px}
.manual-control span{font-size:11px}
.manual-control small{font-size:10px}
.manual-buttons button,
.experiment-start,
.experiment-reset{font-size:12px;min-height:38px}

.logic-node small{font-size:10px}
.logic-node strong{font-size:13px}
.logic-node p{font-size:11px;color:#85978f}
.logic-code{
  padding:10px 11px;
  font-size:10px;
  line-height:1.55;
}

.result-status{font-size:10px}
.result-item span{font-size:10px;color:#80938c}
.result-item strong{font-size:15px}
.result-progress__head{font-size:10px}
.result-message{font-size:11px;color:#91a39b}
.experiment-log>div{
  grid-template-columns:72px minmax(0,1fr);
  font-size:10px;
  line-height:1.45;
}

.lab-action strong{font-size:12px}
.lab-action small{font-size:10px;color:#82938d}
.lab-browser-note{font-size:10px;color:#6f817b}

/* V5 logic / rain / reason */
.experiment-note strong{font-size:11px}
.experiment-note span{font-size:10px;color:#91866d}
.rain-selector legend{font-size:11px}
.rain-option strong{font-size:12px}
.rain-option small{font-size:10px}

.logic-check{
  grid-template-columns:32px minmax(0,1fr) auto;
  gap:10px;
  padding:11px;
}
.logic-check__icon{
  width:32px;
  height:32px;
  font-size:11px;
}
.logic-check small{font-size:10px;color:#7c8f88}
.logic-check strong{font-size:12px}
.logic-check p{font-size:10px;color:#879991}
.check-badge{font-size:10px;padding:4px 7px}
.result-reason strong{font-size:11px}
.result-reason p{font-size:10px;color:#91a29b}
.progress-legend{font-size:10px}

/* ---------- EXTRA SMALL MOBILE ---------- */
@media (max-width:360px){
  .lab-intro h1{font-size:27px}
  .lab-lead{font-size:13px}
  .lab-tech-tags span{font-size:9px}
  .metric-chip span{font-size:9px}
  .metric-chip strong{font-size:17px}
  .viewer-status{font-size:9px}
}

/* ---------- TABLET ---------- */
@media (min-width:640px){
  .lab-kicker{font-size:11px}
  .lab-overline{font-size:11px}
  .lab-intro h1{font-size:36px}
  .lab-lead{font-size:15px}
  .lab-tech-tags span{font-size:11px}

  .section-eyebrow{font-size:10px}
  .viewer-card__topbar h2,
  .section-heading h2{font-size:18px}

  .metric-chip{
    min-width:118px;
    padding:10px 11px;
  }
  .metric-chip span{font-size:11px}
  .metric-chip strong{font-size:22px}
  .viewer-status{font-size:11px}

  .gesture-item strong{font-size:12px}
  .gesture-item small{font-size:10px}

  .sensor-card{
    min-height:132px;
    padding:13px;
  }
  .sensor-card__head small{font-size:11px}
  .sensor-card>strong{font-size:22px}
  .sensor-card p{font-size:11px}
  .sensor-card__action{font-size:10px}

  .device-identity span{font-size:11px}
  .device-identity strong{font-size:14px}
  .device-identity small{font-size:11px}
  .device-status{font-size:11px}
  .device-details>div{font-size:12px}
  .device-hint,
  .device-note{font-size:11px}

  .experiment-mission>span{font-size:11px}
  .experiment-mission strong{font-size:14px}
  .experiment-mission p{font-size:12px}
  .control-head label{font-size:13px}
  .control-head output{font-size:20px}
  .range-scale{font-size:11px}
  .mode-selector legend,
  .rain-selector legend{font-size:12px}
  .mode-option strong,
  .rain-option strong{font-size:13px}
  .mode-option small,
  .rain-option small{font-size:11px}
  .manual-control span{font-size:12px}
  .manual-control small{font-size:11px}
  .manual-buttons button,
  .experiment-start,
  .experiment-reset{font-size:13px;min-height:42px}

  .logic-node small{font-size:11px}
  .logic-node strong{font-size:14px}
  .logic-node p{font-size:12px}
  .logic-code{font-size:11px}

  .logic-check small{font-size:11px}
  .logic-check strong{font-size:13px}
  .logic-check p{font-size:11px}
  .check-badge{font-size:11px}

  .result-status{font-size:11px}
  .result-item span{font-size:11px}
  .result-item strong{font-size:17px}
  .result-progress__head{font-size:11px}
  .result-message,
  .result-reason p{font-size:11px}
  .result-reason strong{font-size:12px}
  .experiment-log>div{font-size:11px}

  .lab-action strong{font-size:13px}
  .lab-action small{font-size:11px}
  .lab-browser-note{font-size:11px}
}

/* ---------- DESKTOP ---------- */
@media (min-width:1024px){
  .lab-container{
    grid-template-columns:minmax(0,1.55fr) minmax(360px,.85fr);
  }

  .lab-intro{
    padding:24px 28px;
  }

  .lab-intro h1{font-size:40px}
  .lab-lead{font-size:16px}
  .lab-kicker{font-size:12px}
  .lab-overline{font-size:11px}
  .lab-tech-tags span{font-size:11px}

  .viewer-card__topbar,
  .section-heading{
    min-height:72px;
    padding-top:12px;
    padding-bottom:12px;
  }

  .section-number{
    width:34px;
    height:34px;
    flex-basis:34px;
    font-size:11px;
  }

  .section-eyebrow{
    margin-bottom:2px;
    font-size:10px;
  }

  .viewer-card__topbar h2,
  .section-heading h2{font-size:19px}

  .viewer-live,
  .live-badge{font-size:11px}

  .viewer-browser__address{font-size:11px}
  .viewer-browser__address b{font-size:10px}

  .metric-chip{
    min-width:124px;
    padding:10px 12px;
  }
  .metric-chip span{font-size:12px}
  .metric-chip strong{font-size:23px}
  .viewer-status{
    bottom:10px;
    font-size:11px;
  }

  .gesture-item{
    min-height:68px;
  }
  .gesture-item strong{font-size:13px}
  .gesture-item small{font-size:11px}

  .sensor-grid{
    gap:10px;
    padding-left:14px;
    padding-right:14px;
  }
  .sensor-card{
    min-height:142px;
    padding:14px;
  }
  .sensor-card__head span{font-size:17px}
  .sensor-card__head small{font-size:11px}
  .sensor-card>strong{font-size:23px}
  .sensor-card p{font-size:11px}
  .sensor-card__action{font-size:11px}
  .sensor-card--status>strong{font-size:20px}

  .device-summary{
    grid-template-columns:66px minmax(0,1fr) auto;
    padding:13px;
  }
  .device-visual{
    width:66px;
    height:66px;
    font-size:13px;
  }
  .device-identity span{font-size:11px}
  .device-identity strong{font-size:15px}
  .device-identity small{font-size:11px}
  .device-status{font-size:11px}
  .device-details>div{font-size:12px}
  .device-hint,
  .device-note{font-size:11px}

  .experiment-note strong{font-size:12px}
  .experiment-note span{font-size:11px}

  .experiment-mission>span{font-size:11px}
  .experiment-mission strong{font-size:15px}
  .experiment-mission p{font-size:12px}

  .control-head label{font-size:13px}
  .control-head output{font-size:21px}
  .range-scale{font-size:11px}

  .mode-selector legend,
  .rain-selector legend{font-size:12px}
  .mode-option strong,
  .rain-option strong{font-size:13px}
  .mode-option small,
  .rain-option small{font-size:11px}
  .manual-control span{font-size:12px}
  .manual-control small{font-size:11px}

  .manual-buttons button,
  .experiment-start,
  .experiment-reset{
    min-height:44px;
    font-size:13px;
  }

  .logic-node{padding:13px}
  .logic-node small{font-size:11px}
  .logic-node strong{font-size:15px}
  .logic-node p{font-size:12px}
  .logic-code{
    padding:11px 12px;
    font-size:11px;
  }

  .logic-check{
    grid-template-columns:36px minmax(0,1fr) auto;
    gap:11px;
    padding:12px;
  }
  .logic-check__icon{
    width:36px;
    height:36px;
    font-size:12px;
  }
  .logic-check small{font-size:11px}
  .logic-check strong{font-size:14px}
  .logic-check p{font-size:11px}
  .check-badge{font-size:11px}

  .result-status{font-size:11px}
  .result-item{
    padding:12px;
  }
  .result-item span{font-size:11px}
  .result-item strong{font-size:18px}
  .result-progress__head{font-size:11px}
  .result-message{font-size:12px}
  .result-reason strong{font-size:12px}
  .result-reason p{font-size:11px}
  .progress-legend{font-size:11px}
  .experiment-log>div{
    grid-template-columns:76px minmax(0,1fr);
    font-size:11px;
  }

  .lab-action{
    min-height:68px;
    padding:11px 13px;
  }
  .lab-action strong{font-size:14px}
  .lab-action small{font-size:11px}
  .lab-browser-note{font-size:11px}
}

/* Large desktop */
@media (min-width:1280px){
  .lab-container{
    grid-template-columns:minmax(0,1.62fr) 390px;
  }

  .lab-intro h1{font-size:42px}
  .viewer-card__topbar h2,
  .section-heading h2{font-size:20px}
}

/* Contrast pass: ข้อความรองต้องอ่านได้บนจอคอม */
@media (min-width:640px){
  .section-eyebrow,
  .sensor-card p,
  .sensor-card__action,
  .device-hint,
  .device-note,
  .experiment-mission p,
  .mode-option small,
  .rain-option small,
  .manual-control small,
  .logic-node p,
  .logic-check p,
  .result-message,
  .result-reason p,
  .lab-action small,
  .lab-browser-note{
    color:#8fa19a;
  }
}


/* =========================================================
   V7 3D RAIN LOCK
   แยกสถานะ “ฝนตก” ออกจาก “ปั๊มกำลังรดน้ำ”
   ========================================================= */

.viewer-card.is-raining .viewer-browser{
  border-color:rgba(121,207,232,.22);
}

.viewer-card.is-raining .viewer-browser::after{
  content:"RAIN LOCK";
  position:absolute;
  top:10px;
  right:10px;
  z-index:8;
  padding:5px 9px;
  border:1px solid rgba(121,207,232,.28);
  border-radius:999px;
  background:rgba(8,31,38,.78);
  color:#9edaf2;
  font-size:10px;
  font-weight:700;
  letter-spacing:.35px;
  pointer-events:none;
}

.viewer-card.is-raining.is-pump-running .viewer-browser::after{
  content:"STATE ERROR";
  border-color:rgba(235,120,94,.52);
  color:#ffb09d;
}

/* Rain Lock badge ต้องอ่านได้ชัดบน Desktop */
@media (min-width:1024px){
  .viewer-card.is-raining .viewer-browser::after{
    top:12px;
    right:12px;
    padding:6px 10px;
    font-size:11px;
  }
}


/* =========================================================
   V8 — 3D WATER TANK + SPRINKLER ARC
   ========================================================= */

.viewer-card.is-water-warning .metric-water{
  border-color:rgba(232,184,85,.36);
  background:rgba(72,54,14,.78);
}

.viewer-card.is-water-warning .metric-water strong{
  color:#f0c76c;
}

.viewer-card.is-water-low .metric-water{
  border-color:rgba(239,101,90,.48);
  background:rgba(75,24,21,.84);
  box-shadow:0 0 18px rgba(239,101,90,.10);
}

.viewer-card.is-water-low .metric-water strong{
  color:#ff968c;
}

.viewer-card.is-water-low .viewer-browser{
  border-color:rgba(239,101,90,.22);
}

.sensor-card[data-device="tank"].is-active{
  border-color:rgba(95,201,225,.34);
  box-shadow:0 0 0 1px rgba(95,201,225,.06);
}

#waterCardText{
  margin-top:4px;
  color:#81958e;
  font-size:10px;
  line-height:1.45;
}

.viewer-card.is-water-warning #waterCardText{
  color:#b9a36b;
}

.viewer-card.is-water-low #waterCardText{
  color:#ca8078;
}

@media (min-width:640px){
  #waterCardText{
    font-size:11px;
  }
}

@media (min-width:1024px){
  #waterCardText{
    font-size:11px;
  }
}
