/* earth-1: the only stylesheet. Follows the device's light/dark setting. */
:root {
  /* Catppuccin Latte (light) */
  color-scheme: light dark;
  --bg: #eff1f5;          /* base */
  --card: #e6e9ef;        /* mantle */
  --text: #4c4f69;        /* text */
  --muted: #6c6f85;       /* subtext0 */
  --border: #bcc0cc;      /* surface1 */
  --accent: #8839ef;      /* mauve */
  --accent-text: #eff1f5; /* base */
  --secondary: #ccd0da;   /* surface0 */
  --secondary-text: #4c4f69;
  --code: #40a02b;        /* green */
}
@media (prefers-color-scheme: dark) {
  :root {
    /* Catppuccin Mocha (dark) */
    --bg: #1e1e2e;          /* base */
    --card: #313244;        /* surface0 */
    --text: #cdd6f4;        /* text */
    --muted: #a6adc8;       /* subtext0 */
    --border: #45475a;      /* surface1 */
    --accent: #cba6f7;      /* mauve */
    --accent-text: #1e1e2e; /* base */
    --secondary: #45475a;   /* surface1 */
    --secondary-text: #cdd6f4;
    --code: #a6e3a1;        /* green */
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: max(1.5rem, env(safe-area-inset-top)) 1rem 2rem;
}

h1 { font-size: 1.75rem; margin: 0 0 1rem; text-align: center; }
h2 { font-size: 1.1rem; margin: 0 0 1rem; color: var(--muted); }

article {
  background: var(--card);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
}

p:empty { display: none; }
p { margin: 0 0 1rem; }
form { margin: 0; }
form ~ div, form ~ p { margin-top: 1rem; }
article > :last-child { margin-bottom: 0; }

button, input {
  display: block;
  width: 100%;
  font: inherit;
  padding: 0.85rem 1rem;
  border-radius: 10px;
}

button {
  border: 0;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.6; cursor: default; filter: none; }
button.secondary { background: var(--secondary); color: var(--secondary-text); }
button.outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

input {
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

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

small:empty { display: none; }
small { display: block; margin-top: 0.5rem; color: var(--muted); }

#code {
  font-size: 5rem;
  text-align: center;
  color: var(--code);
  margin: 0;
}

.status { font-size: 1.15rem; font-weight: 600; }
.status:has(+ .detail:not(:empty)) { margin-bottom: 0; }
small.detail { margin: 0.25rem 0 1rem; }

/* Spinner in front of "Logging in…" etc. */
.busy::before {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 0.6em;
  vertical-align: -0.1em;
  border: 2px solid var(--accent);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .busy::before { animation-duration: 2.5s; } }

details button { margin-top: 0.5rem; }

details summary { cursor: pointer; color: var(--muted); padding: 0.5rem 0; }
pre {
  font-size: 0.8rem;
  white-space: pre-wrap;
  color: var(--muted);
}
