:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1c2733;
  --muted: #64748b;
  --accent: #0e7c66;
  --accent-soft: #e0f2ee;
  --error: #b3261e;
  --border: #d7dee5;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

header h1 {
  font-size: 1.6rem;
  margin: 0 0 4px;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 1.1rem;
  margin: 0 0 16px;
}

.card h3 {
  font-size: 0.95rem;
  margin: 16px 0 8px;
  color: var(--muted);
}

.fields {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.swap-indicator {
  color: var(--muted);
  padding-bottom: 10px;
}

.field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

input[type="text"],
select,
output.result {
  width: 100%;
  padding: 10px 12px;
  font-size: 1.05rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--text);
}

input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

input.invalid {
  border-color: var(--error);
  background: #fdf3f2;
}

output.result {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  background: var(--accent-soft);
  border-color: var(--accent);
}

.distance-row {
  display: flex;
  gap: 8px;
}

.distance-row input {
  flex: 1;
}

.distance-row select {
  width: 5.5em;
}

.mode-toggle {
  display: flex;
  gap: 16px;
  margin: 16px 0;
}

.mode-toggle label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
}

.splits {
  margin-top: 8px;
}

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

.splits th,
.splits td {
  text-align: left;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.splits th {
  color: var(--muted);
  font-weight: 600;
}

.hint {
  min-height: 1.2em;
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.hint.error {
  color: var(--error);
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 420px) {
  .fields {
    flex-direction: column;
    align-items: stretch;
  }

  .swap-indicator {
    display: none;
  }
}
