.tools-main,
.converter-main {
  min-height: calc(100svh - 150px);
}

.tools-hero,
.converter-heading,
.amount-converter {
  margin: 0 auto;
  max-width: 1160px;
  padding-inline: clamp(20px, 5vw, 44px);
}

.tools-hero,
.converter-heading {
  border-bottom: 1px solid var(--line);
  padding-bottom: clamp(48px, 7vw, 76px);
  padding-top: clamp(72px, 10vw, 116px);
}

.tools-hero h1,
.converter-heading h1 {
  font-size: clamp(3rem, 7vw, 6.2rem);
  line-height: 1;
  margin: 0;
}

.tools-hero > p:last-child,
.converter-heading > p:last-child {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.8;
  margin: 22px 0 0;
  max-width: 760px;
}

.tools-list {
  padding-top: 48px;
}

.tools-list-heading {
  margin-bottom: 24px;
}

.tool-entry {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  grid-template-columns: 56px minmax(0, 1fr);
  max-width: 760px;
  padding: 22px;
  transition: box-shadow 180ms ease, transform 180ms ease;
}

.tool-entry:hover {
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.tool-entry-mark {
  align-items: center;
  background: var(--steel);
  border-radius: 6px;
  color: var(--panel);
  display: flex;
  font: 800 1.4rem "Segoe UI", sans-serif;
  height: 56px;
  justify-content: center;
  width: 56px;
}

.tool-entry > span:last-child {
  display: grid;
  gap: 7px;
}

.tool-entry strong {
  font-size: 1.2rem;
}

.tool-entry small {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.65;
}

.back-link {
  border-bottom: 2px solid var(--gold);
  color: var(--steel);
  display: inline-block;
  font-family: "Segoe UI", sans-serif;
  font-weight: 800;
  margin-bottom: 38px;
  padding-bottom: 5px;
}

.amount-converter {
  padding-bottom: clamp(48px, 8vw, 80px);
  padding-top: clamp(38px, 6vw, 64px);
}

.amount-direction {
  border: 0;
  margin: 0 0 28px;
  padding: 0;
}

.amount-direction legend {
  color: var(--steel);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.84rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.direction-segments {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 660px;
  overflow: hidden;
}

.direction-segments label {
  position: relative;
}

.direction-segments label + label {
  border-left: 1px solid var(--line);
}

.direction-segments input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.direction-segments span {
  align-items: center;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  font: 700 0.94rem "Segoe UI", sans-serif;
  justify-content: center;
  min-height: 52px;
  padding: 10px 14px;
  text-align: center;
}

.direction-segments input:checked + span {
  background: var(--steel);
  color: var(--panel);
}

.converter-grid {
  align-items: center;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr);
}

.converter-pane {
  min-width: 0;
}

.pane-heading {
  align-items: baseline;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
  min-height: 24px;
}

.pane-heading > :first-child {
  font-size: 1.04rem;
  font-weight: 800;
}

.pane-heading > :last-child {
  color: var(--muted);
  font: 0.78rem "Segoe UI", sans-serif;
}

.converter-pane textarea,
.converter-pane output {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: block;
  font: inherit;
  line-height: 1.8;
  min-height: 250px;
  overflow-wrap: anywhere;
  padding: 20px;
  width: 100%;
}

.converter-pane textarea {
  resize: vertical;
}

.converter-pane output {
  border-top: 4px solid var(--brick);
  white-space: pre-wrap;
}

.converter-pane textarea::placeholder,
.converter-pane output[data-empty="true"] {
  color: var(--muted);
}

.swap-button {
  background: var(--steel);
  border: 0;
  border-radius: 8px;
  color: var(--gold);
  cursor: pointer;
  font-size: 1.5rem;
  height: 52px;
  width: 52px;
}

.converter-error {
  border-left: 4px solid var(--brick);
  color: var(--brick);
  font-family: "Segoe UI", sans-serif;
  line-height: 1.6;
  margin: 18px 0 0;
  padding: 8px 0 8px 14px;
}

.converter-error[hidden] {
  display: none;
}

.converter-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.converter-actions button {
  border: 1px solid transparent;
  cursor: pointer;
}

.converter-actions .danger {
  background: rgba(155, 61, 46, 0.1);
  color: var(--brick);
}

#copyStatus {
  color: var(--steel);
  font: 0.88rem "Segoe UI", sans-serif;
  min-height: 1.4em;
}

.tool-entry:focus-visible,
.back-link:focus-visible,
.direction-segments input:focus-visible + span,
.converter-pane textarea:focus-visible,
.swap-button:focus-visible,
.converter-actions button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

@media (max-width: 760px) {
  .converter-grid {
    align-items: stretch;
    grid-template-columns: minmax(0, 1fr);
  }

  .swap-button {
    width: 100%;
  }

  .converter-pane textarea,
  .converter-pane output {
    min-height: 200px;
  }
}

@media (max-width: 420px) {
  .direction-segments {
    grid-template-columns: minmax(0, 1fr);
  }

  .direction-segments label + label {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .pane-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}
