.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.mode-tab {
  border: 1px solid var(--border, #cbd5e1);
  background: var(--surface, #fff);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted, #64748b);
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.mode-tab.is-active {
  background: var(--accent, #0b7285);
  color: #fff;
  border-color: var(--accent, #0b7285);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent, #0b7285) 35%, transparent);
}

.mode-tab:focus-visible {
  outline: 2px solid var(--accent-500, #0ba5b5);
  outline-offset: 2px;
}

.input-grid {
  display: grid;
  gap: 12px;
}

.input-grid.two {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.input-hint {
  font-size: 0.85rem;
  color: var(--muted, #64748b);
  margin-top: 4px;
}

.input-hint.error {
  color: var(--danger-600, #c53030);
}

.unit-badge {
  font-size: 0.85rem;
  color: var(--muted, #64748b);
  margin-left: 6px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.sticky-bar {
  position: sticky;
  bottom: 0;
  padding: 8px;
  padding-bottom: 14px;
  padding-right: 72px;
  background: var(--surface, #fff);
  box-shadow: 0 -8px 16px rgba(15, 23, 42, 0.12);
  border-top: 1px solid var(--border, #cbd5e1);
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.result-grid {
  display: grid;
  gap: 16px;
  margin-top: 12px;
}

@media (min-width: 640px) {
  .result-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.result-value {
  font-size: 1.2rem;
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-100, rgba(12, 131, 179, 0.16));
  color: var(--accent-700, #0b7285);
  font-size: 0.85rem;
  margin-left: 8px;
}

#bodyfat-results[data-has-result="true"] .result-placeholder {
  display: none;
}

#bodyfat-results[data-has-result="false"] .result-content {
  display: none;
}

.plain-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.history-item {
  border-top: 1px solid var(--border, #cbd5e1);
  padding: 8px 0;
}

.history-item:first-child {
  border-top: none;
}

.history-headline {
  font-weight: 600;
}

.history-detail {
  color: var(--muted, #64748b);
}

.unit-fieldset {
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.unit-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.unit-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  cursor: pointer;
}

.lang-switch {
  margin-top: 12px;
}

.error {
  color: var(--danger-600, #c53030);
}

#bodyfat-category-reference[hidden] {
  display: none;
}

.bodyfat-category-table {
  width: 100%;
}

.bodyfat-category-table .category-label {
  font-weight: 600;
}

.bodyfat-category-table .category-range-value {
  text-align: right;
}

.bodyfat-category-table tr.is-active td {
  background: var(--accent-100, rgba(12, 131, 179, 0.12));
  font-weight: 700;
}

[data-method-group] {
  overflow: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease, max-height 0.25s ease;
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
}

[data-method-group].is-visible {
  max-height: 1200px;
  opacity: 1;
  transform: translateY(0);
}

.bodyfat-gauge {
  margin-top: 8px;
  position: relative;
  width: 100%;
}

.bodyfat-gauge-caption {
  margin-top: 8px;
}

.bodyfat-gauge-track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  border: 1px solid var(--table-border, #d0d9e5);
  overflow: hidden;
  background: var(--table-row-alt-bg, #eef4fc);
}

.bodyfat-gauge-segment {
  position: absolute;
  top: 0;
  bottom: 0;
  transition: background-color 0.2s ease;
}

.bodyfat-gauge-segment[data-category="essential"] {
  background: #6ba4ff;
}

.bodyfat-gauge-segment[data-category="athletes"] {
  background: #50a5f1;
}

.bodyfat-gauge-segment[data-category="fitness"] {
  background: #2fb8a8;
}

.bodyfat-gauge-segment[data-category="average"] {
  background: #f59f00;
}

.bodyfat-gauge-segment[data-category="obese"] {
  background: #e03131;
}

.bodyfat-gauge-segment.is-active {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.bodyfat-gauge-marker {
  position: absolute;
  top: -8px;
  transform: translateX(-50%);
  width: 0;
  height: 28px;
  border-left: 3px solid var(--fg, #0f172a);
  transition: left 0.18s ease;
}

.bodyfat-gauge-marker::after {
  content: "";
  position: absolute;
  top: 0;
  left: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--fg, #0f172a);
  border: 2px solid var(--surface, #fff);
}

.bodyfat-gauge-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 10px;
}

.bodyfat-gauge-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted, #64748b);
}

.bodyfat-gauge-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--fg, #0f172a);
  display: inline-block;
}

.bodyfat-gauge-dot[data-category="essential"] {
  background: #6ba4ff;
}

.bodyfat-gauge-dot[data-category="athletes"] {
  background: #50a5f1;
}

.bodyfat-gauge-dot[data-category="fitness"] {
  background: #2fb8a8;
}

.bodyfat-gauge-dot[data-category="average"] {
  background: #f59f00;
}

.bodyfat-gauge-dot[data-category="obese"] {
  background: #e03131;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
}

@media (max-width: 640px) {
  .sticky-bar {
    bottom: 72px;
    padding-right: 72px;
  }
}
