:root {
  color-scheme: dark;
  --tool-bg: #101416;
  --tool-panel: #ffffff;
  --tool-text: #273035;
  --tool-muted: #5b686e;
  --tool-line: #d5dfe2;
  --tool-accent: #00e5ff;
  --tool-accent-dark: #007f8d;
  --tool-focus: rgba(0, 166, 189, 0.2);
  --tool-warm: #f2d06b;
  --tool-danger: #a1291e;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.tools-shell {
  min-width: 320px;
  color: #f4f7f8;
  font-size: 16px;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}

.tools-shell a {
  color: var(--tool-accent);
  text-underline-offset: 0.2em;
}

.tools-shell button,
.tools-shell input,
.tools-shell select,
.tools-shell textarea {
  font: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 8px 12px;
  color: #051518;
  background: var(--tool-accent);
  border-radius: 4px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.tools-header .logo {
  line-height: normal;
}

.tools-header .country-toggle {
  margin-bottom: 12px;
}

.section-toggle .country-toggle-inner {
  flex-wrap: nowrap;
}

.section-toggle .country-option {
  white-space: nowrap;
}

.tools-main,
.tool-detail-main {
  width: 100%;
  margin: 0;
  padding: 0 0 40px;
}

.tools-hero {
  padding: 8px 0 34px;
  text-align: center;
}

.tools-hero h1 {
  margin: 0;
  color: #f5f8f9;
  font-size: clamp(34px, 6vw, 52px);
  line-height: 1.2;
}

.tools-hero p {
  max-width: 600px;
  margin: 12px auto 0;
  color: #b7c4c8;
  font-size: clamp(17px, 2.5vw, 20px);
}

.section-heading {
  margin-bottom: 16px;
}

.tool-eyebrow,
.tool-kicker {
  margin: 0 0 8px;
  color: var(--tool-accent-dark);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.1em;
}

.section-heading .tool-eyebrow {
  color: var(--tool-accent);
}

.section-heading h2 {
  margin: 0;
  color: #f5f8f9;
  font-size: 24px;
}

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

.tool-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px;
  color: var(--tool-text) !important;
  background: #ffffff;
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.tool-card:hover,
.tool-card:focus-visible {
  color: var(--tool-text) !important;
  border-color: #70d8e3;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.14), 0 14px 26px rgba(0, 0, 0, 0.14);
  outline: 0;
  transform: translateY(-3px);
}

.tool-card-featured {
  background: linear-gradient(150deg, #e8fcfe 0%, #ffffff 58%);
  border-color: #75dce6;
}

.tool-card-icon {
  display: grid;
  width: 46px;
  height: 46px;
  margin-bottom: 14px;
  place-items: center;
  background: #e9f8fa;
  border-radius: 50%;
  font-size: 24px;
}

.tool-card-category {
  color: #815600;
  font-size: 13px;
  font-weight: 850;
}

.tool-card h3 {
  margin: 9px 0 10px;
  color: #20272a;
  font-size: clamp(23px, 3vw, 29px);
  line-height: 1.3;
}

.tool-card p {
  margin: 0 0 20px;
  color: #56646a;
}

.tool-card-link {
  margin-top: auto;
  color: var(--tool-accent-dark);
  font-size: 15px;
  font-weight: 850;
}

.breadcrumbs {
  width: 100%;
  margin: 0 0 10px;
  color: #aebbc0;
  font-size: 14px;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumbs li:not(:last-child)::after {
  content: "/";
  margin-left: 6px;
  color: #63737a;
}

.breadcrumbs a {
  color: #d4dde0;
}

.tool-content-card,
.tool-feedback {
  width: 100%;
  padding: 20px;
  color: var(--tool-text);
  background: #ffffff;
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.1);
}

.tool-content-card {
  margin-bottom: 20px;
}

.tool-detail-hero {
  padding-bottom: 30px;
  border-bottom: 1px solid #dfe5e7;
}

.tool-detail-hero h1 {
  margin: 0;
  color: #202428;
  font-size: clamp(36px, 5vw, 54px);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.tool-deck {
  max-width: 760px;
  margin: 18px 0 0;
  color: #4c5a60;
  font-size: clamp(18px, 2.5vw, 23px);
  line-height: 1.6;
}

.pace-workspace {
  margin-top: 28px;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 620px;
  margin: 0 auto 20px;
  padding: 4px;
  background: #e9eef0;
  border: 1px solid #cad6d9;
  border-radius: 999px;
}

.mode-switch button {
  min-height: 44px;
  padding: 8px 14px;
  color: #56646a;
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 850;
}

.mode-switch button:hover,
.mode-switch button:focus-visible {
  color: #006e7c;
  outline: 0;
}

.mode-switch button[aria-pressed="true"] {
  color: #052126;
  background: #ffffff;
  box-shadow: 0 2px 7px rgba(28, 48, 54, 0.16);
}

.pace-form {
  margin: 0;
}

.calculator-input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.input-panel,
.converter-fieldset {
  min-width: 0;
  margin: 0;
  padding: 18px;
  background: #f4f7f8;
  border: 1px solid #d2dde0;
  border-radius: 8px;
}

.input-panel[hidden] {
  display: none;
}

.input-panel legend,
.converter-fieldset legend {
  padding: 0 5px;
  color: #344147;
  font-size: 15px;
  font-weight: 850;
}

.distance-control {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #4f5d63;
  font-weight: 800;
}

.distance-control input {
  width: min(190px, 72%);
  height: 58px;
  padding: 7px 12px;
  color: #182126;
  background: #ffffff;
  border: 2px solid #8aa0a7;
  border-radius: 7px;
  font-size: 29px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.time-input-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  min-width: 0;
}

.time-control {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: #5a686e;
  font-size: 12px;
  font-weight: 800;
}

.time-control input {
  width: 72px;
  height: 58px;
  padding: 7px 8px;
  color: #182126;
  background: #ffffff;
  border: 2px solid #8aa0a7;
  border-radius: 7px;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.distance-control input:focus,
.time-control input:focus,
.unit-select-label select:focus,
.tool-feedback textarea:focus {
  border-color: #008fa2;
  box-shadow: 0 0 0 3px var(--tool-focus);
  outline: 0;
}

.distance-control input[aria-invalid="true"],
.time-control input[aria-invalid="true"] {
  border-color: #b63224;
}

.time-separator {
  padding-bottom: 10px;
  color: #364348;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.input-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}

.input-presets button {
  min-height: 36px;
  padding: 6px 11px;
  color: #334147;
  background: #ffffff;
  border: 1px solid #91a5ab;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
}

.input-presets button:hover,
.input-presets button:focus-visible,
.input-presets button[aria-pressed="true"] {
  color: #052126;
  background: #c7f6fa;
  border-color: #00a6bd;
  outline: 0;
}

.pace-entry-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.unit-select-label select {
  height: 58px;
  padding: 0 12px;
  color: #263136;
  background: #ffffff;
  border: 2px solid #8aa0a7;
  border-radius: 7px;
  font-weight: 850;
}

.calculator-error {
  margin: 12px 0 0;
  color: var(--tool-danger);
  font-size: 14px;
  font-weight: 800;
}

.calculate-button {
  display: block;
  min-width: 170px;
  min-height: 46px;
  margin: 18px auto 0;
  padding: 10px 20px;
  color: #052126;
  background: #9df1f8;
  border: 1px solid #00a6bd;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 900;
}

.calculate-button:hover,
.calculate-button:focus-visible {
  background: #68e7f2;
  outline: 3px solid var(--tool-focus);
  outline-offset: 2px;
}

.result-panel {
  margin-top: 24px;
  padding: 22px;
  background: linear-gradient(145deg, #063d43 0%, #082a2e 100%);
  border-radius: 10px;
  color: #f4fbfc;
}

.result-primary {
  display: grid;
  gap: 3px;
  text-align: center;
}

.result-primary > span:first-child {
  color: #a8e9ee;
  font-size: 14px;
  font-weight: 800;
}

.result-primary strong {
  color: #ffffff;
  font-size: clamp(42px, 8vw, 68px);
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.result-primary > span:last-child {
  color: #c5dadd;
  font-size: 14px;
}

.result-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-top: 20px;
}

.result-metrics div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 7px;
  text-align: center;
}

.result-metrics span {
  color: #b9d2d5;
  font-size: 12px;
  font-weight: 750;
}

.result-metrics strong {
  overflow: hidden;
  color: #ffffff;
  font-size: clamp(18px, 3vw, 24px);
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.copy-result-button {
  min-height: 40px;
  padding: 7px 15px;
  color: #e9fdff;
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid rgba(0, 229, 255, 0.45);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
}

.copy-result-button:hover,
.copy-result-button:focus-visible {
  background: rgba(0, 229, 255, 0.22);
  outline: 0;
}

.copy-status {
  color: #bcecf0;
  font-size: 13px;
}

.calculator-table-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.result-table-card {
  min-width: 0;
  padding: 18px;
  background: #f5f8f9;
  border: 1px solid #d6e0e2;
  border-radius: 8px;
}

.result-table-card h3 {
  margin: 0 0 11px;
  color: #243035;
  font-size: 18px;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid #d5dde0;
  border-radius: 6px;
  -webkit-overflow-scrolling: touch;
}

.result-table-card table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.result-table-card th,
.result-table-card td {
  padding: 10px 12px;
  border-bottom: 1px solid #e0e6e8;
  text-align: right;
  white-space: nowrap;
}

.result-table-card th:first-child,
.result-table-card td:first-child {
  text-align: left;
}

.result-table-card thead th {
  color: #755000;
  background: #eef3f4;
  font-size: 13px;
}

.result-table-card tbody tr:last-child td {
  border-bottom: 0;
  font-weight: 850;
}

.unit-converter {
  margin-top: 42px;
  padding: 24px;
  background: #eef8f9;
  border: 1px solid #9fd7dc;
  border-radius: 10px;
}

.converter-heading h2,
.tool-explainer h2 {
  margin: 0;
  color: #20292d;
  font-size: clamp(27px, 4vw, 36px);
  line-height: 1.3;
}

.converter-heading > p:last-child {
  margin: 8px 0 0;
  color: #59686e;
}

.converter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  margin-top: 20px;
}

.converter-fieldset {
  background: #ffffff;
}

.converter-unit {
  padding-bottom: 10px;
  color: #3f4e53;
  font-weight: 900;
}

.converter-arrow {
  color: #007f8d;
  font-size: 30px;
  font-weight: 900;
}

.converter-summary {
  margin: 16px 0 0;
  color: #203237;
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

.calculator-note {
  margin: 9px 0 0;
  color: #627177;
  font-size: 13px;
  text-align: center;
}

.tool-explainer {
  max-width: 760px;
  margin: 46px auto 8px;
}

.tool-explainer h2 {
  margin-top: 40px;
}

.tool-explainer > h2:first-child {
  margin-top: 0;
}

.tool-explainer p,
.tool-explainer li {
  color: #4f5e64;
}

.tool-explainer li + li {
  margin-top: 9px;
}

.faq-list details {
  padding: 17px 0;
  border-top: 1px solid #dce3e5;
}

.faq-list details:last-child {
  border-bottom: 1px solid #dce3e5;
}

.faq-list summary {
  cursor: pointer;
  color: #20272a;
  font-weight: 850;
}

.faq-list details p {
  margin: 12px 0 0;
}

.tool-feedback {
  margin-top: 0;
}

.tool-feedback h2 {
  margin: 0 0 7px;
  color: #273035;
  font-size: 24px;
}

.tool-feedback > p {
  margin: 0;
  color: #5b686e;
}

.feedback-actions,
.feedback-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.feedback-button,
.feedback-submit,
.feedback-cancel {
  min-height: 44px;
  padding: 9px 16px;
  color: #283034;
  background: #f3f6f7;
  border: 1px solid #8d9ba0;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 800;
}

.feedback-button:hover,
.feedback-button:focus-visible,
.feedback-submit:hover,
.feedback-submit:focus-visible,
.feedback-cancel:hover,
.feedback-cancel:focus-visible {
  color: #006e7c;
  border-color: #008fa2;
  outline: 0;
}

.tool-feedback form {
  margin-top: 18px;
}

.tool-feedback form label {
  display: block;
  margin-bottom: 7px;
  color: #344147;
  font-weight: 850;
}

.tool-feedback textarea {
  width: 100%;
  padding: 11px;
  color: #20272a;
  background: #ffffff;
  border: 1px solid #8d9ba0;
  border-radius: 6px;
  resize: vertical;
}

.feedback-submit {
  color: #052126;
  background: #a9f3fa;
  border-color: #00a6bd;
}

.feedback-status {
  min-height: 1.6em;
  margin-top: 12px !important;
  font-size: 14px;
  font-weight: 800;
}

.feedback-status[data-state="success"] {
  color: #096b45;
}

.feedback-status[data-state="error"] {
  color: var(--tool-danger);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.site-footer {
  padding: 22px 0 4px;
  color: #9eacb1;
  font-size: 13px;
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 22px;
  border-top: 1px solid #364349;
  padding-top: 18px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.footer-links a {
  color: #c9d3d6;
}

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

  .calculator-input-grid,
  .calculator-table-grid {
    grid-template-columns: 1fr;
  }

  .result-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .section-toggle .country-toggle-inner {
    width: 100%;
  }

  .section-toggle .country-option {
    flex: 1 1 0;
    justify-content: center;
    padding-right: 6px;
    padding-left: 6px;
  }

  .section-toggle .country-option > span:first-child {
    display: none;
  }

  .tools-main,
  .tool-detail-main {
    padding-bottom: 24px;
  }

  .tool-content-card,
  .tool-feedback {
    padding: 15px;
  }

  .tool-detail-hero {
    padding-bottom: 24px;
  }

  .mode-switch button {
    padding-right: 7px;
    padding-left: 7px;
    font-size: 14px;
  }

  .input-panel,
  .converter-fieldset,
  .result-panel,
  .unit-converter {
    padding: 15px;
  }

  .time-control input {
    width: min(20vw, 67px);
    min-width: 52px;
    font-size: 25px;
  }

  .distance-control input {
    font-size: 26px;
  }

  .result-primary strong {
    font-size: clamp(38px, 13vw, 54px);
  }

  .result-metrics strong {
    font-size: 19px;
  }

  .converter-grid {
    grid-template-columns: 1fr;
  }

  .converter-arrow {
    line-height: 1;
    text-align: center;
    transform: rotate(90deg);
  }

  .site-footer-inner {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .tool-card {
    transition: none;
  }
}
