/* Forms: sign-in and other forms, inputs and their messages; the game request form. */

/* Sign in */

.auth {
    max-width: 420px;
    margin: 0 auto;
    padding: clamp(1rem, 6vw, 3rem) 0;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1.5rem;
}

.auth-form label {
    font-weight: 500;
}

.auth-form input {
    font: inherit;
    font-size: 1.1rem;  /* 16px+ stops iPhones zooming into the field */
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    background: var(--field);
    color: var(--ink);
    width: 100%;
}

.auth-form input:focus {
    outline: 2px solid var(--gold);
    outline-offset: 1px;
}

.auth-form .select {
    font: inherit;
    font-size: 1rem;
    padding: 0.7rem 0.6rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    background: var(--field);
    width: 100%;
    max-width: 100%;
}

.auth h2 {
    margin-top: 2rem;
}

.auth-form .code-input {
    font-size: 1.8rem;
    letter-spacing: 0.4em;
    text-align: center;
}

.auth-form .button {
    min-height: 48px;
    font: 500 1rem var(--sans);
    cursor: pointer;
    margin-top: 0.4rem;
}

.auth-error {
    color: var(--danger);
    margin: 0;
}

.auth-note {
    color: var(--ink-soft);
    font-size: 0.9rem;
}

/* What a guest's sign-in will move to the account: worth reading before they go on. */
.auth-guest {
    border-left: 3px solid var(--gold-soft);
    padding: 0.4rem 0 0.4rem 0.8rem;
}

/* The knight check on the sign-in form: each square is a radio button (works without script, and with the arrow
   keys), hidden over its square so a click anywhere on the square picks it. */
.knight-check {
    border: 0;
    padding: 0;
    margin: 0.6rem 0 0;
    min-width: 0;
}

.knight-check legend {
    font-weight: 500;
    padding: 0;
}

.knight-check .auth-note {
    margin: 0.2rem 0 0.6rem;
}

.knight-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    width: 100%;
    max-width: 320px;
    aspect-ratio: 1;
    border: 5px solid var(--board-frame);
    user-select: none;
}

.knight-square {
    position: relative;
    aspect-ratio: 1;
    cursor: pointer;
    touch-action: manipulation;
}

.knight-square.light { background: var(--board-light); }
.knight-square.dark { background: var(--board-dark); }

.auth-form .knight-square input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}

.knight-square img {
    position: absolute;
    inset: 6%;
    width: 88%;
    height: 88%;
    pointer-events: none;
}

.knight-square:hover::after,
.knight-square:has(input:checked)::after {
    content: "";
    position: absolute;
    inset: 32%;
    border-radius: 50%;
    background: rgba(24, 24, 27, 0.35);
    pointer-events: none;
}

.knight-square:has(input:checked)::after {
    background: var(--board-frame);
}

.knight-square:has(input:focus-visible) {
    outline: 3px solid var(--gold);
    outline-offset: -3px;
    z-index: 1;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* The bot trap: off the page for people, still in the form for scripts. */
.trap {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* "New to CaissaHub? Create an account" under the sign-in form, and the reverse. */
.auth-switch {
    margin-top: 1.5rem;
    text-align: center;
}

.auth-alt {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
    text-align: center;
}

.auth-alt p {
    margin-top: 0;
    color: var(--ink-soft);
}

/* ---------- Requesting a game on the website ---------- */
.request-form fieldset {
    border: 0;
    padding: 0;
    margin: 0 0 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
}

.request-form legend {
    font-weight: 600;
    margin-bottom: 0.5rem;
    width: 100%;
}

