.unit-page {
  --unit-ink: #061738;
  --unit-muted: #49617f;
  --unit-blue: #2f7df2;
  --unit-green: #08ae64;
  --unit-teal: #13b8c8;
  --unit-orange: #ff880e;
  --unit-violet: #815be8;
  --unit-amber: #ffb020;
  --unit-border: #dce6f2;
}

.unit-page main {
  background:
    radial-gradient(circle at 7% 12%, rgba(8, 174, 100, .08), transparent 280px),
    radial-gradient(circle at 78% 9%, rgba(47, 125, 242, .08), transparent 320px),
    radial-gradient(circle at 92% 44%, rgba(255, 136, 14, .08), transparent 260px),
    linear-gradient(180deg, #fff 0%, #f8fbff 55%, #fff 100%);
}

.unit-page .directory-container {
  width: min(100% - 64px, 1376px);
}

.unit-hero {
  padding: 22px 0 34px;
  border-bottom: 1px solid #dfe7f1;
  background:
    radial-gradient(circle at 76% 34%, rgba(19, 184, 200, .14), transparent 220px),
    radial-gradient(circle at 92% 72%, rgba(129, 91, 232, .11), transparent 180px),
    linear-gradient(180deg, #fff 0%, rgba(248, 252, 255, .96) 100%);
}

.unit-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 520px;
  align-items: center;
  gap: 36px;
}

.unit-breadcrumbs,
.unit-tabs,
.unit-select-row,
.unit-result-panel,
.unit-tool-footer,
.unit-guide-tabs,
.unit-side-card h2,
.unit-side-card a,
.unit-pairs a {
  display: flex;
  align-items: center;
}

.unit-breadcrumbs {
  gap: 9px;
  margin-bottom: 22px;
  color: var(--unit-blue);
  font-size: 13px;
  font-weight: 780;
}

.unit-breadcrumbs span:last-child {
  color: var(--unit-muted);
}

.unit-breadcrumbs svg {
  width: 13px;
  height: 13px;
}

.unit-hero-copy h1 {
  margin: 0;
  color: transparent;
  background: linear-gradient(90deg, var(--unit-ink), #0d3a7b 52%, #008965);
  -webkit-background-clip: text;
  background-clip: text;
  font-size: clamp(44px, 4.7vw, 66px);
  line-height: 1;
  font-weight: 900;
}

.unit-hero-copy p {
  max-width: 660px;
  margin: 16px 0 0;
  color: #173057;
  font-size: 19px;
  line-height: 1.45;
}

.unit-hero-art {
  position: relative;
  min-height: 190px;
}

.unit-ruler,
.unit-scale,
.unit-thermometer,
.unit-beaker,
.unit-arrow,
.unit-spark {
  position: absolute;
}

.unit-ruler {
  left: 28px;
  top: 38px;
  width: 62px;
  height: 142px;
  border: 2px solid #068b99;
  border-radius: 9px;
  background: linear-gradient(160deg, #37d3da, #0fa5b6);
  transform: rotate(-16deg);
  box-shadow: 0 12px 24px rgba(19, 184, 200, .18);
}

.unit-ruler span {
  display: block;
  width: 24px;
  height: 2px;
  margin: 18px 0 0 10px;
  background: rgba(255, 255, 255, .78);
}

.unit-ruler span:nth-child(even) {
  width: 34px;
}

.unit-scale {
  left: 120px;
  top: 82px;
  width: 178px;
  height: 76px;
  border: 3px solid #09284e;
  border-radius: 18px 18px 26px 26px;
  background: linear-gradient(180deg, #d7f8ff, #98d9ef);
  box-shadow: 0 18px 28px rgba(17, 40, 77, .12);
}

.unit-scale::before {
  content: "";
  position: absolute;
  left: -17px;
  right: -17px;
  top: -35px;
  height: 48px;
  border: 3px solid #09284e;
  border-radius: 50%;
  background: linear-gradient(180deg, #edf8ff, #b9dff3);
}

.unit-scale b {
  position: absolute;
  left: 56px;
  top: 30px;
  display: grid;
  place-items: center;
  width: 70px;
  height: 30px;
  border: 2px solid #47708f;
  border-radius: 6px;
  background: #a6d6e7;
  color: #09284e;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px;
}

.unit-thermometer {
  left: 326px;
  top: 34px;
  width: 44px;
  height: 146px;
  border: 3px solid #09284e;
  border-radius: 22px;
  background: #f6fbff;
}

.unit-thermometer::after {
  content: "";
  position: absolute;
  left: 8px;
  bottom: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--unit-orange);
}

.unit-thermometer i {
  position: absolute;
  left: 17px;
  bottom: 24px;
  width: 8px;
  height: 82px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff6b5f, var(--unit-orange));
}

.unit-beaker {
  left: 404px;
  top: 80px;
  width: 78px;
  height: 104px;
  border: 3px solid rgba(9, 40, 78, .72);
  border-top-width: 0;
  border-radius: 0 0 18px 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .72), rgba(206, 241, 255, .7));
}

.unit-beaker i {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 54px;
  border-radius: 0 0 13px 13px;
  background: linear-gradient(180deg, rgba(47, 125, 242, .25), rgba(19, 184, 200, .48));
}

.unit-beaker b {
  position: absolute;
  right: 14px;
  top: 18px;
  width: 20px;
  height: 44px;
  border-top: 2px solid rgba(9, 40, 78, .45);
  border-bottom: 2px solid rgba(9, 40, 78, .45);
  box-shadow: 0 13px 0 rgba(9, 40, 78, .28), 0 27px 0 rgba(9, 40, 78, .28);
}

.unit-arrow {
  border: solid var(--unit-teal);
  border-width: 0 5px 5px 0;
}

.arrow-top {
  left: 270px;
  top: 18px;
  width: 78px;
  height: 78px;
  border-radius: 0 0 44px 0;
  transform: rotate(-42deg);
}

.arrow-bottom {
  left: 372px;
  top: 136px;
  width: 82px;
  height: 82px;
  border-color: var(--unit-violet);
  border-radius: 0 0 44px 0;
  transform: rotate(138deg);
}

.unit-spark {
  color: var(--unit-teal);
  font-size: 22px;
  font-weight: 900;
}

.spark-one {
  left: 104px;
  top: 20px;
}

.spark-two {
  right: 0;
  top: 48px;
  color: var(--unit-amber);
}

.unit-workspace {
  padding: 18px 0 18px;
}

.unit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 318px;
  align-items: start;
  gap: 20px;
}

.unit-main-column,
.unit-sidebar {
  display: grid;
  gap: 16px;
}

.unit-card,
.unit-side-card,
.unit-detail-card {
  border: 1px solid var(--unit-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 14px 34px rgba(17, 40, 77, .07);
}

.unit-tool-card,
.unit-guide-card {
  overflow: hidden;
}

.unit-tabs,
.unit-guide-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-bottom: 1px solid #dfe7f1;
}

.unit-guide-tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.unit-tabs button,
.unit-guide-tabs button {
  min-height: 52px;
  border: 0;
  border-right: 1px solid #dfe7f1;
  background: #fff;
  color: #173057;
  font-size: 13px;
  font-weight: 850;
}

.unit-tabs button:last-child,
.unit-guide-tabs button:last-child {
  border-right: 0;
}

.unit-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.unit-tabs svg,
.unit-guide-tabs svg {
  width: 18px;
  height: 18px;
}

.unit-tabs button.is-active,
.unit-guide-tabs button.is-active {
  color: #007a49;
  background:
    radial-gradient(circle at 50% 0%, rgba(8, 174, 100, .11), transparent 70%),
    #fff;
  box-shadow: inset 0 -3px 0 var(--unit-green);
}

.unit-tabs button[data-unit-category="weight"].is-active { color: #06818f; box-shadow: inset 0 -3px 0 var(--unit-teal); }
.unit-tabs button[data-unit-category="temperature"].is-active { color: #b65d00; box-shadow: inset 0 -3px 0 var(--unit-orange); }
.unit-tabs button[data-unit-category="area"].is-active { color: #6c46d7; box-shadow: inset 0 -3px 0 var(--unit-violet); }
.unit-tabs button[data-unit-category="volume"].is-active { color: #005dbb; box-shadow: inset 0 -3px 0 var(--unit-blue); }
.unit-tabs button[data-unit-category="speed"].is-active { color: #9a6500; box-shadow: inset 0 -3px 0 var(--unit-amber); }

.unit-temp-icon,
.unit-area-icon,
.unit-speed-icon {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.unit-temp-icon::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 1px;
  width: 5px;
  height: 13px;
  border-radius: 999px;
  background: currentColor;
}

.unit-temp-icon::after {
  content: "";
  position: absolute;
  left: 4px;
  bottom: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid currentColor;
}

.unit-area-icon::before {
  content: "";
  position: absolute;
  inset: 2px;
  border: 2px dashed currentColor;
  border-radius: 4px;
}

.unit-speed-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 2px;
  height: 12px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
}

.unit-speed-icon::after {
  content: "";
  position: absolute;
  left: 9px;
  bottom: 3px;
  width: 2px;
  height: 8px;
  background: currentColor;
  transform: rotate(-35deg);
  transform-origin: bottom;
}

.unit-converter-form {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.unit-converter-form label {
  display: grid;
  gap: 8px;
}

.unit-converter-form label > span {
  color: var(--unit-ink);
  font-size: 14px;
  font-weight: 880;
}

.unit-amount-field input,
.unit-select-row select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #d5e0ee;
  border-radius: 7px;
  background: #fff;
  color: var(--unit-ink);
  font-size: 18px;
  font-weight: 820;
}

.unit-amount-field input {
  padding: 0 16px;
  font-size: 28px;
}

.unit-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px minmax(0, 1fr);
  align-items: end;
  gap: 14px;
}

.unit-select-row select {
  padding: 0 42px 0 14px;
}

.unit-amount-field input:focus,
.unit-select-row select:focus {
  border-color: var(--unit-blue);
  box-shadow: 0 0 0 3px rgba(47, 125, 242, .13);
  outline: 0;
}

.unit-swap {
  display: grid;
  place-items: center;
  width: 54px;
  min-height: 48px;
  border: 1px solid #cbd9ea;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f8fbff);
  color: var(--unit-green);
}

.unit-result-panel {
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border: 1px solid #cceadb;
  border-radius: 8px;
  background:
    radial-gradient(circle at 10% 0%, rgba(8, 174, 100, .11), transparent 180px),
    radial-gradient(circle at 92% 0%, rgba(47, 125, 242, .08), transparent 180px),
    linear-gradient(145deg, #fff, #f6fffb);
}

.unit-result-panel span {
  display: block;
  color: #087a47;
  font-size: 13px;
  font-weight: 900;
}

.unit-result-panel strong {
  display: inline-block;
  margin-top: 6px;
  color: transparent;
  background: linear-gradient(90deg, var(--unit-ink), var(--unit-blue), var(--unit-green));
  -webkit-background-clip: text;
  background-clip: text;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1;
}

.unit-result-panel em {
  margin-left: 10px;
  color: var(--unit-ink);
  font-size: 20px;
  font-style: normal;
  font-weight: 850;
}

.unit-result-panel button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #c8e9d7;
  border-radius: 7px;
  background: #fff;
  color: #087a47;
  font-weight: 850;
}

.unit-equivalents h2 {
  margin: 0 0 10px;
  color: var(--unit-ink);
  font-size: 15px;
}

#equivalentGrid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.equivalent-pill {
  min-width: 0;
  padding: 12px 8px;
  border: 1px solid #dfe7f1;
  border-radius: 7px;
  background: linear-gradient(180deg, #fff, #f8fbff);
  text-align: center;
}

.equivalent-pill strong,
.equivalent-pill span {
  display: block;
}

.equivalent-pill strong {
  color: var(--unit-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
}

.equivalent-pill span {
  margin-top: 4px;
  color: var(--unit-muted);
  font-size: 11px;
  font-weight: 780;
}

.unit-tool-footer {
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid #dfe7f1;
}

.unit-ghost,
.unit-save {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--unit-ink);
  font-weight: 850;
}

.unit-save {
  color: #087a47;
}

.unit-side-card {
  padding: 18px;
}

.unit-side-card h2 {
  gap: 8px;
  margin: 0 0 12px;
  color: var(--unit-ink);
  font-size: 18px;
}

.quick-card {
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 176, 32, .13), transparent 140px),
    #fff;
}

.unit-example-list {
  display: grid;
}

.unit-example-list button {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid #dfe7f1;
  background: transparent;
  color: var(--unit-ink);
  text-align: left;
}

.unit-example-list button:last-child {
  border-bottom: 0;
}

.unit-example-list button > span {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 12px;
  background: #e9fbfc;
  color: #088391;
  font-size: 13px;
  font-weight: 900;
}

.unit-example-list button:nth-child(2) > span { background: #eaf3ff; color: #005dbb; }
.unit-example-list button:nth-child(3) > span { background: #fff3dc; color: #b65d00; }
.unit-example-list button:nth-child(4) > span { background: #f1ecff; color: #6c46d7; }
.unit-example-list button:nth-child(5) > span { background: #eafaf3; color: #087a47; }

.unit-example-list strong {
  font-size: 13px;
  line-height: 1.25;
}

.unit-checklist {
  background:
    radial-gradient(circle at 100% 0%, rgba(8, 174, 100, .11), transparent 150px),
    #fff;
}

#commonUnits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin-bottom: 14px;
}

.common-unit {
  position: relative;
  padding-left: 23px;
  color: #173057;
  font-size: 13px;
  font-weight: 760;
}

.common-unit::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1px;
  width: 15px;
  height: 15px;
  border-radius: 4px;
  background: var(--unit-green);
}

.common-unit::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  width: 4px;
  height: 7px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.unit-side-card a,
.unit-pairs a {
  justify-content: space-between;
  gap: 10px;
  color: #005dbb;
  font-size: 13px;
  font-weight: 850;
}

.unit-pairs {
  background:
    radial-gradient(circle at 0% 100%, rgba(129, 91, 232, .11), transparent 150px),
    #fff;
}

.unit-pairs a {
  padding: 10px 0;
  border-bottom: 1px solid #dfe7f1;
  color: #173057;
}

.unit-pairs a:last-child {
  border-bottom: 0;
}

.unit-guide-body {
  padding: 20px;
}

.unit-guide-body section[hidden] {
  display: none;
}

#guide-formula {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
}

#guide-formula[hidden] {
  display: none;
}

.unit-guide-body h2,
.unit-guide-body h3 {
  margin: 0 0 10px;
  color: var(--unit-ink);
}

.unit-guide-body h2 {
  font-size: 20px;
}

.unit-guide-body h3 {
  font-size: 17px;
}

.unit-guide-body p,
.unit-guide-body li,
.unit-guide-body details {
  color: #263b5f;
  font-size: 14px;
  line-height: 1.6;
}

.unit-guide-body code {
  display: block;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid #cbe9dc;
  border-left: 4px solid var(--unit-green);
  border-radius: 8px;
  background:
    radial-gradient(circle at 100% 0%, rgba(47, 125, 242, .08), transparent 150px),
    #f8fffb;
  color: var(--unit-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  font-weight: 850;
  white-space: normal;
}

.unit-guide-body aside {
  padding: 16px;
  border: 1px solid #f5d9ba;
  border-radius: 8px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 136, 14, .13), transparent 120px),
    #fffaf2;
}

.prefix-table {
  overflow: hidden;
  border: 1px solid #dfe7f1;
  border-radius: 8px;
}

.prefix-table div {
  display: grid;
  grid-template-columns: 1fr .7fr .9fr 1.8fr;
}

.prefix-table strong,
.prefix-table span {
  min-width: 0;
  padding: 9px 11px;
  border-right: 1px solid #dfe7f1;
  border-bottom: 1px solid #dfe7f1;
  color: #173057;
  font-size: 13px;
}

.prefix-table strong {
  background: #f2f7fc;
  color: var(--unit-ink);
}

.prefix-table div:last-child span {
  border-bottom: 0;
}

.prefix-table span:last-child,
.prefix-table strong:last-child {
  border-right: 0;
}

.example-grid,
.unit-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.example-grid article,
.unit-detail-card {
  padding: 16px;
  border: 1px solid #dfe7f1;
  border-radius: 8px;
  background: #fff;
}

.example-grid article:nth-child(1) { border-top: 4px solid var(--unit-blue); }
.example-grid article:nth-child(2) { border-top: 4px solid var(--unit-teal); }
.example-grid article:nth-child(3) { border-top: 4px solid var(--unit-orange); }
.example-grid article:nth-child(4) { border-top: 4px solid var(--unit-green); }

.example-grid strong {
  color: var(--unit-ink);
  font-size: 15px;
}

.unit-guide-body details {
  padding: 13px 0;
  border-bottom: 1px solid #dfe7f1;
}

.unit-guide-body summary {
  color: var(--unit-ink);
  font-weight: 880;
  cursor: pointer;
}

.unit-detail-section {
  padding: 6px 0 20px;
}

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

.unit-detail-card {
  background:
    radial-gradient(circle at 100% 0%, rgba(47, 125, 242, .08), transparent 130px),
    #fff;
}

.unit-detail-card:nth-child(2) {
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 176, 32, .1), transparent 130px),
    #fff;
}

.unit-detail-card:nth-child(3) {
  background:
    radial-gradient(circle at 100% 0%, rgba(129, 91, 232, .1), transparent 130px),
    #fff;
}

.unit-detail-card span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #eaf3ff;
  color: #005dbb;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.unit-detail-card h2 {
  margin: 12px 0 8px;
  color: var(--unit-ink);
  font-size: 18px;
}

.unit-detail-card p {
  margin: 0;
  color: #263b5f;
  font-size: 13px;
  line-height: 1.55;
}

.unit-related-section {
  padding-top: 0;
}

.unit-newsletter {
  background:
    radial-gradient(circle at 12% 50%, rgba(47, 125, 242, .12), transparent 170px),
    linear-gradient(90deg, #f7fbff, #f4fff9);
}

@media (max-width: 1180px) {
  .unit-hero-inner {
    grid-template-columns: minmax(0, 1fr) 420px;
  }

  .unit-beaker {
    left: 330px;
  }

  .arrow-bottom {
    left: 318px;
  }

  .unit-layout {
    grid-template-columns: minmax(0, 1fr);
  }

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

  #equivalentGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .unit-page .directory-container {
    width: min(100% - 32px, 720px);
  }

  .unit-hero-inner {
    grid-template-columns: 1fr;
  }

  .unit-hero-art {
    min-height: 170px;
    transform: scale(.9);
    transform-origin: left top;
  }

  .unit-tabs {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .unit-tabs button {
    min-width: 150px;
  }

  .unit-sidebar,
  .unit-detail-grid,
  .example-grid {
    grid-template-columns: 1fr;
  }

  #guide-formula {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .unit-hero {
    padding: 16px 0 22px;
  }

  .unit-hero-copy h1 {
    font-size: 42px;
  }

  .unit-hero-copy p {
    font-size: 16px;
  }

  .unit-hero-art {
    display: none;
  }

  .unit-converter-form {
    padding: 16px;
  }

  .unit-select-row {
    grid-template-columns: 1fr;
  }

  .unit-swap {
    width: 100%;
  }

  .unit-result-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .unit-result-panel em {
    display: block;
    margin: 8px 0 0;
    font-size: 16px;
  }

  #equivalentGrid,
  .unit-guide-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .unit-guide-tabs button:nth-child(2) {
    border-right: 0;
  }

  .prefix-table {
    overflow-x: auto;
  }

  .prefix-table div {
    min-width: 640px;
  }
}

@media (max-width: 430px) {
  .unit-page .directory-container {
    width: min(100% - 24px, 390px);
  }

  .unit-hero-copy h1 {
    font-size: 36px;
  }

  .unit-tabs button {
    min-width: 132px;
    min-height: 48px;
  }

  .unit-side-card,
  .unit-guide-body {
    padding: 14px;
  }
}
