:root {
  --navy: #2c3e50;
  --softgray: #e9ecef;
  --teal: #1abc9c;
  --gold: #f1c40f;
  --slate: #556366;
  --coral: #e74c3c;
  --white: #ffffff;
  --gray-100: #f7fafc;
  --gray-200: #edf2f7;
  --gray-300: #e2e8f0;
  --max-width: 1120px;
  --container-pad: 16px;
  --radius: 10px;
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.06);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body{
  margin:0;
  font-family:"Montserrat",system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial;
  color:var(--navy);
  background:linear-gradient(135deg,#ecf0f1 0%,#d6dbdf 100%);
  padding:16px;
}

.container{
  max-width:var(--max-width);
  margin:0 auto;
  min-height:100vh;
  display:flex;
  flex-direction:column;
  gap:18px;
  padding:18px;
}

.page-header{ text-align:center; padding:1rem; }
.header-grid{
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  gap:12px;
  padding:8px 0;
}
.page-title{
  margin:0;
  justify-self:center;
  font-size:2rem;
  font-weight:700;
}

@media (max-width: 767px){
  .header-grid{ grid-template-columns:1fr; text-align:left; }
  .page-title{ justify-self:start; }
}

.cols{ display:flex; flex-direction:column; gap:24px; }

.experiment-area{
  background:var(--gray-100);
  border-radius:10px;
  padding:20px;
  margin-bottom:24px;
}

.sim-area{
  background:var(--softgray);
  border-radius:8px;
  padding:12px;
  position:relative;
  overflow:hidden;
  height:420px;
}

.controls{
  background:white;
  border-radius:8px;
  padding:16px;
  box-shadow:var(--shadow-sm);
}

.control-group{ margin-bottom:18px; }
.label{
  display:block;
  margin-bottom:6px;
  font-size:14px;
  color:var(--slate);
  font-weight:600;
}

.range-row{ display:flex; align-items:center; gap:12px; }
.range{ flex:1; }

.value{
  display:inline-block;
  padding:6px 8px;
  border-radius:6px;
  background:rgba(26,188,156,0.12);
  color:var(--teal);
  min-width:64px;
  text-align:center;
  font-weight:700;
}

.btn{
  display:inline-block;
  border-radius:0.375rem;
  font-weight:600;
  cursor:pointer;
  border:1px solid transparent;
  font-size:16px;
  padding:12px 24px;
  transition:all 0.2s;
}

.navy-btn{ background-color: rgba(44,62,80,0.8); color:white; }
.navy-btn:hover{ background-color: rgba(44,62,80,0.7); transform: translateY(-2px); }

.gold-btn{ background-color: rgba(241,196,15,1); color: var(--navy); opacity:0.9; }
.gold-btn:hover{ background-color: rgba(241,196,15,0.5); transform: translateY(-2px); }

.coral-btn{ background-color: rgba(231,76,60,0.8); color:white; }
.coral-btn:hover{ background-color: rgba(231,76,60,0.7); transform: translateY(-2px); }

.button-stack{ display:flex; flex-direction:column; gap:10px; margin-top:20%; }

.panel{
  margin-top:24px;
  background:white;
  border-radius:8px;
  padding:16px;
  box-shadow:var(--shadow-sm);
}
.panel h3{ margin:0 0 12px 0; font-size:18px; }
.panel .panel-body{ color:var(--navy); }
.panel ol{ margin:8px 0 0 20px; }

.table-wrap{ overflow-x:auto; }
.results-table{
  width:100%;
  border-collapse:collapse;
  background:white;
  border:1px solid var(--softgray);
}
.results-table th, .results-table td{
  border:1px solid var(--softgray);
  padding:8px;
  text-align:left;
}
.results-table thead tr{ background:var(--softgray); }
.results-table th{ font-weight:700; }

.row-delete{ background:none; border:0; cursor:pointer; color:#e53e3e; font-size:16px; }

.table-input{
  width:100%;
  max-width:160px;
  padding:8px;
  border-radius:6px;
  border:1px solid var(--gray-300);
  background:white;
  font:inherit;
  color:var(--navy);
  text-align:center;
}
.table-input:focus{
  outline:3px solid rgba(26, 188, 156, 0.18);
  outline-offset:2px;
}

/* range styling */
input[type="range"]{ -webkit-appearance:none; appearance:none; height:6px; background:transparent; }
input[type="range"]::-webkit-slider-runnable-track{
  height:6px;
  background:linear-gradient(90deg,#d0d0d0,#bdbdbd);
  border-radius:6px;
}
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none;
  width:18px;height:18px;border-radius:50%;
  background:var(--navy);
  margin-top:-6px;
  box-shadow:0 2px 6px rgba(0,0,0,0.2);
}

/* Responsive */
@media (min-width: 768px){
  .cols{ flex-direction:row; }
  .sim-area{ flex:2; margin-right:24px; }
  .controls{ flex:1; }
}



.rig{
  position:relative;
  width:100%;
  height:100%;
  border-radius:10px;
  background:
    radial-gradient(circle at 22% 18%, rgba(255,255,255,0.65), rgba(255,255,255,0) 58%),
    radial-gradient(circle at 90% 15%, rgba(255,255,255,0.40), rgba(255,255,255,0) 55%),
    linear-gradient(180deg, #ffffff 0%, #f2f4f7 100%);
  border:1px solid rgba(44,62,80,0.12);
  box-shadow:var(--shadow-xs);
  overflow:hidden;
}

.wires{ position:absolute; inset:0; width:100%; height:100%; pointer-events:none; z-index:6; }
.wire{ fill:none; stroke-linecap:round; stroke-linejoin:round; opacity:0.95; }
.wire-red{ stroke: rgba(231, 76, 60, 0.95); stroke-width: 7.2; }
.wire-black{ stroke: rgba(20, 25, 35, 0.92); stroke-width: 6.2; }

/* Water bath block */
.bath{
  position:absolute;
  left:22px;
  top:22px;
  width:60%;
  height:80%;
  border-radius:12px;
  background: rgba(255,255,255,0.80);
  border: 1px solid rgba(44, 62, 80, 0.14);
  box-shadow: var(--shadow-xs);
  padding:14px;
  z-index:5;
}

.bath-label{
  font-size:1rem;
  font-weight:800;
  color: var(--navy);
  padding:4px 10px;
  border-radius:999px;
  background: rgba(26,188,156,0.12);
  border: 1px solid rgba(26,188,156,0.28);
  display:inline-block;
}

.beaker{
  position:relative;
  margin-top:10%;
  bottom: 10%;
  width:100%;
  height:90%;
  border-radius:12px;
}

.water{
  position:absolute;
  left:10px; right:10px;
  bottom:10%;
  height:60%;
  border-radius: 0 0 14px 14px;
  background: linear-gradient(180deg, rgba(90,170,255,0.55), rgba(40,120,220,0.55));
  overflow:hidden;
  transition: filter 160ms ease;
}
.bubbles{
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,0.22), rgba(255,255,255,0) 28%),
    radial-gradient(circle at 55% 65%, rgba(255,255,255,0.18), rgba(255,255,255,0) 26%),
    radial-gradient(circle at 75% 85%, rgba(255,255,255,0.20), rgba(255,255,255,0) 30%);
  opacity:0.0;
  transition: opacity 160ms ease;
}


.probe{
  position:absolute;
  left:45%;
  top:20%;
  width:10%;
  height:80%;
  z-index:4;
}
.probe-stem{
  position:absolute;
  left:45%;
  top:0%;
  
  width:20%;
  height:75%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(140,150,160,0.95), rgba(90,100,110,0.95));
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.35);
}
.probe-head{
  position:absolute;
  left:45%;
  top:65%;
  transform: translateX(-50%);
  width:24px;
  height:24px;
  border-radius:50%;
  background: linear-gradient(180deg, rgba(40,50,60,0.95), rgba(10,15,20,0.95));
  border: 2px solid rgba(255,255,255,0.18);
  box-shadow: 0 8px 14px rgba(0,0,0,0.18);
}
.probe-leads{
  position:absolute;
  left:45%;
  top:0%;
  transform: translateX(-50%);
  width:40%;
  display:flex;
  justify-content:space-between;
}
.probe-terminal{
  width:12px;height:12px;border-radius:50%;
  background: rgba(44, 62, 80, 0.22);
  border: 2px solid rgba(44, 62, 80, 0.22);
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.65);
}

/* Thermometer */
.thermometer{
  position:absolute;
  right:70%;
  top:10%;
  width:10%;
  height:80%;
  z-index:3;
}
.thermo-tube{
  position:absolute;
  left:26px;
  top:8px;
  width:10px;
  height:170px;
  border-radius:999px;
  background: rgba(255,255,255,0.65);
  border: 2px solid rgba(44,62,80,0.25);
}
.thermo-bulb{
  position:absolute;
  left:20px;
  bottom:10px;
  width:22px;
  height:22px;
  border-radius:50%;
  background: rgba(255,255,255,0.65);
  border: 2px solid rgba(44,62,80,0.25);
}
.thermo-mercury{
  position:absolute;
  left:30%;
  bottom:40%;
  width:40%;
  height:60%;
  border-radius:999px;
  background: linear-gradient(180deg, rgba(231,76,60,0.9), rgba(231,76,60,0.55));
  transition: height 160ms ease;
}
.thermo-scale{
  position:absolute;
  left:70%;
  top:10%;
  height:75%;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  font-size:0.5rem;
  color: rgba(44,62,80,0.65);
  font-weight:700;
}

/* Hotplate */
.hotplate{
  position:absolute;
  margin-left: auto;
  margin-right: auto;
  width: 90%;
  bottom:0%;
  height:10%;
  border-radius:12px;
  background: rgba(44,62,80,0.08);
  border: 1px solid rgba(44,62,80,0.12);
  display:flex;
  align-items:center;
  justify-content:center;
  gap:14px;
}
.hotplate-top{
  width:120px;
  height:12px;
  border-radius:999px;
  background: rgba(44,62,80,0.14);
}
.hotplate-ring{
  width:30px;height:30px;border-radius:50%;
  border: 3px solid rgba(231,76,60,0.18);
  background: rgba(231,76,60,0.06);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
.hotplate-text{
  font-size:0.8rem;
  font-weight:700;
  color: rgba(44,62,80,0.65);
}


.meter{
  position:absolute;
  right:5%;
  top:5%;
  width:30%;
  border-radius:10px;
  background:#101a24;
  border:1px solid rgba(44,62,80,0.20);
  box-shadow:var(--shadow-sm);
  padding:14px;
  z-index:7;
  color:white;
}

.meter-topbar{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; }
.meter-name{ font-weight:800; letter-spacing:0.6px; font-size:12px; color:rgba(255,255,255,0.90); }
.meter-mode{
  font-weight:900;
  font-size:1rem;
  padding:4px 10px;
  border-radius:999px;
  background: rgba(26,188,156,0.18);
  border:1px solid rgba(26,188,156,0.30);
}

.meter-jacks{ position:absolute; right:14px; top:44px; display:flex; gap:10px; }
.jack{
  width:14px;height:14px;border-radius:50%;
  border:2px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.06);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.30);
}
.jack-red{ outline:3px solid rgba(231,76,60,0.20); }
.jack-black{ outline:3px solid rgba(20,25,35,0.25); }

.lcd{
  position:relative;
  border-radius:10px;
  padding:14px 12px;
  background: linear-gradient(180deg, rgba(214,232,210,0.95), rgba(182,210,178,0.92));
  border:1px solid rgba(255,255,255,0.18);
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.18), inset 0 -2px 10px rgba(255,255,255,0.18);
  overflow:hidden;
}
.lcd::before{
  content:"";
  position:absolute; inset:0;
  background: repeating-linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.05) 1px, rgba(255,255,255,0) 1px, rgba(255,255,255,0) 4px);
  opacity:0.28; pointer-events:none;
}
.lcd::after{
  content:"";
  position:absolute; inset:0;
  background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.35), rgba(255,255,255,0) 55%);
  opacity:0.55; pointer-events:none;
}
.lcd-live{
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 10px;
}

/* Fixed-character readout so decimal never moves */
.lcd-digits{
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1ch;
  justify-content: end;     
  align-items: baseline;

  width: 5ch;             
  overflow: hidden;
  white-space: nowrap;

  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-weight: 900;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;        /* IMPORTANT: keep 0 so alignment is exact */
  color: rgba(10, 22, 14, 0.95);
  text-shadow: 0 1px 0 rgba(255,255,255,0.22);
}

.lcd-digit{
  display: inline-block;
  width: 1ch;
  text-align: center;
}

/* Optional: nudge the dot slightly like many LCDs */
.lcd-digit.decimal{
  transform: translateY(1px);
}


/* Unit stays put */
.lcd-unit{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-weight: 900;
  font-size: 16px;
  color: rgba(10, 22, 14, 0.80);
}


@media (max-width: 767px){
  .header-actions{
    justify-self:start;
    width:100%;
    margin-top:8px;
  }

  body{ padding:8px; }
  .container{ padding:0 8px; }

  .btn{
    padding:14px 20px;
    font-size:16px;
    min-height:48px;
  }

  /* Larger sliders for touch */
  input[type="range"]::-webkit-slider-thumb{
    width:24px; height:24px; margin-top:-9px;
  }
  input[type="range"]::-moz-range-thumb{
    width:24px; height:24px;
  }
  input[type="range"]{ height:10px; }

  .bath{ position:relative; width:auto; height:320px; margin:0 auto; }
  .meter{ left:22px; right:22px; top:auto; bottom:18px; width:auto; }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse){
  .btn{
    min-height:50px;
    font-size:17px;
  }

  .control-group{ margin-bottom:20px; }
  .button-stack{ gap:12px; }
}
