:root {
  --red: #d62828; /* the brand, and destructive actions only */
  --red-dark: #a81d1d;
  --accent: #2456b8; /* ordinary buttons, links and tabs */
  --accent-dark: #1b4390;
  --ink: #1f1a1a;
  --muted: #6b6060;
  --line: #e6dcdc;
  --bg: #fbf5f3;
  --card: #ffffff;
  --error: #b3261e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #7aa6ff;
    --accent-dark: #5d8ff0;
    --ink: #f3ecec;
    --muted: #b5a6a6;
    --line: #3d3232;
    --bg: #1c1515;
    --card: #271e1e;
    --error: #ff8a80;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.card {
  position: relative;
  width: 100%;
  max-width: 24rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

.brand {
  display: block;
  text-align: center;
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--red);
  text-decoration: none;
  margin-bottom: 1.25rem;
}

/* Back arrow in the card's top-left corner, leading to the website. */
.back {
  position: absolute;
  top: 0.9rem;
  left: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
}

.back:hover {
  background: var(--bg);
  color: var(--ink);
}

.back svg {
  width: 1.4rem;
  height: 1.4rem;
  fill: currentColor;
}

/* Signed out, the sign-in view shows the site's navigation instead. */
[data-state="auth"] .back {
  display: none;
}

.site-nav {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 10;
  display: flex;
  gap: 0.75rem;
}

.site-nav[hidden] {
  display: none;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.site-nav a:hover {
  border-color: var(--muted);
}

.site-nav svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

h1 {
  font-size: 1.25rem;
  margin: 0 0 0.5rem;
}

p {
  margin: 0 0 1rem;
}

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

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.25rem;
}

.tabs button {
  flex: 1;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0.6rem 0;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.tabs button[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

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

input {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.65rem 0.75rem;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
}

label > .muted {
  display: block;
  font-weight: 400;
  margin-top: 0.35rem;
}

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

button.primary,
button.secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.75rem;
  font: inherit;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  margin-top: 0.25rem;
}

button.primary {
  background: var(--accent);
  color: #fff;
  border: 0;
}

button.primary:hover {
  background: var(--accent-dark);
}

button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.apple {
  margin-top: 0.6rem;
  background: var(--ink);
  color: var(--card);
  border-color: var(--ink);
}

button.link {
  display: block;
  width: 100%;
  background: none;
  border: 0;
  padding: 0.6rem 0 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
}

button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.g {
  font-weight: 800;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 1rem 0;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}

.notice {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 1rem 0.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
}

.notice.emphasised {
  background: rgba(214, 40, 40, 0.08);
  border-color: var(--red);
}

.notice p {
  margin: 0.25rem 0 0;
}

.notice .inline {
  text-align: right;
  padding: 0.4rem 0 0.35rem;
}

.small {
  font-size: 0.9rem;
}

.message {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: var(--error);
}

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

h2 {
  font-size: 1rem;
  margin: 0 0 0.6rem;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 1rem;
}

legend {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0;
  margin-bottom: 0.4rem;
}

.choice {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-weight: 400;
  margin-bottom: 0.6rem;
}

.choice input {
  width: auto;
  margin: 0.3rem 0 0;
  accent-color: var(--accent);
}

.choice span {
  display: block;
}

.subsection {
  border-top: 1px solid var(--line);
  margin-top: 1.5rem;
  padding-top: 1.25rem;
}

button.secondary + button.secondary {
  margin-top: 0.6rem;
}
