.login-overlay, .logout-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10200; /* Above header (10100), shadowbox (10000), BskyExplain (10001), CreateDreamer (10002) */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.login-overlay.visible, .logout-overlay.visible {
    opacity: 1;
}
.login-box, .logout-box {
    background: #faf7fc;
    border: 2px solid #87408d;
    border-radius: 0;
    box-shadow: 0 8px 32px rgba(135, 64, 141, 0.3);
    padding: 28px 32px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative; /* For positioning close button */
}
.login-box.visible, .logout-box.visible {
    transform: scale(1);
}

/* Close button (X) in top-right corner — used on logout popup */
.logout-box .logout-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: #87408d;
    font-size: 28px;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
    font-weight: 300;
    opacity: 0.6;
    z-index: 10;
}

.logout-box .logout-close-btn:hover {
    opacity: 1;
    transform: scale(1.15);
    background: rgba(135, 64, 141, 0.1);
    border-radius: 0;
}

.logout-box .logout-close-btn:active {
    transform: scale(0.95);
}

/* Compact layout */
.login-content.login-compact {
    display: flex;
    flex-direction: column;
    gap: 0;
}
/* Header row — contains only the info-box now that logo lives inside it */
.login-header-row {
    display: flex;
    gap: 16px;
    align-items: stretch;
    margin-bottom: 14px;
}
/* Logo inside the info-box: centered, larger */
.login-content.login-compact .login-logo {
    display: block;
    width: auto;
    height: 96px;
    max-height: 96px;
    margin: 0 auto 6px;
    object-fit: contain;
}
.login-info-box {
    flex: 1;
    width: 100%;
    border: 1px solid rgba(135, 64, 141, 0.25);
    padding: 14px 16px;
    background: rgba(135, 64, 141, 0.03);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 90px;
    justify-content: center;
}
.login-info-text {
    margin: 0;
    font-size: 0.8rem;
    color: #666;
    line-height: 1.5;
    text-align: center;
}
.login-info-box .login-become-btn {
    width: 100%;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    gap: 0;
    border: 2px solid;
    border-color: var(--core-color, #87408d);
    color: white;
    background: var(--core-color, #87408d);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
}
.login-info-box .login-become-btn:hover {
    background: transparent;
    color: var(--core-color, #87408d);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(135, 64, 141, 0.25);
}
.login-info-box .login-become-btn img {
    display: none;
}
.become-btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shine 3s ease-in-out infinite;
    pointer-events: none;
}
@keyframes shine {
    0% {
        left: -100%;
    }
    50%, 100% {
        left: 100%;
    }
}
@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}
.login-content.login-compact .login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.login-prompt-text {
    margin: 0;
    font-size: 0.8rem;
    color: #666;
    text-align: center;
}
.login-handle-input-group {
    margin-bottom: 0;
}
.login-password-group {
    display: none;
}
.login-status-message {
    padding: 10px 14px;
    border-radius: 0;
    font-size: 0.85rem;
    text-align: center;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(135, 64, 141, 0.05);
    border: 1px solid rgba(135, 64, 141, 0.15);
    color: #555;
}
/* Close row + dismiss button (replaces the X close button) */
.login-close-row {
    margin-top: 8px;
}
.login-dismiss-btn {
    width: 100%;
    padding: 9px 14px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 0;
    color: #999;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.login-dismiss-btn:hover {
    background: #f5f5f5;
    color: #555;
    border-color: #bbb;
}

/* Divider */
.login-divider {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0 0 10px 0;
    position: relative;
}
.login-divider::before {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(135, 64, 141, 0.15);
}
.login-divider span {
    padding: 0 16px;
    font-size: 0.75rem;
    color: #999;
    text-transform: lowercase;
    text-align: center;
    white-space: nowrap;
}
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(135, 64, 141, 0.15);
}
/* Buttons row - side door + main */
.login-buttons-row {
    display: flex;
    gap: 0;
    align-items: stretch;
    margin-top: 4px;
}
.login-buttons-divider {
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: #aaa;
    padding: 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}
.login-buttons-row:has(.login-side-door-btn.visible) .login-buttons-divider {
    display: flex;
}
.login-side-door-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 0;
    width: 0;
    min-width: 0;
    max-width: 0;
    padding: 0;
    overflow: hidden;
    background: transparent;
    border: 1.5px solid #aaa;
    border-radius: 0;
    font-size: 0.72rem;
    font-weight: 600;
    color: #777;
    cursor: not-allowed;
    opacity: 0;
    transition: all 0.3s ease, flex 0.3s ease, width 0.3s ease, min-width 0.3s ease, max-width 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    text-align: center;
    line-height: 1.2;
    min-height: 48px;
    letter-spacing: 0.02em;
}
.login-side-door-btn.visible {
    flex: 1;
    width: auto;
    min-width: 0;
    max-width: none;
    padding: 8px 12px;
    opacity: 1;
    cursor: pointer;
}
.login-side-door-btn.visible:hover {
    background: rgba(135, 64, 141, 0.06);
    border-color: var(--account-color, #87408d);
    color: var(--account-color, #87408d);
}
.login-side-door-sub {
    font-size: 0.55rem;
    opacity: 0.5;
    margin-top: 2px;
    white-space: nowrap;
    font-weight: 400;
}
.login-main-btn {
    flex: 1;
    min-height: 48px;
}
.login-main-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
/* New section - prominent */
.login-new-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.login-new-text {
    margin: 0 0 6px 0;
    font-size: 0.7rem;
    color: #888;
    text-align: center;
}
.login-new-subtext {
    margin: 0;
    font-size: 0.7rem;
    color: #999;
    text-align: center;
    font-style: italic;
}
.login-become-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: transparent;
    padding: 14px 20px;
    width: 100%;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
}
.login-become-btn:hover {
    background: rgba(135, 64, 141, 0.08);
    transform: translateY(-1px);
}
.login-cancel-btn {
    display: none;
}
.login-box.login-disabled {
    max-width: 320px;
    padding: 24px 16px 16px;
}
.login-disabled-message {
    padding: 32px 24px;
    text-align: center;
    margin: 20px 0;
}
.welcome-text {
    margin: 0 0 16px 0;
    color: #87408d;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.4;
}
.soon-text {
    margin: 0 0 16px 0;
    color: #666;
    font-size: 1.05rem;
    line-height: 1.5;
}
.thanks-text {
    margin: 0;
    color: #888;
    font-size: 0.95rem;
    line-height: 1.5;
    font-style: italic;
}
.login-enter-btn {
    width: 100%;
    padding: 14px;
    background: #87408d;
    color: white;
    border: none;
    border-radius: 0;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    cursor: not-allowed;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.login-enter-btn:hover {
    background: #6f336f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(135, 64, 141, 0.3);
}
.login-enter-btn.pressed {
    background: #5a2a5a;
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(135, 64, 141, 0.2);
}
.enter-text {
    display: inline-block;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.soon-text-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    font-weight: 700;
    letter-spacing: 2px;
}
.login-enter-btn.pressed .enter-text {
    opacity: 0;
    transform: scale(1.2);
}
.login-enter-btn.pressed .soon-text-btn {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.login-close-btn {
    width: 100%;
    padding: 12px;
    background: #87408d;
    color: white;
    border: none;
    border-radius: 0;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.login-close-btn:hover {
    background: #6f336f;
}
.login-content, .logout-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
}
.login-logo {
    width: auto;
    height: auto;
    max-width: 180px;
    max-height: 100px;
    margin: 0 auto 8px auto;
    object-fit: contain;
}
.login-title {
    margin: 0 0 0px 0;
    color: #87408d;
    font-size: 1.3rem;
    font-weight: 600;
    text-transform: lowercase;
}
.login-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}
.login-handle-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    width: 100%;
}
.login-domain-icon {
    width: 36px;
    height: 46px;
    object-fit: contain;
    padding: 4px;
    background: white;
    border: 2px solid #d0c7f0;
    flex-shrink: 0;
}
.login-handle-input-wrapper {
    display: flex;
    align-items: center;
    flex: 1;
    border: 2px solid #d0c7f0;
    background: white;
    min-width: 0;
    height: 46px;
}
.login-at-symbol {
    padding: 0 4px 0 12px;
    color: #666;
    font-size: 1rem;
    font-family: monospace;
    font-weight: 600;
    flex-shrink: 0;
}
#loginUsername {
    border: none;
    font-size: 1rem;
    box-sizing: border-box;
    outline: none;
    font-family: monospace;
    padding: 12px 12px 12px 4px;
    background: transparent;
    flex: 1;
    min-width: 60px;
}
#loginUsername::placeholder {
    color: #999;
}
#loginUsername.admin-mode {
    color: #d4af37;
    font-weight: bold;
}
#loginPassword {
    width: 100%;
    padding: 12px;
    border: 2px solid #d0c7f0;
    border-radius: 0;
    font-size: 1rem;
    box-sizing: border-box;
    text-align: center;
    font-family: monospace;
    letter-spacing: 2px;
}
#loginSubmit {
    width: 100%;
    padding: 14px;
    background: #87408d;
    color: white;
    border: none;
    border-radius: 0;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 4px;
}
#loginSubmit:hover {
    background: #6f336f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(135, 64, 141, 0.3);
}
#loginSubmit:disabled {
    background: #999;
    cursor: not-allowed;
    transform: none;
}
#loginCancel, #logoutCancel {
    width: 100%;
    padding: 10px;
    background: transparent;
    color: #87408d;
    border: 1px solid #87408d;
    border-radius: 0;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}
#loginCancel:hover, #logoutCancel:hover {
    background: rgba(135, 64, 141, 0.1);
}
.login-help-text {
    margin: 8px 0 0 0;
    font-size: 0.8rem;
    color: #777;
    line-height: 1.4;
}
.login-help-link {
    color: #87408d;
    text-decoration: none;
}
.login-help-link:hover {
    text-decoration: underline;
}
@media (max-width: 768px) {
    .login-box, .logout-box {
        max-width: 85%;
        padding: 28px 24px;
    }
    .login-header-row {
        flex-direction: column;
        align-items: stretch;
    }
    .login-content.login-compact .login-logo {
        display: block;
        width: auto;
        height: 88px;
        max-height: 88px;
        margin: 0 auto 6px;
        object-fit: contain;
    }
    .login-info-box {
        width: 100%;
    }
    .login-message-box {
        max-width: 80%;
        padding: 24px 20px;
    }
    .login-message-box .login-title {
        font-size: 1.15rem;
    }
    .login-message-box .login-message-text {
        font-size: 0.95rem !important;
    }
}
@media (max-width: 480px) {
    .login-box, .logout-box {
        max-width: 95%;
        padding: 24px 20px;
    }
    .login-header-row {
        gap: 12px;
    }
    .login-message-box {
        max-width: 90%;
        padding: 20px 16px;
    }
    .login-message-box .login-logo {
        height: 60px;
        width: auto;
    }
    .login-message-box .login-title {
        font-size: 1.1rem;
        margin: 8px 0 4px 0;
    }
    .login-message-box .login-message-text {
        font-size: 0.9rem !important;
        margin: 0.75rem 0 1rem 0 !important;
        line-height: 1.4 !important;
    }
    .login-message-box .login-method-btn {
        padding: 12px 16px;
        font-size: 0.95rem;
    }
    .login-logo {
        height: 80px;
    }
    .login-title {
        font-size: 1.2rem;
    }
    .login-handle-row {
        gap: 6px;
    }
    .login-domain-icon {
        width: 32px;
        height: 42px;
    }
    #domainToggle {
        width: 42px;
        height: 42px;
    }
    .login-handle-input-wrapper {
        height: 42px;
    }
}
.logout-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #87408d;
    margin-bottom: 16px;
}
.logout-message {
    margin: 0 0 4px 0;
    color: #87408d;
    font-size: 1.3rem;
    font-weight: 600;
}
.logout-handle {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 0.95rem;
    font-family: monospace;
}
.logout-buttons {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
#logoutConfirm {
    width: 100%;
    padding: 12px;
    background: #87408d;
    color: white;
    border: none;
    border-radius: 0;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
#logoutConfirm:hover {
    background: #6f336f;
}
.login-form {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0 0 0;
    box-sizing: border-box;
}
.login-handle-input-group {
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    border: 2px solid #d0c7f0;
    background: white;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.login-handle-input-group:focus-within {
    border-color: #87408d;
}
.login-handle-prefix {
    display: flex;
    align-items: center;
    padding: 14px 8px 14px 12px;
    font-size: 1rem;
    color: #87408d;
    font-weight: 600;
    user-select: none;
}
.login-handle-suffix {
    padding: 14px 16px 14px 0;
    font-size: 0.95rem;
    color: #87408d;
    font-weight: 500;
    user-select: none;
    white-space: nowrap;
}
.login-handle-input {
    flex: 1;
    padding: 14px 16px 14px 4px;
    border: none;
    font-size: 1rem;
    font-family: 'Georgia', serif;
    background: transparent;
    color: #333;
}
.login-handle-input:focus {
    outline: none;
}
.login-handle-input::placeholder {
    color: #999;
    font-style: italic;
}
.login-password-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    background: none;
    border: none;
    cursor: pointer;
    color: #87408d;
    opacity: 0.55;
    transition: opacity 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.login-password-toggle:hover {
    opacity: 0.85;
}
.login-handle-input-group.error-shake {
    animation: shake 0.5s;
    border-color: #ff6b6b;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}
.login-divider {
    width: 100%;
    text-align: center;
    margin: 16px 0;
    position: relative;
}
.login-divider span {
    display: inline-block;
    padding: 0 12px;
    background: #faf7fc;
    color: #999;
    font-size: 0.85rem;
    text-transform: lowercase;
    position: relative;
    z-index: 1;
}
.login-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #d0c7f0;
    z-index: 0;
}
.login-method-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: white;
    border: 2px solid #d0c7f0;
    border-radius: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}
.login-method-btn:hover:not(:disabled) {
    background: #f8f5fc;
    border-color: #87408d;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(135, 64, 141, 0.2);
}
.login-method-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(135, 64, 141, 0.2);
}
.login-method-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
}
.login-disabled-btn {
    position: relative;
    opacity: 0.6;
}
.login-coming-soon {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.7rem;
    color: #999;
    text-transform: lowercase;
    font-style: italic;
    font-weight: 400;
}
.login-btn-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}
.login-btn-icon-greyscale {
    filter: grayscale(100%) opacity(0.5);
}
.login-bluesky-btn {
    border-color: #0085ff;
}
.login-bluesky-btn:hover:not(:disabled) {
    border-color: #0066cc;
    background: #f0f7ff;
}
.login-reverie-btn {
    border-color: #87408d;
}
.login-reverie-btn:hover:not(:disabled) {
    border-color: #6a3370;
    background: #f8f5fc;
}
.login-enter-btn {
    border-color: #d0c7f0;
}
.login-enter-btn:hover:not(:disabled) {
    border-color: #87408d;
    background: #f8f5fc;
}
.login-dreamweaver-btn {
    border-color: #d0c7f0;
}
.login-cancel-btn {
    width: 100%;
    max-width: 200px;
    padding: 6px;
    background: transparent;
    color: #888;
    border: none;
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.2s;
    margin: 4px auto 0 auto;
}
.login-cancel-btn:hover {
    color: #87408d;
}
.login-help-text {
    margin: 8px 0 0 0;
    color: #888;
    font-size: 0.85rem;
    line-height: 1.4;
}
.login-help-link {
    color: #87408d;
    text-decoration: none;
}
.login-help-link:hover {
    text-decoration: underline;
}
.dreamweaver-status {
    margin: 20px 0;
    padding: 15px;
    background: rgba(135, 64, 141, 0.05);
    border: 1px solid rgba(135, 64, 141, 0.2);
    text-align: center;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.dreamweaver-status p {
    margin: 0;
    font-size: 0.95rem;
}
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(135, 64, 141, 0.2);
    border-top-color: #87408d;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 8px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.become-dreamweaver-btn {
    background: linear-gradient(135deg, #87408d, #a855c9);
    border: none;
    color: white;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(135, 64, 141, 0.3);
}
.become-dreamweaver-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(135, 64, 141, 0.4);
}
.become-dreamweaver-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Error shake animation for password field */
@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}
.error-shake {
    animation: error-shake 0.5s ease;
}
.error-shake input {
    border-color: #d94848 !important;
}

/* ============================================================================
   MOBILE-FIRST STATUS & BUTTON STATES
   ============================================================================ */

/* Status message icon */
.login-status-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Spinner animation for status icon */
.login-status-spinner {
    animation: spin 1.5s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Status message states using CSS custom properties */
.login-status-message.checking {
    background: rgba(135, 64, 141, 0.05);
    border: 1px solid rgba(135, 64, 141, 0.2);
    color: #555;
}

.login-status-message.found {
    background: color-mix(in srgb, var(--account-color, #87408d) 5%, white);
    border: 1px solid color-mix(in srgb, var(--account-color, #87408d) 20%, transparent);
    color: var(--account-color, #87408d);
}

.login-status-message.error {
    background: rgba(217, 72, 72, 0.05);
    border: 1px solid rgba(217, 72, 72, 0.2);
    color: #d94848;
}

/* Login box found state */
.login-box.login-box-found {
    border-color: var(--account-color, #87408d);
    background: color-mix(in srgb, var(--account-color, #87408d) 3%, white);
}

/* Side door tints to account color when a dreamweaver is found */
.login-box.login-box-found .login-side-door-btn.visible {
    border-color: var(--account-color, #87408d);
    color: var(--account-color, #87408d);
}

/* Submit button ready state */
.login-main-btn.login-btn-ready {
    opacity: 1;
    cursor: pointer;
    background: var(--account-color, #87408d);
    border-color: var(--account-color, #87408d);
    color: white;
}

.login-main-btn.login-btn-ready:hover {
    filter: brightness(0.9);
    transform: translateY(-1px);
}

/* ============================================================================
   MOBILE TOUCH-FRIENDLY IMPROVEMENTS
   ============================================================================ */

@media (max-width: 768px) {
    /* Ensure login box doesn't overflow on mobile */
    .login-box, .logout-box {
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .login-form,
    .login-handle-input-group,
    .login-buttons-row {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Prevent iOS zoom on input focus */
    .login-handle-input {
        font-size: 16px !important;
        max-width: 100%;
    }
    
    /* Touch-friendly button sizing */
    .login-side-door-btn.visible {
        min-height: 44px;
        padding: 8px 10px;
        font-size: 0.68rem;
    }
    
    .login-side-door-sub {
        font-size: 0.52rem;
    }
    
    .login-main-btn {
        min-height: 48px;
        font-size: 1rem;
    }
    
    .login-method-btn {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* Better status message on mobile */
    .login-status-message {
        padding: 12px 14px;
        font-size: 0.9rem;
    }
    
    .login-info-text {
        font-size: 0.8rem;
        line-height: 1.4;
    }
    
    /* Prevent text selection on buttons */
    .login-method-btn,
    .login-side-door-btn,
    .login-main-btn,
    .login-become-btn {
        -webkit-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
}

@media (max-width: 380px) {
    .login-box, .logout-box {
        max-width: 100%;
        width: 100%;
        margin: 0 8px;
        padding: 20px 16px;
    }
    
    .login-header-row {
        gap: 10px;
    }
    
    .login-content.login-compact .login-logo {
        display: block;
        width: auto;
        height: 64px;
        max-height: 64px;
        margin: 0 auto 4px;
    }
    
    .login-info-box {
        padding: 10px 12px;
        min-height: 80px;
    }
    
    .login-info-text {
        font-size: 0.7rem;
    }
    
    .login-divider span {
        font-size: 0.7rem;
        padding: 0 10px;
    }
    
    /* Keep buttons in a row even at 375px */
    .login-side-door-btn.visible {
        font-size: 0.65rem;
    }
    .login-buttons-divider {
        padding: 0 5px;
    }
    
    .login-main-btn {
        width: 100%;
        flex: 1;
    }
}

/* ============================================================================
   DEACTIVATED PANEL - Mobile-Responsive Layout
   ============================================================================ */

.login-deactivated-box {
    max-width: 480px;
    width: 95%;
    padding: 0;
    overflow: hidden;
}

.deactivated-header {
    padding: 12px 16px;
    background: #f7fafc;
    border-bottom: 1px solid var(--user-color, #87408d);
    text-align: center;
}

.deactivated-title {
    font-size: 1.1rem;
    color: var(--user-color, #87408d);
    display: block;
    margin-bottom: 8px;
}

.deactivated-explainer {
    color: #4a5568;
    font-size: 0.82rem;
    line-height: 1.3;
    max-width: 360px;
    margin: 0 auto;
}

.deactivated-explainer strong {
    color: var(--user-color, #87408d);
}

.deactivated-profile-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px;
    flex-wrap: wrap;
}

.deactivated-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.deactivated-avatar-frame {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    background: #f3f3f3;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--user-color, #87408d);
    flex-shrink: 0;
}

.deactivated-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.deactivated-name-section {
    text-align: center;
}

.deactivated-display-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--user-color, #87408d);
}

.deactivated-handle-text {
    color: var(--user-color, #87408d);
    font-weight: 700;
    font-size: 0.85rem;
    margin-top: 2px;
}

.deactivated-octant-section {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.deactivated-octant-container {
    width: 220px;
    height: 110px;
}

.deactivated-eventstack-section {
    padding: 8px 16px;
    text-align: center;
}

.deactivated-eventstack {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    max-height: 200px;
    overflow: auto;
    border: 1px solid var(--user-color, #87408d);
    background: #ffffff;
    -webkit-overflow-scrolling: touch;
}

.deactivated-actions {
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.deactivated-close-btn {
    width: 60%;
    max-width: 200px;
    background: #eef2f7;
    color: #2d3748;
    padding: 10px 16px;
    border: 1px solid #cbd5e1;
    min-height: 44px;
}

/* Mobile deactivated panel adjustments */
@media (max-width: 480px) {
    .login-deactivated-box {
        width: 100%;
        max-width: 100%;
        margin: 0 8px;
    }
    
    .deactivated-header {
        padding: 10px 12px;
    }
    
    .deactivated-title {
        font-size: 1rem;
    }
    
    .deactivated-explainer {
        font-size: 0.78rem;
    }
    
    .deactivated-profile-row {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }
    
    .deactivated-avatar-frame {
        width: 70px;
        height: 70px;
    }
    
    .deactivated-octant-container {
        width: 100%;
        max-width: 280px;
        height: 100px;
    }
    
    .deactivated-eventstack-section {
        padding: 8px 12px;
    }
    
    .deactivated-eventstack {
        max-height: 150px;
    }
    
    .deactivated-close-btn {
        width: 80%;
    }
}

/* ── Mobile login: layout + keyboard fixes ──────────── */
@media (max-width: 600px) {

    /* Overlay scrolls from top — keyboard appearing won't clip content */
    .login-overlay,
    .logout-overlay {
        align-items: flex-start;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 8vh 0 env(safe-area-inset-bottom, 20px);
    }

    .login-box,
    .logout-box {
        max-width: 96%;
        width: 96%;
        margin: 0 auto;
        padding: 22px 18px;
        flex-shrink: 0;   /* don't let the box squash */
    }

    /* ── Header: logo LEFT of become-btn, no column stacking ── */
    .login-header-row {
        flex-direction: row;   /* override the 768px column rule */
        align-items: center;
        gap: 12px;
        margin-bottom: 12px;
    }

    /* Logo: inside info-box, centered */
    .login-content.login-compact .login-logo {
        display: block;
        width: auto;
        height: 80px;
        max-height: 80px;
        margin: 0 auto 4px;
        object-fit: contain;
    }

    /* Info box: full-width, centered column */
    .login-info-box {
        flex: 1;
        width: 100%;
        border: 1px solid rgba(135, 64, 141, 0.28);
        background: rgba(135, 64, 141, 0.04);
        padding: 14px 16px;
        min-height: 0;
        gap: 8px;
        max-width: unset;
        align-items: center;
        justify-content: center;
    }

    /* Show description at compact size */
    .login-info-text {
        display: block;
        font-size: 0.72rem;
        line-height: 1.35;
        color: #777;
        margin: 0;
    }

    /* Tighter divider */
    .login-divider {
        margin: 8px 0 6px 0;
    }

    /* Become-btn fills the info-box column */
    .login-info-box .login-become-btn {
        width: 100%;
        padding: 10px 14px;
        font-size: 0.88rem;
        gap: 6px;
    }

    /* ── Inputs: 16px prevents iOS auto-zoom ── */
    .login-handle-input {
        font-size: 16px !important;
    }

    /* ── Buttons row: side door + submit share space ── */
    .login-buttons-row {
        align-items: stretch;
        gap: 0;
    }

    .login-side-door-btn.visible {
        min-height: 44px;
        font-size: 0.65rem;
        padding: 6px 8px;
        line-height: 1.2;
    }

    .login-side-door-sub {
        font-size: 0.5rem;
    }

    .login-buttons-divider {
        padding: 0 5px;
        font-size: 0.55rem;
    }

    .login-main-btn {
        min-height: 44px;
        font-size: 0.95rem;
    }

    /* ── Keyboard-active: collapse decorative content ── */
    .login-box.keyboard-active {
        padding: 14px 16px;
        transition: padding 0.2s ease;
    }

    .login-box.keyboard-active .login-header-row {
        display: none;           /* hide logo + info + become btn */
    }

    .login-box.keyboard-active .login-divider {
        display: none;           /* hide the "or, enter via…" divider */
    }

    .login-box.keyboard-active .login-close-row {
        margin-top: 4px;
    }

    .login-box.keyboard-active .login-close-row .login-dismiss-btn {
        padding: 6px 14px;
        font-size: 0.72rem;
    }
}

/* Overlay top-padding collapses when keyboard is up */
@media (max-width: 600px) {
    .login-overlay.keyboard-active {
        padding-top: 2vh;
    }
}
