:root {
  color-scheme: light dark;
  --background: #f3f4f6;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #59636e;
  --border: #d1d9e0;
  --accent: #0b57d0;
  --on-accent: #ffffff;
  --error: #b3261e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #131314;
    --card: #1f1f21;
    --text: #e8eaed;
    --muted: #a8adb4;
    --border: #3c4043;
    --accent: #a8c7fa;
    --on-accent: #062e6f;
    --error: #f2b8b5;
  }
}

html,
body {
  height: 100%;
  margin: 0;
}

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

#app {
  position: fixed;
  inset: 0;
}

/* The client draws its own focus indication. */
#app canvas:focus {
  outline: none;
}

#panel {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 16px;
  overflow: auto;
  background: var(--background);
}

#panel[hidden],
#banner[hidden] {
  display: none;
}

.card {
  box-sizing: border-box;
  width: 100%;
  max-width: 420px;
  margin: auto;
  padding: 32px 24px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 1px 3px rgb(0 0 0 / 12%);
  text-align: center;
}

.card > :last-child {
  margin-bottom: 0;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.375rem;
  line-height: 1.3;
}

p {
  margin: 0 0 20px;
  color: var(--muted);
}

label {
  display: block;
  margin: 24px 0 6px;
  font-weight: 600;
  text-align: left;
}

input {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 1.5rem;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
}

input[aria-invalid="true"] {
  border-color: var(--error);
}

.hint {
  margin: 8px 0 24px;
  font-size: 0.9375rem;
  text-align: left;
}

.hint.error {
  color: var(--error);
}

button,
.button {
  display: inline-block;
  box-sizing: border-box;
  min-width: 160px;
  padding: 12px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

form button {
  width: 100%;
}

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

.spinner {
  width: 32px;
  height: 32px;
  margin: 0 auto 16px;
  box-sizing: border-box;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 4s;
  }
}

#banner {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 2;
  box-sizing: border-box;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 10px;
  background: #303134;
  color: #ffffff;
  box-shadow: 0 2px 8px rgb(0 0 0 / 25%);
  font-size: 0.9375rem;
  transform: translateX(-50%);
}
