:root{
  --ink:#0f172a;
  --muted:#64748b;
  --shadow: 0 18px 45px rgba(15,23,42,.12);
  --shadow2: 0 10px 24px rgba(15,23,42,.10);
  --r:24px;

  --blue: rgba(59,130,246,.18);
  --green: rgba(34,197,94,.18);
  --orange: rgba(251,146,60,.18);
  --red: rgba(239,68,68,.18);
  --teal: rgba(20,184,166,.18);
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color:var(--ink);
  background:
    radial-gradient(circle at 12% 12%, rgba(20,184,166,.14), transparent 45%),
    radial-gradient(circle at 88% 18%, rgba(59,130,246,.12), transparent 45%),
    radial-gradient(circle at 30% 92%, rgba(251,146,60,.12), transparent 45%),
    linear-gradient(180deg, #f6fbff, #fff7ff);
  min-height:100vh;
}

.sub{font-size:.65em; vertical-align:baseline; position:relative; top:.25em; font-weight:1000}

/* Topbar */
.topbar{
  max-width:1100px;
  margin:0 auto;
  padding:18px 16px 10px;
  display:flex;
  gap:12px;
  align-items:flex-start;
}
.back{
  text-decoration:none;
  padding:10px 12px;
  border-radius:14px;
  background:rgba(15,23,42,.06);
  color:var(--ink);
  font-weight:900;
  border:1px solid rgba(15,23,42,.08);
}
.pill{
  display:inline-flex;
  padding:7px 10px;
  border-radius:999px;
  font-weight:1000;
  font-size:12px;
  color:#334155;
  background: rgba(15,23,42,.06);
  border:1px solid rgba(15,23,42,.08);
}
.title h1{
  margin:8px 0 0;
  font-size: clamp(24px, 3.6vw, 38px);
  letter-spacing:-.02em;
}
.subtitle{
  margin:6px 0 0;
  color:var(--muted);
  font-size: 14px;
  font-weight:700;
}

/* Layout */
.page{max-width:1100px;margin:0 auto;padding:0 16px 26px;}
.panel{
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(8px);
  margin-top: 10px;
}
.panelTop{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  gap:12px;
  flex-wrap:wrap;
}
.panelTop h2{margin:0}
.muted{margin:0;color:var(--muted);font-size:13px;font-weight:800}

.labGrid{
  margin-top: 14px;
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media(min-width:980px){
  .labGrid{grid-template-columns: 1fr 1.15fr 1fr;}
}

.card{
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(15,23,42,.08);
  border-radius: var(--r);
  box-shadow: var(--shadow2);
  padding: 16px;
}
.cardTitle{margin:0 0 10px;font-size:16px}

/* Reactants (Beakers) */
.beakerRow{
  display:flex;
  align-items:flex-end;
  justify-content:center;
  gap:14px;
  margin-top:10px;
  flex-wrap:wrap;
}

.beaker{
  width:120px;
  height:190px;
  border-radius: 22px 22px 16px 16px;
  border: 1px solid rgba(15,23,42,.14);
  position:relative;
  overflow:hidden;
  background: rgba(255,255,255,.86);
  box-shadow: 0 16px 30px rgba(15,23,42,.10);
}
.beaker::before{
  content:"";
  position:absolute;
  inset: 10px;
  border-radius: 18px 18px 14px 14px;
  border: 1px dashed rgba(15,23,42,.10);
  pointer-events:none;
  opacity:.7;
}
.beaker::after{
  content:"";
  position:absolute;
  top: 12px;
  right: 10px;
  width: 22px;
  height: 140px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,0));
  opacity:.7;
}

.liquid{
  position:absolute;
  bottom:0;
  width:100%;
  height:72%;
  transition: height .45s ease, background .45s ease;
  border-top: 1px solid rgba(15,23,42,.10);
}

.acidLiquid{
  background: rgba(236,72,153,.65); /* pink indicator in acid */
}
.baseLiquid{
  background: rgba(59,130,246,.55); /* blue base */
}

.waves{
  position:absolute;
  left:0; right:0; top:-10px;
  height: 20px;
  opacity:.35;
  background:
    radial-gradient(circle at 20% 70%, rgba(255,255,255,.9) 0 22%, transparent 23%),
    radial-gradient(circle at 55% 60%, rgba(255,255,255,.9) 0 22%, transparent 23%),
    radial-gradient(circle at 85% 80%, rgba(255,255,255,.9) 0 22%, transparent 23%);
  filter: blur(.2px);
}

.label{
  margin-top:10px;
  width:120px;
  text-align:center;
  font-weight:900;
  font-size:12px;
  color: var(--muted);
}

.pourBtn{
  border-radius: 18px;
  padding:10px 14px;
  font-weight:1000;
  cursor:pointer;
  border:1px solid rgba(15,23,42,.12);
  background: rgba(20,184,166,.16);
  color:#115e59;
  box-shadow: 0 12px 22px rgba(15,23,42,.10);
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
}
.pourBtn:hover{transform: translateY(-2px)}
.pourBtn:active{transform: translateY(-1px) scale(.99)}
.pourBtn:disabled{
  opacity:.55;
  cursor:not-allowed;
  transform:none;
  box-shadow:none;
}

.note{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(251,146,60,.12);
  border: 1px dashed rgba(251,146,60,.25);
  color:#7c2d12;
  font-weight:900;
  font-size: 12px;
  text-align:center;
}

/* Center zone */
.mid{position:relative}
.zone{
  position:relative;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(20,184,166,.10), rgba(59,130,246,.06));
  border: 1px solid rgba(15,23,42,.08);
  overflow:hidden;
  text-align:center;
  padding: 14px;
  min-height: 240px;
  display:grid;
  place-items:center;
}

.eqBig{
  font-weight: 1000;
  font-size: 18px;
  letter-spacing: .01em;
  margin-bottom: 8px;
}
.eqHint{
  margin-top: 4px;
  font-size: 12px;
  font-weight: 900;
  color: var(--muted);
}

/* pH Meter */
.phMeter{
  width: min(420px, 95%);
  margin-top:10px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 18px;
  padding: 10px 12px;
}
.phLabel{
  font-weight: 1000;
  font-size: 12px;
  color:#0f172a;
  display:flex;
  justify-content:space-between;
  align-items:center;
}
.phTrack{
  margin-top:8px;
  height: 12px;
  background: linear-gradient(90deg,
    rgba(236,72,153,.95),
    rgba(251,146,60,.95),
    rgba(250,204,21,.95),
    rgba(34,197,94,.95),
    rgba(59,130,246,.95)
  );
  border-radius:999px;
  overflow:hidden;
  position:relative;
}
.phFill{
  position:absolute;
  inset:0;
  width: 15%;
  background: rgba(15,23,42,.16); /* overlay mask */
  border-radius:999px;
  transition: width .35s ease;
}
.phValue{
  margin-top:8px;
  font-weight:1000;
  font-size:13px;
  color:#0f172a;
}

/* Status pill */
.status{
  margin-top:10px;
  padding: 8px 10px;
  border-radius: 999px;
  font-weight: 1000;
  font-size: 12px;
  background: rgba(15,23,42,.06);
  border: 1px solid rgba(15,23,42,.10);
  text-align:center;
}

/* Controls */
.controls{
  margin-top:12px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:center;
}
.btn{
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(15,23,42,.06);
  border-radius: 18px;
  padding: 10px 14px;
  font-weight: 1000;
  cursor:pointer;
}
.btn.primary{
  background: rgba(20,184,166,.16);
  border-color: rgba(20,184,166,.26);
  color:#115e59;
}
.btn:active{transform: scale(.99);}

/* Products */
/* Products */
.productsBox{
  height: 190px;                 /* smaller */
  border-radius: 24px;
  border: 1px solid rgba(15,23,42,.08);
  background: linear-gradient(180deg, rgba(59,130,246,.06), rgba(34,197,94,.06));
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 14px;
  position:relative;
  overflow:hidden;
}

.productChip{
  width: 88px;                   /* smaller */
  height: 70px;                  /* smaller */
  border-radius: 22px;
  display:flex;                  /* change to flex */
  align-items:center;
  justify-content:center;
  font-weight: 1000;
  font-size: 26px;               /* smaller */
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.92);
  box-shadow: 0 14px 28px rgba(15,23,42,.10);
  opacity: 0;
  transform: translateY(12px) scale(.94);
  white-space: nowrap;           /* keep CO₂ one line */
  line-height: 1;                /* prevent vertical stacking */
  transition: opacity .25s ease, transform .25s ease;
}

.productChip.show{
  opacity: 1;
  transform: translateY(0) scale(1);
}


.miniExplain{
  margin-top: 12px;
  padding: 12px 12px;
  border-radius: 18px;
  background: rgba(59,130,246,.10);
  border: 1px dashed rgba(59,130,246,.22);
  color:#1e3a8a;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
}

/* Drip + FX */
.drip{
  position:absolute;
  top: 18px;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(59,130,246,.75);
  box-shadow: 0 0 16px rgba(59,130,246,.35);
  transform: translateX(-50%);
  opacity:0;
}
.drip.on{
  opacity:1;
  animation: dripFall .55s ease-in forwards;
}
@keyframes dripFall{
  0%{ transform: translateX(-50%) translateY(0) scale(.95); opacity:1;}
  100%{ transform: translateX(-50%) translateY(150px) scale(.7); opacity:0;}
}

.bubble{
  position:absolute;
  left: var(--x);
  top: var(--y);
  width: 10px; height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.8);
  border: 1px solid rgba(15,23,42,.08);
  opacity:.9;
  animation: bubbleUp .9s ease-out forwards;
}
@keyframes bubbleUp{
  0%{ transform: translate(0,0) scale(.8); opacity:.9;}
  100%{ transform: translate(0,-46px) scale(1.4); opacity:0;}
}
