/* Account pages: /login/, and the base of /profiel/ and /speler/ (they load this file before their own).
   Builds on /shared/page.css (tokens, base, back link, footer). Mobile-first, one column of max 560px,
   light + dark. Same controls as /zaak/ (inputs, buttons, messages). */

:root {
  --surface: color-mix(in srgb, var(--page-text) 6%, transparent);
  --surface-strong: color-mix(in srgb, var(--page-text) 10%, transparent);
  --line: color-mix(in srgb, var(--page-text) 16%, transparent);
  --gold: #E9B44C;
  --gold-text: #1d1a16;
  --danger: #b3261e;
  --ok: #1d6b3a;
  --focus: var(--page-text);
}

@media (prefers-color-scheme: dark) {
  :root {
    --danger: #ff8a80;
    --ok: #7fd49a;
  }
}

.account { max-width: 592px; padding-bottom: 40px; } /* 560px column + 2 × 16px gutter */
.account .back { margin-top: -10px; }

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

.lead { margin: 0 0 16px; color: var(--page-muted); }
.muted { margin: 8px 0 0; color: var(--page-muted); font-size: 14px; }
.who-line { margin: 4px 0 12px; color: var(--page-muted); font-size: 14px; overflow-wrap: anywhere; }
.email { overflow-wrap: anywhere; }

h2 { margin: 0 0 8px; font-size: 20px; line-height: 1.2; font-weight: 800; }
h2:focus { outline: none; }
h2:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h3 { margin: 0; font-size: 17px; line-height: 1.25; font-weight: 800; overflow-wrap: anywhere; }

/* ---------- Cards ---------- */

.card {
  padding: 16px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.card + .card { margin-top: 12px; }
.card > p:first-of-type { margin-top: 0; }

/* ---------- Fields ---------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label,
.label { font-size: 14px; font-weight: 800; }

.input {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--page-bg);
  box-shadow: inset 0 0 0 1px var(--line);
  color: inherit;
  font: inherit;
}

.input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--danger); }

.input-code {
  max-width: 12ch;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.2em;
  font-variant-numeric: tabular-nums;
}

.hint { margin: 0; color: var(--page-muted); font-size: 13px; }
.card > .hint { margin-top: 12px; }

.check-field { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0 4px; }
.check-field input {
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--page-text);
}
.check-field input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.check-field input[aria-invalid="true"] { outline: 2px solid var(--danger); outline-offset: 2px; }
.check-field label { font-weight: 800; line-height: 1.4; }

.code-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  color: inherit;
  font: inherit;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

@media (hover: hover) {
  .btn:not([disabled]):hover { background: var(--surface-strong); }
}

.btn-primary { background: var(--page-text); color: var(--page-bg); box-shadow: none; }

@media (hover: hover) {
  .btn-primary:not([disabled]):hover { background: color-mix(in srgb, var(--page-text) 85%, var(--page-bg)); }
}

.btn-danger { background: var(--danger); color: #fff; box-shadow: none; }

@media (prefers-color-scheme: dark) {
  .btn-danger { color: #1d1a16; }
}

@media (hover: hover) {
  .btn-danger:not([disabled]):hover { background: color-mix(in srgb, var(--danger) 85%, var(--page-text)); }
}

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.choice { display: grid; gap: 8px; margin: 12px 0 0; }
.choice .btn { width: 100%; }

/* ---------- Messages and states ---------- */

.msg { margin: 8px 0 0; font-size: 14px; }
.msg:empty { display: none; }
.msg-ok { color: var(--ok); }
.msg-error { color: var(--danger); }
.field .msg { margin: 0; }

.state { margin: 0; padding: 12px 0; color: var(--page-muted); }
.state-error { color: var(--danger); }

/* ---------- Avatars and pickers ---------- */

.avatar { display: inline-grid; place-items: center; line-height: 0; }
.avatar svg { display: block; width: 100%; height: auto; max-width: 100%; }
.avatar-fallback {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-strong);
}

.avatar-row { display: flex; align-items: center; gap: 16px; margin: 4px 0 16px; }
.avatar-row .muted { margin: 0; }
.avatar-preview { flex: none; width: 112px; }
.av-img { display: block; }
.av-img svg { display: block; width: 100%; height: 100%; }

.pick-set { margin: 0 0 16px; padding: 0; border: 0; min-width: 0; }
.pick-set legend { margin-bottom: 8px; padding: 0; font-size: 14px; font-weight: 800; }

.pick-grid { display: grid; gap: 8px; }
.pick-bases { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.pick-swatches { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }

.pick { position: relative; display: block; cursor: pointer; }

/* The real radio sits under the tile: keyboard and screen readers use it, the tile shows its state. */
.pick input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}

.pick-face {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 4px;
  border-radius: 12px;
  background: var(--page-bg);
  box-shadow: inset 0 0 0 1px var(--line);
}

.pick-bases .pick-face .avatar { max-width: 100%; }

.pick input:checked + .pick-face { box-shadow: inset 0 0 0 3px var(--page-text); }
.pick input:focus-visible + .pick-face { outline: 3px solid var(--focus); outline-offset: 2px; }
.pick input:disabled + .pick-face { opacity: 0.4; cursor: not-allowed; }

@media (hover: hover) {
  .pick input:not(:checked):not(:disabled):hover + .pick-face { background: var(--surface-strong); }
}

.swatch {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #000 20%, transparent);
}

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