:root {
  color-scheme: light dark;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #666;
  --accent: #2b6cb0;
  --border: #ddd;
  --error: #c53030;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1b1e24;
    --text: #e8e8ea;
    --muted: #999;
    --border: #2d313a;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.center-card {
  max-width: 360px;
  margin: 15vh auto;
  padding: 2rem;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.center-card h1 {
  margin-top: 0;
  font-size: 1.4rem;
}

form label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

input,
select,
button {
  width: 100%;
  padding: 0.6rem;
  margin-bottom: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
}

button:hover {
  opacity: 0.9;
}

.error {
  color: var(--error);
  font-size: 0.85rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar button {
  width: auto;
  margin: 0;
  padding: 0.5rem 1rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.tool-card {
  display: block;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
}

.tool-card:hover {
  border-color: var(--accent);
}

.tool-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.tool-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

main.tool-page {
  max-width: 700px;
  margin: 0 auto;
  padding: 1.5rem;
}

.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.section h2 {
  margin-top: 0;
  font-size: 1.05rem;
}

.row {
  display: flex;
  gap: 0.5rem;
}

.row > * {
  flex: 1;
}

ul.list {
  list-style: none;
  padding: 0;
  margin: 0;
}

ul.list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

ul.list li:last-child {
  border-bottom: none;
}

.bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 70px;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.bar-track {
  position: relative;
  height: 18px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--accent);
}

.bar-fill.target {
  background: #c05621;
  opacity: 0.6;
}

.legend {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}
