/* Login gate. Dark by default, light honored if the OS asks for it. */

:root {
  color-scheme: dark light;

  --bg: #0a0c10;
  --bg-glow: #131a26;
  --surface: #12161d;
  --border: #232a35;
  --border-focus: #3a6ea5;
  --text: #e8ecf2;
  --text-dim: #8b97a8;
  --accent: #4a9eff;
  --accent-hover: #6bb0ff;
  --danger: #ff6b6b;
  --radius: 10px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f9;
    --bg-glow: #e8edf4;
    --surface: #ffffff;
    --border: #d8dfe8;
    --text: #131720;
    --text-dim: #5c6878;
    --accent: #1a6fd4;
    --accent-hover: #1560bd;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font: 15px/1.5 ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(70rem 40rem at 50% -12rem, var(--bg-glow), transparent 70%),
    var(--bg);
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.shell { width: 100%; max-width: 25rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), 0 12px 32px -12px rgb(0 0 0 / 0.45);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.glyph {
  font-size: 1.6rem;
  line-height: 1;
  filter: saturate(0.7);
}

h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sub {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  margin-bottom: 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.tab {
  flex: 1;
  padding: 0.5rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text-dim);
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

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

.tab.is-active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.15);
}

/* MUST come before any rule that sets `display` on an element carrying [hidden].
   The browser's own [hidden] rule is `display: none` at UA-stylesheet strength,
   so ANY author rule with a display -- `label { display: block }` below being the
   one that actually bit -- silently overrides it and the element renders anyway.
   That is how the invite-code field appeared on the Sign in tab: login.js sets
   `codeField.hidden = true` correctly and the CSS simply ignored it.
   !important because the whole point is to beat later display declarations. */
[hidden] {
  display: none !important;
}

label {
  display: block;
  margin-bottom: 0.9rem;
}

label > span {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
}

input {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgb(74 158 255 / 0.15);
}

.primary {
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.65rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.primary:hover:not(:disabled) { background: var(--accent-hover); }

.primary:disabled { opacity: 0.55; cursor: default; }

.error {
  margin: 0 0 0.9rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.83rem;
  color: var(--danger);
  background: rgb(255 107 107 / 0.09);
  border: 1px solid rgb(255 107 107 / 0.25);
  border-radius: 7px;
}

.foot {
  margin: 1rem 0 0;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
