@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=DM+Mono:wght@300;400;500&family=Lato:wght@300;400;700&display=swap');

:root {
  --lab-white: #f8f5ef;
  --lab-paper: #eee9df;
  --lab-cream: #e5ddd0;
  --flask-blue: #3a7cbd;
  --flask-teal: #2a9d8f;
  --flask-amber: #e76f51;
  --flask-purple: #7b5ea7;
  --ink-dark: #1c2433;
  --ink-mid: #3d4f63;
  --ink-soft: #6b7e94;
  --accent-teal: #2a9d8f;
  --accent-blue: #3a7cbd;
  --accent-gold: #c97d3a;
  --accent-red: #c84b31;
  --text-dark: #1c2433;
  --text-mid: #3d4f63;
  --text-soft: #6b7e94;
  --border-light: rgba(60,80,110,0.15);
  --border-mid: rgba(60,80,110,0.25);
  --shadow-sm: 0 2px 12px rgba(28,36,51,0.08);
  --shadow-md: 0 8px 32px rgba(28,36,51,0.12);
  --shadow-lg: 0 20px 60px rgba(28,36,51,0.18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background-color: var(--lab-white);
  font-family: 'Lato', sans-serif;
  color: var(--text-dark);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Lab Blueprint Grid */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(58,124,189,0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(58,124,189,0.055) 1px, transparent 1px),
    linear-gradient(rgba(58,124,189,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(58,124,189,0.025) 1px, transparent 1px);
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
  z-index: 0;
  pointer-events: none;
}

/* Paper texture */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  opacity: 0.55;
  z-index: 0;
  pointer-events: none;
}

.page-wrapper {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* TOP-RIGHT: Burette + Conical Flask + Separating Funnel */
.page-wrapper::before {
  content: '';
  position: absolute;
  top: -10px;
  right: -60px;
  width: 260px;
  height: 420px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 260 420'%3E%3Cg opacity='0.13'%3E%3Crect x='28' y='10' width='18' height='250' rx='4' fill='none' stroke='%233a7cbd' stroke-width='2.2'/%3E%3Cpath d='M30 260 L33 308 L43 308 L46 260' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3Ccircle cx='38' cy='312' r='3' fill='%233a7cbd' opacity='0.5'/%3E%3Crect x='24' y='240' width='28' height='10' rx='3' fill='%233a7cbd' opacity='0.35'/%3E%3Cline x1='28' y1='40' x2='46' y2='40' stroke='%233a7cbd' stroke-width='1.2' opacity='0.5'/%3E%3Cline x1='28' y1='65' x2='46' y2='65' stroke='%233a7cbd' stroke-width='1.2' opacity='0.5'/%3E%3Cline x1='28' y1='90' x2='46' y2='90' stroke='%233a7cbd' stroke-width='1.2' opacity='0.5'/%3E%3Cline x1='28' y1='115' x2='46' y2='115' stroke='%233a7cbd' stroke-width='1.2' opacity='0.5'/%3E%3Cline x1='28' y1='140' x2='46' y2='140' stroke='%233a7cbd' stroke-width='1.2' opacity='0.5'/%3E%3Cline x1='28' y1='165' x2='46' y2='165' stroke='%233a7cbd' stroke-width='1.2' opacity='0.5'/%3E%3Cline x1='28' y1='190' x2='46' y2='190' stroke='%233a7cbd' stroke-width='1.2' opacity='0.5'/%3E%3Cline x1='28' y1='215' x2='46' y2='215' stroke='%233a7cbd' stroke-width='1.2' opacity='0.5'/%3E%3Cline x1='28' y1='52' x2='38' y2='52' stroke='%233a7cbd' stroke-width='0.8' opacity='0.35'/%3E%3Cline x1='28' y1='77' x2='38' y2='77' stroke='%233a7cbd' stroke-width='0.8' opacity='0.35'/%3E%3Cline x1='28' y1='102' x2='38' y2='102' stroke='%233a7cbd' stroke-width='0.8' opacity='0.35'/%3E%3Cline x1='28' y1='127' x2='38' y2='127' stroke='%233a7cbd' stroke-width='0.8' opacity='0.35'/%3E%3Cline x1='28' y1='152' x2='38' y2='152' stroke='%233a7cbd' stroke-width='0.8' opacity='0.35'/%3E%3Cline x1='28' y1='177' x2='38' y2='177' stroke='%233a7cbd' stroke-width='0.8' opacity='0.35'/%3E%3Cline x1='28' y1='202' x2='38' y2='202' stroke='%233a7cbd' stroke-width='0.8' opacity='0.35'/%3E%3C/g%3E%3Cg opacity='0.12' transform='translate(68,50)'%3E%3Cellipse cx='62' cy='18' rx='22' ry='8' fill='none' stroke='%232a9d8f' stroke-width='2.2'/%3E%3Crect x='54' y='18' width='16' height='58' rx='2' fill='none' stroke='%232a9d8f' stroke-width='2.2'/%3E%3Cpath d='M54 76 L12 205 Q12 225 34 225 L90 225 Q112 225 112 205 L70 76 Z' fill='none' stroke='%232a9d8f' stroke-width='2.5' stroke-linejoin='round'/%3E%3Cpath d='M19 190 Q62 177 105 190' fill='none' stroke='%232a9d8f' stroke-width='2' opacity='0.55'/%3E%3Ccircle cx='36' cy='203' r='5' fill='%232a9d8f' opacity='0.3'/%3E%3Ccircle cx='62' cy='208' r='3.5' fill='%232a9d8f' opacity='0.25'/%3E%3Ccircle cx='86' cy='202' r='4' fill='%232a9d8f' opacity='0.3'/%3E%3C/g%3E%3Cg opacity='0.10' transform='translate(170,15)'%3E%3Cellipse cx='42' cy='14' rx='30' ry='11' fill='none' stroke='%237b5ea7' stroke-width='2'/%3E%3Cpath d='M12 14 L20 100 Q20 118 42 118 Q64 118 64 100 L72 14 Z' fill='none' stroke='%237b5ea7' stroke-width='2.2'/%3E%3Crect x='38' y='118' width='8' height='30' fill='none' stroke='%237b5ea7' stroke-width='2'/%3E%3Crect x='34' y='144' width='16' height='6' rx='2' fill='%237b5ea7' opacity='0.3'/%3E%3Cpath d='M40 150 L40 168 L44 168 L44 150' fill='none' stroke='%237b5ea7' stroke-width='2'/%3E%3Cpath d='M21 68 Q42 60 63 68' fill='none' stroke='%23e76f51' stroke-width='1.8' opacity='0.45'/%3E%3Cpath d='M19 90 Q42 82 65 90' fill='none' stroke='%237b5ea7' stroke-width='1.8' opacity='0.45'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
  z-index: 0;
}

/* TOP-LEFT: Beaker + Pipette + Test Tube Rack */
.page-wrapper::after {
  content: '';
  position: absolute;
  top: 30px;
  left: -60px;
  width: 260px;
  height: 390px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 260 390'%3E%3Cg opacity='0.12' transform='translate(8,35)'%3E%3Cpath d='M20 10 L14 195 Q14 215 36 215 L96 215 Q118 215 118 195 L112 10 Z' fill='none' stroke='%23e76f51' stroke-width='2.5'/%3E%3Crect x='14' y='4' width='104' height='12' rx='4' fill='none' stroke='%23e76f51' stroke-width='2.2'/%3E%3Cpath d='M112 10 L130 10' stroke='%23e76f51' stroke-width='2.2' stroke-linecap='round'/%3E%3Cline x1='14' y1='60' x2='112' y2='60' stroke='%23e76f51' stroke-width='1' opacity='0.38'/%3E%3Cline x1='14' y1='100' x2='112' y2='100' stroke='%23e76f51' stroke-width='1' opacity='0.38'/%3E%3Cline x1='14' y1='145' x2='112' y2='145' stroke='%23e76f51' stroke-width='1' opacity='0.38'/%3E%3Cline x1='14' y1='178' x2='112' y2='178' stroke='%23e76f51' stroke-width='1' opacity='0.38'/%3E%3Cpath d='M18 180 Q65 167 112 180' fill='none' stroke='%232a9d8f' stroke-width='2' opacity='0.5'/%3E%3Ccircle cx='40' cy='193' r='5' fill='%232a9d8f' opacity='0.28'/%3E%3Ccircle cx='65' cy='198' r='3.5' fill='%232a9d8f' opacity='0.22'/%3E%3Ccircle cx='90' cy='192' r='4' fill='%232a9d8f' opacity='0.25'/%3E%3C/g%3E%3Cg opacity='0.11' transform='translate(158,8)'%3E%3Cellipse cx='28' cy='20' rx='22' ry='12' fill='none' stroke='%237b5ea7' stroke-width='2'/%3E%3Crect x='22' y='32' width='12' height='145' rx='3' fill='none' stroke='%237b5ea7' stroke-width='2'/%3E%3Cellipse cx='28' cy='122' rx='16' ry='10' fill='none' stroke='%237b5ea7' stroke-width='1.5' opacity='0.5'/%3E%3Cpath d='M22 177 L25 218 L31 218 L34 177' fill='none' stroke='%237b5ea7' stroke-width='2'/%3E%3Ccircle cx='28' cy='223' r='3.5' fill='%237b5ea7' opacity='0.4'/%3E%3Cline x1='22' y1='55' x2='34' y2='55' stroke='%237b5ea7' stroke-width='1' opacity='0.4'/%3E%3Cline x1='22' y1='78' x2='34' y2='78' stroke='%237b5ea7' stroke-width='1' opacity='0.4'/%3E%3Cline x1='22' y1='100' x2='34' y2='100' stroke='%237b5ea7' stroke-width='1' opacity='0.4'/%3E%3Cline x1='22' y1='122' x2='34' y2='122' stroke='%237b5ea7' stroke-width='1' opacity='0.4'/%3E%3Cline x1='22' y1='145' x2='34' y2='145' stroke='%237b5ea7' stroke-width='1' opacity='0.4'/%3E%3Cline x1='22' y1='162' x2='34' y2='162' stroke='%237b5ea7' stroke-width='1' opacity='0.4'/%3E%3C/g%3E%3Cg opacity='0.10' transform='translate(5,248)'%3E%3Crect x='5' y='100' width='152' height='10' rx='3' fill='%233a7cbd' opacity='0.4'/%3E%3Crect x='5' y='50' width='152' height='7' rx='3' fill='%233a7cbd' opacity='0.28'/%3E%3Crect x='16' y='5' width='14' height='78' rx='7' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3Crect x='44' y='5' width='14' height='78' rx='7' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3Crect x='72' y='5' width='14' height='78' rx='7' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3Crect x='100' y='5' width='14' height='78' rx='7' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3Crect x='128' y='5' width='14' height='78' rx='7' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3Crect x='16' y='54' width='14' height='29' rx='7' fill='%232a9d8f' opacity='0.28'/%3E%3Crect x='44' y='44' width='14' height='39' rx='7' fill='%23e76f51' opacity='0.22'/%3E%3Crect x='72' y='60' width='14' height='23' rx='7' fill='%237b5ea7' opacity='0.25'/%3E%3Crect x='100' y='48' width='14' height='35' rx='7' fill='%232a9d8f' opacity='0.2'/%3E%3Crect x='128' y='38' width='14' height='45' rx='7' fill='%23e76f51' opacity='0.18'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
  z-index: 0;
}

/* ─── Header ─── */
header {
  text-align: center;
  margin-bottom: 52px;
  animation: fadeDown 0.8s ease both;
  position: relative;
}

.badge {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent-teal);
  border: 1.5px solid var(--accent-teal);
  padding: 5px 16px;
  border-radius: 20px;
  margin-bottom: 20px;
  background: rgba(42,157,143,0.08);
}

h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  line-height: 1.15;
  color: var(--ink-dark);
  margin-bottom: 12px;
  font-weight: 700;
}

h1 em { font-style: italic; color: var(--accent-teal); }

.subtitle {
  font-size: 14px;
  color: var(--text-soft);
  letter-spacing: 0.5px;
  max-width: 440px;
  margin: 0 auto;
  line-height: 1.75;
}

header::after {
  content: '• • •';
  display: block;
  font-size: 8px;
  letter-spacing: 6px;
  color: rgba(42,157,143,0.3);
  margin-top: 16px;
}

/* ─── Steps ─── */
.steps-track {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 40px;
  animation: fadeDown 0.9s ease 0.1s both;
}

.step-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 12px; font-weight: 500;
  color: var(--text-soft);
  transition: all 0.4s ease;
  background: var(--lab-white);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.step-dot.active {
  border-color: var(--accent-teal);
  color: var(--accent-teal);
  background: rgba(42,157,143,0.08);
  box-shadow: 0 0 0 4px rgba(42,157,143,0.12), var(--shadow-sm);
}

.step-dot.done { border-color: var(--accent-teal); background: var(--accent-teal); color: #fff; }
.step-dot.done::after { content: '✓'; font-size: 14px; }
.step-dot.done span { display: none; }

.step-line { width: 60px; height: 2px; background: var(--border-light); transition: background 0.4s ease; flex-shrink: 0; }
.step-line.done { background: var(--accent-teal); }

@media (max-width: 480px) { .step-line { width: 30px; } }

/* ─── Cards ─── */
.card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: clamp(28px, 5vw, 48px);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.9);
  display: none;
  animation: slideUp 0.5s ease both;
  position: relative;
  overflow: hidden;
}

/* Step 1 card: microscope + watch glass */
#step-1::before {
  content: '';
  position: absolute;
  bottom: -15px; right: -15px;
  width: 230px; height: 230px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 230 230'%3E%3Cg opacity='0.08' transform='translate(18,8)'%3E%3Crect x='32' y='178' width='82' height='13' rx='4' fill='%233a7cbd'/%3E%3Crect x='60' y='80' width='14' height='98' rx='3' fill='none' stroke='%233a7cbd' stroke-width='2.5'/%3E%3Cpath d='M67 80 Q67 48 96 48' fill='none' stroke='%233a7cbd' stroke-width='3' stroke-linecap='round'/%3E%3Ccircle cx='96' cy='48' r='9' fill='none' stroke='%233a7cbd' stroke-width='2.5'/%3E%3Crect x='92' y='57' width='8' height='20' rx='2' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3Crect x='90' y='12' width='10' height='36' rx='3' fill='none' stroke='%233a7cbd' stroke-width='2.2'/%3E%3Cellipse cx='95' cy='12' rx='10' ry='5' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3Crect x='40' y='114' width='62' height='8' rx='2' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3Crect x='50' y='110' width='42' height='4' rx='1' fill='%233a7cbd' opacity='0.22'/%3E%3Ccircle cx='28' cy='132' r='9' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3Ccircle cx='110' cy='132' r='7' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3C/g%3E%3Cg opacity='0.07' transform='translate(128,148)'%3E%3Cellipse cx='42' cy='30' rx='40' ry='19' fill='none' stroke='%232a9d8f' stroke-width='2.2'/%3E%3Cellipse cx='42' cy='32' rx='30' ry='11' fill='none' stroke='%232a9d8f' stroke-width='1.2' opacity='0.5'/%3E%3Ccircle cx='36' cy='30' r='3.5' fill='%232a9d8f' opacity='0.3'/%3E%3Ccircle cx='48' cy='33' r='2.5' fill='%232a9d8f' opacity='0.22'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: contain;
  pointer-events: none; z-index: 0;
}

/* Step 2 card: round-bottom flask + stirring rod + dropper */
#step-2::before {
  content: '';
  position: absolute;
  bottom: -10px; right: -10px;
  width: 220px; height: 220px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 220'%3E%3Cg opacity='0.08'%3E%3Ccircle cx='120' cy='148' r='58' fill='none' stroke='%232a9d8f' stroke-width='2.8'/%3E%3Crect x='109' y='52' width='22' height='72' rx='4' fill='none' stroke='%232a9d8f' stroke-width='2.8'/%3E%3Cellipse cx='120' cy='52' rx='22' ry='9' fill='none' stroke='%232a9d8f' stroke-width='2.2'/%3E%3Cpath d='M76 157 Q120 143 164 157' fill='none' stroke='%233a7cbd' stroke-width='2.2' opacity='0.5'/%3E%3Ccircle cx='95' cy='168' r='6' fill='%233a7cbd' opacity='0.25'/%3E%3Ccircle cx='120' cy='173' r='4.5' fill='%233a7cbd' opacity='0.2'/%3E%3Ccircle cx='145' cy='167' r='5.5' fill='%233a7cbd' opacity='0.22'/%3E%3C/g%3E%3Cg opacity='0.08'%3E%3Crect x='18' y='8' width='7' height='175' rx='3' fill='none' stroke='%237b5ea7' stroke-width='2.2'/%3E%3Cellipse cx='21' cy='8' rx='7' ry='4' fill='none' stroke='%237b5ea7' stroke-width='2'/%3E%3C/g%3E%3Cg opacity='0.08' transform='translate(48,5)'%3E%3Crect x='15' y='25' width='26' height='52' rx='5' fill='none' stroke='%23e76f51' stroke-width='2'/%3E%3Crect x='20' y='14' width='16' height='13' rx='3' fill='none' stroke='%23e76f51' stroke-width='2'/%3E%3Crect x='23' y='4' width='10' height='12' rx='2' fill='none' stroke='%23e76f51' stroke-width='2'/%3E%3Cpath d='M28 2 L28 4' stroke='%23e76f51' stroke-width='2' stroke-linecap='round'/%3E%3Crect x='17' y='40' width='22' height='24' rx='2' fill='%23e76f51' opacity='0.15'/%3E%3Cline x1='19' y1='46' x2='37' y2='46' stroke='%23e76f51' stroke-width='1' opacity='0.38'/%3E%3Cline x1='19' y1='52' x2='37' y2='52' stroke='%23e76f51' stroke-width='1' opacity='0.38'/%3E%3Cline x1='19' y1='57' x2='30' y2='57' stroke='%23e76f51' stroke-width='1' opacity='0.38'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: contain;
  pointer-events: none; z-index: 0;
}

.card.active { display: block; }

.card-title, .card-desc, .form-row, .inputs-grid,
.formula-display, .btn-row, .error-msg { position: relative; z-index: 1; }

@keyframes slideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: translateY(0); } }

.card-title { font-family: 'Playfair Display', serif; font-size: 1.6rem; color: var(--ink-dark); margin-bottom: 6px; }
.card-desc { font-size: 13px; color: var(--text-soft); margin-bottom: 32px; line-height: 1.65; }

/* ─── Form ─── */
.form-row { margin-bottom: 22px; }

label {
  display: block;
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 8px;
}

input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  background: var(--lab-white);
  border: 1.5px solid var(--border-mid);
  border-radius: 10px;
  padding: 13px 18px;
  font-size: 15px;
  color: var(--ink-dark);
  font-family: 'Lato', sans-serif;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
  -webkit-appearance: none;
}

textarea { resize: vertical; min-height: 90px; }

input:focus, textarea:focus {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px rgba(42,157,143,0.12);
}

input::placeholder, textarea::placeholder { color: rgba(107,126,148,0.45); }

/* ─── Titration Grid ─── */
.inputs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 520px) { .inputs-grid { grid-template-columns: 1fr; } }

.input-box {
  background: var(--lab-paper);
  border: 1.5px solid var(--border-light);
  border-radius: 14px;
  padding: 20px 16px 16px;
  text-align: center;
  transition: border-color 0.3s, transform 0.2s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
}

/* Mini test tube in each input box */
.input-box::after {
  content: '';
  position: absolute;
  bottom: 5px; right: 7px;
  width: 28px; height: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'%3E%3Crect x='10' y='2' width='8' height='21' rx='4' fill='none' stroke='%232a9d8f' stroke-width='1.8' opacity='0.28'/%3E%3Crect x='10' y='15' width='8' height='8' rx='4' fill='%232a9d8f' opacity='0.18'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  pointer-events: none;
}

.input-box:focus-within {
  border-color: var(--accent-teal);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(42,157,143,0.12);
}

.input-box label {
  font-size: 22px; letter-spacing: 0;
  color: var(--accent-teal);
  font-family: 'Playfair Display', serif;
  font-style: italic;
  margin-bottom: 4px;
  text-transform: none;
  display: block;
  position: relative; z-index: 1;
}

.input-box .unit {
  font-size: 10px; color: var(--text-soft);
  font-family: 'DM Mono', monospace;
  letter-spacing: 1px; margin-bottom: 12px;
  position: relative; z-index: 1;
}

.input-box input {
  background: transparent; border: none;
  border-bottom: 2px solid var(--border-mid);
  border-radius: 0; padding: 8px 4px;
  text-align: center; font-size: 22px; font-weight: 700;
  color: var(--ink-dark); box-shadow: none !important;
  position: relative; z-index: 1;
}

.input-box input:focus { border-bottom-color: var(--accent-teal); box-shadow: none !important; }

/* ─── Formula Display ─── */
.formula-display {
  background: linear-gradient(135deg, #e8f4f2, #eef5fb);
  border: 1.5px solid rgba(42,157,143,0.22);
  border-radius: 14px;
  padding: 20px 70px 20px 24px;
  margin-bottom: 28px;
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.8;
  position: relative;
  overflow: hidden;
}

/* Dropper bottle watermark */
.formula-display::before {
  content: '';
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  width: 52px; height: 76px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 52 76'%3E%3Cg opacity='0.16'%3E%3Crect x='14' y='24' width='24' height='46' rx='5' fill='none' stroke='%23e76f51' stroke-width='2'/%3E%3Crect x='19' y='14' width='14' height='12' rx='3' fill='none' stroke='%23e76f51' stroke-width='2'/%3E%3Crect x='22' y='5' width='8' height='11' rx='2' fill='none' stroke='%23e76f51' stroke-width='2'/%3E%3Cpath d='M26 3 L26 5' stroke='%23e76f51' stroke-width='2' stroke-linecap='round'/%3E%3Crect x='16' y='36' width='20' height='22' rx='2' fill='%23e76f51' opacity='0.16'/%3E%3Cline x1='18' y1='42' x2='34' y2='42' stroke='%23e76f51' stroke-width='1' opacity='0.38'/%3E%3Cline x1='18' y1='47' x2='34' y2='47' stroke='%23e76f51' stroke-width='1' opacity='0.38'/%3E%3Cline x1='18' y1='52' x2='28' y2='52' stroke='%23e76f51' stroke-width='1' opacity='0.38'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: contain;
  pointer-events: none;
}

.formula-display .f-big {
  font-size: 15px; color: var(--ink-dark);
  display: block; margin-top: 4px;
  position: relative; z-index: 1;
}

.formula-display .f-fraction {
  display: inline-flex; flex-direction: column;
  align-items: center; vertical-align: middle; margin: 0 4px;
}

.formula-display .f-fraction span:first-child {
  border-bottom: 1.5px solid var(--text-soft);
  padding-bottom: 2px; margin-bottom: 2px;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 30px; border-radius: 50px; border: none;
  cursor: pointer; font-size: 14px;
  font-family: 'Lato', sans-serif; font-weight: 700;
  letter-spacing: 0.5px; transition: all 0.25s ease; text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-teal), #1f8075);
  color: #fff; box-shadow: 0 6px 20px rgba(42,157,143,0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(42,157,143,0.4); }

.btn-secondary {
  background: transparent; color: var(--text-mid);
  border: 1.5px solid var(--border-mid);
}
.btn-secondary:hover { border-color: var(--accent-teal); color: var(--accent-teal); transform: translateY(-1px); background: rgba(42,157,143,0.05); }

.btn-green {
  background: linear-gradient(135deg, var(--flask-blue), #2863a0);
  color: #fff; box-shadow: 0 6px 20px rgba(58,124,189,0.3);
}
.btn-green:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(58,124,189,0.4); }

.btn-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 32px; position: relative; z-index: 1; }

/* ─── Result Card ─── */
.result-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: clamp(28px, 5vw, 48px);
  box-shadow: var(--shadow-md);
  display: none;
  animation: slideUp 0.6s ease both;
  position: relative;
  overflow: hidden;
}

/* Result top-right: round-bottom flask + crucible */
.result-card::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 270px; height: 290px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 270 290'%3E%3Cg opacity='0.08'%3E%3Ccircle cx='155' cy='192' r='74' fill='none' stroke='%232a9d8f' stroke-width='2.8'/%3E%3Crect x='141' y='76' width='28' height='92' rx='6' fill='none' stroke='%232a9d8f' stroke-width='2.8'/%3E%3Cellipse cx='155' cy='76' rx='26' ry='11' fill='none' stroke='%232a9d8f' stroke-width='2.2'/%3E%3Cpath d='M97 202 Q155 186 213 202' fill='none' stroke='%233a7cbd' stroke-width='2.2' opacity='0.48'/%3E%3Ccircle cx='118' cy='214' r='6.5' fill='%233a7cbd' opacity='0.25'/%3E%3Ccircle cx='155' cy='220' r='5' fill='%233a7cbd' opacity='0.2'/%3E%3Ccircle cx='192' cy='213' r='6' fill='%233a7cbd' opacity='0.22'/%3E%3Ccircle cx='138' cy='226' r='3.5' fill='%233a7cbd' opacity='0.16'/%3E%3Ccircle cx='172' cy='228' r='3' fill='%233a7cbd' opacity='0.16'/%3E%3C/g%3E%3Cg opacity='0.08' transform='translate(10,14)'%3E%3Cpath d='M20 40 L25 92 Q25 108 46 108 Q67 108 67 92 L72 40 Z' fill='none' stroke='%23c97d3a' stroke-width='2.2'/%3E%3Crect x='20' y='34' width='52' height='10' rx='3' fill='none' stroke='%23c97d3a' stroke-width='2'/%3E%3Cpath d='M8 8 Q8 40 22 45' fill='none' stroke='%23c97d3a' stroke-width='2.5' stroke-linecap='round'/%3E%3Cpath d='M82 8 Q82 40 68 45' fill='none' stroke='%23c97d3a' stroke-width='2.5' stroke-linecap='round'/%3E%3Cpath d='M8 8 Q45 2 82 8' fill='none' stroke='%23c97d3a' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M32 118 Q34 130 30 142' fill='none' stroke='%23e76f51' stroke-width='1.6' opacity='0.38' stroke-linecap='round'/%3E%3Cpath d='M46 122 Q48 134 44 146' fill='none' stroke='%23e76f51' stroke-width='1.6' opacity='0.38' stroke-linecap='round'/%3E%3Cpath d='M60 118 Q62 130 58 142' fill='none' stroke='%23e76f51' stroke-width='1.6' opacity='0.38' stroke-linecap='round'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: contain;
  pointer-events: none; z-index: 0;
}

/* Result bottom-left: evaporating dish + spatula */
.result-card::after {
  content: '';
  position: absolute;
  bottom: -10px; left: -10px;
  width: 210px; height: 170px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 210 170'%3E%3Cg opacity='0.08' transform='translate(60,65)'%3E%3Cellipse cx='55' cy='22' rx='53' ry='24' fill='none' stroke='%237b5ea7' stroke-width='2.5'/%3E%3Cellipse cx='55' cy='20' rx='40' ry='15' fill='none' stroke='%237b5ea7' stroke-width='1.4' opacity='0.5'/%3E%3Ccircle cx='42' cy='19' r='4.5' fill='%237b5ea7' opacity='0.28'/%3E%3Ccircle cx='58' cy='21' r='3' fill='%237b5ea7' opacity='0.22'/%3E%3Ccircle cx='70' cy='18' r='3.5' fill='%237b5ea7' opacity='0.25'/%3E%3C/g%3E%3Cg opacity='0.09' transform='translate(10,8)'%3E%3Crect x='15' y='8' width='7' height='110' rx='3' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3Crect x='10' y='118' width='17' height='9' rx='1.5' fill='%233a7cbd' opacity='0.32'/%3E%3Crect x='8' y='127' width='21' height='5' rx='1' fill='none' stroke='%233a7cbd' stroke-width='1.5'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: contain;
  pointer-events: none; z-index: 0;
}

.result-card.active { display: block; }

.result-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem; color: var(--text-soft);
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 10px;
  position: relative; z-index: 1;
}

.result-title::after { content: ''; flex: 1; height: 1px; background: var(--border-light); }

.result-sample-info { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 32px; position: relative; z-index: 1; }

.info-chip {
  background: var(--lab-paper); border: 1px solid var(--border-light);
  border-radius: 8px; padding: 8px 16px; font-size: 13px; color: var(--ink-mid);
}

.info-chip span {
  font-family: 'DM Mono', monospace; font-size: 10px;
  letter-spacing: 1px; color: var(--text-soft);
  text-transform: uppercase; display: block; margin-bottom: 2px;
}

.result-big {
  text-align: center;
  padding: 44px 20px;
  background: linear-gradient(135deg, #e8f4f2, #eef5fb);
  border-radius: 16px;
  margin-bottom: 28px;
  border: 1.5px solid rgba(42,157,143,0.2);
  position: relative; overflow: hidden; z-index: 1;
}

.result-big::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 110%, rgba(42,157,143,0.1), transparent 65%);
  pointer-events: none;
}

/* Small conical flask icon bottom-left of result box */
.result-big::after {
  content: '';
  position: absolute; left: 12px; bottom: 8px;
  width: 65px; height: 65px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 65 65'%3E%3Cg opacity='0.15'%3E%3Cellipse cx='32' cy='13' rx='11' ry='5' fill='none' stroke='%232a9d8f' stroke-width='2'/%3E%3Crect x='27' y='13' width='10' height='20' rx='2' fill='none' stroke='%232a9d8f' stroke-width='2'/%3E%3Cpath d='M27 33 L9 58 Q9 64 21 64 L43 64 Q55 64 55 58 L37 33 Z' fill='none' stroke='%232a9d8f' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M12 57 Q32 51 52 57' fill='none' stroke='%232a9d8f' stroke-width='1.5' opacity='0.5'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: contain;
  pointer-events: none;
}

.result-label { font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--text-soft); margin-bottom: 16px; position: relative; }
.result-value { font-family: 'Playfair Display', serif; font-size: clamp(3rem, 12vw, 5.5rem); font-weight: 700; color: var(--accent-teal); line-height: 1; text-shadow: 0 2px 20px rgba(42,157,143,0.2); position: relative; }
.result-unit { font-family: 'DM Mono', monospace; font-size: 14px; color: var(--text-soft); margin-top: 10px; letter-spacing: 2px; }

.interpretation { border-radius: 12px; padding: 18px 22px; margin-bottom: 28px; border-left: 3px solid; position: relative; z-index: 1; }
.interp-title { font-size: 10px; font-family: 'DM Mono', monospace; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 6px; }
.interp-text { font-size: 14px; line-height: 1.65; color: var(--ink-mid); }

.breakdown-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 28px; position: relative; z-index: 1; }
@media (max-width: 480px) { .breakdown-grid { grid-template-columns: 1fr; } }

.breakdown-item { background: var(--lab-paper); border: 1px solid var(--border-light); border-radius: 12px; padding: 16px; text-align: center; }
.breakdown-item .bi-label { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 1.5px; color: var(--text-soft); text-transform: uppercase; margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.breakdown-item .bi-val { font-size: 18px; font-weight: 700; color: var(--ink-dark); font-family: 'DM Mono', monospace; }

/* ─── History ─── */
.history-section { margin-top: 48px; display: none; position: relative; }

/* History: test tube rack watermark (right side) */
.history-section::before {
  content: '';
  position: absolute;
  top: 28px; right: -40px;
  width: 190px; height: 140px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 190 140'%3E%3Cg opacity='0.09'%3E%3Crect x='5' y='98' width='180' height='11' rx='3' fill='%233a7cbd' opacity='0.38'/%3E%3Crect x='5' y='50' width='180' height='7' rx='3' fill='%233a7cbd' opacity='0.26'/%3E%3Crect x='16' y='5' width='16' height='78' rx='8' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3Crect x='46' y='5' width='16' height='78' rx='8' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3Crect x='76' y='5' width='16' height='78' rx='8' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3Crect x='106' y='5' width='16' height='78' rx='8' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3Crect x='136' y='5' width='16' height='78' rx='8' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3Crect x='166' y='5' width='16' height='78' rx='8' fill='none' stroke='%233a7cbd' stroke-width='2'/%3E%3Crect x='16' y='52' width='16' height='31' rx='8' fill='%232a9d8f' opacity='0.27'/%3E%3Crect x='46' y='42' width='16' height='41' rx='8' fill='%23e76f51' opacity='0.22'/%3E%3Crect x='76' y='58' width='16' height='25' rx='8' fill='%237b5ea7' opacity='0.25'/%3E%3Crect x='106' y='46' width='16' height='37' rx='8' fill='%232a9d8f' opacity='0.2'/%3E%3Crect x='136' y='35' width='16' height='48' rx='8' fill='%23e76f51' opacity='0.18'/%3E%3Crect x='166' y='50' width='16' height='33' rx='8' fill='%237b5ea7' opacity='0.22'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: contain;
  pointer-events: none; z-index: 0;
}

.history-section.has-items { display: block; }

.history-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem; color: var(--text-soft);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
  position: relative; z-index: 1;
}
.history-title::after { content: ''; flex: 1; height: 1px; background: var(--border-light); }

.history-list { display: flex; flex-direction: column; gap: 10px; position: relative; z-index: 1; }

.history-item {
  background: #ffffff; border: 1px solid var(--border-light);
  border-radius: 12px; padding: 16px 20px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  animation: slideUp 0.3s ease both;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}
.history-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

.hi-name { font-weight: 700; font-size: 14px; flex: 1; min-width: 120px; color: var(--ink-dark); }
.hi-result { font-family: 'DM Mono', monospace; font-size: 18px; color: var(--accent-teal); font-weight: 500; }
.hi-unit { font-size: 10px; color: var(--text-soft); font-family: 'DM Mono', monospace; letter-spacing: 1px; }
.hi-vals { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text-soft); letter-spacing: 0.5px; }

/* ─── Error ─── */
.error-msg { background: rgba(200,75,49,0.08); border: 1px solid rgba(200,75,49,0.25); border-radius: 8px; padding: 10px 16px; font-size: 13px; color: var(--accent-red); margin-top: 12px; display: none; }
.error-msg.show { display: block; }

/* ─── Misc ─── */
.deco-line { text-align: center; margin: 20px 0; font-size: 18px; color: var(--border-mid); letter-spacing: 8px; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--lab-paper); }
::-webkit-scrollbar-thumb { background: rgba(42,157,143,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(42,157,143,0.5); }
