* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f7f3ec;
  color: #1a1a1a;
  display: flex;
  justify-content: center;
  padding: 24px 12px;
}

.card {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

/* Toast alert — more prominent than the inline #status line, for things the visitor
   should actually notice (limit reached, upload rejected, verification failed, etc). */
.toast {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 1000;
  max-width: min(92vw, 420px);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  opacity: 0;
  transform: translate(-50%, -16px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.toast-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-error {
  background: #fdeaea;
  color: #a12626;
  border: 1px solid #f3b8b8;
}

.toast-success {
  background: #e3f3ea;
  color: #1a7a4c;
  border: 1px solid #b7ddc7;
}

.app-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
}

.app-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 4px;
  color: #1a1a1a;
}

.beta-badge {
  display: inline-block;
  vertical-align: middle;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1a7a4c;
  background: #e3f3ea;
  border-radius: 999px;
  padding: 2px 8px;
}

.subtitle {
  color: #666;
  font-size: 0.9rem;
  margin: 0 0 4px;
}

.limit-notice {
  color: #888;
  font-size: 0.8rem;
  margin: 0 0 8px;
}

.disclaimer {
  color: #a15c00;
  background: #fff6e5;
  border-radius: 8px;
  font-size: 0.78rem;
  padding: 8px 10px;
  margin: 0 0 8px;
}

.ethics-note {
  color: #1a6b3c;
  background: #e3f3ea;
  border-radius: 8px;
  font-size: 0.78rem;
  padding: 8px 10px;
  margin: 0 0 20px;
}

form {
  text-align: left;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 8px;
}

input[type="text"],
input[type="number"] {
  padding: 10px 11px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
  color: #1a1a1a;
  font-size: 0.88rem;
  min-width: 0;
  width: 100%;
}

.full-field {
  width: 100%;
  margin: 0 0 8px;
}

.fill-factor-block {
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 10px 12px 12px;
  margin: 6px 0 0;
}

.fill-factor-block label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #444;
  margin: 0 0 8px;
}

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

.fill-factor-row input[type="range"] {
  flex: 1;
  accent-color: #1a7a4c;
}

#fill-factor-value {
  font-weight: 700;
  font-size: 0.9rem;
  color: #1a7a4c;
  min-width: 3.2em;
  text-align: right;
}

.manual-sizes {
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 8px 12px 12px;
  margin: 10px 0 0;
}

.manual-sizes summary {
  font-size: 0.82rem;
  font-weight: 600;
  color: #444;
  cursor: pointer;
  padding: 4px 0;
}

.manual-sizes .field-grid {
  margin-top: 8px;
}

.manual-hint {
  color: #777;
  font-size: 0.76rem;
  margin: 4px 0 0;
}

.cf-turnstile {
  margin-top: 12px;
}

button {
  margin-top: 16px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #1a7a4c;
  color: white;
  font-size: 1rem;
  cursor: pointer;
}

button:disabled {
  background: #aaa;
  cursor: not-allowed;
}

#status {
  min-height: 1.2em;
  color: #444;
  font-size: 0.9rem;
}

#status a {
  color: #1a7a4c;
  font-weight: 600;
}

#result {
  margin-top: 16px;
  text-align: left;
  outline: none; /* programmatically focused after a calculation, not keyboard-navigated */
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-card {
  background: #f4f4f4;
  border-radius: 10px;
  padding: 14px 16px;
}

.result-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.result-distance {
  font-size: 1.3rem;
  font-weight: 700;
  color: #1a7a4c;
  margin: 0 0 4px;
}

.result-source {
  font-size: 0.82rem;
  color: #666;
  margin: 0;
}

.result-aperture {
  font-size: 0.82rem;
  color: #1a7a4c;
  font-weight: 600;
  margin: 6px 0 0;
  padding-top: 6px;
  border-top: 1px solid #ddd;
}

.result-note {
  font-size: 0.78rem;
  color: #777;
  background: #f4f4f4;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0;
}
