/* ── Pace Converter Styles ── */

body {
  padding-top: var(--safeT);
  overscroll-behavior: none;
}

.title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.title .logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
  flex: 0 0 auto;
}

.title h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
}

.title .sub {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 56vw;
}

.seg {
  display: inline-flex;
  background: var(--btn);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  flex: 0 0 auto;
}

.seg button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  -webkit-user-select: none;
}

.seg button:active { background: var(--btnHover); }

.seg button.active {
  background: rgba(31,111,235,0.18);
  color: var(--accent);
}

main {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 14px calc(18px + var(--safeB));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radiusLg);
  overflow: hidden;
}

.cardHd {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cardHd.inputHd {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.cardHd.inputHd .rowTop {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: nowrap;
}

.cardHd.inputHd .rowTop .pillIcon { flex: 0 0 auto; }
.cardHd.inputHd .rowTop .field { flex: 1 1 auto; min-width: 150px; }
.cardHd.inputHd .rowTop .seg { flex: 0 0 auto; margin-left: auto; }

.cardHd .left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pillIcon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.07);
  flex: 0 0 auto;
}

.cardHd h2 {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.hdField label.small { margin-bottom: 4px; }

.cardBody { padding: 12px; }

.grid2 {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 12px;
  align-items: stretch;
}

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

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

label.small {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 6px 2px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

select, input[type="number"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 10px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

select:focus, input:focus { border-color: #484f58; }

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.field { flex: 1 1 240px; min-width: 240px; }
.field.small { flex: 0 0 190px; min-width: 190px; }
.field.tiny { flex: 0 0 140px; min-width: 140px; }

.unitSeg {
  display: inline-flex;
  background: var(--btn);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  flex: 0 0 auto;
}

.unitSeg button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.15s, color 0.15s;
}

.unitSeg button:active { background: var(--btnHover); }

.unitSeg button.active {
  background: rgba(31,111,235,0.18);
  color: var(--accent);
}

.note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.customRow {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: nowrap;
  margin-bottom: 10px;
}

.customRow .field {
  flex: 1 1 auto;
  min-width: 0;
}

.customUnit {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: auto;
  flex: 0 0 auto;
}

/* Wheel picker */
.wheelWrap {
  --wheelH: 168px;
  --laneH: 40px;
  --wrapPad: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: var(--wrapPad);
  overflow: hidden;
  position: relative;
}

.wheels {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 6px;
  align-items: center;
  justify-items: stretch;
}

.wheelSep {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 20px;
  color: var(--muted2);
  align-self: center;
  justify-self: center;
  padding: 0 2px;
  user-select: none;
  -webkit-user-select: none;
}

.wheel {
  height: var(--wheelH);
  overflow: auto;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(22,27,34,0.75);
  position: relative;
  scrollbar-width: none;
}

.wheel::-webkit-scrollbar { display: none; }

.wheelInner {
  padding: calc((var(--wheelH) - var(--laneH)) / 2) 0;
}

.wheelItem {
  scroll-snap-align: center;
  height: var(--laneH);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 800;
  color: var(--muted2);
  user-select: none;
  -webkit-user-select: none;
}

.wheelItem.active { color: var(--text); text-shadow: 0 0 12px rgba(88,166,255,0.18); }

.wheelLbl {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 4px;
  text-align: center;
}

.wheelLbl span { justify-self: center; }

.wheelLbl span:nth-child(1) { grid-column: 1; }
.wheelLbl span:nth-child(2) { grid-column: 3; }
.wheelLbl span:nth-child(3) { grid-column: 5; }

.wheelLbl.speed {
  grid-template-columns: 0.85fr auto 0.85fr auto 1.05fr;
}

.wheels.speed {
  grid-template-columns: 0.85fr auto 0.85fr auto 1.05fr;
}

.wheelSep.unitSep { opacity: 0.4; }

.wheelItem.unit {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.wheelWrap::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(13,17,23,1) 0%, rgba(13,17,23,0.0) 28%, rgba(13,17,23,0.0) 72%, rgba(13,17,23,1) 100%);
  opacity: 0.92;
}

.lane {
  pointer-events: none;
  position: absolute;
  left: var(--wrapPad);
  right: var(--wrapPad);
  top: calc(var(--wrapPad) + (var(--wheelH) / 2));
  transform: translateY(-50%);
  height: var(--laneH);
  border-top: 1px solid rgba(88,166,255,0.25);
  border-bottom: 1px solid rgba(88,166,255,0.25);
  background: rgba(88,166,255,0.06);
  border-radius: 12px;
}

/* Pace banner */
.paceBanner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
}

.paceStat {
  text-align: center;
  min-width: 0;
  flex: 1 1 0;
}

.psLabel {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
  white-space: nowrap;
}

.psValue {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.psValue.pk,
.psValue.pm { color: var(--success); }
.psValue.kph,
.psValue.mph { color: var(--accent); }
.psValue.ms { color: var(--purple); }
.psValue.dim { color: var(--muted2); }

/* Summary */
.summaryGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (max-width: 768px) {
  .summaryGrid { grid-template-columns: repeat(2, 1fr); }
}

.metric {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 10px 9px;
}

.metric .k {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric .v {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.metric .v.dim { color: var(--muted2); }

/* Tables */
.section { border-top: 1px solid var(--border); }
.section:first-child { border-top: none; }

.secHd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0));
}

.secHd .left { display: flex; align-items: center; gap: 10px; min-width: 0; }

.secBadge {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.07);
  flex: 0 0 auto;
}

.secHd h3 {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.accentBar {
  height: 6px;
  width: 54px;
  border-radius: 999px;
  opacity: 0.95;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

table thead th:last-child,
table tbody td:last-child { text-align: right; }

thead th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 11px;
  background: rgba(1,4,9,0.35);
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(48,54,61,0.75);
  vertical-align: middle;
}

tbody tr:hover td { background: rgba(88,166,255,0.06); }

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  font-weight: 800;
}

.distCell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  opacity: 0.95;
  flex: 0 0 auto;
}
