*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  /* Tokens come from theme.css -- the same palette the player runs on. */

  html, body { height: 100%; }
  body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
  }

  body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent);
    z-index: 100;
  }

  main { width: 100%; max-width: 380px; }

  /* ---- Brand ---- */
  .brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 24px 2px;
  }

  .eq-icon { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
  .eq-icon span {
    display: block;
    width: 3px;
    background: var(--accent);
    animation: eq 1.4s ease-in-out infinite;
    transform-origin: bottom;
  }
  .eq-icon span:nth-child(1) { height: 35%; animation-delay: 0s; }
  .eq-icon span:nth-child(2) { height: 75%; animation-delay: .15s; }
  .eq-icon span:nth-child(3) { height: 50%; animation-delay: .35s; }
  .eq-icon span:nth-child(4) { height: 90%; animation-delay: .1s; }
  .eq-icon span:nth-child(5) { height: 60%; animation-delay: .25s; }

  @keyframes eq {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(.3); }
  }

  .brand h1 {
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
  }
  .brand p {
    font-size: .72rem;
    color: var(--muted);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: .08em;
  }

  /* ---- Card ---- */
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 28px 24px;
    position: relative;
    overflow: hidden;
  }

  .step { display: none; }
  .step.active { display: block; animation: rise .25s ease-out; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }

  label {
    display: block;
    font-size: .6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--muted);
    margin: 18px 0 7px;
  }
  label:first-of-type { margin-top: 0; }

  input {
    width: 100%;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 11px 12px;
    font-size: .92rem;
    font-family: inherit;
    transition: border-color .15s;
  }
  input::placeholder { color: var(--placeholder); }
  input:focus {
    outline: none;
    border-color: var(--accent);
  }
  /* Border colour alone is a weak place-marker once a form has four fields, and
     it is invisible to anyone who cannot see the accent hue. Keyboard focus gets
     a real ring; the border change stays for the pointer. */
  input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  .code-input {
    letter-spacing: .5em;
    text-align: center;
    font-size: 1.4rem;
    font-variant-numeric: tabular-nums;
    padding-left: .5em;
  }

  button.primary {
    width: 100%;
    margin-top: 22px;
    min-height: 44px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--on-accent);
    padding: 12px 14px;
    font-size: .72rem;
    font-weight: 700;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: .1em;
    cursor: pointer;
    transition: background .12s, border-color .12s;
  }
  button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
  button.primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
  button.primary:disabled { opacity: .4; cursor: default; }

  .back {
    background: none;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    font-size: .75rem;
    font-family: inherit;
    padding: 4px 0;
    margin-bottom: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: .04em;
  }
  .back:hover { color: var(--text); }
  .back svg { width: 14px; height: 14px; }

  .step-title {
    font-size: .95rem;
    font-weight: 600;
    margin: 2px 0 4px;
  }
  .step-hint {
    font-size: .78rem;
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 4px;
  }

  #status {
    font-size: .75rem;
    color: var(--danger);
    min-height: 1.1em;
    margin-top: 14px;
  }

  /* Sign-up and recovery live on the player's own door, so the two ways in are
     offered here rather than being URLs a visitor has to guess. */
  .door-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    justify-content: space-between;
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
  }
  .door-links a {
    /* These are the only route to a reset code on a phone, and a flex item can
       take the standard control height without disturbing the line it sits on. */
    display: inline-flex;
    align-items: center;
    min-height: var(--control-h-md);
    font-size: .76rem;
    color: var(--muted);
    text-decoration: none;
  }
  .door-links a:hover { color: var(--text); text-decoration: underline; }

.login-panel[hidden], #otp-entry[hidden], #send-otp[hidden] { display: none; }
.signup-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-top: 8px;
  font-size: .76rem;
}
.signup-actions form { margin: 0; min-width: 0; }
.signup-actions form:last-child { margin-left: auto; text-align: right; }
.signup-actions button {
  appearance: none;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--muted);
  font: inherit;
  line-height: 1.4;
  text-align: inherit;
  padding: 8px 0;
  min-height: 44px;
  cursor: pointer;
}
.signup-actions button:hover { color: var(--text); text-decoration: underline; }
.signup-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#password-section label { margin-top: 18px; }
.login-mode { display: block; background: none; border: 0; color: var(--accent); font: inherit; font-size: .78rem; padding: 12px 0; cursor: pointer; }
.login-mode:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.otp-field { position: relative; }
.otp-field input { padding-right: 118px; letter-spacing: .25em; font-variant-numeric: tabular-nums; }
.otp-field button { position: absolute; right: 5px; top: 5px; bottom: 5px; border: 0; background: var(--surface); color: var(--accent); padding: 0 9px; cursor: pointer; }
.otp-field button:disabled { color: var(--muted); cursor: default; }
#otp-hint { margin-top: 10px; }
button.primary { transition: opacity .18s ease, background .12s, border-color .12s; }
@media (prefers-reduced-motion: reduce) { .step.active, .eq-icon span { animation: none; } button.primary { transition: none; } }
