/*
 * PlayMateX sign-in pages (webplay) — play/DESIGN.md §9, tokens from play/src/styles/tokens.css.
 * Premium through restraint: solid surfaces, 1px edges, one accent. No glow, gradient, blur or stock art.
 * Served under a strict CSP (style-src 'self'): no inline styles anywhere, state is classes + [hidden].
 */

@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 300 800;
  font-stretch: 100%;
  font-display: swap;
  src: url("/fonts/roboto-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 300 800;
  font-stretch: 100%;
  font-display: swap;
  src: url("/fonts/roboto-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --accent: #E11414;
  --bg: #0A0A0D;
  --surface: #18181C;
  --surface-alt: #161619;
  --text: #F5F5F7;
  --text-2: #A8A8B0;
  --text-faint: #6F7078;
  --border: #26262C;
  --error: #FF6B6B;
  --font: "Roboto", system-ui, "Segoe UI", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Roboto Mono", Consolas, Menlo, monospace;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout: a centred column, max 400px. Phone = edge-to-edge (no card), 28px × 20px. */
.shell {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 28px max(20px, env(safe-area-inset-right)) 28px max(20px, env(safe-area-inset-left));
}
.card {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

/* Desktop (≥ 600px): the barely-there card. */
@media (min-width: 600px) {
  .shell { align-items: center; padding: 40px 20px; }
  .card {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 40px 36px;
  }
}

.logo {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 28px;
}

h1 {
  margin: 0 0 22px;
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead {
  margin: -10px 0 22px;
  font-size: 15px;
  line-height: 21px;
  color: var(--text-2);
}

form { margin: 0; }

/* Inputs: 52px, radius 12, 16px text; focus = accent border + 1px inset ring (a 2px ring) over 120ms. */
input {
  display: block;
  width: 100%;
  height: 52px;
  margin: 0;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
}
input::placeholder { color: var(--text-faint); opacity: 1; }
input:focus { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
input:not(.sr) ~ input:not(.sr) { margin-top: 12px; }   /* input → input 12px (labels are visually hidden) */

/* Password managers' autofill keeps the page's colours. */
input:-webkit-autofill,
input:-webkit-autofill:hover {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  box-shadow: inset 0 0 0 100px var(--surface);
  transition: background-color 600000s 0s, border-color 120ms ease-out;
}
input:-webkit-autofill:focus {
  box-shadow: inset 0 0 0 1px var(--accent), inset 0 0 0 100px var(--surface);
}
input:autofill {
  filter: none;
  -webkit-text-fill-color: var(--text);
  box-shadow: inset 0 0 0 100px var(--surface);
}

/* The accent pill: hover brightness, 1px press, white focus ring. */
.btn {
  display: block;
  width: 100%;
  height: 50px;
  margin: 14px 0 0;
  padding: 0 22px;
  border: 0;
  border-radius: 25px;
  background: var(--accent);
  color: #FFFFFF;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: filter 120ms ease-out;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; filter: none; transform: none; }
.btn:focus { outline: none; }
.btn:focus-visible { outline: 2.5px solid var(--text); outline-offset: 2px; }
.btn--quiet { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.choices .btn { margin-top: 12px; }
.choices .btn:first-child { margin-top: 0; }

.error {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--error);
}
.error:empty { margin: 0; }

.link, .help {
  display: inline-block;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-2);
  text-decoration: none;
  border-radius: 4px;
}
.link { margin-top: 14px; }
.link + .link { display: block; margin-top: 10px; }   /* the password step has two: Forgot / First time here */
.help { margin-top: 24px; }
.link:hover, .help:hover { text-decoration: underline; }
.link:focus-visible, .help:focus-visible, .open:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.help-text { margin: 8px 0 0; font-size: 12px; line-height: 16px; color: var(--text-2); overflow-wrap: anywhere; }

.open {
  display: inline-block;
  margin-top: 22px;
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
}
.open:hover { text-decoration: underline; }

/* The match code: two PIN boxes that pop in one by one (0 ms, 120 ms). */
.pins { display: flex; justify-content: center; gap: 12px; }
.pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 64px;
  border-radius: 12px;
  background: var(--surface);
  border: 2px solid var(--accent);
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  opacity: 0;
  transform: scale(.85);
}
.is-popping .pin { animation: pin-pop 180ms cubic-bezier(.2, .8, .2, 1) forwards; }
.is-popping .pin + .pin { animation-delay: 120ms; }
@keyframes pin-pop {
  from { opacity: 0; transform: scale(.85); }
  to { opacity: 1; transform: scale(1); }
}

.spinner {
  width: 28px;
  height: 28px;
  margin: 26px auto 0;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Steps: out 160ms (up 6px), then in 200ms (from 8px below). Never a crossfade. */
.step.is-out { animation: step-out 160ms ease-out forwards; pointer-events: none; }
.step.is-in { animation: step-in 200ms ease-out both; }
@keyframes step-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-6px); }
}
@keyframes step-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .step.is-out, .step.is-in, .is-popping .pin { animation-duration: 1ms; animation-delay: 0ms; }
  .spinner { animation-duration: 2400ms; }
}

.sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
