.unit-page {
  box-sizing: border-box;
  width: min(100% - 2rem, 1120px);
  margin: 0 auto;
}

.unit-page section {
  box-sizing: border-box;
}

.unit-tool,
.unit-category-intro,
.unit-home-intro,
.unit-home-guide,
.unit-directory,
.unit-related {
  margin: 1.25rem 0;
  padding: clamp(1rem, 3vw, 1.75rem);
  background: #fff;
  border: 1px solid #d9e2e9;
  border-radius: 14px;
}

.unit-tool {
  max-width: 760px;
  margin-right: auto;
  margin-left: auto;
}

.unit-tool > h2,
.unit-category-intro > h2,
.unit-home-intro > h2,
.unit-home-guide > h2,
.unit-directory > h2,
.unit-related > h2 {
  margin-top: 0;
}

.form-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.form-inline label {
  padding: 0;
  color: #24384b;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
}

.form-inline select {
  box-sizing: border-box;
  max-width: 220px;
  min-height: 44px;
  padding: 0.55rem 2rem 0.55rem 0.7rem;
  font-size: 1rem;
  background: #fff;
  border: 1px solid #91a7ba;
  border-radius: 8px;
}

.unit-entry-info {
  margin: 0 auto 1rem;
  color: #31506c;
  font-size: 0.9rem;
  text-align: center;
}

.unit-page #entry.unit-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 1rem;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: none;
  margin: 0;
  padding: clamp(1rem, 4vw, 1.5rem);
  background: #f4f9fd;
  border: 1px solid #c7d8e6;
  border-radius: 12px;
  box-shadow: none;
}

.unit-page #entry.unit-entry::before {
  content: none;
}

.unit-field label,
.unit-result-label {
  display: block;
  margin-bottom: 0.4rem;
  padding: 0;
  color: #173b5f;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
}

.unit-field {
  min-width: 0;
}

.unit-value-row {
  display: flex;
  align-items: stretch;
  min-height: 56px;
  overflow: hidden;
  background: #fff;
  border: 2px solid #3b8edb;
  border-radius: 10px;
}

.unit-page .unit-value-row input#x,
.unit-page .unit-value-row output#y {
  flex: 1 1 0;
  box-sizing: border-box;
  min-width: 0;
  width: auto;
  max-width: none;
  padding: 0.65rem 0.8rem;
  color: #152d42;
  background: transparent;
  border: 0;
  font-family: system-ui, sans-serif;
  font-size: clamp(1.35rem, 4vw, 1.9rem);
  line-height: 1.2;
}

.unit-page .unit-value-row input#x:focus {
  outline: 3px solid #ffbf47;
  outline-offset: -3px;
}

.unit-output {
  border-color: #77a596;
}

.unit-page .unit-value-row output#y {
  display: flex;
  align-items: center;
  color: #075e48;
  font-weight: 700;
  white-space: nowrap;
}

.unit-page .unit-value-row output#y.scientific {
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  letter-spacing: -0.01em;
}

.unit-page .unit-value-row output#y sup {
  margin-left: 0.08em;
  font-size: 0.7em;
  line-height: 1;
  align-self: flex-start;
  padding-top: 0.65em;
}

.unit-symbol {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  color: #274a67;
  background: #e8f1f8;
  font-weight: 700;
  white-space: nowrap;
}

.unit-swap-symbol {
  padding-bottom: 1rem;
  color: #5a7186;
  font-size: 1.4rem;
  font-weight: 700;
}

.unit-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.unit-entry .unit-actions button,
.unit-entry #resetButton,
.unit-entry #copyButton {
  min-height: 44px;
  margin: 0;
  padding: 0.6rem 1rem;
  position: static;
  border-radius: 8px;
  box-shadow: none;
}

.unit-entry .unit-actions .unit-secondary-button {
  color: #31506c;
  background: #fff;
  border: 1px solid #9db0c0;
}

.unit-entry .unit-actions .unit-secondary-button:hover {
  background: #eef5fa;
  box-shadow: none;
}

.unit-entry .warning {
  grid-column: 1 / -1;
  min-height: 1.25rem;
  text-align: center;
}

.unit-content-grid {
  align-items: flex-start;
}

.unit-content-grid .topic-content-left {
  min-width: 0;
}

.unit-card {
  margin: 0 0 1rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  background: #fff;
  border: 1px solid #d9e2e9;
  border-radius: 12px;
}

.unit-card h2:first-child {
  margin-top: 0;
}

.formula-display,
#calculation .pre {
  box-sizing: border-box;
  max-width: 100%;
  padding: 1rem;
  overflow-x: auto;
  color: #173b5f;
  background: #f4f8fb;
  border-radius: 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.7;
}

.formula-display span,
#calculation .pre span {
  color: #075eaa;
}

#table1n table {
  width: min(100%, 560px);
  border-collapse: collapse;
}

#table1n th,
#table1n td {
  padding: 0.65rem;
  text-align: right;
  border: 1px solid #d8e1e8;
}

#table1n th {
  color: #173b5f;
  background: #edf5fb;
}

#table1n tr:nth-child(even) {
  background: #f8fafc;
}

.unit-examples .example h3 {
  margin: 0 0 0.75rem;
  color: #173b5f;
  font-size: 1.05rem;
}

.unit-examples .step {
  margin: 0;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  background: #f4f8fb;
  border-radius: 9px;
  line-height: 1.6;
}

.unit-faq details {
  padding: 0.85rem 0;
  border-top: 1px solid #dce4ea;
}

.unit-faq summary {
  color: #173b5f;
  cursor: pointer;
  font-weight: 700;
}

.faq-answer {
  margin-top: 0.65rem;
}

.unit-popular-grid,
.unit-related ul,
.unit-category-grid,
.unit-category-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.unit-popular-grid,
.unit-related ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.65rem;
}

.unit-popular-grid a,
.unit-related a {
  display: block;
  min-height: 44px;
  box-sizing: border-box;
  padding: 0.7rem 0.8rem;
  color: #075eaa;
  background: #f5f9fc;
  border: 1px solid #d4e0e8;
  border-radius: 8px;
  text-decoration: none;
}

.unit-popular-grid a:hover,
.unit-related a:hover {
  background: #eaf5ff;
  border-color: #75aada;
}

.unit-category-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  color: #31506c;
  background: #eef7ff;
  border-radius: 9px;
}

.unit-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.unit-category-card {
  padding: 1rem;
  background: #f9fbfd;
  border: 1px solid #d8e1e8;
  border-radius: 10px;
}

.unit-category-card h3 {
  margin: 0 0 0.5rem;
}

.unit-category-card h3 a {
  color: #075eaa;
}

.unit-category-card .unit-count {
  color: #52677a;
  font-size: 0.9rem;
  font-weight: 700;
}

.unit-category-card li + li {
  margin-top: 0.35rem;
}

.unit-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.unit-chip-list li {
  padding: 0.45rem 0.7rem;
  color: #31506c;
  background: #f3f7fa;
  border: 1px solid #d5e0e8;
  border-radius: 999px;
}

.unit-directory #category_links,
.unit-page > #category_links {
  padding: 0;
}

.unit-directory #category_links > div > h2:first-child,
.unit-page > #category_links > div > h2:first-child {
  margin-top: 0.75rem;
}

@media (max-width: 700px) {
  body header .nav-list {
    display: none;
  }

  body ol.breadcrumb {
    box-sizing: border-box;
    height: 50px;
    min-height: 50px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
  }

  body .breadcrumb li {
    margin-bottom: 0;
    flex: 0 0 auto;
  }

  .breadcrumb a {
    height: 42px;
    padding: 0 0.5rem;
  }

  .unit-page {
    width: min(100% - 1rem, 1120px);
  }

  .unit-page .topic-content.unit-content-grid {
    display: block;
    width: 100%;
    padding: 0;
  }

  .unit-page .topic-content-left {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 0;
  }

  .unit-page .topic-content-right {
    display: none;
  }

  .unit-page #entry.unit-entry {
    grid-template-columns: 1fr;
  }

  .unit-value-row {
    width: 100%;
  }

  .unit-swap-symbol {
    padding: 0;
    text-align: center;
  }

  .unit-actions {
    grid-column: 1;
  }

  .unit-actions button {
    flex: 1;
  }

  .form-inline {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .form-inline select {
    width: 100%;
    max-width: none;
  }
}
