.calc-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1rem 5rem;
  color: #ededed;
}

.calc-heading {
  max-width: 880px;
  margin-bottom: 1.5rem;
}

.calc-kicker {
  color: #00abf0;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 0.35rem;
}

.calc-heading p {
  color: #d9e2ee;
  max-width: 760px;
}

.calc-stage {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}

.calc-layout {
  font-size: 1.05rem;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 27, 41, 0.78);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  overflow: hidden;
}

.calc-side-image {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 100%;
  text-align: center;
}

.calc-side-image img {
  width: min(18vw, 48px);
  height: auto;
  border-radius: 8px;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.28));
}

.calc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.18);
}

.calc-tab {
  appearance: none;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: #dbe7f3;
  font-weight: 700;
  font-size: 0.94rem;
  line-height: 1.2;
  padding: 0.8rem 0.9rem;
  cursor: pointer;
  flex: 1 1 132px;
  min-height: 58px;
}

.calc-tab-break {
  flex-basis: 100%;
  height: 0;
}

.calc-tab:hover,
.calc-tab.is-active {
  color: #081b29;
  background: #00abf0;
}

.calc-tab:disabled {
  cursor: not-allowed;
  color: rgba(237, 237, 237, 0.45);
  background: transparent;
}

.calc-panel {
  display: none;
  padding: 1.25rem;
}

.calc-panel.is-active {
  display: block;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  margin-bottom: 1rem;
}

.panel-head h2 {
  font-size: 1.35rem;
  margin: 0;
}

.panel-head span {
  color: #9ecfe8;
  font-size: 0.9rem;
}

.calc-form {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(190px, 1.3fr) minmax(120px, 1fr) auto;
  gap: 0.85rem;
  align-items: end;
}

.calc-subsection-title {
  color: #9ecfe8;
  font-size: 0.95rem;
  font-weight: 800;
  margin: 0.35rem 0 0.75rem;
}

.result-grid + .calc-subsection-title {
  margin-top: 1.35rem;
}

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

.speed-form button {
  justify-self: start;
  min-width: 140px;
}

.reacting-air-form {
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
}

.reacting-normal-shock-form {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.reacting-oblique-shock-form {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.normal-shock-dimensional-form {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.oblique-shock-dimensional-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.normal-shock-dimensional-form button,
.oblique-shock-dimensional-form button {
  justify-self: start;
  min-width: 120px;
}

.reacting-normal-shock-form button,
.reacting-oblique-shock-form button {
  justify-self: start;
  min-width: 120px;
}

.oblique-shock-form {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
}

.mw-field.is-hidden {
  display: none;
}

.calc-form label {
  display: grid;
  gap: 0.35rem;
  color: #cde0ee;
  font-size: 1rem;
  font-weight: 600;
  min-width: 0;
}

.calc-form label > span {
  white-space: nowrap;
}

.calc-form input,
.calc-form select {
  width: 100%;
  box-sizing: border-box;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  padding: 0.55rem 0.65rem;
}

.calc-form select option {
  color: #081b29;
}

.calc-form button {
  min-height: 42px;
  border: 2px solid #00abf0;
  border-radius: 6px;
  background: #00abf0;
  color: #081b29;
  font-weight: 800;
  padding: 0.55rem 1rem;
  cursor: pointer;
}

.calc-form button:hover {
  background: transparent;
  color: #00abf0;
}

.calc-error {
  min-height: 1.4rem;
  margin: 0.8rem 0 0;
  color: #ffb36b;
  font-weight: 700;
}

.calc-note {
  margin: 0.85rem 0 0;
  color: #b8d2e5;
  font-size: 0.95rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.75rem;
}

.oblique-shock-dimensional-form + .calc-error + .result-grid {
  margin-top: 1.65rem;
}

.result-item {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.8rem;
  min-height: 82px;
}

.result-item.starts-new-row {
  grid-column-start: 1;
}

.result-row-gap {
  grid-column: 1 / -1;
  min-height: 0.5rem;
}

.result-branch-label {
  grid-column: 1 / -1;
  color: #9ecfe8;
  font-size: 0.9rem;
  font-weight: 800;
  margin: 0.55rem 0 -0.2rem;
}

.gas-properties-label {
  margin-top: 1.15rem;
}

.result-label {
  display: block;
  color: #9ecfe8;
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.result-label sub,
.result-label sup {
  font-size: 0.68em;
  line-height: 0;
}

.result-value {
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.reacting-air-results {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
}

.reacting-summary-grid,
.species-grid {
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}

.species-grid {
  margin-top: 0.7rem;
}

.species-grid .result-item {
  min-height: 74px;
  padding: 0.68rem;
}

.result-section-label {
  grid-column: 1 / -1;
  color: #9ecfe8;
  font-size: 0.9rem;
  font-weight: 800;
  margin: 0.35rem 0 -0.15rem;
}

.species-grid .result-label {
  font-size: 0.82rem;
}

.species-grid .result-value {
  font-size: 0.98rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .speed-form,
  .reacting-air-form,
  .reacting-normal-shock-form,
  .reacting-oblique-shock-form,
  .oblique-shock-form,
  .calc-form,
  .result-grid,
  .species-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reacting-oblique-shock-form button,
  .reacting-normal-shock-form button {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 620px) {
  .calc-tabs {
    overflow-x: visible;
  }

  .calc-side-image {
    justify-content: center;
  }

  .calc-side-image img {
    width: min(22vw, 44px);
  }

  .calc-form,
  .speed-form,
  .reacting-air-form,
  .reacting-normal-shock-form,
  .reacting-oblique-shock-form,
  .oblique-shock-form,
  .result-grid,
  .species-grid {
    grid-template-columns: 1fr;
  }

  .panel-head {
    display: block;
  }
}
