:root {
  --navy-950: #061326;
  --navy-900: #091d38;
  --navy-800: #12345a;
  --blue: #2f6bff;
  --blue-soft: #eaf0ff;
  --turquoise: #22c9bd;
  --turquoise-dark: #087e78;
  --turquoise-soft: #e4fbf8;
  --orange: #ff8f43;
  --orange-dark: #c94f0a;
  --orange-soft: #fff0e6;
  --yellow: #ffc857;
  --ink: #10243f;
  --muted: #62748b;
  --line: #dbe5ef;
  --surface: #ffffff;
  --page: #eef4f9;
  --danger: #c43535;
  --success: #087e5a;
  --shadow-lg: 0 28px 70px rgba(2, 18, 39, 0.2);
  --shadow-md: 0 14px 35px rgba(11, 35, 64, 0.12);
  --radius-lg: 26px;
  --radius-md: 18px;
  color-scheme: light;
  font-family:
    Inter, ui-rounded, "Avenir Next", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--navy-950);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 12%, rgba(34, 201, 189, 0.2), transparent 27rem),
    radial-gradient(circle at 91% 7%, rgba(47, 107, 255, 0.2), transparent 25rem),
    linear-gradient(165deg, var(--navy-950) 0%, #0b2341 43%, #0b1c35 100%);
}

button,
input {
  font: inherit;
}

button,
label,
input[type="radio"] {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
label:has(input:focus-visible) {
  outline: 3px solid rgba(47, 107, 255, 0.42);
  outline-offset: 3px;
}

sup,
sub {
  line-height: 0;
}

.page-glow {
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(3px);
}

.page-glow-one {
  top: 12vh;
  left: -11rem;
  width: 24rem;
  height: 24rem;
  border: 1px solid rgba(54, 216, 204, 0.18);
}

.page-glow-two {
  right: -8rem;
  bottom: 8vh;
  width: 18rem;
  height: 18rem;
  border: 1px solid rgba(255, 147, 72, 0.15);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 22px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 22px;
  color: #fff;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.brand-mark svg {
  width: 43px;
  height: 43px;
  overflow: visible;
}

.brand-mark ellipse {
  fill: none;
  stroke: var(--turquoise);
  stroke-width: 2.4;
}

.brand-mark .atom-core {
  fill: var(--orange);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-title {
  font-size: clamp(1.18rem, 2.2vw, 1.55rem);
  font-weight: 850;
  letter-spacing: -0.035em;
}

.brand-subtitle {
  margin-top: 6px;
  color: #80e5df;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.constants {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 11px 17px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.constant-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  white-space: nowrap;
}

.constant-label {
  color: #a7bbcf;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.constant-item strong {
  color: #fff;
  font-size: 0.93rem;
}

.constant-divider {
  width: 1px;
  height: 30px;
  background: rgba(255, 255, 255, 0.15);
}

main {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 32px;
  background: var(--page);
  box-shadow: var(--shadow-lg);
}

.setup-panel {
  padding: 30px 34px 32px;
  border-bottom: 1px solid #d6e2ed;
  background:
    linear-gradient(90deg, rgba(47, 107, 255, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(47, 107, 255, 0.035) 1px, transparent 1px),
    #fff;
  background-size: 26px 26px;
}

.setup-heading,
.map-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  margin-bottom: 0;
  color: var(--navy-900);
  letter-spacing: -0.035em;
}

h1 {
  font-size: clamp(1.55rem, 2.6vw, 2rem);
}

h2 {
  font-size: clamp(1.45rem, 2.3vw, 1.82rem);
}

.answer-mode {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #d7e3ed;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.82);
  font-size: 0.79rem;
  font-weight: 750;
  white-space: nowrap;
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  gap: 22px;
  margin-top: 25px;
}

.setup-step {
  min-width: 0;
  margin: 0;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 22px rgba(11, 35, 64, 0.055);
}

fieldset.setup-step {
  min-inline-size: 0;
}

.step-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  margin: 0 0 15px;
  padding: 0;
  border: 0;
  color: var(--navy-900);
  font-size: 0.92rem;
  font-weight: 800;
}

.step-heading > div,
.step-heading > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.step-number {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--navy-900);
  font-size: 0.78rem;
  box-shadow: 0 6px 13px rgba(9, 29, 56, 0.2);
}

.step-hint {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 550;
}

.legend-label {
  font-size: 0.92rem;
  font-weight: 800;
}

.formula-control {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(130px, 0.65fr);
  gap: 10px;
}

.formula-entry-wrap {
  position: relative;
}

.formula-input {
  width: 100%;
  height: 60px;
  padding: 0 48px 0 17px;
  border: 2px solid #cbd8e4;
  border-radius: 14px;
  color: var(--navy-900);
  background: #fff;
  font-size: 1.2rem;
  font-weight: 750;
  letter-spacing: 0.025em;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.formula-input::placeholder {
  color: #9aabba;
}

.formula-input:hover {
  border-color: #aebfd0;
}

.formula-input:focus {
  border-color: var(--blue);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(47, 107, 255, 0.12);
}

.formula-input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(196, 53, 53, 0.09);
}

.formula-clear {
  position: absolute;
  top: 50%;
  right: 12px;
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  transform: translateY(-50%);
  place-items: center;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: #edf2f6;
}

.formula-clear[hidden] {
  display: none;
}

.formula-clear:hover {
  color: var(--navy-900);
  background: #e2eaf1;
}

.formula-clear svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.formula-preview-wrap {
  display: flex;
  min-width: 0;
  height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 0 16px;
  border: 1px solid #bce9e5;
  border-radius: 14px;
  background: var(--turquoise-soft);
}

.preview-label {
  color: var(--turquoise-dark);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.formula-preview {
  overflow: hidden;
  color: var(--navy-900);
  font-size: clamp(1.3rem, 2.3vw, 1.72rem);
  font-weight: 850;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.formula-preview sub {
  font-size: 0.63em;
}

.field-feedback {
  min-height: 17px;
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.field-feedback.is-error {
  color: var(--danger);
  font-weight: 650;
}

.field-feedback.is-valid {
  color: var(--success);
  font-weight: 650;
}

.state-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.state-option {
  position: relative;
  display: flex;
  min-height: 74px;
  align-items: center;
  gap: 9px;
  padding: 11px;
  overflow: hidden;
  border: 2px solid #d7e2ec;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.state-option:hover {
  transform: translateY(-1px);
  border-color: #aac1d6;
}

.state-option:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.state-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.state-icon {
  position: relative;
  display: block;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 11px;
  background: #eef4f8;
}

.state-icon i {
  position: absolute;
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue);
}

.solid-icon i:nth-child(1) { left: 8px; top: 8px; }
.solid-icon i:nth-child(2) { left: 17px; top: 8px; }
.solid-icon i:nth-child(3) { left: 26px; top: 8px; }
.solid-icon i:nth-child(4) { left: 8px; top: 17px; }
.solid-icon i:nth-child(5) { left: 17px; top: 17px; }
.solid-icon i:nth-child(6) { left: 26px; top: 17px; }
.solid-icon i:nth-child(7) { left: 8px; top: 26px; }
.solid-icon i:nth-child(8) { left: 17px; top: 26px; }
.solid-icon i:nth-child(9) { left: 26px; top: 26px; }

.liquid-icon i:nth-child(1) { left: 8px; top: 25px; }
.liquid-icon i:nth-child(2) { left: 17px; top: 26px; }
.liquid-icon i:nth-child(3) { left: 27px; top: 24px; }
.liquid-icon i:nth-child(4) { left: 12px; top: 17px; }
.liquid-icon i:nth-child(5) { left: 23px; top: 16px; }
.liquid-icon i:nth-child(6) { left: 7px; top: 9px; }
.liquid-icon i:nth-child(7) { left: 29px; top: 8px; }

.gas-icon i:nth-child(1) { left: 7px; top: 7px; }
.gas-icon i:nth-child(2) { right: 7px; top: 9px; }
.gas-icon i:nth-child(3) { left: 16px; top: 18px; }
.gas-icon i:nth-child(4) { left: 8px; bottom: 7px; }
.gas-icon i:nth-child(5) { right: 6px; bottom: 6px; }

.state-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.state-copy strong {
  color: var(--navy-900);
  font-size: 0.84rem;
}

.state-copy span {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 700;
}

.state-check {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  width: 18px;
  height: 18px;
  transform: scale(0.65);
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  opacity: 0;
  transition: opacity 150ms ease, transform 150ms ease;
}

.state-option:has(input:checked) .state-check {
  transform: scale(1);
  opacity: 1;
}

.state-check svg {
  width: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.state-feedback {
  margin-bottom: -3px;
}

.map-section {
  position: relative;
  padding: 31px 34px 30px;
  background:
    radial-gradient(circle at 50% 34%, rgba(47, 107, 255, 0.075), transparent 17rem),
    linear-gradient(180deg, #eef4f9 0%, #f6f9fc 100%);
}

.map-heading {
  position: relative;
  z-index: 3;
}

.map-heading > p {
  max-width: 410px;
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: right;
}

.map-heading > p strong {
  color: var(--navy-900);
}

.map-stage {
  position: relative;
  height: 505px;
  max-width: 1120px;
  margin: 26px auto 5px;
}

.map-connectors {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.connector-line {
  fill: none;
  stroke: #b9c9d9;
  stroke-linecap: round;
  stroke-width: 3;
  stroke-dasharray: 8 9;
  transition: stroke 350ms ease, stroke-dasharray 350ms ease;
}

.connector-pulse {
  fill: var(--turquoise);
  opacity: 0;
}

.map-stage.has-results .connector-line {
  stroke: url(#lineGradient);
  stroke-dasharray: 0;
}

.map-stage.has-results .connector-pulse {
  opacity: 1;
  animation: connectorGlow 1.9s ease-in-out infinite;
}

.quantity-card {
  --card-color: var(--blue);
  position: absolute;
  z-index: 2;
  display: flex;
  width: 350px;
  height: 150px;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 18px;
  overflow: hidden;
  border: 2px solid #d7e2ec;
  border-radius: 21px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.quantity-card:hover:not(.is-unavailable) {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--card-color) 55%, #d7e2ec);
  box-shadow: 0 18px 38px rgba(11, 35, 64, 0.16);
}

.quantity-card.is-source {
  transform: translateY(-3px);
  border-color: var(--card-color);
  box-shadow:
    0 18px 38px rgba(11, 35, 64, 0.16),
    0 0 0 5px color-mix(in srgb, var(--card-color) 11%, transparent);
}

.quantity-card.is-calculated:not(.is-source) {
  border-color: color-mix(in srgb, var(--card-color) 48%, #d7e2ec);
}

.card-accent {
  position: absolute;
  top: 0;
  left: 22px;
  width: 44px;
  height: 4px;
  border-radius: 0 0 5px 5px;
  background: var(--card-color);
}

.volume-card {
  --card-color: var(--blue);
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.volume-card:hover:not(.is-unavailable),
.volume-card.is-source {
  transform: translateX(-50%) translateY(-3px);
}

.moles-card {
  --card-color: var(--turquoise);
  top: 176px;
  left: 50%;
  width: 368px;
  transform: translateX(-50%);
  border-color: #183d65;
  color: #fff;
  background:
    radial-gradient(circle at 85% 20%, rgba(54, 216, 204, 0.21), transparent 8rem),
    linear-gradient(145deg, var(--navy-900), #0b294e);
  box-shadow: 0 20px 44px rgba(4, 23, 47, 0.26);
}

.moles-card:hover,
.moles-card.is-source {
  transform: translateX(-50%) translateY(-3px);
  border-color: var(--turquoise);
  box-shadow:
    0 22px 46px rgba(4, 23, 47, 0.3),
    0 0 0 5px rgba(34, 201, 189, 0.12);
}

.particles-card {
  --card-color: var(--turquoise-dark);
  bottom: 0;
  left: 2.5%;
  width: min(380px, 38%);
}

.mass-card {
  --card-color: var(--orange);
  right: 2.5%;
  bottom: 0;
  width: min(380px, 38%);
}

.quantity-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.quantity-number {
  color: #8192a5;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.moles-card .quantity-number {
  color: #8fb0ca;
}

.source-choice {
  position: relative;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.71rem;
  font-weight: 800;
}

.source-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.choice-dot {
  position: relative;
  display: block;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  border: 2px solid #aebdcb;
  border-radius: 50%;
  background: #fff;
}

.source-choice input:checked + .choice-dot {
  border-color: var(--card-color);
}

.source-choice input:checked + .choice-dot::after {
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--card-color);
  content: "";
}

.moles-card .source-choice {
  color: #bdd0e1;
}

.moles-card .choice-dot {
  border-color: #6e91ad;
  background: #12345a;
}

.moles-card .source-choice input:checked + .choice-dot {
  border-color: var(--turquoise);
}

.quantity-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.quantity-icon {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  color: var(--card-color);
  background: color-mix(in srgb, var(--card-color) 11%, #fff);
}

.quantity-icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.particles-icon svg circle {
  fill: currentColor;
  stroke: none;
}

.moles-card .quantity-icon {
  color: var(--turquoise);
  background: rgba(54, 216, 204, 0.12);
}

.moles-icon svg circle {
  fill: var(--orange);
  stroke: none;
}

.moles-icon svg ellipse {
  stroke: currentColor;
}

.quantity-kicker {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.moles-card .quantity-kicker {
  color: #8fb0ca;
}

.quantity-card h3 {
  margin: 0;
  color: var(--navy-900);
  font-size: 1.02rem;
  letter-spacing: -0.018em;
}

.moles-card h3 {
  color: #fff;
}

.value-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 39px;
  align-items: center;
  overflow: hidden;
  border: 1px solid #d6e1ea;
  border-radius: 11px;
  background: #f7fafc;
}

.quantity-card.is-source .value-shell {
  border-color: var(--card-color);
  background: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--card-color) 10%, transparent);
}

.moles-card .value-shell {
  border-color: #2a4b6d;
  background: rgba(2, 17, 35, 0.38);
}

.moles-card.is-source .value-shell {
  border-color: var(--turquoise);
  background: rgba(255, 255, 255, 0.08);
}

.quantity-input,
.quantity-output {
  min-width: 0;
  width: 100%;
  height: 38px;
  margin: 0;
  padding: 0 12px;
  overflow: hidden;
  border: 0;
  color: var(--navy-900);
  background: transparent;
  font-size: 1.03rem;
  font-weight: 820;
  line-height: 38px;
  outline: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quantity-input {
  display: none;
}

.quantity-card.is-source .quantity-input {
  display: block;
}

.quantity-card.is-source .quantity-output {
  display: none;
}

.quantity-input::placeholder {
  color: #9aabba;
  font-size: 0.82rem;
  font-weight: 650;
}

.moles-card .quantity-input,
.moles-card .quantity-output {
  color: #fff;
}

.moles-card .quantity-input::placeholder {
  color: #88a4bb;
}

.quantity-output.is-placeholder {
  color: #a4b1be;
  font-weight: 650;
}

.scientific-output {
  font-size: 0.99rem;
}

.scientific-output sup {
  font-size: 0.69em;
}

.quantity-unit {
  align-self: stretch;
  display: flex;
  min-width: 43px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-left: 1px solid #d6e1ea;
  color: var(--muted);
  background: #edf3f7;
  font-size: 0.74rem;
  font-weight: 850;
  white-space: nowrap;
}

.moles-card .quantity-unit {
  border-color: #2a4b6d;
  color: #bcd0e2;
  background: rgba(255, 255, 255, 0.07);
}

.mole-orbits {
  position: absolute;
  right: -18px;
  bottom: -44px;
  width: 130px;
  height: 130px;
  opacity: 0.12;
  pointer-events: none;
}

.mole-orbits span {
  position: absolute;
  top: 53px;
  left: 17px;
  width: 96px;
  height: 25px;
  transform: rotate(25deg);
  border: 3px solid var(--turquoise);
  border-radius: 50%;
}

.mole-orbits span:nth-child(2) {
  transform: rotate(95deg);
}

.mole-orbits i {
  position: absolute;
  top: 59px;
  left: 58px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--orange);
}

.quantity-card.is-unavailable {
  cursor: not-allowed;
  opacity: 0.58;
  box-shadow: 0 9px 25px rgba(11, 35, 64, 0.08);
}

.quantity-card.is-unavailable .source-choice {
  cursor: not-allowed;
}

.unavailable-note {
  position: absolute;
  right: 18px;
  bottom: 20px;
  left: 18px;
  display: flex;
  min-height: 39px;
  align-items: center;
  justify-content: center;
  margin: 0;
  border: 1px dashed #aab9c7;
  border-radius: 11px;
  color: #64778a;
  background: rgba(241, 245, 248, 0.96);
  font-size: 0.76rem;
  font-weight: 750;
}

.volume-card:not(.is-unavailable) .unavailable-note {
  display: none;
}

.calculation-feedback {
  display: flex;
  min-height: 0;
  max-width: 690px;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.4;
  text-align: center;
  transition: min-height 180ms ease, margin 180ms ease;
}

.calculation-feedback:not(:empty) {
  min-height: 42px;
  margin-top: 11px;
  padding: 9px 14px;
  border: 1px solid #cbd9e5;
  border-radius: 13px;
  background: #fff;
}

.calculation-feedback.is-error {
  border-color: #efc2c2;
  color: var(--danger);
  background: #fff7f7;
}

.calculation-feedback.is-success {
  border-color: #bce8d9;
  color: var(--success);
  background: #f2fcf8;
}

.action-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  margin-top: 17px;
}

.reset-button,
.start-button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 22px;
  border-radius: 15px;
  font-weight: 850;
  letter-spacing: 0.02em;
}

.reset-button {
  border: 1px solid #cbd8e3;
  color: var(--muted);
  background: #fff;
}

.reset-button:hover {
  color: var(--navy-900);
  border-color: #aebfd0;
  background: #f9fbfd;
}

.start-button {
  min-width: 190px;
  border: 1px solid #d95f16;
  color: #fff;
  background: linear-gradient(135deg, #ff9a4d, #f57527);
  box-shadow: 0 13px 25px rgba(230, 100, 28, 0.27);
  text-shadow: 0 1px 0 rgba(125, 49, 6, 0.25);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.start-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 17px 30px rgba(230, 100, 28, 0.33);
  filter: saturate(1.06);
}

.start-button:active {
  transform: translateY(0);
}

.reset-button svg,
.start-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 5px 0;
  color: #9eb2c7;
  font-size: 0.76rem;
}

.app-footer p {
  margin: 0;
  color: #d1dfec;
  font-weight: 700;
}

.app-footer span {
  text-align: right;
}

@keyframes connectorGlow {
  0%, 100% {
    opacity: 0.35;
    r: 4px;
  }
  50% {
    opacity: 1;
    r: 7px;
  }
}

@media (max-width: 980px) {
  .setup-grid {
    grid-template-columns: 1fr;
  }

  .state-step {
    max-width: none;
  }

  .particles-card,
  .mass-card {
    width: 41%;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 24px, 720px);
    padding-top: 16px;
  }

  .app-header {
    align-items: flex-start;
  }

  .constants {
    gap: 12px;
    padding: 9px 12px;
  }

  .constant-item:nth-of-type(2),
  .constant-divider {
    display: none;
  }

  main {
    border-radius: 25px;
  }

  .setup-panel,
  .map-section {
    padding-right: 22px;
    padding-left: 22px;
  }

  .map-stage {
    display: grid;
    height: auto;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
  }

  .map-connectors {
    display: none;
  }

  .quantity-card,
  .volume-card,
  .moles-card,
  .particles-card,
  .mass-card {
    position: relative;
    inset: auto;
    width: 100%;
    height: 154px;
    transform: none;
  }

  .moles-card {
    order: 1;
  }

  .volume-card {
    order: 2;
  }

  .particles-card {
    order: 3;
  }

  .mass-card {
    order: 4;
  }

  .quantity-card:hover:not(.is-unavailable),
  .quantity-card.is-source,
  .volume-card:hover:not(.is-unavailable),
  .volume-card.is-source,
  .moles-card:hover,
  .moles-card.is-source {
    transform: translateY(-2px);
  }
}

@media (max-width: 600px) {
  .app-shell {
    width: min(100% - 16px, 560px);
    padding-top: 10px;
  }

  .app-header {
    margin: 0 4px 14px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 15px;
  }

  .brand-mark svg {
    width: 37px;
  }

  .constants {
    align-self: center;
    padding: 8px 10px;
  }

  .constant-label {
    display: none;
  }

  .constant-item strong {
    font-size: 0.76rem;
  }

  .setup-panel,
  .map-section {
    padding: 24px 16px;
  }

  .setup-heading,
  .map-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .answer-mode {
    min-height: 30px;
  }

  .setup-grid {
    margin-top: 19px;
  }

  .setup-step {
    padding: 16px;
  }

  .formula-control {
    grid-template-columns: 1fr;
  }

  .formula-preview-wrap {
    height: 55px;
  }

  .state-options {
    gap: 6px;
  }

  .state-option {
    min-height: 94px;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 8px 5px;
    text-align: center;
  }

  .state-icon {
    width: 38px;
  }

  .map-heading > p {
    text-align: left;
  }

  .map-stage {
    grid-template-columns: 1fr;
  }

  .quantity-card,
  .volume-card,
  .moles-card,
  .particles-card,
  .mass-card {
    height: 154px;
  }

  .moles-card {
    order: 1;
  }

  .volume-card {
    order: 2;
  }

  .particles-card {
    order: 3;
  }

  .mass-card {
    order: 4;
  }

  .action-bar {
    display: grid;
    grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  }

  .reset-button,
  .start-button {
    min-width: 0;
    padding: 0 14px;
  }

  .app-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
    padding: 13px 6px 0;
  }

  .app-footer span {
    text-align: left;
  }
}

@media (max-width: 385px) {
  .brand-title {
    font-size: 1.02rem;
  }

  .brand-subtitle {
    font-size: 0.64rem;
  }

  .constants {
    display: none;
  }

  .quantity-card {
    padding-right: 14px;
    padding-left: 14px;
  }

  .choice-label {
    font-size: 0.67rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
