:root {
  color-scheme: light dark;
  --bg: #f6f6f4;
  --surface: #ffffff;
  --text: #1c1c1a;
  --muted: #6b6b66;
  --border: #dcdcd6;
  --accent: #1f5fd6;
  --accent-text: #ffffff;
  --error-bg: #fdecea;
  --error-text: #8a1c12;
  --warning-bg: #fff4d6;
  --warning-text: #6b4a00;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --surface: #1f1f1d;
    --text: #ececea;
    --muted: #9b9b95;
    --border: #3a3a36;
    --accent: #5b8cf0;
    --accent-text: #0b0b0a;
    --error-bg: #3b1714;
    --error-text: #f5b4ac;
    --warning-bg: #3a2f10;
    --warning-text: #f2d48a;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    15px/1.5 system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
}

h1 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
}

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

.page--narrow {
  max-width: 360px;
  padding-top: 15vh;
}

.page--narrow h1 {
  margin-bottom: 20px;
}

.muted {
  color: var(--muted);
}

/* Buttons */

.button {
  font: inherit;
  border-radius: var(--radius);
  cursor: pointer;
}

.button--primary {
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid var(--accent);
  padding: 10px 18px;
  font-weight: 600;
}

.button--primary:hover {
  filter: brightness(1.08);
}

.button--primary:disabled {
  opacity: 0.6;
  cursor: progress;
}

.button--quiet {
  background: none;
  border: none;
  color: var(--muted);
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.button--quiet:hover {
  color: var(--text);
}

.button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Login */

.login {
  display: grid;
  gap: 10px;
}

.login label {
  font-weight: 600;
}

.login input {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.login .error {
  margin: 0;
  color: var(--error-text);
}

/* Main page */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar form {
  margin: 0;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-bottom: 20px;
}

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

.notice {
  margin: 0 0 20px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.notice--error {
  background: var(--error-bg);
  border-color: transparent;
  color: var(--error-text);
}

.notice--warning {
  background: var(--warning-bg);
  border-color: transparent;
  color: var(--warning-text);
}

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

.result__meta {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.result__age {
  margin: 0 0 12px;
}

#age {
  font-size: 1.6rem;
  font-weight: 650;
}

.result__meta .notice--warning {
  margin-bottom: 12px;
}

.result__fields {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
  margin: 0;
}

.result__fields dt {
  color: var(--muted);
}

.result__fields dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Emails are designed for a white background, whatever the page theme. */
.result__email {
  display: block;
  width: 100%;
  height: 70vh;
  min-height: 420px;
  border: 0;
  background: #ffffff;
}

[hidden] {
  display: none !important;
}
