/* The Play page's login sheet: the gate, with the form in its dark third. The materials are ages.css's (.ages on each element here).
   The ids and state classes (.hidden, .show, .loading) are cspr-auth.js's: keep them. */

/* the sheet covers the game page; its own scroll, so a short phone reaches the button */
#wallet-login-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    min-height: 0;
    overflow-y: auto;
}

#wallet-login-overlay.hidden {
    display: none;
}

#wallet-login-overlay .gate-art img {
    position: fixed;
}

.wallet-login-container h1 {
    margin: 0;
    font-size: 0;
    line-height: 0;
}

/* the small logo is cropped to its ink: this is the size Welcome's stands at */
.gate-copy h1 .login-logo {
    width: 250px;
    height: auto;
    margin-left: 0;
}

.gate-copy .wallet-login-description {
    margin: 16px 0 24px;
}

/* lane K6: the terms sentence under the wallet's button, as Google's button has one. On a phone each link is 44 px to press, and the margin takes the height back out of the line */
.gate-copy .wallet-login-terms { margin: 14px 0 0; color: var(--ash); font-size: 1rem; line-height: 1.35; }
.gate-copy .wallet-login-terms a { color: var(--bone); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.gate-copy .wallet-login-terms a:hover { color: var(--gold); }
@media (max-width: 760px), (pointer: coarse) {
    .gate-copy .wallet-login-terms a { display: inline-flex; align-items: center; min-height: 44px; margin-block: -12px; }
}

/* the top bar while a wallet works */
.wallet-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    padding: 10px 20px 12px;
    background: #16161f;
    border-bottom: 2px solid var(--gold);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
    transform: translateY(-110%);
    transition: transform .3s ease-in-out;
}

.wallet-progress-bar.show {
    transform: translateY(0);
}

.wallet-progress-bar .progress-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
}

.wallet-progress-bar .progress-spinner {
    flex: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 211, 77, .3);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.wallet-progress-bar .progress-title {
    color: var(--gold);
    font: 400 1.1rem/1.2 var(--display);
}

.wallet-progress-bar .progress-message {
    color: var(--bone);
    font-size: 1rem;
    line-height: 1.3;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* the button is a cut stone (.enter): only its busy state is its own */
.cspr-login-button:disabled {
    opacity: 1;
}

.cspr-login-button.loading {
    color: transparent;
}

.cspr-login-button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border: 3px solid rgba(26, 16, 7, .3);
    border-top-color: #1a1007;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.wallet-status {
    margin-bottom: 14px;
    padding: 10px 12px;
    font-size: 1.05rem;
}

.wallet-connected {
    background: rgba(111, 220, 140, .12);
    color: var(--up, #6fdc8c);
}

.wallet-disconnected {
    background: rgba(255, 143, 143, .12);
    color: #ff8f8f;
}

#errorContainer {
    margin-top: 14px;
    padding: 10px 12px;
    background: #2a1d22;
    border-top: 2px solid #ff8f8f;
    color: #ffb4b4;
    font-size: 1.05rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

/* CSPR.click's own UI */
#csprclick-ui {
    margin-bottom: 1rem;
}

/* Ensure CSPR.click SDK modals appear above everything */
.csprclick-modal,
.csprclick-overlay,
[class*="csprclick"],
[class*="cspr-click"],
.ReactModal__Overlay,
.ReactModal__Content,
div[role="dialog"],
.modal-overlay,
iframe[src*="cspr.click"],
iframe[src*="csprclick"] {
    z-index: 999999 !important;
}

#csprclick-ui iframe {
    z-index: 999999 !important;
    position: relative;
}

/* the confirmation over the sheet */
.wallet-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 16px;
    background: rgba(5, 5, 8, .78);
}

.wallet-modal.show {
    display: flex;
}

.wallet-modal-content {
    width: min(460px, 100%);
    padding: 22px 24px 24px;
    background: #1b1b24;
    border-top: 2px solid var(--gold);
}

.wallet-modal-title {
    color: var(--bone);
    font: 400 1.7rem/1.15 var(--display);
}

.wallet-modal-body {
    margin: 10px 0 20px;
    color: var(--bone);
}

.public-key-display {
    margin-top: 12px;
    padding: 10px 12px;
    background: #0f0f15;
    border: 1px solid var(--rule);
}

.public-key-text {
    display: block;
    color: var(--gold);
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: .85rem;
    line-height: 1.4;
    word-break: break-all;
}

.wallet-modal-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

@media (max-width: 760px) {
    .gate-copy h1 .login-logo {
        width: 150px;
    }

    .gate-copy .wallet-login-description {
        margin: 8px 0 16px;
    }

    .wallet-modal-buttons {
        flex-direction: column-reverse;
    }

    .wallet-modal-buttons .enter {
        width: 100%;
        text-align: center;
    }
}

/* a phone on its side: the logo gives way so the button stays on the screen */
@media (max-height: 560px) {
    #wallet-login-overlay {
        align-items: flex-start;
    }

    .gate-copy h1 .login-logo {
        width: 112px;
    }

    .gate-copy .wallet-login-description {
        margin: 6px 0 12px;
        font-size: 1.02rem;
        line-height: 1.35;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wallet-progress-bar {
        transition: none;
    }

    .wallet-progress-bar .progress-spinner,
    .cspr-login-button.loading::after {
        animation-duration: 3s;
    }
}
