:root {
  color-scheme: light dark;
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --text: #1a2233;
  --muted: #5a6472;
  --accent: #1b7a4d;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --border: #d8dee6;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --card-bg: #1c222b;
    --text: #eef1f5;
    --muted: #9aa4b2;
    --accent: #3fae7c;
    --accent-text: #08130d;
    --danger: #e5675f;
    --border: #2c333d;
  }
}

* {
  box-sizing: border-box;
}

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

.site-header {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem 0 0.5rem;
  text-align: center;
}

.site-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.tagline {
  margin: 0;
  color: var(--muted);
}

main {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

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

.optional {
  font-weight: normal;
  color: var(--muted);
  font-size: 0.85em;
}

.field {
  margin-bottom: 0.75rem;
}

.field:last-child {
  margin-bottom: 0;
}

.field-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.field-row .field {
  flex: 1 1 12rem;
  margin-bottom: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
}

.field-grid .field {
  margin-bottom: 0;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

input:read-only {
  opacity: 0.7;
}

.combobox {
  position: relative;
}

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0.25rem 0 0;
  padding: 0.25rem;
  list-style: none;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 16rem;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.suggestions[hidden] {
  display: none;
}

.suggestion-item {
  padding: 0.55rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
}

.suggestion-item.active {
  background: var(--accent);
  color: var(--accent-text);
}

.hint {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.message {
  margin: 0.5rem 0 0;
  color: var(--danger);
  font-size: 0.9rem;
  min-height: 1.2em;
}

.btn {
  display: inline-block;
  padding: 0.65rem 1.1rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  margin-top: 0.5rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

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

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.result-header h2 {
  margin: 0;
}

.result-header .btn {
  margin-top: 0;
  flex-shrink: 0;
}

.result-message {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.result-stats {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.result-stats[hidden] {
  display: none;
}

.stat-tile {
  flex: 1 1 8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
}

details.card summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 1.1rem;
}

details.card[open] summary {
  margin-bottom: 0.75rem;
}

.site-footer {
  max-width: 640px;
  margin: 1.5rem auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--accent);
}

.build-badge {
  display: block;
  margin-top: 0.25rem;
}

.license {
  margin-top: 0.5rem;
}

@media (min-width: 600px) {
  body {
    padding: 0 1.5rem 3rem;
  }
}
