.lab-calc {
  padding-block: clamp(44px,6.8vw,96px);
  background: radial-gradient(ellipse at 90% 20%,#e9e2f2,transparent 55%),#f2eff5;
  border-top: 1px solid #d6cfdf;
}
.calc-heading { max-width: 760px; margin-bottom: clamp(20px,3vw,36px); }
.calc-heading h2 { margin: 12px 0; font-size: clamp(2.35rem,4.6vw,4.9rem); line-height: 1.05; letter-spacing: -.057em; }
.calc-heading h2 em { color: #694a83; font: italic 400 1.05em/1 Georgia,serif; font-synthesis: style; }
.calc-heading>p:last-child { color: #554d60; max-width: 66ch; font-size: 1.06rem; }
.calc-console {
  display: grid; grid-template-columns: 1.03fr 1fr; border-radius: 22px;
  background: #fff; box-shadow: 0 18px 48px #2b1b3e14; border: 1px solid #d1c7d9;
  overflow: hidden; isolation: isolate;
}
.calc-form,.calc-readout { padding: clamp(22px,3.5vw,50px); min-width: 0; }
.calc-form h3 { font-size: clamp(1.3rem,2vw,1.7rem); line-height: 1.2; margin: 0 0 22px; letter-spacing: -.035em; }
.calc-form label,.calc-form legend { display: block; font-weight: 650; font-size: .95rem; color: #362d3f; margin: 0 0 6px; }
.calc-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-bottom: 16px; }
.calc-fields > div { display: flex; flex-direction: column; }
.calc-fields .calc-input { margin-top: auto; }
.calc-input,.calc-target select {
  display: flex; align-items: center; min-height: 48px; background: #faf8fc;
  border: 1px solid #bcb0c7; border-radius: 9px; color: #33283f;
}
.calc-input:focus-within,.calc-target select:focus-visible { outline: 2px solid #865ca9; outline-offset: 2px; }
.calc-input:has(input[aria-invalid=true]) { border-color: #a34840; }
.calc-input span { padding-right: 13px; color: #66586e; font-weight: 650; }
.calc-input input { appearance: none; min-width: 0; width: 100%; min-height: 46px; padding: 8px 13px; background: transparent; border: 0; color: #302737; font: inherit; }
.calc-input input:focus-visible { outline: 0; }
.calc-input input::placeholder { color: #776f7d; }
.calc-target { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.calc-target select {
  appearance: none; min-width: 80px; padding: 8px 30px 8px 12px; font: inherit; font-weight: 650;
  background: linear-gradient(45deg,transparent 50%,#795f8c 50%) right 17px center/5px 5px no-repeat,
    linear-gradient(135deg,#795f8c 50%,transparent 50%) right 12px center/5px 5px no-repeat,#f4eff8;
}
.calc-tip { margin-top: 5px; color: #645a6c; font-size: .875rem; }
.calc-capacity { margin: 21px 0 10px; padding: 0; border: 0; min-width: 0; }
.calc-capacity legend { padding: 0; }
.calc-options { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.calc-options label { display: block; margin: 0; position: relative; }
.calc-options input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.calc-options span { cursor: pointer; min-height: 44px; border-radius: 9px; border: 1px solid #c9bdd3; display: grid; place-items: center; color: #54435d; transition: background .2s,color .2s; }
.calc-options input:checked+span { background: #49345d; border-color: #49345d; color: #fff; }
.calc-options input:focus-visible+span { outline: 2px solid #9368b2; outline-offset: 2px; }
.calc-options label > span { align-content: center; gap: .15rem; padding: .45rem .2rem; line-height: 1.2; }
.calc-options small { font-size: .875rem; font-weight: 400; }
.calc-extra { border-bottom: 1px solid #ddd4e4; padding-bottom: 5px; }
.calc-extra summary,.calc-math summary,.calc-reset { cursor: pointer; padding-block: 12px; min-height: 44px; font-size: .94rem; font-weight: 640; }
.calc-extra summary::marker,.calc-math summary::marker { color: #885ca3; }
.calc-extra[open] { padding-bottom: 15px; }
.calc-extra .calc-input { max-width: 200px; }
.calc-reset { text-decoration: underline; text-underline-offset: 4px; color: #654577; }
.calc-readout {
  position: relative; isolation: isolate; color: #f7f2ff;
  background: radial-gradient(ellipse at 115% 3%,#604375 0%,transparent 54%),linear-gradient(138deg,#241c30,#18131f);
}
.calc-readout::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .17; background-image: radial-gradient(#cfb3de 1px,transparent 1px); background-size: 15px 15px; mask-image: linear-gradient(220deg,#000,transparent 40%); }
.calc-readout h3 { color: #eedbfd; font-size: 1rem; font-weight: 590; }
.calc-main-value { margin-top: 3px; line-height: 1.13; letter-spacing: -.055em; overflow-wrap: anywhere; }
.calc-main-value strong { font-size: clamp(2.55rem,4.8vw,4.6rem); font-weight: 570; font-variant-numeric: tabular-nums; }
.calc-main-value span { color: #cab0db; font-size: 1.38rem; letter-spacing: normal; }
.calc-ruler { --mark: 0%; --ticks: 100; margin: 19px 0 17px; }
.calc-track { height: 34px; position: relative; border: 1px solid #84738c; border-radius: 5px; overflow: hidden; background: #ffffff08; }
.calc-fill { height: 100%; width: var(--mark); background: linear-gradient(90deg,#82669b,#d6b4ed 86%,#edd6a9); transition: width .32s ease; }
.calc-ruler:not(.has-reading) .calc-fill { visibility: hidden; }
.calc-ticks { position: absolute; inset: 0; background-image: linear-gradient(to right,#d9cce0a6 1px,transparent 1px),linear-gradient(to right,#c3b4d0a6 1px,transparent 1px); background-size: calc(100% / var(--ticks) * 10) 64%,calc(100% / var(--ticks)) 26%; background-repeat: repeat-x; background-position: left bottom; }
.calc-endpoints { margin-top: 4px; display: flex; justify-content: space-between; color: #dacbdf; font-size: .84rem; font-variant-numeric: tabular-nums; }
.calc-metrics { margin: 0; }
.calc-metrics>div { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; column-gap: 15px; padding: 10px 0; border-bottom: 1px solid #ffffff25; }
.calc-metrics dt { color: #dfd3e6; font-size: .94rem; }
.calc-metrics dd { margin: 0; font-size: 1.04rem; font-weight: 650; overflow-wrap: anywhere; }
.calc-status { margin: 16px 0; min-height: 2.8em; font-size: .94rem; color: #e7dceb; }
.calc-status.attention { color: #ffdaa5; }
.calc-copy { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; padding: 7px 14px; border: 1px solid #c0a9cb; border-radius: 9px; color: #2f1c39; background: #e9d4f5; }
.calc-copy:disabled { background: transparent; color: #c4b5cc; border-color: #72657e; }
#lab-copied:not(:empty) { margin-top: 8px; }
#lab-copy-text { width: 100%; color: #221b2b; margin-top: 8px; }
.calc-math { color: #54445e; margin-top: 12px; }
.calc-math p { margin: 4px 0 12px; max-width: 76ch; }
@media (max-width:780px) {
  .calc-console { grid-template-columns: 1fr; }
  .calc-heading { margin-bottom: 18px; }
  .calc-status { min-height: 0; }
}
@media (max-width:410px) {
  .calc-form,.calc-readout { padding: 20px 16px; }
  .calc-fields { gap: 9px; }
  .calc-fields label { font-size: .9rem; }
}
